diff --git a/src/apps/deskflow-gui/dialogs/SettingsDialog.cpp b/src/apps/deskflow-gui/dialogs/SettingsDialog.cpp index 5272a9a2f..0f8a8169a 100644 --- a/src/apps/deskflow-gui/dialogs/SettingsDialog.cpp +++ b/src/apps/deskflow-gui/dialogs/SettingsDialog.cpp @@ -156,7 +156,7 @@ void SettingsDialog::accept() Settings::setValue(Settings::Security::KeySize, ui->comboTlsKeyLength->currentText().toInt()); Settings::setValue(Settings::Security::TlsEnabled, ui->groupSecurity->isChecked()); m_appConfig.setLanguageSync(ui->cbLanguageSync->isChecked()); - m_appConfig.setInvertScrollDirection(ui->cbScrollDirection->isChecked()); + Settings::setValue(Settings::Client::InvertScrollDirection, ui->cbScrollDirection->isChecked()); m_appConfig.setEnableService(ui->cbServiceEnabled->isChecked()); Settings::setValue(Settings::Gui::CloseToTray, ui->cbCloseToTray->isChecked()); Settings::setValue(Settings::Gui::SymbolicTrayIcon, ui->rbIconMono->isChecked()); @@ -186,7 +186,7 @@ void SettingsDialog::loadFromConfig() ui->cbAutoHide->setChecked(Settings::value(Settings::Gui::Autohide).toBool()); ui->cbPreventSleep->setChecked(Settings::value(Settings::Core::PreventSleep).toBool()); ui->cbLanguageSync->setChecked(m_appConfig.languageSync()); - ui->cbScrollDirection->setChecked(m_appConfig.invertScrollDirection()); + ui->cbScrollDirection->setChecked(Settings::value(Settings::Client::InvertScrollDirection).toBool()); ui->cbServiceEnabled->setChecked(m_appConfig.enableService()); ui->cbCloseToTray->setChecked(Settings::value(Settings::Gui::CloseToTray).toBool()); ui->comboElevate->setCurrentIndex(static_cast(m_appConfig.elevateMode())); diff --git a/src/lib/common/Settings.cpp b/src/lib/common/Settings.cpp index c8c7e4116..98fe49fe5 100644 --- a/src/lib/common/Settings.cpp +++ b/src/lib/common/Settings.cpp @@ -71,7 +71,8 @@ void Settings::cleanSettings() QVariant Settings::defaultValue(const QString &key) { if ((key == Core::Scope) || (key == Gui::Autohide) || (key == Core::StartedBefore) || - (key == Core::PreventSleep) || (key == Server::ExternalConfig)) { + (key == Core::PreventSleep) || (key == Server::ExternalConfig) || + (key == Client::InvertScrollDirection)) { return false; } diff --git a/src/lib/common/Settings.h b/src/lib/common/Settings.h index f54db1a66..428f47d84 100644 --- a/src/lib/common/Settings.h +++ b/src/lib/common/Settings.h @@ -32,6 +32,7 @@ public: struct Client { inline static const auto Binary = QStringLiteral("client/binary"); + inline static const auto InvertScrollDirection = QStringLiteral("client/invertscolldirection"); inline static const auto RemoteHost = QStringLiteral("client/remotehost"); }; struct Core @@ -96,6 +97,7 @@ private: // clang-format off inline static const QStringList m_validKeys = { Client::Binary + , Client::InvertScrollDirection , Client::RemoteHost , Core::LastVersion , Core::PreventSleep diff --git a/src/lib/gui/config/AppConfig.cpp b/src/lib/gui/config/AppConfig.cpp index 7cc66acbb..24570d5e3 100644 --- a/src/lib/gui/config/AppConfig.cpp +++ b/src/lib/gui/config/AppConfig.cpp @@ -63,7 +63,7 @@ const char *const AppConfig::m_SettingsName[] = { "", // 27 key length Moved to Deskflow settings "", // 28 Prevent sleep moved to deskflow settings "languageSync", - "invertScrollDirection", + "", // 30 = invertscrolldriection moved to deskflow settings "", // 31 = guid, obsolete "", // 32 = licenseRegistryUrl, obsolete "", // 33 = licenseNextCheck, obsolete @@ -123,7 +123,6 @@ void AppConfig::recallFromCurrentScope() m_UseInternalConfig = getFromCurrentScope(kUseInternalConfig, m_UseInternalConfig).toBool(); m_ClientGroupChecked = getFromCurrentScope(kClientGroupChecked, m_ClientGroupChecked).toBool(); m_LanguageSync = getFromCurrentScope(kLanguageSync, m_LanguageSync).toBool(); - m_InvertScrollDirection = getFromCurrentScope(kInvertScrollDirection, m_InvertScrollDirection).toBool(); m_EnableService = getFromCurrentScope(kEnableService, m_EnableService).toBool(); } @@ -165,7 +164,6 @@ void AppConfig::commit() setInCurrentScope(kElevateModeLegacy, m_ElevateMode == ElevateMode::kAlways); setInCurrentScope(kUseInternalConfig, m_UseInternalConfig); setInCurrentScope(kLanguageSync, m_LanguageSync); - setInCurrentScope(kInvertScrollDirection, m_InvertScrollDirection); setInCurrentScope(kEnableService, m_EnableService); } } @@ -405,11 +403,6 @@ ElevateMode AppConfig::elevateMode() const return m_ElevateMode; } -bool AppConfig::invertScrollDirection() const -{ - return m_InvertScrollDirection; -} - bool AppConfig::languageSync() const { return m_LanguageSync; @@ -497,11 +490,6 @@ void AppConfig::setElevateMode(ElevateMode em) m_ElevateMode = em; } -void AppConfig::setInvertScrollDirection(bool newValue) -{ - m_InvertScrollDirection = newValue; -} - void AppConfig::setLanguageSync(bool newValue) { m_LanguageSync = newValue; diff --git a/src/lib/gui/config/AppConfig.h b/src/lib/gui/config/AppConfig.h index 86deff145..411776f64 100644 --- a/src/lib/gui/config/AppConfig.h +++ b/src/lib/gui/config/AppConfig.h @@ -84,7 +84,7 @@ private: // 27 = tlsKeyLength Moved to deskflow settings // 28 = Prevent Sleep moved to deskflow settings kLanguageSync = 29, - kInvertScrollDirection = 30, + // 30 = InvertScrollDirection moved to deskflow settings // 31 = guid, obsolete // 32 = license registry url, obsolete // 33 = license next check, obsolete @@ -136,7 +136,6 @@ public: const QString &logFilename() const override; void persistLogDir() const override; bool languageSync() const override; - bool invertScrollDirection() const override; int port() const override; const QString &networkInterface() const override; bool isActiveScopeWritable() const override; @@ -164,7 +163,6 @@ public: void setLogToFile(bool b) override; void setLogFilename(const QString &s) override; void setElevateMode(ElevateMode em) override; - void setInvertScrollDirection(bool b) override; void setLanguageSync(bool b) override; void setEnableService(bool enabled) override; @@ -239,7 +237,6 @@ private: bool m_LogToFile = false; QString m_LogFilename = logDir() + deskflow::gui::kDefaultLogFile; ElevateMode m_ElevateMode = deskflow::gui::kDefaultElevateMode; - bool m_InvertScrollDirection = false; bool m_LanguageSync = true; bool m_ServerGroupChecked = false; bool m_UseInternalConfig = false; diff --git a/src/lib/gui/config/IAppConfig.h b/src/lib/gui/config/IAppConfig.h index 06f99bd40..f49774b99 100644 --- a/src/lib/gui/config/IAppConfig.h +++ b/src/lib/gui/config/IAppConfig.h @@ -40,7 +40,6 @@ public: virtual const QString &logFilename() const = 0; virtual void persistLogDir() const = 0; virtual bool languageSync() const = 0; - virtual bool invertScrollDirection() const = 0; virtual int port() const = 0; virtual const QString &networkInterface() const = 0; virtual int logLevel() const = 0; @@ -62,7 +61,6 @@ public: virtual void setLogFilename(const QString &logFilename) = 0; virtual void setElevateMode(ElevateMode elevateMode) = 0; virtual void setLanguageSync(bool languageSync) = 0; - virtual void setInvertScrollDirection(bool invertScrollDirection) = 0; virtual void setEnableService(bool enableService) = 0; }; diff --git a/src/lib/gui/core/CoreProcess.cpp b/src/lib/gui/core/CoreProcess.cpp index 8c0e41e64..784f6698e 100644 --- a/src/lib/gui/core/CoreProcess.cpp +++ b/src/lib/gui/core/CoreProcess.cpp @@ -585,7 +585,7 @@ bool CoreProcess::addClientArgs(QStringList &args, QString &app) args << "--sync-language"; } - if (m_appConfig.invertScrollDirection()) { + if (Settings::value(Settings::Client::InvertScrollDirection).toBool()) { args << "--invert-scroll"; } diff --git a/src/test/shared/gui/mocks/AppConfigMock.h b/src/test/shared/gui/mocks/AppConfigMock.h index 63647b160..1c72b53ad 100644 --- a/src/test/shared/gui/mocks/AppConfigMock.h +++ b/src/test/shared/gui/mocks/AppConfigMock.h @@ -41,7 +41,6 @@ public: MOCK_METHOD(const QString &, logFilename, (), (const, override)); MOCK_METHOD(void, persistLogDir, (), (const, override)); MOCK_METHOD(bool, languageSync, (), (const, override)); - MOCK_METHOD(bool, invertScrollDirection, (), (const, override)); MOCK_METHOD(int, port, (), (const, override)); MOCK_METHOD(const QString &, networkInterface, (), (const, override)); MOCK_METHOD(int, logLevel, (), (const, override)); @@ -63,7 +62,6 @@ public: MOCK_METHOD(void, setLogFilename, (const QString &logFilename), (override)); MOCK_METHOD(void, setElevateMode, (ElevateMode elevateMode), (override)); MOCK_METHOD(void, setLanguageSync, (bool languageSync), (override)); - MOCK_METHOD(void, setInvertScrollDirection, (bool invertScrollDirection), (override)); MOCK_METHOD(void, setEnableService, (bool enableService), (override)); private: