From 701f3da26d1788d222068355348d0c589aed0387 Mon Sep 17 00:00:00 2001 From: Pierre TILAK Date: Fri, 19 Jul 2019 11:16:45 +1200 Subject: [PATCH] Compass Add setting to concatenate indicators - Remove HomeHeading / COG / HeadingToNext - Add setting AdditionalIndicatorsCompass that group the previous settings --- src/FlightMap/Widgets/QGCCompassWidget.qml | 15 ++++++--------- src/Settings/FlyView.SettingsGroup.json | 16 ++-------------- src/Settings/FlyViewSettings.cc | 4 +--- src/Settings/FlyViewSettings.h | 4 +--- src/ui/preferences/GeneralSettings.qml | 22 ++++------------------ 5 files changed, 14 insertions(+), 47 deletions(-) diff --git a/src/FlightMap/Widgets/QGCCompassWidget.qml b/src/FlightMap/Widgets/QGCCompassWidget.qml index d345b949c..c52990d06 100644 --- a/src/FlightMap/Widgets/QGCCompassWidget.qml +++ b/src/FlightMap/Widgets/QGCCompassWidget.qml @@ -41,7 +41,7 @@ Item { property real _courseOverGround:activeVehicle ? activeVehicle.gps.courseOverGround.rawValue : 0 function isCOGAngleOK(){ - if(_groundSpeed < 0.5 && _showCOGAngleCompass){ + if(_groundSpeed < 0.5 && _showAdditionalIndicatorsCompass){ return false } else{ @@ -49,21 +49,19 @@ Item { } } - function isHeadingAngleOK(){ - return vehicle && _showHomeHeadingCompass && !isNaN(_headingToHome) + function isHeadingHomeOK(){ + return vehicle && _showAdditionalIndicatorsCompass && !isNaN(_headingToHome) } function isHeadingToNextWPOK(){ - return vehicle && _showHeadingToNextWP && !isNaN(_headingToNextWP) + return vehicle && _showAdditionalIndicatorsCompass && !isNaN(_headingToNextWP) } function isNorthUpLocked(){ return _lockNorthUpCompass } - readonly property bool _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass.value - readonly property bool _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass.value - readonly property bool _showHeadingToNextWP: QGroundControl.settingsManager.flyViewSettings.showHeadingToNextWP.value + readonly property bool _showAdditionalIndicatorsCompass: QGroundControl.settingsManager.flyViewSettings.showAdditionalIndicatorsCompass.value readonly property bool _lockNorthUpCompass: QGroundControl.settingsManager.flyViewSettings.lockNorthUpCompass.value QGCPalette { id: qgcPal; colorGroupEnabled: enabled } @@ -132,12 +130,11 @@ Item { Image { id: homePointer width: size * 0.1 - source: isHeadingAngleOK() ? "/qmlimages/Home.svg" : "" + source: isHeadingHomeOK() ? "/qmlimages/Home.svg" : "" mipmap: true fillMode: Image.PreserveAspectFit anchors.centerIn: parent sourceSize.width: width - visible: _showHomeHeadingCompass transform: Translate { property double _angle: isNorthUpLocked()?-_heading+_headingToHome:_headingToHome diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json index 139ac3a2d..2b43456d5 100644 --- a/src/Settings/FlyView.SettingsGroup.json +++ b/src/Settings/FlyView.SettingsGroup.json @@ -26,20 +26,8 @@ "defaultValue": false }, { - "name": "showHomeHeadingCompass", - "shortDescription": "Show/Hide Home heading on Compass", - "type": "bool", - "defaultValue": false -}, -{ - "name": "showCOGAngleCompass", - "shortDescription": "Show/Hide Course Over Ground angle on Compass", - "type": "bool", - "defaultValue": false -}, -{ - "name": "showHeadingToNextWP", - "shortDescription": "Show/Hide Heading to Next Waypoint on Compass", + "name": "showAdditionalIndicatorsCompass", + "shortDescription": "Show additional heading indicators on Compass", "type": "bool", "defaultValue": false }, diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc index 4fc63051e..c3ba1a475 100644 --- a/src/Settings/FlyViewSettings.cc +++ b/src/Settings/FlyViewSettings.cc @@ -21,7 +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) -DECLARE_SETTINGSFACT(FlyViewSettings, showHeadingToNextWP) +DECLARE_SETTINGSFACT(FlyViewSettings, showAdditionalIndicatorsCompass) DECLARE_SETTINGSFACT(FlyViewSettings, lockNorthUpCompass) diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h index da979932a..ec24e599e 100644 --- a/src/Settings/FlyViewSettings.h +++ b/src/Settings/FlyViewSettings.h @@ -23,8 +23,6 @@ public: DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(alternateInstrumentPanel) - DEFINE_SETTINGFACT(showHomeHeadingCompass) - DEFINE_SETTINGFACT(showCOGAngleCompass) - DEFINE_SETTINGFACT(showHeadingToNextWP) + DEFINE_SETTINGFACT(showAdditionalIndicatorsCompass) DEFINE_SETTINGFACT(lockNorthUpCompass) }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index 69824022f..4fedfdcd2 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -476,25 +476,11 @@ Rectangle { property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel } FactCheckBox { - text: qsTr("Show/Hide Home heading on Compass") - visible: _showHomeHeadingCompass.visible - fact: _showHomeHeadingCompass + text: qsTr("Show additional heading indicators on Compass") + visible: _showAdditionalIndicatorsCompass.visible + fact: _showAdditionalIndicatorsCompass - property Fact _showHomeHeadingCompass: QGroundControl.settingsManager.flyViewSettings.showHomeHeadingCompass - } - FactCheckBox { - text: qsTr("Show/Hide Course Over Ground angle on Compass") - visible: _showCOGAngleCompass.visible - fact: _showCOGAngleCompass - - property Fact _showCOGAngleCompass: QGroundControl.settingsManager.flyViewSettings.showCOGAngleCompass - } - FactCheckBox { - text: qsTr("Show/Hide Heading to Next Waypoint on Compass") - visible: _showHeadingToNextWP.visible - fact: _showHeadingToNextWP - - property Fact _showHeadingToNextWP: QGroundControl.settingsManager.flyViewSettings.showHeadingToNextWP + property Fact _showAdditionalIndicatorsCompass: QGroundControl.settingsManager.flyViewSettings.showAdditionalIndicatorsCompass } FactCheckBox { text: qsTr("Lock North up on Compass") -- 2.22.0