Browse Source

Added version check for settings to prevent application crashes because of old, incompatible settings

QGC4.4
pixhawk 14 years ago
parent
commit
152bb9b3da
  1. 20
      src/Core.cc
  2. 6
      src/QGC.h
  3. 11
      src/configuration.h

20
src/Core.cc

@ -40,6 +40,7 @@ This file is part of the QGROUNDCONTROL project @@ -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) @@ -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);

6
src/QGC.h

@ -5,6 +5,8 @@ @@ -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 @@ -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
{

11
src/configuration.h

@ -2,6 +2,7 @@ @@ -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 @@ @@ -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

Loading…
Cancel
Save