refactor: move lastVersion to Settings

newkey: core/lastVersion <= General/lastVersion
Remove from app config
This commit is contained in:
sithlord48
2025-03-06 21:11:19 -05:00
committed by Nick Bolton
parent 5360fb3c89
commit 03f142977f
4 changed files with 7 additions and 19 deletions

View File

@ -217,8 +217,8 @@ void MainWindow::setupControls()
ui->lblIpAddresses->setText(tr("This computer's IP addresses: %1").arg(getIPAddresses()));
if (m_appConfig.lastVersion() != kVersion) {
m_appConfig.setLastVersion(kVersion);
if (Settings::value(Settings::Core::LastVersion).toString() != kVersion) {
Settings::setValue(Settings::Core::LastVersion, kVersion);
}
// Setup the log toggle, set its initial state to closed

View File

@ -31,6 +31,7 @@ public:
struct Core
{
inline static const auto LastVersion = QStringLiteral("core/lastVersion");
inline static const auto Scope = QStringLiteral("core/loadFromSystemScope");
inline static const auto StartedBefore = QStringLiteral("core/startedBefore");
};
@ -82,7 +83,8 @@ private:
QString m_portableSettingsFile = QStringLiteral("%1.conf").arg(kAppName);
// clang-format off
inline static const QStringList m_validKeys = {
Core::Scope
Core::LastVersion
, Core::Scope
, Core::StartedBefore
, Gui::Autohide
, Gui::AutoUpdateCheck

View File

@ -47,7 +47,7 @@ const char *const AppConfig::m_SettingsName[] = {
"", // 11 = kTlsEnabled (retain legacy string value) Moved to Settings
"", // 12 AutoHide, moved to Settings
"", // 13 = serialKey, obsolete
"lastVersion",
"", // 14 last Version moved ot deskflow settings
"", // 15 = lastExpiringWarningTime, obsolete
"", // 16 = activationHasRun, obsolete
"", // 17 = minimizeToTray, obsolete
@ -119,7 +119,6 @@ void AppConfig::recallFromCurrentScope()
m_LogLevel = getFromCurrentScope(kLogLevel, m_LogLevel).toInt();
m_LogToFile = getFromCurrentScope(kLogToFile, m_LogToFile).toBool();
m_LogFilename = getFromCurrentScope(kLogFilename, m_LogFilename).toString();
m_LastVersion = getFromCurrentScope(kLastVersion, m_LastVersion).toString();
m_ServerGroupChecked = getFromCurrentScope(kServerGroupChecked, m_ServerGroupChecked).toBool();
m_UseExternalConfig = getFromCurrentScope(kUseExternalConfig, m_UseExternalConfig).toBool();
m_ConfigFile = getFromCurrentScope(kConfigFile, m_ConfigFile).toString();
@ -168,7 +167,6 @@ void AppConfig::commit()
setInCurrentScope(kLogFilename, m_LogFilename);
setInCurrentScope(kElevateMode, static_cast<int>(m_ElevateMode));
setInCurrentScope(kElevateModeLegacy, m_ElevateMode == ElevateMode::kAlways);
setInCurrentScope(kLastVersion, m_LastVersion);
setInCurrentScope(kUseExternalConfig, m_UseExternalConfig);
setInCurrentScope(kConfigFile, m_ConfigFile);
setInCurrentScope(kUseInternalConfig, m_UseInternalConfig);
@ -410,11 +408,6 @@ ProcessMode AppConfig::processMode() const
return m_EnableService ? ProcessMode::kService : ProcessMode::kDesktop;
}
QString AppConfig::lastVersion() const
{
return m_LastVersion;
}
QString AppConfig::coreServerName() const
{
#ifdef Q_OS_WIN
@ -525,10 +518,6 @@ void AppConfig::setServerHostname(const QString &newValue)
{
m_ServerHostname = newValue;
}
void AppConfig::setLastVersion(const QString &version)
{
m_LastVersion = version;
}
void AppConfig::setScreenName(const QString &s)
{

View File

@ -68,7 +68,7 @@ private:
// 11 = tlsEnagled moved to Settigns
// 12 = auto hide, Moved to Settings
// 13 = serial key, obsolete
kLastVersion = 14,
// 14 = kLastVersion, moved to deskflow settings
// 15 = last expire time, obsolete
// 16 = activation has run, obsolete
// 17 = minimize to tray, obsolete
@ -158,7 +158,6 @@ public:
QString logDir() const;
bool serverGroupChecked() const;
bool useInternalConfig() const;
QString lastVersion() const;
//
// Setters (overrides)
@ -186,7 +185,6 @@ public:
void setUseInternalConfig(bool);
void setClientGroupChecked(bool);
void setServerHostname(const QString &);
void setLastVersion(const QString &version);
/// @brief Sets the user preference to load from SystemScope.
/// @param [in] value
@ -264,7 +262,6 @@ private:
bool m_LogToFile = false;
QString m_LogFilename = logDir() + deskflow::gui::kDefaultLogFile;
ElevateMode m_ElevateMode = deskflow::gui::kDefaultElevateMode;
QString m_LastVersion = "";
bool m_InvertScrollDirection = false;
bool m_LanguageSync = true;
bool m_PreventSleep = false;