Commit b600e360 authored by Don Gagne's avatar Don Gagne

Merge pull request #951 from DonLakeFlyer/Versioning

More work on versioning
parents ef726502 b263cb96
...@@ -94,9 +94,4 @@ double limitAngleToPMPId(double angle) ...@@ -94,9 +94,4 @@ double limitAngleToPMPId(double angle)
return angle; return angle;
} }
int applicationVersion()
{
return APPLICATIONVERSION;
}
} }
...@@ -93,7 +93,6 @@ qreal groundTimeSeconds(); ...@@ -93,7 +93,6 @@ qreal groundTimeSeconds();
float limitAngleToPMPIf(float angle); float limitAngleToPMPIf(float angle);
/** @brief Returns the angle limited to -pi - pi */ /** @brief Returns the angle limited to -pi - pi */
double limitAngleToPMPId(double angle); double limitAngleToPMPId(double angle);
int applicationVersion();
const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21; const static int MAX_FLIGHT_TIME = 60 * 60 * 24 * 21;
......
...@@ -12,24 +12,27 @@ ...@@ -12,24 +12,27 @@
// If you need to make an incompatible changes to stored settings, bump this version number // 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. // up by 1. This will caused store settings to be cleared on next boot.
#define QGC_SETTINGS_VERSION 1 #define QGC_SETTINGS_VERSION 2
#define QGC_APPLICATION_NAME "QGroundControl" #define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION_BASE "v2.0.3" #define QGC_ORG_NAME "QGroundControl.org"
#define QGC_ORG_DOMAIN "org.qgroundcontrol"
#ifdef QGC_APPLICATION_VERSION_SUFFIX #define QGC_APPLICATION_VERSION_MAJOR 2
#define QGC_APPLICATION_VERSION QGC_APPLICATION_VERSION_BASE QGC_APPLICATION_VERSION_SUFFIX #define QGC_APPLICATION_VERSION_MINOR 1
#else
#define QGC_APPLICATION_VERSION QGC_APPLICATION_VERSION_BASE " (Developer Build)" // The following #definess can be overriden from the command line so that automated build systems can
#endif // add additional build identification.
namespace QGC // Only comes from command line
//#define QGC_APPLICATION_VERSION_COMMIT "..."
{ #ifndef QGC_APPLICATION_VERSION_BUILDNUMBER
const QString APPNAME = "QGROUNDCONTROL"; #define QGC_APPLICATION_VERSION_BUILDNUMBER 0
const QString ORG_NAME = "QGROUNDCONTROL.ORG"; //can be customized by forks to e.g. mycompany.com to maintain separate Settings for customized apps #endif
const QString ORG_DOMAIN = "org.qgroundcontrol";//can be customized by forks
const int APPLICATIONVERSION = 203; // 2.0.3 #ifndef QGC_APPLICATION_VERSION_BUILDTYPE
} #define QGC_APPLICATION_VERSION_BUILDTYPE "(Developer Build)"
#endif
#endif // QGC_CONFIGURATION_H #endif // QGC_CONFIGURATION_H
...@@ -72,11 +72,16 @@ QGCCore::QGCCore(int &argc, char* argv[]) : ...@@ -72,11 +72,16 @@ QGCCore::QGCCore(int &argc, char* argv[]) :
QApplication(argc, argv), QApplication(argc, argv),
_mainWindow(NULL) _mainWindow(NULL)
{ {
// Set application name // Set application information
this->setApplicationName(QGC_APPLICATION_NAME); this->setApplicationName(QGC_APPLICATION_NAME);
this->setApplicationVersion(QGC_APPLICATION_VERSION); this->setOrganizationName(QGC_ORG_NAME);
this->setOrganizationName(QGC::ORG_NAME); this->setOrganizationDomain(QGC_ORG_DOMAIN);
this->setOrganizationDomain(QGC::ORG_DOMAIN);
// Version string is build from component parts. Format is:
// vMajor.Minor.BuildNumber BuildType
QString versionString("v%1.%2.%3 %4");
versionString = versionString.arg(QGC_APPLICATION_VERSION_MAJOR).arg(QGC_APPLICATION_VERSION_MINOR).arg(QGC_APPLICATION_VERSION_BUILDNUMBER).arg(QGC_APPLICATION_VERSION_BUILDTYPE);
this->setApplicationVersion(versionString);
// Set settings format // Set settings format
QSettings::setDefaultFormat(QSettings::IniFormat); QSettings::setDefaultFormat(QSettings::IniFormat);
......
...@@ -139,7 +139,7 @@ bool SerialLink::isBootloader() ...@@ -139,7 +139,7 @@ bool SerialLink::isBootloader()
void SerialLink::loadSettings() void SerialLink::loadSettings()
{ {
// Load defaults from settings // Load defaults from settings
QSettings settings(QGC::ORG_NAME, QGC::APPNAME); QSettings settings;
settings.sync(); settings.sync();
if (settings.contains("SERIALLINK_COMM_PORT")) if (settings.contains("SERIALLINK_COMM_PORT"))
{ {
...@@ -157,7 +157,7 @@ void SerialLink::loadSettings() ...@@ -157,7 +157,7 @@ void SerialLink::loadSettings()
void SerialLink::writeSettings() void SerialLink::writeSettings()
{ {
// Store settings // Store settings
QSettings settings(QGC::ORG_NAME, QGC::APPNAME); QSettings settings;
settings.setValue("SERIALLINK_COMM_PORT", getPortName()); settings.setValue("SERIALLINK_COMM_PORT", getPortName());
settings.setValue("SERIALLINK_COMM_BAUD", getBaudRateType()); settings.setValue("SERIALLINK_COMM_BAUD", getBaudRateType());
settings.setValue("SERIALLINK_COMM_PARITY", getParityType()); settings.setValue("SERIALLINK_COMM_PARITY", getParityType());
......
...@@ -984,7 +984,7 @@ void MainWindow::storeSettings() ...@@ -984,7 +984,7 @@ void MainWindow::storeSettings()
// Save the last current view in any case // Save the last current view in any case
settings.setValue("CURRENT_VIEW", currentView); settings.setValue("CURRENT_VIEW", currentView);
// Save the current window state, but only if a system is connected (else no real number of widgets would be present)) // Save the current window state, but only if a system is connected (else no real number of widgets would be present))
if (UASManager::instance()->getUASList().length() > 0) settings.setValue(getWindowStateKey(), saveState(QGC::applicationVersion())); if (UASManager::instance()->getUASList().length() > 0) settings.setValue(getWindowStateKey(), saveState());
// Save the current view only if a UAS is connected // Save the current view only if a UAS is connected
if (UASManager::instance()->getUASList().length() > 0) settings.setValue("CURRENT_VIEW_WITH_UAS_CONNECTED", currentView); if (UASManager::instance()->getUASList().length() > 0) settings.setValue("CURRENT_VIEW_WITH_UAS_CONNECTED", currentView);
// Save the current power mode // Save the current power mode
...@@ -1439,7 +1439,7 @@ void MainWindow::setActiveUAS(UASInterface* uas) ...@@ -1439,7 +1439,7 @@ void MainWindow::setActiveUAS(UASInterface* uas)
if (settings.contains(getWindowStateKey())) if (settings.contains(getWindowStateKey()))
{ {
SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget()); SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget());
win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion()); win->restoreState(settings.value(getWindowStateKey()).toByteArray());
} }
} }
...@@ -1596,7 +1596,7 @@ void MainWindow::storeViewState() ...@@ -1596,7 +1596,7 @@ void MainWindow::storeViewState()
widgetnames = widgetnames.mid(0,widgetnames.length()-1); widgetnames = widgetnames.mid(0,widgetnames.length()-1);
settings.setValue(getWindowStateKey() + "WIDGETS",widgetnames); settings.setValue(getWindowStateKey() + "WIDGETS",widgetnames);
settings.setValue(getWindowStateKey(), win->saveState(QGC::applicationVersion())); settings.setValue(getWindowStateKey(), win->saveState());
settings.setValue(getWindowStateKey()+"CENTER_WIDGET", centerStack->currentIndex()); settings.setValue(getWindowStateKey()+"CENTER_WIDGET", centerStack->currentIndex());
// Although we want save the state of the window, we do not want to change the top-leve state (minimized, maximized, etc) // Although we want save the state of the window, we do not want to change the top-leve state (minimized, maximized, etc)
// therefore this state is stored here and restored after applying the rest of the settings in the new // therefore this state is stored here and restored after applying the rest of the settings in the new
...@@ -1685,7 +1685,7 @@ void MainWindow::loadViewState() ...@@ -1685,7 +1685,7 @@ void MainWindow::loadViewState()
if (settings.contains(getWindowStateKey())) if (settings.contains(getWindowStateKey()))
{ {
SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget()); SubMainWindow *win = qobject_cast<SubMainWindow*>(centerStack->currentWidget());
win->restoreState(settings.value(getWindowStateKey()).toByteArray(), QGC::applicationVersion()); win->restoreState(settings.value(getWindowStateKey()).toByteArray());
} }
} }
void MainWindow::setAdvancedMode(bool isAdvancedMode) void MainWindow::setAdvancedMode(bool isAdvancedMode)
......
...@@ -38,9 +38,6 @@ QGCSettingsWidget::QGCSettingsWidget(JoystickInput *joystick, QWidget *parent, Q ...@@ -38,9 +38,6 @@ QGCSettingsWidget::QGCSettingsWidget(JoystickInput *joystick, QWidget *parent, Q
this->window()->setWindowTitle(tr("QGroundControl Settings")); this->window()->setWindowTitle(tr("QGroundControl Settings"));
// Settings reset
connect(ui->resetSettingsButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
// Audio preferences // Audio preferences
ui->audioMuteCheckBox->setChecked(GAudioOutput::instance()->isMuted()); ui->audioMuteCheckBox->setChecked(GAudioOutput::instance()->isMuted());
connect(ui->audioMuteCheckBox, SIGNAL(toggled(bool)), GAudioOutput::instance(), SLOT(mute(bool))); connect(ui->audioMuteCheckBox, SIGNAL(toggled(bool)), GAudioOutput::instance(), SLOT(mute(bool)));
...@@ -200,13 +197,3 @@ void QGCSettingsWidget::selectCustomMode(int mode) ...@@ -200,13 +197,3 @@ void QGCSettingsWidget::selectCustomMode(int mode)
MainWindow::instance()->setCustomMode(static_cast<enum MainWindow::CUSTOM_MODE>(ui->customModeComboBox->itemData(mode).toInt())); MainWindow::instance()->setCustomMode(static_cast<enum MainWindow::CUSTOM_MODE>(ui->customModeComboBox->itemData(mode).toInt()));
MainWindow::instance()->showInfoMessage(tr("Please restart QGroundControl"), tr("The optimization selection was changed. The application needs to be closed and restarted to put all optimizations into effect.")); MainWindow::instance()->showInfoMessage(tr("Please restart QGroundControl"), tr("The optimization selection was changed. The application needs to be closed and restarted to put all optimizations into effect."));
} }
void QGCSettingsWidget::resetSettings()
{
QSettings settings;
settings.sync();
settings.clear();
// Write current application version
settings.setValue("QGC_APPLICATION_VERSION", QGC_APPLICATION_VERSION);
settings.sync();
}
...@@ -23,7 +23,6 @@ public slots: ...@@ -23,7 +23,6 @@ public slots:
void setDefaultStyle(); void setDefaultStyle();
void selectStylesheet(); void selectStylesheet();
void selectCustomMode(int mode); void selectCustomMode(int mode);
void resetSettings();
private: private:
MainWindow* mainWindow; MainWindow* mainWindow;
......
...@@ -164,29 +164,6 @@ ...@@ -164,29 +164,6 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Danger Zone</string>
</property>
<layout class="QGridLayout" name="gridLayout" columnstretch="10,0">
<item row="1" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Delete all settings, layouts and restore defaults</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="resetSettingsButton">
<property name="text">
<string>Reset Settings</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
......
...@@ -266,7 +266,7 @@ void TerminalConsole::setLink(int index) ...@@ -266,7 +266,7 @@ void TerminalConsole::setLink(int index)
void TerminalConsole::loadSettings() void TerminalConsole::loadSettings()
{ {
// Load defaults from settings // Load defaults from settings
QSettings settings(QGC::ORG_NAME, QGC::APPNAME); QSettings settings;
settings.sync(); settings.sync();
if (settings.contains("TERMINALCONSOLE_COMM_PORT")) if (settings.contains("TERMINALCONSOLE_COMM_PORT"))
{ {
...@@ -288,7 +288,7 @@ void TerminalConsole::loadSettings() ...@@ -288,7 +288,7 @@ void TerminalConsole::loadSettings()
void TerminalConsole::writeSettings() void TerminalConsole::writeSettings()
{ {
// Store settings // Store settings
QSettings settings(QGC::ORG_NAME, QGC::APPNAME); QSettings settings;
settings.setValue("TERMINALCONSOLE_COMM_PORT", m_settings.name); settings.setValue("TERMINALCONSOLE_COMM_PORT", m_settings.name);
settings.setValue("TERMINALCONSOLE_COMM_BAUD", m_settings.baudRate); settings.setValue("TERMINALCONSOLE_COMM_BAUD", m_settings.baudRate);
settings.setValue("TERMINALCONSOLE_COMM_PARITY", m_settings.parity); settings.setValue("TERMINALCONSOLE_COMM_PARITY", m_settings.parity);
......
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