diff --git a/src/FlightDisplay/FlightDisplayView.qml b/src/FlightDisplay/FlightDisplayView.qml index 0265d175a01a7925029d79c1c441b08045f03309..26efdb2cd9b7520e78f50a061ba02745ce3ed85f 100644 --- a/src/FlightDisplay/FlightDisplayView.qml +++ b/src/FlightDisplay/FlightDisplayView.qml @@ -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) } } } diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index 869094f255a2a8abf3ad0143e5cc4be544eb972a..3e7b83305a0d6c4389f6fd9b25714fe574e0e6f4 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -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" } diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index 8912f375e19db8e1567fc4ef248d9a16f6f50530..a9f26fb1ab2a6c5f39f73276f901205b6a6343ee 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -1,24 +1,24 @@ /*===================================================================== - + QGroundControl Open Source Ground Control Station - + (c) 2009 - 2014 QGROUNDCONTROL PROJECT - + 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 . - + ======================================================================*/ /// @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(); +} diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 3a1260522b287e2447c45142f4a07b9770b70ceb..52655212a3162a206f1a824ef6488336bcfb1659 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -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; }