diff --git a/src/FlightMap/Widgets/QGCCompassWidget.qml b/src/FlightMap/Widgets/QGCCompassWidget.qml index f5725662a26120594bbc33fded8eb97517813689..d3036a034f7e199358c4977a1c094800596f92ad 100644 --- a/src/FlightMap/Widgets/QGCCompassWidget.qml +++ b/src/FlightMap/Widgets/QGCCompassWidget.qml @@ -17,10 +17,11 @@ import QtQuick 2.3 import QtGraphicalEffects 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Vehicle 1.0 -import QGroundControl.Palette 1.0 +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Vehicle 1.0 +import QGroundControl.Palette 1.0 Item { id: root @@ -37,6 +38,9 @@ Item { property real _headingToHome: vehicle ? vehicle.headingToHome.rawValue : 0 property real _courseOverGround:activeVehicle ? activeVehicle.gps.courseOverGround.rawValue : 0 + readonly property bool _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass.value + readonly property bool _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass.value + QGCPalette { id: qgcPal; colorGroupEnabled: enabled } @@ -67,11 +71,12 @@ Item { Image { id: homePointer width: size * 0.1 - source: "/qmlimages/Home.svg" + source: _showHomeHeadingCompass ? "/qmlimages/Home.svg" : "" mipmap: true fillMode: Image.PreserveAspectFit anchors.centerIn: parent sourceSize.width: width + visible: _showHomeHeadingCompass transform: Translate { x: size/2.3 * Math.sin((-_heading + _headingToHome)*(3.14/180)) @@ -95,17 +100,21 @@ Item { } Image { - function f(){ - console.log(_heading -_courseOverGround) - } - property double test: f() id: cOGPointer - source: "/qmlimages/attitudePointer.svg" + source: _showCOGAngleCompass ? "/qmlimages/attitudePointer.svg" : "" mipmap: true fillMode: Image.PreserveAspectFit anchors.fill: parent sourceSize.height: parent.height + onVisibleChanged: { + if (visible) + console.log("is being displayed") + else + console.log("is being hidden") + } + + transform: Rotation { origin.x: cOGPointer.width / 2 origin.y: cOGPointer.height / 2 diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json index ec456ebdfa7b3483f2868f1f51165b5d54d8cb23..cc755ba7c45cb1189567294a4d6a7c74eb6b7da4 100644 --- a/src/Settings/FlyView.SettingsGroup.json +++ b/src/Settings/FlyView.SettingsGroup.json @@ -24,5 +24,17 @@ "shortDescription": "Use Vertical Instrument Panel instead of the default one", "type": "bool", "defaultValue": false +}, +{ + "name": "showHomeHeadingCompass", + "shortDescription": "Show/Hide Home heading on the Compass", + "type": "bool", + "defaultValue": false +}, +{ + "name": "showCOGAngleCompass", + "shortDescription": "Show/Hide Course Over Ground angle on the Compass", + "type": "bool", + "defaultValue": false } ] diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc index 2d3d1f8fa2d723d9b2aa7b0e2530bb0e4558f118..39e32b7fb1dfc2087fcdcf677ef96587a6fcd640 100644 --- a/src/Settings/FlyViewSettings.cc +++ b/src/Settings/FlyViewSettings.cc @@ -21,3 +21,5 @@ DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) +DECLARE_SETTINGSFACT(FlyViewSettings, showHomeHeadingCompass) +DECLARE_SETTINGSFACT(FlyViewSettings, showCOGAngleCompass) diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h index ee12163b25d8949299fcffb5b5ec4958eec37e91..09956aa5cb261ac033c1dfc22faafaf47d6e61a2 100644 --- a/src/Settings/FlyViewSettings.h +++ b/src/Settings/FlyViewSettings.h @@ -23,4 +23,6 @@ public: DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(alternateInstrumentPanel) + DEFINE_SETTINGFACT(showHomeHeadingCompass) + DEFINE_SETTINGFACT(showCOGAngleCompass) }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index eda8d14c37ae8d21597b8471d215073bc6add64f..1fdd4fd0609e9bfcf8e07c4920233f86a40ba395 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -475,6 +475,21 @@ Rectangle { property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel } + FactCheckBox { + text: qsTr("Show/Hide Home heading on the Compass") + visible: _showHomeHeadingCompass.visible + fact: _showHomeHeadingCompass + + property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass + } + FactCheckBox { + text: qsTr("Show/Hide Course Over Ground angle on the Compass") + visible: _showCOGAngleCompass.visible + fact: _showCOGAngleCompass + + property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass + } + GridLayout { columns: 2