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>
This commit is contained in:
Dirk Hohndel 2015-01-03 13:47:05 -08:00
parent 09f5289271
commit 5cc261311e

View file

@ -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)