Unverified Commit 2aa69014 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7574 from Aeronavics/old_widget_layout_as_alternative

Old instrument panel layout as alternative
parents a0df347e 10461de1
...@@ -38,6 +38,7 @@ Item { ...@@ -38,6 +38,7 @@ Item {
property bool _airspaceEnabled: QGroundControl.airmapSupported ? QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue : false property bool _airspaceEnabled: QGroundControl.airmapSupported ? QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue : false
readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5 readonly property real _margins: ScreenTools.defaultFontPixelHeight * 0.5
readonly property bool _useAlternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel.value
QGCMapPalette { id: mapPal; lightColors: useLightColors } QGCMapPalette { id: mapPal; lightColors: useLightColors }
...@@ -74,12 +75,21 @@ Item { ...@@ -74,12 +75,21 @@ Item {
break; break;
} }
} else { } else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml" if(_useAlternateInstrumentPanel){
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
}
else{
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
}
} }
} else { } else {
instrumentsLoader.source = "" instrumentsLoader.source = ""
} }
} }
Connections {
target: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
onValueChanged: _setInstrumentWidget()
}
Connections { Connections {
target: QGroundControl.settingsManager.appSettings.virtualJoystick target: QGroundControl.settingsManager.appSettings.virtualJoystick
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* *
****************************************************************************/ ****************************************************************************/
import QtQuick 2.3 import QtQuick 2.3
import QGroundControl 1.0 import QGroundControl 1.0
...@@ -17,157 +18,74 @@ import QGroundControl.FlightMap 1.0 ...@@ -17,157 +18,74 @@ import QGroundControl.FlightMap 1.0
import QGroundControl.Palette 1.0 import QGroundControl.Palette 1.0
Rectangle { Rectangle {
id: instrumentPanel id: root
height: instrumentColumn.height + (_topBottomMargin * 2)
width: getPreferredInstrumentWidth() width: getPreferredInstrumentWidth()
radius: _showLargeCompass ? width / 2 : ScreenTools.defaultFontPixelWidth / 2 height: _outerRadius * 2
color: _backgroundColor radius: _outerRadius
border.width: _showLargeCompass ? 1 : 0 color: qgcPal.window
border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property real _maxHeight: maxHeight property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9) property real _outerRadius: _innerRadius + _topBottomMargin
property color _backgroundColor: qgcPal.window property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33 property real _sizeRatio: ScreenTools.isTinyScreen ? (width / _defaultSize) * 0.5 : width / _defaultSize
property real _topBottomMargin: (width * 0.05) / 2 property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio
property real _availableValueHeight: _maxHeight - (outerCompass.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showLargeCompass ? compass.height : 0) property real _normalFontSize: ScreenTools.defaultFontPointSize * 1.5 * _sizeRatio
property bool _showLargeCompass: QGroundControl.settingsManager.appSettings.showLargeCompass.value property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
readonly property real _outerRingRatio: 0.95 property real _topBottomMargin: (width * 0.05) / 2
readonly property real _innerRingRatio: 0.80 property real _availableValueHeight: maxHeight - (root.height + _valuesItem.anchors.topMargin)
QGCPalette { id: qgcPal } // Prevent all clicks from going through to lower layers
DeadMouseArea {
MouseArea {
anchors.fill: parent anchors.fill: parent
onClicked: _valuesWidget.showPicker()
} }
Column { QGCPalette { id: qgcPal }
id: instrumentColumn
anchors.topMargin: _topBottomMargin
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
spacing: _spacing
Item {
width: parent.width
height: outerCompass.height
CompassRing {
id: outerCompass
size: parent.width * _outerRingRatio
vehicle: activeVehicle
anchors.horizontalCenter: parent.horizontalCenter
visible: !_showLargeCompass
}
QGCAttitudeWidget {
id: attitudeWidget
size: parent.width * (_showLargeCompass ? _outerRingRatio : _innerRingRatio)
vehicle: activeVehicle
anchors.centerIn: outerCompass
showHeading: !_showLargeCompass
}
Image {
id: gearThingy
anchors.bottom: outerCompass.bottom
anchors.right: outerCompass.right
source: qgcPal.globalTheme == QGCPalette.Light ? "/res/gear-black.svg" : "/res/gear-white.svg"
mipmap: true
opacity: 0.5
width: outerCompass.width * 0.15
sourceSize.width: width
fillMode: Image.PreserveAspectFit
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: gearThingy.opacity = 0.85
onExited: gearThingy.opacity = 0.5
onClicked: _valuesWidget.showPicker()
}
}
Image {
id: healthWarning
anchors.bottom: outerCompass.bottom
anchors.left: outerCompass.left
source: "/qmlimages/Yield.svg"
mipmap: true
visible: activeVehicle ? !_warningsViewed && activeVehicle.unhealthySensors.length > 0 && _valuesWidget.currentPage() != 2 : false
opacity: 0.8
width: outerCompass.width * 0.15
sourceSize.width: width
fillMode: Image.PreserveAspectFit
property bool _warningsViewed: false
MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: healthWarning.opacity = 1
onExited: healthWarning.opacity = 0.8
onClicked: {
_valuesWidget.showPage(2)
healthWarning._warningsViewed = true
}
}
Connections {
target: activeVehicle
onUnhealthySensorsChanged: healthWarning._warningsViewed = false
}
}
}
Rectangle {
id: _spacer1
anchors.horizontalCenter: parent.horizontalCenter
height: 1
width: parent.width * 0.9
color: qgcPal.text
}
Item { QGCAttitudeWidget {
width: parent.width id: attitude
height: _valuesWidget.height anchors.leftMargin: _topBottomMargin
anchors.left: parent.left
size: _innerRadius * 2
vehicle: activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
Rectangle { QGCCompassWidget {
anchors.fill: _valuesWidget id: compass
color: _backgroundColor anchors.leftMargin: _spacing
radius: _spacing anchors.left: attitude.right
visible: !_showLargeCompass size: _innerRadius * 2
} vehicle: activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
InstrumentSwipeView { Item {
id: _valuesWidget id: _valuesItem
anchors.margins: 1 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.left: parent.left anchors.top: parent.bottom
anchors.right: parent.right width: parent.width
textColor: qgcPal.text height: _valuesWidget.height
backgroundColor: _backgroundColor visible: widgetRoot.showValues
maxHeight: _availableValueHeight
} // Prevent all clicks from going through to lower layers
DeadMouseArea {
anchors.fill: parent
} }
Rectangle { Rectangle {
id: _spacer2 anchors.fill: _valuesWidget
anchors.horizontalCenter: parent.horizontalCenter color: qgcPal.window
height: 1
width: parent.width * 0.9
color: qgcPal.text
visible: _showLargeCompass
} }
QGCCompassWidget { PageView {
id: compass id: _valuesWidget
anchors.horizontalCenter: parent.horizontalCenter anchors.margins: 1
size: parent.width * 0.95 anchors.left: parent.left
vehicle: activeVehicle anchors.right: parent.right
visible: _showLargeCompass maxHeight: _availableValueHeight
} }
} }
} }
...@@ -19,15 +19,15 @@ import QGroundControl.Palette 1.0 ...@@ -19,15 +19,15 @@ import QGroundControl.Palette 1.0
Rectangle { Rectangle {
id: root id: root
width: getPreferredInstrumentWidth() width: getPreferredInstrumentWidth() * 0.7
height: _outerRadius * 2 height: _outerRadius * 4 + _valuesWidget.height
radius: _outerRadius radius: _outerRadius
color: qgcPal.window color: qgcPal.window
border.width: 1 border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property real _innerRadius: (width - (_topBottomMargin * 3)) / 4 property real _innerRadius: (width - (_topBottomMargin * 2)) / 2
property real _outerRadius: _innerRadius + _topBottomMargin property real _outerRadius: _innerRadius + _topBottomMargin * 2
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9) property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property real _sizeRatio: ScreenTools.isTinyScreen ? (width / _defaultSize) * 0.5 : width / _defaultSize property real _sizeRatio: ScreenTools.isTinyScreen ? (width / _defaultSize) * 0.5 : width / _defaultSize
property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio
...@@ -35,7 +35,7 @@ Rectangle { ...@@ -35,7 +35,7 @@ Rectangle {
property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33 property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
property real _topBottomMargin: (width * 0.05) / 2 property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: maxHeight - (root.height + _valuesItem.anchors.topMargin) property real _availableValueHeight: maxHeight - (attitude.height + compass.height)
// Prevent all clicks from going through to lower layers // Prevent all clicks from going through to lower layers
DeadMouseArea { DeadMouseArea {
...@@ -45,27 +45,21 @@ Rectangle { ...@@ -45,27 +45,21 @@ Rectangle {
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
QGCAttitudeWidget { QGCAttitudeWidget {
id: attitude id: attitude
anchors.leftMargin: _topBottomMargin anchors.topMargin : _topBottomMargin
anchors.left: parent.left anchors.bottomMargin: _topBottomMargin
size: _innerRadius * 2 anchors.top: parent.top
vehicle: activeVehicle size: _innerRadius * 2
anchors.verticalCenter: parent.verticalCenter vehicle: activeVehicle
} anchors.horizontalCenter: parent.horizontalCenter
QGCCompassWidget {
id: compass
anchors.leftMargin: _spacing
anchors.left: attitude.right
size: _innerRadius * 2
vehicle: activeVehicle
anchors.verticalCenter: parent.verticalCenter
} }
Item { Item {
id: _valuesItem id: _valuesItem
anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4 anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.top: parent.bottom anchors.bottomMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.top: attitude.bottom
anchors.bottom: compass.top
width: parent.width width: parent.width
height: _valuesWidget.height height: _valuesWidget.height
visible: widgetRoot.showValues visible: widgetRoot.showValues
...@@ -88,4 +82,14 @@ Rectangle { ...@@ -88,4 +82,14 @@ Rectangle {
maxHeight: _availableValueHeight maxHeight: _availableValueHeight
} }
} }
QGCCompassWidget {
id: compass
anchors.bottom : parent.bottom
anchors.bottomMargin: _topBottomMargin
anchors.topMargin: _topBottomMargin
size: _innerRadius * 2
vehicle: activeVehicle
anchors.horizontalCenter: parent.horizontalCenter
}
} }
...@@ -18,5 +18,11 @@ ...@@ -18,5 +18,11 @@
"shortDescription": "Show/Hide Log Replay status bar", "shortDescription": "Show/Hide Log Replay status bar",
"type": "bool", "type": "bool",
"defaultValue": false "defaultValue": false
},
{
"name": "alternateInstrumentPanel",
"shortDescription": "Use Vertical Instrument Panel instead of the default one",
"type": "bool",
"defaultValue": false
} }
] ]
...@@ -20,3 +20,4 @@ DECLARE_SETTINGGROUP(FlyView, "FlyView") ...@@ -20,3 +20,4 @@ DECLARE_SETTINGGROUP(FlyView, "FlyView")
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMinimumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude) DECLARE_SETTINGSFACT(FlyViewSettings, guidedMaximumAltitude)
DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar) DECLARE_SETTINGSFACT(FlyViewSettings, showLogReplayStatusBar)
DECLARE_SETTINGSFACT(FlyViewSettings, alternateInstrumentPanel)
...@@ -22,4 +22,5 @@ public: ...@@ -22,4 +22,5 @@ public:
DEFINE_SETTINGFACT(guidedMinimumAltitude) DEFINE_SETTINGFACT(guidedMinimumAltitude)
DEFINE_SETTINGFACT(guidedMaximumAltitude) DEFINE_SETTINGFACT(guidedMaximumAltitude)
DEFINE_SETTINGFACT(showLogReplayStatusBar) DEFINE_SETTINGFACT(showLogReplayStatusBar)
DEFINE_SETTINGFACT(alternateInstrumentPanel)
}; };
...@@ -461,6 +461,13 @@ Rectangle { ...@@ -461,6 +461,13 @@ Rectangle {
property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized property Fact _virtualJoystickCentralized: QGroundControl.settingsManager.appSettings.virtualJoystickCentralized
} }
FactCheckBox {
text: qsTr("Use Vertical Instrument Panel")
visible: _alternateInstrumentPanel.visible
fact: _alternateInstrumentPanel
property Fact _alternateInstrumentPanel: QGroundControl.settingsManager.flyViewSettings.alternateInstrumentPanel
}
GridLayout { GridLayout {
columns: 2 columns: 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment