#6538 Fixed missing setting and added function to remove repetitions

This commit is contained in:
Jamie Newbon 2020-02-27 00:40:58 +00:00
parent d4ae9faad0
commit 691019c6b5
2 changed files with 11 additions and 5 deletions

View file

@ -61,11 +61,10 @@ const char* AppConfig::m_SynergySettingsName[] = {
"lastExpiringWarningTime",
"activationHasRun",
"minimizeToTray",
"ActivateEmail",
"loadFromSystemScope"
};
static const char* logLevelNames[] =
{
"INFO",
@ -251,6 +250,7 @@ void AppConfig::saveSettings()
setSetting(LastExpireWarningTime, m_LastExpiringWarningTime);
setSetting(ActivationHasRun, m_ActivationHasRun);
setSetting(MinimizeToTray, m_MinimizeToTray);
setSetting(LoadSystemSettings, m_LoadFromSystemScope);
settings().sync();
}
@ -383,7 +383,7 @@ QVariant AppConfig::loadSetting(AppConfig::Setting name, const QVariant& default
}
AppConfig::SaveChoice AppConfig::checkGlobalSave() {
if (settings().scope() == QSettings::Scope::SystemScope) {
if (isSystemScoped()) {
QMessageBox query;
query.setWindowTitle(tr("Save global settings."));
@ -423,14 +423,14 @@ void AppConfig::switchToGlobal(bool global) {
}
void AppConfig::setLoadFromSystemScope(bool value) {
if (value && settings().scope() == QSettings::UserScope)
if (value && !isSystemScoped())
{
m_LoadFromSystemScope = value;
saveSettings(); //Save user prefs
switchToGlobal(); //Switch the the System Scope
loadSettings(); //Load the settings.
}
else if (!value && settings().scope() == QSettings::SystemScope)
else if (!value && isSystemScoped())
{
switchToGlobal(false); // Switch to UserScope
loadSettings(true); // Load user settings ignoring System scope setting
@ -438,3 +438,7 @@ void AppConfig::setLoadFromSystemScope(bool value) {
saveSettings(); // Save user prefs
}
}
bool AppConfig::isSystemScoped() const {
return m_pSettings->scope() == QSettings::SystemScope;
}

View file

@ -75,6 +75,8 @@ class AppConfig: public QObject
/// @return The scoped setting currently selected
QSettings& settings();
bool isSystemScoped() const;
const QString& screenName() const;
int port() const;
const QString& networkInterface() const;