Browse Source

Rework to use standard instrument values display

QGC4.4
DonLakeFlyer 4 years ago committed by Lorenz Meier
parent
commit
4614924e01
  1. 3
      custom-example/custom.qrc
  2. 8
      custom-example/qgroundcontrol.qrc
  3. 278
      custom-example/res/CustomFlyViewOverlay.qml

3
custom-example/custom.qrc

@ -1,7 +1,4 @@ @@ -1,7 +1,4 @@
<RCC>
<qresource prefix="/custom">
<file alias="CustomFlyViewOverlay.qml">res/CustomFlyViewOverlay.qml</file>
</qresource>
<qresource prefix="custom/img">
<file alias="altitude.svg">res/Images/altitude.svg</file>
<file alias="attitude_crosshair.svg">res/Images/attitude_crosshair.svg</file>

8
custom-example/qgroundcontrol.qrc

@ -116,6 +116,7 @@ @@ -116,6 +116,7 @@
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">../src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/MultiRotorMotorDisplay.qml">../src/QmlControls/MultiRotorMotorDisplay.qml</file>
<file alias="QGroundControl/Controls/OfflineMapButton.qml">../src/QmlControls/OfflineMapButton.qml</file>
<file alias="QGroundControl/Controls/ParameterDiffDialog.qml">../src/QmlControls/ParameterDiffDialog.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">../src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">../src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">../src/QmlControls/PIDTuning.qml</file>
@ -133,7 +134,6 @@ @@ -133,7 +134,6 @@
<file alias="QGroundControl/Controls/QGCFlickableHorizontalIndicator.qml">../src/QmlControls/QGCFlickableHorizontalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">../src/QmlControls/QGCFlickableVerticalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCGroupBox.qml">../src/QmlControls/QGCGroupBox.qml</file>
<file alias="QGroundControl/Controls/QGCHoverButton.qml">../src/QmlControls/QGCHoverButton.qml</file>
<file alias="QGroundControl/Controls/QGCLabel.qml">../src/QmlControls/QGCLabel.qml</file>
<file alias="QGroundControl/Controls/QGCListView.qml">../src/QmlControls/QGCListView.qml</file>
<file alias="QGroundControl/Controls/QGCMapCircleVisuals.qml">../src/MissionManager/QGCMapCircleVisuals.qml</file>
@ -178,6 +178,7 @@ @@ -178,6 +178,7 @@
<file alias="QGroundControl/Controls/TerrainStatus.qml">../src/PlanView/TerrainStatus.qml</file>
<file alias="QGroundControl/Controls/TakeoffItemMapVisual.qml">../src/PlanView/TakeoffItemMapVisual.qml</file>
<file alias="QGroundControl/Controls/ToolStrip.qml">../src/QmlControls/ToolStrip.qml</file>
<file alias="QGroundControl/Controls/ToolStripHoverButton.qml">../src/QmlControls/ToolStripHoverButton.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemStats.qml">../src/PlanView/TransectStyleComplexItemStats.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTabBar.qml">../src/PlanView/TransectStyleComplexItemTabBar.qml</file>
<file alias="QGroundControl/Controls/TransectStyleComplexItemTerrainFollow.qml">../src/PlanView/TransectStyleComplexItemTerrainFollow.qml</file>
@ -225,6 +226,8 @@ @@ -225,6 +226,8 @@
<file alias="QGroundControl/FlightDisplay/PreFlightSensorsHealthCheck.qml">../src/FlightDisplay/PreFlightSensorsHealthCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightSoundCheck.qml">../src/FlightDisplay/PreFlightSoundCheck.qml</file>
<file alias="QGroundControl/FlightDisplay/PreFlightCheckListShowAction.qml">../src/FlightDisplay/PreFlightCheckListShowAction.qml</file>
<file alias="QGroundControl/FlightDisplay/ProximityRadarValues.qml">../src/FlightDisplay/ProximityRadarValues.qml</file>
<file alias="QGroundControl/FlightDisplay/ProximityRadarVideoView.qml">../src/FlightDisplay/ProximityRadarVideoView.qml</file>
<file alias="QGroundControl/FlightDisplay/TerrainProgress.qml">../src/FlightDisplay/TerrainProgress.qml</file>
<file alias="QGroundControl/FlightDisplay/TelemetryValuesBar.qml">../src/FlightDisplay/TelemetryValuesBar.qml</file>
<file alias="QGroundControl/FlightDisplay/VehicleWarnings.qml">../src/FlightDisplay/VehicleWarnings.qml</file>
@ -244,6 +247,7 @@ @@ -244,6 +247,7 @@
<file alias="QGroundControl/FlightMap/PhotoVideoControl.qml">../src/FlightMap/Widgets/PhotoVideoControl.qml</file>
<file alias="QGroundControl/FlightMap/PlanMapItems.qml">../src/FlightMap/MapItems/PlanMapItems.qml</file>
<file alias="QGroundControl/FlightMap/PolygonEditor.qml">../src/FlightMap/MapItems/PolygonEditor.qml</file>
<file alias="QGroundControl/FlightMap/ProximityRadarMapView.qml">../src/FlightMap/MapItems/ProximityRadarMapView.qml</file>
<file alias="QGroundControl/FlightMap/QGCArtificialHorizon.qml">../src/FlightMap/Widgets/QGCArtificialHorizon.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeHUD.qml">../src/FlightMap/Widgets/QGCAttitudeHUD.qml</file>
<file alias="QGroundControl/FlightMap/QGCAttitudeWidget.qml">../src/FlightMap/Widgets/QGCAttitudeWidget.qml</file>
@ -271,8 +275,6 @@ @@ -271,8 +275,6 @@
<file alias="VibrationPage.qml">../src/AnalyzeView/VibrationPage.qml</file>
<file alias="VirtualJoystick.qml">../src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="VTOLLandingPatternEditor.qml">../src/PlanView/VTOLLandingPatternEditor.qml</file>
<file alias="QGroundControl/FlightMap/ProximityRadarMapView.qml">../src/FlightMap/MapItems/ProximityRadarMapView.qml</file>
<file alias="QGroundControl/FlightDisplay/ProximityRadarVideoView.qml">../src/FlightDisplay/ProximityRadarVideoView.qml</file>
</qresource>
<qresource prefix="/FirstRunPromptDialogs">
<file alias="UnitsFirstRunPrompt.qml">../src/FirstRunPromptDialogs/UnitsFirstRunPrompt.qml</file>

278
custom-example/res/CustomFlyViewOverlay.qml

@ -56,8 +56,7 @@ Item { @@ -56,8 +56,7 @@ Item {
QGCToolInsets {
id: _totalToolInsets
topEdgeCenterInset: compassArrowIndicator.y + compassArrowIndicator.height
bottomEdgeRightInset: parent.height - vehicleIndicator.y
bottomEdgeCenterInset: bottomEdgeRightInset
rightEdgeBottomInset: parent.width - compassBackground.x
}
//-------------------------------------------------------------------------
@ -129,233 +128,96 @@ Item { @@ -129,233 +128,96 @@ Item {
anchors.topMargin: -height / 2
anchors.horizontalCenter: parent.horizontalCenter
}
//-------------------------------------------------------------------------
//-- Vehicle Indicator
Rectangle {
id: vehicleIndicator
color: qgcPal.window
width: vehicleStatusGrid.width + (ScreenTools.defaultFontPixelWidth * 3)
height: vehicleStatusGrid.height + (ScreenTools.defaultFontPixelHeight * 1.5)
radius: 2
//anchors.bottomMargin: parentToolInsets.bottomEdgeRightInset
anchors.bottom: parent.bottom
anchors.bottomMargin: _toolsMargin
id: compassBackground
anchors.bottom: attitudeIndicator.bottom
anchors.right: attitudeIndicator.left
anchors.rightMargin: -ScreenTools.defaultFontPixelWidth
anchors.rightMargin: -attitudeIndicator.width / 2
width: -anchors.rightMargin + compassBezel.width + (_toolsMargin * 2)
height: attitudeIndicator.height * 0.75
radius: 2
color: qgcPal.window
GridLayout {
id: vehicleStatusGrid
columnSpacing: ScreenTools.defaultFontPixelWidth * 1.5
rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5
columns: 7
anchors.centerIn: parent
Rectangle {
id: compassBezel
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: _toolsMargin
anchors.left: parent.left
width: height
height: parent.height - (northLabelBackground.height / 2) - (headingLabelBackground.height / 2)
radius: height / 2
border.color: qgcPal.text
border.width: 1
color: Qt.rgba(0,0,0,0)
}
//-- Compass
Item {
Layout.rowSpan: 3
Layout.column: 6
Layout.minimumWidth: parent.height * 1.25
Layout.fillHeight: true
Layout.fillWidth: true
//-- Large circle
Rectangle {
height: parent.height
width: height
radius: height * 0.5
border.color: qgcPal.text
border.width: 1
color: Qt.rgba(0,0,0,0)
anchors.centerIn: parent
}
//-- North Label
Rectangle {
height: ScreenTools.defaultFontPixelHeight * 0.75
width: ScreenTools.defaultFontPixelWidth * 2
radius: ScreenTools.defaultFontPixelWidth * 0.25
color: qgcPal.windowShade
anchors.top: parent.top
anchors.topMargin: ScreenTools.defaultFontPixelHeight * -0.25
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
text: "N"
color: qgcPal.text
font.pointSize: ScreenTools.smallFontPointSize
anchors.centerIn: parent
}
}
//-- Needle
Image {
id: compassNeedle
anchors.centerIn: parent
height: parent.height * 0.75
width: height
source: "/custom/img/compass_needle.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
transform: [
Rotation {
origin.x: compassNeedle.width / 2
origin.y: compassNeedle.height / 2
angle: _heading
}]
}
//-- Heading
Rectangle {
height: ScreenTools.defaultFontPixelHeight * 0.75
width: ScreenTools.defaultFontPixelWidth * 3.5
radius: ScreenTools.defaultFontPixelWidth * 0.25
color: qgcPal.windowShade
anchors.bottom: parent.bottom
anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * -0.25
anchors.horizontalCenter: parent.horizontalCenter
QGCLabel {
text: _heading
color: qgcPal.text
font.pointSize: ScreenTools.smallFontPointSize
anchors.centerIn: parent
}
}
}
//-- Second Row
//-- Chronometer
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/chronometer.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
QGCLabel {
id: firstLabel
text: {
if(_activeVehicle)
return secondsToHHMMSS(_activeVehicle.getFact("flightTime").value)
return "00:00:00"
}
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: Text.AlignLeft
}
//-- Ground Speed
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/horizontal_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
QGCLabel {
text: _activeVehicle ? _activeVehicle.groundSpeed.value.toFixed(1) + ' ' + _activeVehicle.groundSpeed.units : "0.0"
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Vertical Speed
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/vertical_speed.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
Rectangle {
id: northLabelBackground
anchors.top: compassBezel.top
anchors.topMargin: -height / 2
anchors.horizontalCenter: compassBezel.horizontalCenter
width: northLabel.contentWidth * 1.5
height: northLabel.contentHeight * 1.5
radius: ScreenTools.defaultFontPixelWidth * 0.25
color: qgcPal.windowShade
}
QGCLabel {
text: _activeVehicle ? _activeVehicle.climbRate.value.toFixed(1) + ' ' + _activeVehicle.climbRate.units : "0.0"
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
id: northLabel
anchors.centerIn: parent
text: "N"
color: qgcPal.text
font.pointSize: ScreenTools.smallFontPointSize
}
//-- Third Row
//-- Odometer
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/odometer.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
}
}
QGCLabel {
text: _activeVehicle ? ('00000' + _activeVehicle.flightDistance.value.toFixed(0)).slice(-5) + ' ' + _activeVehicle.flightDistance.units : "00000"
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Altitude
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/altitude.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
Image {
id: headingNeedle
anchors.centerIn: compassBezel
height: compassBezel.height * 0.75
width: height
source: "/custom/img/compass_needle.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
transform: [
Rotation {
origin.x: headingNeedle.width / 2
origin.y: headingNeedle.height / 2
angle: _heading
}]
}
}
QGCLabel {
text: _altitude
color: _indicatorsColor
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
}
//-- Distance
QGCColoredImage {
height: _indicatorsHeight
width: height
source: "/custom/img/distance.svg"
fillMode: Image.PreserveAspectFit
sourceSize.height: height
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
color: qgcPal.text
Rectangle {
id: headingLabelBackground
anchors.top: compassBezel.bottom
anchors.topMargin: -height / 2
anchors.horizontalCenter: compassBezel.horizontalCenter
width: headingLabel.contentWidth * 1.5
height: headingLabel.contentHeight * 1.5
radius: ScreenTools.defaultFontPixelWidth * 0.25
color: qgcPal.windowShade
}
QGCLabel {
text: _distance ? _distanceStr : noGPS
color: _distance ? _indicatorsColor : qgcPal.colorOrange
font.pointSize: ScreenTools.smallFontPointSize
Layout.fillWidth: true
Layout.minimumWidth: indicatorValueWidth
horizontalAlignment: firstLabel.horizontalAlignment
id: headingLabel
anchors.centerIn: parent
text: _heading
color: qgcPal.text
font.pointSize: ScreenTools.smallFontPointSize
}
}
}
//-------------------------------------------------------------------------
//-- Attitude Indicator
Rectangle {
color: qgcPal.window
width: attitudeIndicator.width * 0.5
height: vehicleIndicator.height
anchors.top: vehicleIndicator.top
anchors.left: vehicleIndicator.right
}
Rectangle {
id: attitudeIndicator
anchors.bottom: vehicleIndicator.bottom
anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * -0.5
anchors.right: parent.right
anchors.bottomMargin: _toolsMargin
anchors.rightMargin: _toolsMargin
anchors.bottom: parent.bottom
anchors.right: parent.right
height: ScreenTools.defaultFontPixelHeight * 6
width: height
radius: height * 0.5
color: qgcPal.windowShade
CustomAttitudeWidget {
size: parent.height * 0.95
vehicle: _activeVehicle

Loading…
Cancel
Save