diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index c409f49d7..0e8f6ee27 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -190,10 +190,7 @@ void Settings::loadGlobal() s.endGroup(); s.beginGroup("GUI"); - enableSmoothAnimation = s.value("smoothAnimation", true).toBool(); smileyPack = s.value("smileyPack", ":/smileys/TwitterEmojiSVG/emoticons.xml").toString(); - customEmojiFont = s.value("customEmojiFont", true).toBool(); - emojiFontFamily = s.value("emojiFontFamily", "DejaVu Sans").toString(); emojiFontPointSize = s.value("emojiFontPointSize", 16).toInt(); firstColumnHandlePos = s.value("firstColumnHandlePos", 50).toInt(); secondColumnHandlePosFromRight = s.value("secondColumnHandlePosFromRight", 50).toInt(); @@ -202,7 +199,6 @@ void Settings::loadGlobal() minimizeOnClose = s.value("minimizeOnClose", false).toBool(); minimizeToTray = s.value("minimizeToTray", false).toBool(); lightTrayIcon = s.value("lightTrayIcon", false).toBool(); - useNativeStyle = s.value("nativeStyle", false).toBool(); useEmoticons = s.value("useEmoticons", true).toBool(); statusChangeNotificationEnabled = s.value("statusChangeNotificationEnabled", false).toBool(); themeColor = s.value("themeColor", 0).toInt(); @@ -392,14 +388,10 @@ void Settings::saveGlobal() const QList widgetNames = widgetSettings.keys(); for (const QString& name : widgetNames) s.setValue(name, widgetSettings.value(name)); - s.endGroup(); s.beginGroup("GUI"); - s.setValue("smoothAnimation", enableSmoothAnimation); s.setValue("smileyPack", smileyPack); - s.setValue("customEmojiFont", customEmojiFont); - s.setValue("emojiFontFamily", emojiFontFamily); s.setValue("emojiFontPointSize", emojiFontPointSize); s.setValue("firstColumnHandlePos", firstColumnHandlePos); s.setValue("secondColumnHandlePosFromRight", secondColumnHandlePosFromRight); @@ -408,7 +400,6 @@ void Settings::saveGlobal() s.setValue("minimizeOnClose", minimizeOnClose); s.setValue("minimizeToTray", minimizeToTray); s.setValue("lightTrayIcon", lightTrayIcon); - s.setValue("nativeStyle", useNativeStyle); s.setValue("useEmoticons", useEmoticons); s.setValue("themeColor", themeColor); s.setValue("style", style); @@ -965,18 +956,6 @@ QByteArray Settings::getWidgetData(const QString& uniqueName) const return widgetSettings.value(uniqueName); } -bool Settings::isAnimationEnabled() const -{ - QMutexLocker locker{&bigLock}; - return enableSmoothAnimation; -} - -void Settings::setAnimationEnabled(bool newValue) -{ - QMutexLocker locker{&bigLock}; - enableSmoothAnimation = newValue; -} - QString Settings::getSmileyPack() const { QMutexLocker locker{&bigLock}; @@ -990,19 +969,6 @@ void Settings::setSmileyPack(const QString &value) emit smileyPackChanged(); } -bool Settings::isCurstomEmojiFont() const -{ - QMutexLocker locker{&bigLock}; - return customEmojiFont; -} - -void Settings::setCurstomEmojiFont(bool value) -{ - QMutexLocker locker{&bigLock}; - customEmojiFont = value; - emit emojiFontChanged(); -} - int Settings::getEmojiFontPointSize() const { QMutexLocker locker{&bigLock}; @@ -1064,31 +1030,6 @@ void Settings::setDateFormat(const QString &format) dateFormat = format; } -QString Settings::getEmojiFontFamily() const -{ - QMutexLocker locker{&bigLock}; - return emojiFontFamily; -} - -void Settings::setEmojiFontFamily(const QString &value) -{ - QMutexLocker locker{&bigLock}; - emojiFontFamily = value; - emit emojiFontChanged(); -} - -bool Settings::getUseNativeStyle() const -{ - QMutexLocker locker{&bigLock}; - return useNativeStyle; -} - -void Settings::setUseNativeStyle(bool value) -{ - QMutexLocker locker{&bigLock}; - useNativeStyle = value; -} - QByteArray Settings::getWindowGeometry() const { QMutexLocker locker{&bigLock}; diff --git a/src/persistence/settings.h b/src/persistence/settings.h index 26689f109..cd9ca5715 100644 --- a/src/persistence/settings.h +++ b/src/persistence/settings.h @@ -175,9 +175,6 @@ public: bool isCurstomEmojiFont() const; void setCurstomEmojiFont(bool value); - QString getEmojiFontFamily() const; - void setEmojiFontFamily(const QString &value); - int getEmojiFontPointSize() const; void setEmojiFontPointSize(int value); @@ -211,9 +208,6 @@ public: void setTypingNotification(bool enabled); // State - bool getUseNativeStyle() const; - void setUseNativeStyle(bool value); - QByteArray getWindowGeometry() const; void setWindowGeometry(const QByteArray &value); @@ -334,13 +328,9 @@ private: QString globalAutoAcceptDir; // GUI - bool enableSmoothAnimation; QString smileyPack; - bool customEmojiFont; - QString emojiFontFamily; - int emojiFontPointSize; + int emojiFontPointSize; bool minimizeOnClose; - bool useNativeStyle; QByteArray windowGeometry; QByteArray windowState; QByteArray splitterState; diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 94ffda2c9..42f3c710f 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -230,13 +230,17 @@ void ChatForm::onFileRecvRequest(ToxFile file) ChatMessage::Ptr msg = ChatMessage::createFileTransferMessage(name, file, false, QDateTime::currentDateTime()); insertChatMessage(msg); - if (!Settings::getInstance().getAutoAcceptDir(f->getToxId()).isEmpty() - || Settings::getInstance().getAutoSaveEnabled()) + if (!Settings::getInstance().getAutoAcceptDir(f->getToxId()).isEmpty()) //per contact autosave { ChatLineContentProxy* proxy = static_cast(msg->getContent(1)); assert(proxy->getWidgetType() == ChatLineContentProxy::FileTransferWidgetType); FileTransferWidget* tfWidget = static_cast(proxy->getWidget()); tfWidget->autoAcceptTransfer(Settings::getInstance().getAutoAcceptDir(f->getToxId())); + } else if (Settings::getInstance().getAutoSaveEnabled()) { //global autosave to global directory + ChatLineContentProxy* proxy = static_cast(msg->getContent(1)); + assert(proxy->getWidgetType() == ChatLineContentProxy::FileTransferWidgetType); + FileTransferWidget* tfWidget = static_cast(proxy->getWidget()); + tfWidget->autoAcceptTransfer(Settings::getInstance().getGlobalAutoAcceptDir()); } Widget::getInstance()->updateFriendActivity(f); diff --git a/src/widget/form/settings/generalform.cpp b/src/widget/form/settings/generalform.cpp index d9c846108..52f2301ef 100644 --- a/src/widget/form/settings/generalform.cpp +++ b/src/widget/form/settings/generalform.cpp @@ -160,8 +160,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) : connect(bodyUI->notifySound, &QCheckBox::stateChanged, this, &GeneralForm::onSetNotifySound); connect(bodyUI->groupAlwaysNotify, &QCheckBox::stateChanged, this, &GeneralForm::onSetGroupAlwaysNotify); connect(bodyUI->autoacceptFiles, &QCheckBox::stateChanged, this, &GeneralForm::onAutoAcceptFileChange); - if (bodyUI->autoacceptFiles->isChecked()) - connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange())); + connect(bodyUI->autoSaveFilesDir, SIGNAL(clicked()), this, SLOT(onAutoSaveDirChange())); //theme connect(bodyUI->useEmoticons, &QCheckBox::stateChanged, this, &GeneralForm::onUseEmoticonsChange); connect(bodyUI->smileyPackBrowser, SIGNAL(currentIndexChanged(int)), this, SLOT(onSmileyBrowserIndexChanged(int))); @@ -291,19 +290,16 @@ void GeneralForm::onAutoAwayChanged() void GeneralForm::onAutoAcceptFileChange() { Settings::getInstance().setAutoSaveEnabled(bodyUI->autoacceptFiles->isChecked()); - - if (bodyUI->autoacceptFiles->isChecked() == true) - connect(bodyUI->autoSaveFilesDir, &QPushButton::clicked, this, &GeneralForm::onAutoSaveDirChange); - else - disconnect(bodyUI->autoSaveFilesDir, &QPushButton::clicked, this, &GeneralForm::onAutoSaveDirChange); } void GeneralForm::onAutoSaveDirChange() { QString previousDir = Settings::getInstance().getGlobalAutoAcceptDir(); QString directory = QFileDialog::getExistingDirectory(0, - tr("Choose an auto accept directory","popup title")); - if (directory.isEmpty()) + tr("Choose an auto accept directory", "popup title"), //opens in home directory + QStandardPaths::locate(QStandardPaths::HomeLocation, QString(), QStandardPaths::LocateDirectory) + ); + if (directory.isEmpty()) // cancel was pressed directory = previousDir; Settings::getInstance().setGlobalAutoAcceptDir(directory); diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index a03a08e77..c341c986b 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -39,8 +39,8 @@ 0 0 - 653 - 1150 + 639 + 1221 @@ -236,6 +236,13 @@ instead of system taskbar. + + + + + + + @@ -256,21 +263,11 @@ instead of system taskbar. - + 0 - - - - You can set this on a per-friend basis by right clicking them. - - - Autoaccept and save files: - - - - + @@ -283,6 +280,23 @@ instead of system taskbar. + + + + Default directory to save files + + + + + + + You can set this on a per-friend basis by right clicking them. + + + Autoaccept files + + + diff --git a/src/widget/style.cpp b/src/widget/style.cpp index 370d573ae..4af49ed7a 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -77,14 +77,11 @@ QList Style::themeColorColors = {QColor(), QColor("#004aa4"), QColor("#9 QString Style::getStylesheet(const QString &filename) { - if (!Settings::getInstance().getUseNativeStyle()) - { - QFile file(filename); - if (file.open(QFile::ReadOnly | QFile::Text)) - return resolve(file.readAll()); - else - qWarning() << "Stylesheet " << filename << " not found"; - } + QFile file(filename); + if (file.open(QFile::ReadOnly | QFile::Text)) + return resolve(file.readAll()); + else + qWarning() << "Stylesheet " << filename << " not found"; return QString(); }