Commit f26504f5 authored by dogmaphobic's avatar dogmaphobic

Saving and Restoring "Map Is Main"

parent 8a9f0c1a
......@@ -56,8 +56,9 @@ Item {
readonly property string _mapName: "FlightDisplayView"
readonly property string _showMapBackgroundKey: "/showMapBackground"
readonly property string _mainIsMapKey: "MainFlyWindowIsMap"
property bool _mainIsMap: !_controller.hasVideo
property bool _mainIsMap: QGroundControl.loadBoolGlobalSetting(_mainIsMapKey, true)
property real _roll: _activeVehicle ? (isNaN(_activeVehicle.roll) ? _defaultRoll : _activeVehicle.roll) : _defaultRoll
property real _pitch: _activeVehicle ? (isNaN(_activeVehicle.pitch) ? _defaultPitch : _activeVehicle.pitch) : _defaultPitch
......@@ -158,6 +159,7 @@ Item {
_mainIsMap = !_mainIsMap
pip.visible = false
reloadContents();
QGroundControl.saveBoolGlobalSetting(_mainIsMapKey, _mainIsMap)
}
}
}
......
......@@ -88,7 +88,7 @@ Item {
horizontalAlignment: TextEdit.AlignHCenter
}
QGCLabel {
text: altitude
text: altitude.toFixed(1)
font.weight: Font.DemiBold
color: isSatellite ? "black" : "white"
}
......@@ -110,7 +110,7 @@ Item {
horizontalAlignment: TextEdit.AlignHCenter
}
QGCLabel {
text: groundSpeed
text: groundSpeed.toFixed(1)
font.weight: Font.DemiBold
color: isSatellite ? "black" : "white"
}
......@@ -134,7 +134,7 @@ Item {
horizontalAlignment: TextEdit.AlignHCenter
}
QGCLabel {
text: airSpeed
text: airSpeed.toFixed(1)
font.weight: Font.DemiBold
color: isSatellite ? "black" : "white"
}
......@@ -156,7 +156,7 @@ Item {
horizontalAlignment: TextEdit.AlignHCenter
}
QGCLabel {
text: climbRate
text: climbRate.toFixed(1)
font.weight: Font.DemiBold
color: isSatellite ? "black" : "white"
}
......
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
......@@ -26,6 +26,8 @@
#include "QGroundControlQmlGlobal.h"
static const char* kQmlGlobalKeyName = "QGCQml";
QGroundControlQmlGlobal::QGroundControlQmlGlobal(QObject* parent)
: QObject(parent)
, _homePositionManager(HomePositionManager::instance())
......@@ -38,3 +40,31 @@ QGroundControlQmlGlobal::~QGroundControlQmlGlobal()
{
}
void QGroundControlQmlGlobal::saveGlobalSetting (const QString& key, const QString& value)
{
QSettings settings;
settings.beginGroup(kQmlGlobalKeyName);
settings.setValue(key, value);
}
QString QGroundControlQmlGlobal::loadGlobalSetting (const QString& key, const QString& defaultValue)
{
QSettings settings;
settings.beginGroup(kQmlGlobalKeyName);
return settings.value(key, defaultValue).toString();
}
void QGroundControlQmlGlobal::saveBoolGlobalSetting (const QString& key, bool value)
{
QSettings settings;
settings.beginGroup(kQmlGlobalKeyName);
settings.setValue(key, value);
}
bool QGroundControlQmlGlobal::loadBoolGlobalSetting (const QString& key, bool defaultValue)
{
QSettings settings;
settings.beginGroup(kQmlGlobalKeyName);
return settings.value(key, defaultValue).toBool();
}
......@@ -47,6 +47,11 @@ public:
Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss
Q_PROPERTY(qreal zOrderMapItems READ zOrderMapItems CONSTANT) ///< z order value for map items, for example: mission item indicators
Q_INVOKABLE void saveGlobalSetting (const QString& key, const QString& value);
Q_INVOKABLE QString loadGlobalSetting (const QString& key, const QString& defaultValue);
Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value);
Q_INVOKABLE bool loadBoolGlobalSetting (const QString& key, bool defaultValue);
// Property accesors
HomePositionManager* homePositionManager () { return _homePositionManager; }
......
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