refactor: Settings use static list of settings that default to true and another that default to false
This commit is contained in:
parent
6c8c6f5208
commit
67ceedcad0
2 changed files with 25 additions and 5 deletions
|
|
@ -109,14 +109,11 @@ int Settings::logLevelToInt(const QString &level)
|
||||||
|
|
||||||
QVariant Settings::defaultValue(const QString &key)
|
QVariant Settings::defaultValue(const QString &key)
|
||||||
{
|
{
|
||||||
if ((key == Gui::Autohide) || (key == Core::StartedBefore) || (key == Core::PreventSleep) ||
|
if (m_defaultFalseValues.contains(key)) {
|
||||||
(key == Server::ExternalConfig) || (key == Client::InvertScrollDirection) || (key == Log::ToFile)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((key == Core::UseHooks) || (key == Gui::CloseToTray) || (key == Gui::LogExpanded) ||
|
if (m_defaultTrueValues.contains(key)) {
|
||||||
(key == Gui::SymbolicTrayIcon) || (key == Gui::CloseReminder) || (key == Security::TlsEnabled) ||
|
|
||||||
(key == Security::CheckPeers) || (key == Client::LanguageSync) || (key == Gui::ShowGenericClientFailureDialog)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,5 +200,28 @@ private:
|
||||||
, Settings::Server::ExternalConfig
|
, Settings::Server::ExternalConfig
|
||||||
, Settings::Server::ExternalConfigFile
|
, Settings::Server::ExternalConfigFile
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// When checking the default values this list contains the ones that default to false.
|
||||||
|
inline static const QStringList m_defaultFalseValues = {
|
||||||
|
Settings::Gui::Autohide
|
||||||
|
, Settings::Core::StartedBefore
|
||||||
|
, Settings::Core::PreventSleep
|
||||||
|
, Settings::Server::ExternalConfig
|
||||||
|
, Settings::Client::InvertScrollDirection
|
||||||
|
, Settings::Log::ToFile
|
||||||
|
};
|
||||||
|
|
||||||
|
// When checking the default values this list contains the ones that default to true.
|
||||||
|
inline static const QStringList m_defaultTrueValues = {
|
||||||
|
Settings::Core::UseHooks
|
||||||
|
, Settings::Client::LanguageSync
|
||||||
|
, Settings::Gui::CloseToTray
|
||||||
|
, Settings::Gui::CloseReminder
|
||||||
|
, Settings::Gui::LogExpanded
|
||||||
|
, Settings::Gui::SymbolicTrayIcon
|
||||||
|
, Settings::Gui::ShowGenericClientFailureDialog
|
||||||
|
, Settings::Security::TlsEnabled
|
||||||
|
, Settings::Security::CheckPeers
|
||||||
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue