From b1fcd835e7cd7244b4f090a8ec0d48e3e18627d5 Mon Sep 17 00:00:00 2001 From: Pierre TILAK Date: Wed, 10 Jul 2019 14:14:18 +1200 Subject: [PATCH] Add Alt Instrument option in Fly View Settings By default the Instrument Panel is the one from master, It can be switched to alternate version by a checkbox in General Settings/Fly View --- src/FlightDisplay/FlightDisplayViewWidgets.qml | 12 +++++++++++- src/Settings/FlyView.SettingsGroup.json | 6 ++++++ src/Settings/FlyViewSettings.cc | 1 + src/Settings/FlyViewSettings.h | 1 + src/ui/preferences/GeneralSettings.qml | 7 +++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/FlightDisplay/FlightDisplayViewWidgets.qml b/src/FlightDisplay/FlightDisplayViewWidgets.qml index f58e2cc67..13b7d54db 100644 --- a/src/FlightDisplay/FlightDisplayViewWidgets.qml +++ b/src/FlightDisplay/FlightDisplayViewWidgets.qml @@ -38,6 +38,7 @@ Item { property bool _airspaceEnabled: QGroundControl.airmapSupported ? QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue : false readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 + readonly property bool _useAlternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.value QGCMapPalette { id: mapPal; lightColors: useLightColors } @@ -74,12 +75,21 @@ Item { break; } } else { - instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml" + if(_useAlternateInstrumentPanel){ + instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml" + } + else{ + instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml" + } } } else { instrumentsLoader.source = "" } } + Connections { + target: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel + onValueChanged: _setInstrumentWidget() + } Connections { target: QGroundControl.settingsManager.appSettings.virtualJoystick diff --git a/src/Settings/FlyView.SettingsGroup.json b/src/Settings/FlyView.SettingsGroup.json index 4e861daa4..794b8fa9f 100644 --- a/src/Settings/FlyView.SettingsGroup.json +++ b/src/Settings/FlyView.SettingsGroup.json @@ -18,5 +18,11 @@ "shortDescription": "Show/Hide Log Replay status bar", "type": "bool", "defaultValue": false +}, +{ + "name": "alternateInstrumentPanel", + "shortDescription": "Use Alternate Instrument Panel instead of the default one", + "type": "bool", + "defaultValue": false } ] diff --git a/src/Settings/FlyViewSettings.cc b/src/Settings/FlyViewSettings.cc index 68ef5dc80..2d3d1f8fa 100644 --- a/src/Settings/FlyViewSettings.cc +++ b/src/Settings/FlyViewSettings.cc @@ -20,3 +20,4 @@ DECLARE_SETTINGGROUP(FlyView, "FlyView") DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) +DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel) diff --git a/src/Settings/FlyViewSettings.h b/src/Settings/FlyViewSettings.h index a6dda7be1..ee12163b2 100644 --- a/src/Settings/FlyViewSettings.h +++ b/src/Settings/FlyViewSettings.h @@ -22,4 +22,5 @@ public: DEFINE_SETTINGFACT(guidedMinimumAltitude) DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(showLogReplayStatusBar) + DEFINE_SETTINGFACT(alternateInstrumentPanel) }; diff --git a/src/ui/preferences/GeneralSettings.qml b/src/ui/preferences/GeneralSettings.qml index add796374..8a07958ce 100644 --- a/src/ui/preferences/GeneralSettings.qml +++ b/src/ui/preferences/GeneralSettings.qml @@ -461,6 +461,13 @@ Rectangle { property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized } + FactCheckBox { + text: qsTr("Use Alternate Instrument Panel") + visible: _alternateInstrumentPanel.visible + fact: _alternateInstrumentPanel + + property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel + } GridLayout { columns: 2 -- 2.22.0