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/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index eb3dae40e4468790210287fb03713b23ded68f15..d2d9a9a5353538e91047edcbc7e60d1d5983bef5 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -76,16 +76,20 @@ Item { //-- Instrument Pannel QGCInstrumentWidget { - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.bottom: parent.bottom - anchors.right: parent.right - size: ScreenTools.defaultFontPixelSize * (9) - active: _activeVehicle != null - heading: _heading - rollAngle: _roll - pitchAngle: _pitch - isSatellite: _mainIsMap ? _flightMap ? _flightMap.isSatelliteMap : true : true - z: QGroundControl.zOrderWidgets + anchors.margins: ScreenTools.defaultFontPixelHeight + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + size: ScreenTools.defaultFontPixelSize * (9) + active: _activeVehicle != null + heading: _heading + rollAngle: _roll + pitchAngle: _pitch + altitude: _altitudeWGS84 + groundSpeed: _groundSpeed + airSpeed: _airSpeed + climbRate: _climbRate + isSatellite: _mainIsMap ? _flightMap ? _flightMap.isSatelliteMap : true : true + z: QGroundControl.zOrderWidgets } //-- Vertical Tool Buttons @@ -93,7 +97,7 @@ Item { id: toolColumn anchors.margins: ScreenTools.defaultFontPixelHeight anchors.left: parent.left - anchors.top: parent.top + anchors.verticalCenter: parent.verticalCenter spacing: ScreenTools.defaultFontPixelHeight //-- Map Center Control diff --git a/src/FlightMap/Images/compassInstrumentDial.svg b/src/FlightMap/Images/compassInstrumentDial.svg index f265280b1905c2387d805fbf0ed70ed2a6efe3b5..dbef2e037655829e23c5484eefd2e2345e11f7e7 100644 --- a/src/FlightMap/Images/compassInstrumentDial.svg +++ b/src/FlightMap/Images/compassInstrumentDial.svg @@ -1,84 +1,87 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + viewBox="-161 253 288 288" enable-background="new -161 253 288 288" xml:space="preserve"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - - + + + + diff --git a/src/FlightMap/Widgets/QGCCompassWidget.qml b/src/FlightMap/Widgets/QGCCompassWidget.qml index 251acc94342aa3c8af734cbfdcb6653c511624bf..28fc249b54181e6d9b680db5d10f77b3f80f6e04 100644 --- a/src/FlightMap/Widgets/QGCCompassWidget.qml +++ b/src/FlightMap/Widgets/QGCCompassWidget.qml @@ -49,9 +49,7 @@ Item { id: borderRect anchors.fill: parent radius: width / 2 - color: "#202020" - border.color: "black" - border.width: 2 + color: "black" } Item { diff --git a/src/FlightMap/Widgets/QGCInstrumentWidget.qml b/src/FlightMap/Widgets/QGCInstrumentWidget.qml index c7d3bc263bda7f4d01dcddfb4a6d3030251c40b4..329dfd7061bf383884154d77a58b081892b58f34 100644 --- a/src/FlightMap/Widgets/QGCInstrumentWidget.qml +++ b/src/FlightMap/Widgets/QGCInstrumentWidget.qml @@ -39,7 +39,10 @@ Item { property alias heading: compass.heading property alias rollAngle: attitude.rollAngle property alias pitchAngle: attitude.pitchAngle - + property real altitude: 0 + property real groundSpeed: 0 + property real airSpeed: 0 + property real climbRate: 0 property real size: ScreenTools.defaultFontPixelSize * (10) property bool isSatellite: false property bool active: false @@ -48,30 +51,144 @@ Item { //-- Instrument Pannel Rectangle { - id: instrumentPannel - anchors.right: parent.right - anchors.bottom: parent.bottom - height: root.size - width: instruments.width + ScreenTools.defaultFontPixelSize - radius: root.size / 2 - visible: _isVisible - color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) - Row { + id: instrumentPannel + height: instruments.height + ScreenTools.defaultFontPixelSize + width: root.size + radius: root.size / 2 + visible: _isVisible + color: isSatellite ? Qt.rgba(1,1,1,0.75) : Qt.rgba(0,0,0,0.75) + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + Column { id: instruments - height: parent.height - spacing: ScreenTools.defaultFontPixelSize / 2 - anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + spacing: ScreenTools.defaultFontPixelSize * 0.33 + anchors.verticalCenter: parent.verticalCenter + //-- Attitude Indicator QGCAttitudeWidget { id: attitude - size: parent.height * 0.9 + size: parent.width * 0.9 active: root.active - anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + //-- Altitude + Rectangle { + height: 1 + width: parent.width * 0.9 + color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) + anchors.horizontalCenter: parent.horizontalCenter + } + Row { + width: root.size * 0.8 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: "H" + font.pixelSize: ScreenTools.defaultFontPixelSize * 1.25 + width: parent.width * 0.45 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + QGCLabel { + text: altitude.toFixed(1) + font.pixelSize: ScreenTools.defaultFontPixelSize * 1.25 + font.weight: Font.DemiBold + width: parent.width * 0.549 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + } + //-- Ground Speed + Rectangle { + height: 1 + width: parent.width * 0.9 + color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) + anchors.horizontalCenter: parent.horizontalCenter + } + Row { + width: root.size * 0.8 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: "GS" + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + width: parent.width * 0.45 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + QGCLabel { + text: groundSpeed.toFixed(1) + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + font.weight: Font.DemiBold + width: parent.width * 0.549 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + } + //-- Air Speed + Rectangle { + height: 1 + width: parent.width * 0.9 + color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) + anchors.horizontalCenter: parent.horizontalCenter + visible: airSpeed > 0 + } + Row { + width: root.size * 0.8 + anchors.horizontalCenter: parent.horizontalCenter + visible: airSpeed > 0 + QGCLabel { + text: "AS" + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + width: parent.width * 0.45 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + QGCLabel { + text: airSpeed.toFixed(1) + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + font.weight: Font.DemiBold + width: parent.width * 0.549 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + } + //-- Climb Rate + Rectangle { + height: 1 + width: parent.width * 0.9 + color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) + anchors.horizontalCenter: parent.horizontalCenter + } + Row { + width: root.size * 0.8 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: "VS" + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + width: parent.width * 0.45 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + QGCLabel { + text: climbRate.toFixed(1) + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.75 + font.weight: Font.DemiBold + width: parent.width * 0.549 + color: isSatellite ? "black" : "white" + horizontalAlignment: TextEdit.AlignHCenter + } + } + //-- Compass + Rectangle { + height: 1 + width: parent.width * 0.9 + color: isSatellite ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) + anchors.horizontalCenter: parent.horizontalCenter } QGCCompassWidget { id: compass - size: parent.height * 0.9 + size: parent.width * 0.9 active: root.active - anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter } } MouseArea { @@ -84,14 +201,14 @@ Item { //-- Show Instruments Rectangle { - id: openButton - anchors.right: parent.right - anchors.bottom: parent.bottom - height: ScreenTools.defaultFontPixelSize * 2 - width: ScreenTools.defaultFontPixelSize * 2 - radius: ScreenTools.defaultFontPixelSize / 3 - visible: !_isVisible - color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) + id: openButton + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + height: ScreenTools.defaultFontPixelSize * 2 + width: ScreenTools.defaultFontPixelSize * 2 + radius: ScreenTools.defaultFontPixelSize / 3 + visible: !_isVisible + color: isSatellite ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) Image { width: parent.width * 0.75 height: parent.height * 0.75 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; }