Added a version setting which can be used to detect upgrades of the application.

This commit is contained in:
Leon Styhre 2021-06-22 17:47:01 +02:00
parent 942e3ca5bf
commit c8af5816a3
2 changed files with 14 additions and 0 deletions

View file

@ -475,6 +475,19 @@ int main(int argc, char* argv[])
Settings::getInstance()->saveFile();
}
// Check if the application version has changed, which would normally mean that the
// user has upgraded to a newer release.
std::string applicationVersion;
if ((applicationVersion = Settings::getInstance()->
getString("ApplicationVersion")) != PROGRAM_VERSION_STRING) {
if (applicationVersion != "") {
LOG(LogInfo) << "Application version changed from previous startup, from \"" <<
applicationVersion << "\" to \"" << PROGRAM_VERSION_STRING << "\"";
}
Settings::getInstance()->setString("ApplicationVersion", PROGRAM_VERSION_STRING);
Settings::getInstance()->saveFile();
}
Window window;
SystemScreensaver screensaver(&window);
MediaViewer mediaViewer(&window);

View file

@ -302,6 +302,7 @@ void Settings::setDefaults()
// Hardcoded or program-internal settings.
//
mStringMap["ApplicationVersion"] = { "", "" };
mBoolMap["DebugGrid"] = { false, false };
mBoolMap["DebugText"] = { false, false };
mBoolMap["DebugImage"] = { false, false };