Commit 152bb9b3 authored by pixhawk's avatar pixhawk

Added version check for settings to prevent application crashes because of...

Added version check for settings to prevent application crashes because of old, incompatible settings
parent 85c4ecd4
......@@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project
#include <QAction>
#include "configuration.h"
#include "QGC.h"
#include "Core.h"
#include "MG.h"
#include "MainWindow.h"
......@@ -69,6 +70,25 @@ Core::Core(int &argc, char* argv[]) : QApplication(argc, argv)
this->setOrganizationName(QLatin1String("OPENMAV"));
this->setOrganizationDomain("http://qgroundcontrol.org");
// Check application settings
// clear them if they mismatch
// QGC then falls back to default
QSettings settings;
if (settings.contains("QGC_APPLICATION_VERSION_INT"))
{
QString qgcVersion = settings.value("QGC_APPLICATION_VERSION").toString();
if (qgcVersion != QGC_APPLICATION_VERSION)
{
settings.clear();
}
}
else
{
// If application version is not set, clear settings anyway
settings.clear();
}
settings.sync();
// Show splash screen
QPixmap splashImage(":images/splash.png");
QSplashScreen* splashScreen = new QSplashScreen(splashImage, Qt::WindowStaysOnTopHint);
......
......@@ -5,6 +5,8 @@
#include <QColor>
#include <QThread>
#include "configuration.h"
namespace QGC
{
const QColor colorCyan(55, 154, 195);
......@@ -18,9 +20,7 @@ namespace QGC
quint64 groundTimeUsecs();
int applicationVersion();
const QString APPNAME = "QGROUNDCONTROL";
const QString COMPANYNAME = "OPENMAV";
const int APPLICATIONVERSION = 80; // 0.8.0
class SLEEP : public QThread
{
......
......@@ -2,6 +2,7 @@
#define CONFIGURATION_H
#include "mavlink.h"
#include <QString>
/** @brief Polling interval in ms */
#ifdef MAVLINK_ENABLED_SLUGS
......@@ -16,6 +17,14 @@
#define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION "v. 0.8.0 (Beta)"
#define QGC_APPLICATION_VERSION "v. 0.8.1 (Alpha)"
namespace QGC
{
const QString APPNAME = "QGROUNDCONTROL";
const QString COMPANYNAME = "OPENMAV";
const int APPLICATIONVERSION = 80; // 0.8.0
}
#endif // CONFIGURATION_H
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