Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
720ca30b
Commit
720ca30b
authored
Oct 31, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Settings versioned independently from app version
parent
f5ac24e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
23 deletions
+26
-23
QGCConfig.h
src/QGCConfig.h
+4
-0
QGCCore.cc
src/QGCCore.cc
+20
-22
QGCCore.h
src/QGCCore.h
+2
-1
No files found.
src/QGCConfig.h
View file @
720ca30b
...
...
@@ -10,6 +10,10 @@
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1
// If you need to make an incompatible changes to stored settings, bump this version number
// up by 1. This will caused store settings to be cleared on next boot.
#define QGC_SETTINGS_VERSION 1
#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION_BASE "v2.0.3"
...
...
src/QGCCore.cc
View file @
720ca30b
...
...
@@ -55,6 +55,7 @@ This file is part of the QGROUNDCONTROL project
#include "MAVLinkSimulationLink.h"
#include "SerialLink.h"
const
char
*
QGCCore
::
_settingsVersionKey
=
"SettingsVersion"
;
/**
* @brief Constructor for the main application.
...
...
@@ -108,31 +109,25 @@ bool QGCCore::init(void)
// Exit main application when last window is closed
connect
(
this
,
SIGNAL
(
lastWindowClosed
()),
this
,
SLOT
(
quit
()));
// Show user an upgrade message if QGC got upgraded (see code below, after splash screen)
bool
upgraded
=
false
;
// Show user an upgrade message if the settings version has been bumped up
bool
settingsUpgraded
=
false
;
enum
MainWindow
::
CUSTOM_MODE
mode
=
MainWindow
::
CUSTOM_MODE_PX4
;
QString
lastApplicationVersion
(
""
);
if
(
settings
.
contains
(
"QGC_APPLICATION_VERSION"
))
{
QString
qgcVersion
=
settings
.
value
(
"QGC_APPLICATION_VERSION"
).
toString
();
if
(
qgcVersion
!=
QGC_APPLICATION_VERSION
)
{
lastApplicationVersion
=
qgcVersion
;
settings
.
clear
();
// Clear settings from different version
// Write current application version
settings
.
setValue
(
"QGC_APPLICATION_VERSION"
,
QGC_APPLICATION_VERSION
);
upgraded
=
true
;
}
else
{
mode
=
(
enum
MainWindow
::
CUSTOM_MODE
)
settings
.
value
(
"QGC_CUSTOM_MODE"
,
(
int
)
MainWindow
::
CUSTOM_MODE_PX4
).
toInt
();
if
(
settings
.
contains
(
_settingsVersionKey
))
{
if
(
settings
.
value
(
_settingsVersionKey
).
toInt
()
!=
QGC_SETTINGS_VERSION
)
{
settingsUpgraded
=
true
;
}
}
else
{
// If application version is not set, clear settings anyway
}
else
if
(
settings
.
allKeys
().
count
())
{
// Settings version key is missing and there are settings. This is an upgrade scenario.
settingsUpgraded
=
true
;
}
if
(
settingsUpgraded
)
{
settings
.
clear
();
// Write current application version
settings
.
setValue
(
"QGC_APPLICATION_VERSION"
,
QGC_APPLICATION_VERSION
);
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
}
mode
=
(
enum
MainWindow
::
CUSTOM_MODE
)
settings
.
value
(
"QGC_CUSTOM_MODE"
,
(
int
)
MainWindow
::
CUSTOM_MODE_PX4
).
toInt
();
settings
.
sync
();
// Show splash screen
...
...
@@ -192,8 +187,11 @@ bool QGCCore::init(void)
// Remove splash screen
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
));
if
(
settingsUpgraded
)
{
_mainWindow
->
showInfoMessage
(
tr
(
"Settings Cleared"
),
tr
(
"The format for QGroundControl saved settings has been modified. "
"Your saved settings have been reset to defaults."
));
}
// Check if link could be connected
if
(
udpLink
&&
!
udpLink
->
connect
())
...
...
src/QGCCore.h
View file @
720ca30b
...
...
@@ -72,7 +72,8 @@ protected:
void
startUASManager
();
private:
MainWindow
*
_mainWindow
;
MainWindow
*
_mainWindow
;
static
const
char
*
_settingsVersionKey
;
};
#endif
/* _CORE_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment