Commit 2c303d69 authored by Pierre TILAK's avatar Pierre TILAK

Put new InstrumentWidget in QGCInstrumentWidget

- Rename QGCInstrumentWidgetAlternate to QGCInstrumentWidget as it's now the default version
- Select  QGCInstrumentWidget as instrumentLoader source
parent 3e4843f6
......@@ -74,7 +74,7 @@ Item {
break;
}
} else {
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidgetAlternate.qml"
instrumentsLoader.source = "qrc:/qml/QGCInstrumentWidget.qml"
}
} else {
instrumentsLoader.source = ""
......
......@@ -7,6 +7,7 @@
*
****************************************************************************/
import QtQuick 2.3
import QGroundControl 1.0
......@@ -17,157 +18,74 @@ import QGroundControl.FlightMap 1.0
import QGroundControl.Palette 1.0
Rectangle {
id: instrumentPanel
height: instrumentColumn.height + (_topBottomMargin * 2)
id: root
width: getPreferredInstrumentWidth()
radius: _showLargeCompass ? width / 2 : ScreenTools.defaultFontPixelWidth / 2
color: _backgroundColor
border.width: _showLargeCompass ? 1 : 0
height: _outerRadius * 2
radius: _outerRadius
color: qgcPal.window
border.width: 1
border.color: _isSatellite ? qgcPal.mapWidgetBorderLight : qgcPal.mapWidgetBorderDark
property real _maxHeight: maxHeight
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property color _backgroundColor: qgcPal.window
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: _maxHeight - (outerCompass.height + _spacer1.height + _spacer2.height + (_spacing * 4)) - (_showLargeCompass ? compass.height : 0)
property bool _showLargeCompass: QGroundControl.settingsManager.appSettings.showLargeCompass.value
readonly property real _outerRingRatio: 0.95
readonly property real _innerRingRatio: 0.80
QGCPalette { id: qgcPal }
MouseArea {
property real _innerRadius: (width - (_topBottomMargin * 3)) / 4
property real _outerRadius: _innerRadius + _topBottomMargin
property real _defaultSize: ScreenTools.defaultFontPixelHeight * (9)
property real _sizeRatio: ScreenTools.isTinyScreen ? (width / _defaultSize) * 0.5 : width / _defaultSize
property real _bigFontSize: ScreenTools.defaultFontPointSize * 2.5 * _sizeRatio
property real _normalFontSize: ScreenTools.defaultFontPointSize * 1.5 * _sizeRatio
property real _labelFontSize: ScreenTools.defaultFontPointSize * 0.75 * _sizeRatio
property real _spacing: ScreenTools.defaultFontPixelHeight * 0.33
property real _topBottomMargin: (width * 0.05) / 2
property real _availableValueHeight: maxHeight - (root.height + _valuesItem.anchors.topMargin)
// Prevent all clicks from going through to lower layers
DeadMouseArea {
anchors.fill: parent
onClicked: _valuesWidget.showPicker()
}
Column {
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
}
QGCPalette { id: qgcPal }
Item {
width: parent.width
height: _valuesWidget.height
QGCAttitudeWidget {
id: attitude
anchors.leftMargin: _topBottomMargin
anchors.left: parent.left
size: _innerRadius * 2
vehicle: activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
Rectangle {
anchors.fill: _valuesWidget
color: _backgroundColor
radius: _spacing
visible: !_showLargeCompass
}
QGCCompassWidget {
id: compass
anchors.leftMargin: _spacing
anchors.left: attitude.right
size: _innerRadius * 2
vehicle: activeVehicle
anchors.verticalCenter: parent.verticalCenter
}
InstrumentSwipeView {
id: _valuesWidget
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
textColor: qgcPal.text
backgroundColor: _backgroundColor
maxHeight: _availableValueHeight
}
Item {
id: _valuesItem
anchors.topMargin: ScreenTools.defaultFontPixelHeight / 4
anchors.top: parent.bottom
width: parent.width
height: _valuesWidget.height
visible: widgetRoot.showValues
// Prevent all clicks from going through to lower layers
DeadMouseArea {
anchors.fill: parent
}
Rectangle {
id: _spacer2
anchors.horizontalCenter: parent.horizontalCenter
height: 1
width: parent.width * 0.9
color: qgcPal.text
visible: _showLargeCompass
anchors.fill: _valuesWidget
color: qgcPal.window
}
QGCCompassWidget {
id: compass
anchors.horizontalCenter: parent.horizontalCenter
size: parent.width * 0.95
vehicle: activeVehicle
visible: _showLargeCompass
PageView {
id: _valuesWidget
anchors.margins: 1
anchors.left: parent.left
anchors.right: parent.right
maxHeight: _availableValueHeight
}
}
}
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