refactor: Move update check setting to Settings
newkey: gui/enableUpdateCheck <= General/enableUpdateCheck remove update check from `AppConfig`
This commit is contained in:
@ -619,13 +619,13 @@ void MainWindow::serverConnectionConfigureClient(const QString &clientName)
|
||||
|
||||
void MainWindow::open()
|
||||
{
|
||||
if (!m_appConfig.enableUpdateCheck().has_value()) {
|
||||
|
||||
if (!Settings::value(Settings::Gui::AutoUpdateCheck).isValid()) {
|
||||
showAndActivate();
|
||||
m_appConfig.setEnableUpdateCheck(messages::showUpdateCheckOption(this));
|
||||
m_configScopes.save();
|
||||
Settings::setValue(Settings::Gui::AutoUpdateCheck, messages::showUpdateCheckOption(this));
|
||||
}
|
||||
|
||||
if (m_appConfig.enableUpdateCheck().value()) {
|
||||
if (Settings::value(Settings::Gui::AutoUpdateCheck).toBool()) {
|
||||
m_versionChecker.checkLatest();
|
||||
} else {
|
||||
qDebug() << "update check disabled";
|
||||
|
||||
@ -150,7 +150,7 @@ void SettingsDialog::accept()
|
||||
m_appConfig.setLogFilename(ui->lineLogFilename->text());
|
||||
m_appConfig.setElevateMode(static_cast<ElevateMode>(ui->comboElevate->currentIndex()));
|
||||
Settings::setValue(Settings::Gui::Autohide, ui->cbAutoHide->isChecked());
|
||||
m_appConfig.setEnableUpdateCheck(ui->cbAutoUpdate->isChecked());
|
||||
Settings::setValue(Settings::Gui::AutoUpdateCheck, ui->cbAutoUpdate->isChecked());
|
||||
m_appConfig.setPreventSleep(ui->cbPreventSleep->isChecked());
|
||||
m_appConfig.setTlsCertPath(ui->lineTlsCertPath->text());
|
||||
m_appConfig.setTlsKeyLength(ui->comboTlsKeyLength->currentText().toInt());
|
||||
@ -191,11 +191,7 @@ void SettingsDialog::loadFromConfig()
|
||||
ui->cbCloseToTray->setChecked(m_appConfig.closeToTray());
|
||||
ui->comboElevate->setCurrentIndex(static_cast<int>(m_appConfig.elevateMode()));
|
||||
|
||||
if (m_appConfig.enableUpdateCheck().has_value()) {
|
||||
ui->cbAutoUpdate->setChecked(m_appConfig.enableUpdateCheck().value());
|
||||
} else {
|
||||
ui->cbAutoUpdate->setChecked(false);
|
||||
}
|
||||
ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::Autohide).toBool());
|
||||
|
||||
if (m_appConfig.isActiveScopeSystem()) {
|
||||
ui->rbScopeSystem->setChecked(true);
|
||||
|
||||
@ -37,6 +37,7 @@ public:
|
||||
struct Gui
|
||||
{
|
||||
inline static const auto Autohide = QStringLiteral("gui/autoHide");
|
||||
inline static const auto AutoUpdateCheck = QStringLiteral("gui/enableUpdateCheck");
|
||||
inline static const auto LogExpanded = QStringLiteral("gui/logExpanded");
|
||||
inline static const auto SymbolicTrayIcon = QStringLiteral("gui/symbolicTrayIcon");
|
||||
};
|
||||
@ -73,6 +74,7 @@ private:
|
||||
inline static const QStringList m_validKeys = {
|
||||
Core::Scope
|
||||
, Gui::Autohide
|
||||
, Gui::AutoUpdateCheck
|
||||
, Gui::LogExpanded
|
||||
, Gui::SymbolicTrayIcon
|
||||
};
|
||||
|
||||
@ -76,7 +76,7 @@ const char *const AppConfig::m_SettingsName[] = {
|
||||
"mainWindowPosition",
|
||||
"", // 41 = Show dev thanks, obsolete
|
||||
"showCloseReminder",
|
||||
"enableUpdateCheck",
|
||||
"", // 43 Moved to deskflow settings
|
||||
"", // 44, Moved to deskflow settings.
|
||||
"", // 45 Moved to deskflow settings
|
||||
"requireClientCerts",
|
||||
@ -141,7 +141,6 @@ void AppConfig::recallFromCurrentScope()
|
||||
getFromCurrentScope<QPoint>(kMainWindowPosition, [](const QVariant &v) { return v.toPoint(); });
|
||||
m_MainWindowSize = getFromCurrentScope<QSize>(kMainWindowSize, [](const QVariant &v) { return v.toSize(); });
|
||||
m_ShowCloseReminder = getFromCurrentScope(kShowCloseReminder, m_ShowCloseReminder).toBool();
|
||||
m_EnableUpdateCheck = getFromCurrentScope<bool>(kEnableUpdateCheck, [](const QVariant &v) { return v.toBool(); });
|
||||
}
|
||||
|
||||
void AppConfig::recallScreenName()
|
||||
@ -195,7 +194,6 @@ void AppConfig::commit()
|
||||
setInCurrentScope(kMainWindowSize, m_MainWindowSize);
|
||||
setInCurrentScope(kMainWindowPosition, m_MainWindowPosition);
|
||||
setInCurrentScope(kShowCloseReminder, m_ShowCloseReminder);
|
||||
setInCurrentScope(kEnableUpdateCheck, m_EnableUpdateCheck);
|
||||
setInCurrentScope(kRequireClientCert, m_RequireClientCert);
|
||||
}
|
||||
|
||||
@ -558,11 +556,6 @@ bool AppConfig::showCloseReminder() const
|
||||
return m_ShowCloseReminder;
|
||||
}
|
||||
|
||||
std::optional<bool> AppConfig::enableUpdateCheck() const
|
||||
{
|
||||
return m_EnableUpdateCheck;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// End getters
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -725,11 +718,6 @@ void AppConfig::setShowCloseReminder(bool value)
|
||||
m_ShowCloseReminder = value;
|
||||
}
|
||||
|
||||
void AppConfig::setEnableUpdateCheck(bool value)
|
||||
{
|
||||
m_EnableUpdateCheck = value;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// End setters
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -98,7 +98,7 @@ private:
|
||||
kMainWindowPosition = 40,
|
||||
// 41 = show dev thanks, obsolete
|
||||
kShowCloseReminder = 42,
|
||||
kEnableUpdateCheck = 43,
|
||||
// 43 = Enable Update Check,
|
||||
// 44 = LogExpanded, Moved to deskflow settings
|
||||
// 45 = Colorful Icon, Moved to deskflow settings
|
||||
kRequireClientCert = 46
|
||||
@ -173,7 +173,6 @@ public:
|
||||
std::optional<QSize> mainWindowSize() const;
|
||||
std::optional<QPoint> mainWindowPosition() const;
|
||||
bool showCloseReminder() const;
|
||||
std::optional<bool> enableUpdateCheck() const;
|
||||
|
||||
//
|
||||
// Setters (overrides)
|
||||
@ -211,7 +210,6 @@ public:
|
||||
void setMainWindowSize(const QSize &size);
|
||||
void setMainWindowPosition(const QPoint &position);
|
||||
void setShowCloseReminder(bool show);
|
||||
void setEnableUpdateCheck(bool value);
|
||||
|
||||
/// @brief Sets the user preference to load from SystemScope.
|
||||
/// @param [in] value
|
||||
@ -313,7 +311,6 @@ private:
|
||||
std::optional<QPoint> m_MainWindowPosition;
|
||||
bool m_LoadFromSystemScope = false;
|
||||
bool m_ShowCloseReminder = true;
|
||||
std::optional<bool> m_EnableUpdateCheck;
|
||||
bool m_RequireClientCert = true;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user