mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
09f5289271
commit
5cc261311e
1 changed files with 12 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue