Commit 118dde2f authored by lm's avatar lm

Added application version check

parent f2b48518
...@@ -80,14 +80,20 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -80,14 +80,20 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
// clear them if they mismatch // clear them if they mismatch
// QGC then falls back to default // QGC then falls back to default
QSettings settings; QSettings settings;
// Show user an upgrade message if QGC got upgraded
bool upgraded = false;
QString lastApplicationVersion("");
if (settings.contains("QGC_APPLICATION_VERSION")) if (settings.contains("QGC_APPLICATION_VERSION"))
{ {
QString qgcVersion = settings.value("QGC_APPLICATION_VERSION").toString(); QString qgcVersion = settings.value("QGC_APPLICATION_VERSION").toString();
if (qgcVersion != QGC_APPLICATION_VERSION) if (qgcVersion != QGC_APPLICATION_VERSION)
{ {
lastApplicationVersion = qgcVersion;
settings.clear(); settings.clear();
// Write current application version // Write current application version
settings.setValue("QGC_APPLICATION_VERSION", QGC_APPLICATION_VERSION); settings.setValue("QGC_APPLICATION_VERSION", QGC_APPLICATION_VERSION);
upgraded = true;
} }
} }
else else
...@@ -156,9 +162,12 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv) ...@@ -156,9 +162,12 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
//mainWindow->addLink(simulationLink); //mainWindow->addLink(simulationLink);
mainWindow = MainWindow::instance(); mainWindow = MainWindow::instance();
// Remove splash screen // Remove splash screen
splashScreen->finish(mainWindow); splashScreen->finish(mainWindow);
if (upgraded) mainWindow->showInfoMessage(tr("Default Settings Loaded"), tr("QGroundControl has been upgraded from version %1 to version %2. Some of your user preferences have been reset to defaults for safety reasons. Please adjust them where needed.").arg(lastApplicationVersion).arg(QGC_APPLICATION_VERSION));
// Check if link could be connected // Check if link could be connected
if (!udpLink->connect()) if (!udpLink->connect())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment