refactor: move invertscrolling to Settings
newkey: client/invertscrolldirection <= General/invertScrollDirection remove invertScrollDirection from AppConfig
This commit is contained in:
@ -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<int>(m_appConfig.elevateMode()));
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
};
|
||||
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
|
||||
@ -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:
|
||||
|
||||
Reference in New Issue
Block a user