aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/updatemanager.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-03 13:47:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-03 13:47:05 -0800
commit5cc261311ec1649440ff9e4db8ff9e3229f167b6 (patch)
tree56157e5332597d95ec090217be18d67490f7b90d /qt-ui/updatemanager.cpp
parent09f5289271eb85cbd63d65e16a7c14705ff27029 (diff)
downloadsubsurface-5cc261311ec1649440ff9e4db8ff9e3229f167b6.tar.gz
Fix the update check logic
Oops. That was supposed to do the opposite of what it ended up doing. The goal was to NOT check for two weeks when the user updates to a new version. Instead it always checked when the user updated to a new version. This mostly would hit developers... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/updatemanager.cpp')
-rw-r--r--qt-ui/updatemanager.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/qt-ui/updatemanager.cpp b/qt-ui/updatemanager.cpp
index b6e8dc47a..d672b2dbb 100644
--- a/qt-ui/updatemanager.cpp
+++ b/qt-ui/updatemanager.cpp
@@ -12,18 +12,25 @@ UpdateManager::UpdateManager(QObject *parent) : QObject(parent)
// is this the first time this version was run?
QSettings settings;
settings.beginGroup("UpdateManager");
- if (settings.contains("LastVersionUsed") && settings.value("LastVersionUsed").toString() == GIT_VERSION_STRING) {
- // this is the version we've been using
+ if (settings.contains("DontCheckForUpdates") && settings.value("DontCheckForUpdates") == "TRUE")
+ return;
+ if (settings.contains("LastVersionUsed")) {
+ // we have checked at least once before
+ if (settings.value("LastVersionUsed").toString() != GIT_VERSION_STRING) {
+ // we have just updated - wait two weeks before you check again
+ settings.setValue("LastVersionUsed", QString(GIT_VERSION_STRING));
+ settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate));
+ return;
+ }
+ // is it time to check again?
QString nextCheckString = settings.value("NextCheck").toString();
QDateTime nextCheck = QDateTime::fromString(nextCheckString, Qt::ISODate);
if (nextCheck > QDateTime::currentDateTime())
return;
}
settings.setValue("LastVersionUsed", QString(GIT_VERSION_STRING));
- if (settings.contains("DontCheckForUpdates") && settings.value("DontCheckForUpdates") == "TRUE")
- return;
- checkForUpdates(true);
settings.setValue("NextCheck", QDateTime::currentDateTime().addDays(14).toString(Qt::ISODate));
+ checkForUpdates(true);
}
void UpdateManager::checkForUpdates(bool automatic)