#5707 Store and update last version uses in settings

This commit is contained in:
Andrew Nelless 2016-10-26 15:57:38 +01:00
parent b7e0473cb4
commit 906fd15b4a
3 changed files with 22 additions and 1 deletions

View File

@ -162,6 +162,7 @@ void AppConfig::loadSettings()
m_CryptoEnabled = settings().value("cryptoEnabled", true).toBool(); m_CryptoEnabled = settings().value("cryptoEnabled", true).toBool();
m_AutoHide = settings().value("autoHide", false).toBool(); m_AutoHide = settings().value("autoHide", false).toBool();
m_Serialkey = settings().value("serialKey", "").toString(); m_Serialkey = settings().value("serialKey", "").toString();
m_lastVersion = settings().value("lastVersion", "Unknown").toString();
m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt(); m_LastExpiringWarningTime = settings().value("lastExpiringWarningTime", 0).toInt();
m_ActivationHasRun = settings().value("activationHasRun", false).toBool(); m_ActivationHasRun = settings().value("activationHasRun", false).toBool();
} }
@ -187,6 +188,7 @@ void AppConfig::saveSettings()
settings().setValue("cryptoEnabled", m_CryptoEnabled); settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("autoHide", m_AutoHide); settings().setValue("autoHide", m_AutoHide);
settings().setValue("serialKey", m_Serialkey); settings().setValue("serialKey", m_Serialkey);
settings().setValue("lastVersion", m_lastVersion);
settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime); settings().setValue("lastExpiringWarningTime", m_LastExpiringWarningTime);
settings().setValue("activationHasRun", m_ActivationHasRun); settings().setValue("activationHasRun", m_ActivationHasRun);
settings().sync(); settings().sync();
@ -203,6 +205,15 @@ AppConfig& AppConfig::activationHasRun(bool value)
return *this; return *this;
} }
QString AppConfig::lastVersion() const
{
return m_lastVersion;
}
void AppConfig::setLastVersion(QString version) {
m_lastVersion = version;
}
QSettings &AppConfig::settings() { return *m_pSettings; } QSettings &AppConfig::settings() { return *m_pSettings; }
void AppConfig::setScreenName(const QString &s) { m_ScreenName = s; } void AppConfig::setScreenName(const QString &s) { m_ScreenName = s; }

View File

@ -104,7 +104,11 @@ class AppConfig: public QObject
bool activationHasRun() const; bool activationHasRun() const;
AppConfig& activationHasRun(bool value); AppConfig& activationHasRun(bool value);
void saveSettings();; QString lastVersion() const;
void saveSettings();
void setLastVersion(QString version);
protected: protected:
QSettings& settings(); QSettings& settings();
void setScreenName(const QString& s); void setScreenName(const QString& s);
@ -139,6 +143,7 @@ protected:
bool m_CryptoEnabled; bool m_CryptoEnabled;
bool m_AutoHide; bool m_AutoHide;
QString m_Serialkey; QString m_Serialkey;
QString m_lastVersion;
int m_LastExpiringWarningTime; int m_LastExpiringWarningTime;
bool m_ActivationHasRun; bool m_ActivationHasRun;

View File

@ -156,6 +156,11 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
setWindowTitle (m_LicenseManager->activeEditionName()); setWindowTitle (m_LicenseManager->activeEditionName());
m_LicenseManager->refresh(); m_LicenseManager->refresh();
QString currentVersion = m_VersionChecker.getVersion();
if (m_AppConfig->lastVersion() != currentVersion) {
m_AppConfig->setLastVersion (currentVersion);
}
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()