Commit d535a632 authored by Don Gagne's avatar Don Gagne

Fix settings prompt on clean install

parent fdb13156
...@@ -181,6 +181,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -181,6 +181,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
, _styleIsDark(true) , _styleIsDark(true)
#endif #endif
, _fakeMobile(false) , _fakeMobile(false)
, _settingsUpgraded(false)
#ifdef QT_DEBUG #ifdef QT_DEBUG
, _testHighDPI(false) , _testHighDPI(false)
#endif #endif
...@@ -307,6 +308,19 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -307,6 +308,19 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
QDir paramDir(ParameterLoader::parameterCacheDir()); QDir paramDir(ParameterLoader::parameterCacheDir());
paramDir.removeRecursively(); paramDir.removeRecursively();
paramDir.mkpath(paramDir.absolutePath()); paramDir.mkpath(paramDir.absolutePath());
} else {
// Determine if upgrade message for settings version bump is required. Check must happen before toolbox is started since
// that will write some settings.
if (settings.contains(_settingsVersionKey)) {
if (settings.value(_settingsVersionKey).toInt() != QGC_SETTINGS_VERSION) {
_settingsUpgraded = true;
}
} else if (settings.allKeys().count()) {
// Settings version key is missing and there are settings. This is an upgrade scenario.
_settingsUpgraded = true;
} else {
settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION);
}
} }
// Set up our logging filters // Set up our logging filters
...@@ -429,20 +443,7 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -429,20 +443,7 @@ bool QGCApplication::_initForNormalAppBoot(void)
// Load known link configurations // Load known link configurations
toolbox()->linkManager()->loadLinkConfigurationList(); toolbox()->linkManager()->loadLinkConfigurationList();
// Show user an upgrade message if the settings version has been bumped up if (_settingsUpgraded) {
bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) {
if (settings.value(_settingsVersionKey).toInt() != QGC_SETTINGS_VERSION) {
settingsUpgraded = true;
}
} else if (settings.allKeys().count()) {
// Settings version key is missing and there are settings. This is an upgrade scenario.
settingsUpgraded = true;
} else {
settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION);
}
if (settingsUpgraded) {
settings.clear(); settings.clear();
settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION); settings.setValue(_settingsVersionKey, QGC_SETTINGS_VERSION);
showMessage("The format for QGroundControl saved settings has been modified. " showMessage("The format for QGroundControl saved settings has been modified. "
......
...@@ -183,13 +183,12 @@ private: ...@@ -183,13 +183,12 @@ private:
static const char* _darkStyleFile; static const char* _darkStyleFile;
static const char* _lightStyleFile; static const char* _lightStyleFile;
bool _styleIsDark; ///< true: dark style, false: light style bool _styleIsDark; ///< true: dark style, false: light style
static const int _missingParamsDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display
static const int _missingParamsDelayedDisplayTimerTimeout = 1000; ///< Timeout to wait for next missing fact to come in before display QTimer _missingParamsDelayedDisplayTimer; ///< Timer use to delay missing fact display
QTimer _missingParamsDelayedDisplayTimer; ///< Timer use to delay missing fact display QStringList _missingParams; ///< List of missing facts to be displayed
QStringList _missingParams; ///< List of missing facts to be displayed bool _fakeMobile; ///< true: Fake ui into displaying mobile interface
bool _settingsUpgraded; ///< true: Settings format has been upgrade to new version
bool _fakeMobile; ///< true: Fake ui into displaying mobile interface
#ifdef QT_DEBUG #ifdef QT_DEBUG
bool _testHighDPI; ///< true: double fonts sizes for simulating high dpi devices bool _testHighDPI; ///< true: double fonts sizes for simulating high dpi devices
......
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