Browse Source

Fix vibration page bar and count display

QGC4.4
Tzuriel Lampner 3 years ago committed by Ramon Roche
parent
commit
6002ac5b47
  1. 103
      src/AnalyzeView/VibrationPage.qml

103
src/AnalyzeView/VibrationPage.qml

@ -21,7 +21,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
AnalyzePage { AnalyzePage {
id: vibrationPage id: geoTagPage
pageComponent: pageComponent pageComponent: pageComponent
pageDescription: qsTr("Analyze vibration associated with your vehicle.") pageDescription: qsTr("Analyze vibration associated with your vehicle.")
allowPopout: true allowPopout: true
@ -29,7 +29,7 @@ AnalyzePage {
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
property bool _available: !isNaN(_activeVehicle.vibration.xAxis.rawValue) property bool _available: !isNaN(_activeVehicle.vibration.xAxis.rawValue)
property real _margins: ScreenTools.defaultFontPixelWidth / 2 property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _barWidth: ScreenTools.defaultFontPixelWidth * 3 property real _barWidth: ScreenTools.defaultFontPixelWidth * 7
property real _barHeight: ScreenTools.defaultFontPixelHeight * 10 property real _barHeight: ScreenTools.defaultFontPixelHeight * 10
property real _xValue: _activeVehicle.vibration.xAxis.rawValue property real _xValue: _activeVehicle.vibration.xAxis.rawValue
property real _yValue: _activeVehicle.vibration.yAxis.rawValue property real _yValue: _activeVehicle.vibration.yAxis.rawValue
@ -38,6 +38,7 @@ AnalyzePage {
readonly property real _barMinimum: 0.0 readonly property real _barMinimum: 0.0
readonly property real _barMaximum: 90.0 readonly property real _barMaximum: 90.0
readonly property real _barBadValue: 60.0 readonly property real _barBadValue: 60.0
readonly property real _barMidValue: 30.0
QGCPalette { id:qgcPal; colorGroupEnabled: true } QGCPalette { id:qgcPal; colorGroupEnabled: true }
@ -50,7 +51,7 @@ AnalyzePage {
RowLayout { RowLayout {
id: barRow id: barRow
spacing: ScreenTools.defaultFontPixelWidth * 4 spacing: ScreenTools.defaultFontPixelWidth * 2
ColumnLayout { ColumnLayout {
Rectangle { Rectangle {
@ -58,6 +59,7 @@ AnalyzePage {
height: _barHeight height: _barHeight
width: _barWidth width: _barWidth
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
color: "transparent"
border.width: 1 border.width: 1
border.color: qgcPal.text border.color: qgcPal.text
@ -67,19 +69,42 @@ AnalyzePage {
height: parent.height * (Math.min(_barMaximum, _xValue) / (_barMaximum - _barMinimum)) height: parent.height * (Math.min(_barMaximum, _xValue) / (_barMaximum - _barMinimum))
color: qgcPal.text color: qgcPal.text
} }
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
// Mid vibe indication line at 30
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barMidValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: qsTr("X") text: qsTr("X (%1)").arg(_xValue.toFixed(0))
} }
} }
Column { ColumnLayout {
Rectangle { Rectangle {
height: _barHeight height: _barHeight
width: _barWidth width: _barWidth
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
color: "transparent"
border.width: 1 border.width: 1
border.color: qgcPal.text border.color: qgcPal.text
@ -89,19 +114,42 @@ AnalyzePage {
height: parent.height * (Math.min(_barMaximum, _yValue) / (_barMaximum - _barMinimum)) height: parent.height * (Math.min(_barMaximum, _yValue) / (_barMaximum - _barMinimum))
color: qgcPal.text color: qgcPal.text
} }
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
// Mid vibe indication line at 30
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barMidValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: qsTr("Y") text: qsTr("Y (%1)").arg(_yValue.toFixed(0))
} }
} }
Column { ColumnLayout {
Rectangle { Rectangle {
height: _barHeight height: _barHeight
width: _barWidth width: _barWidth
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
color: "transparent"
border.width: 1 border.width: 1
border.color: qgcPal.text border.color: qgcPal.text
@ -111,26 +159,37 @@ AnalyzePage {
height: parent.height * (Math.min(_barMaximum, _zValue) / (_barMaximum - _barMinimum)) height: parent.height * (Math.min(_barMaximum, _zValue) / (_barMaximum - _barMinimum))
color: qgcPal.text color: qgcPal.text
} }
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
// Mid vibe indication line at 30
Rectangle {
anchors.topMargin: parent.height * (1.0 - ((_barMidValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
width: parent.width
height: 1
color: "red"
}
} }
QGCLabel { QGCLabel {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: qsTr("Z") text: qsTr("Z (%1)").arg(_zValue.toFixed(0))
} }
} }
} }
// Max vibe indication line at 60
Rectangle {
anchors.topMargin: xBar.height * (1.0 - ((_barBadValue - _barMinimum) / (_barMaximum - _barMinimum)))
anchors.top: barRow.top
anchors.left: barRow.left
anchors.right: barRow.right
width: barRow.width
height: 1
color: "red"
}
Column { Column {
anchors.margins: ScreenTools.defaultFontPixelWidth anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: barRow.right anchors.left: barRow.right
@ -140,15 +199,15 @@ AnalyzePage {
} }
QGCLabel { QGCLabel {
text: qsTr("Accel 1: ") + (_activeVehicle.vibration.clipCount1.rawValueString) text: qsTr("Accel 1: %1").arg(_activeVehicle.vibration.clipCount1.rawValue)
} }
QGCLabel { QGCLabel {
text: qsTr("Accel 2: ") + (_activeVehicle.vibration.clipCount2.rawValueString) text: qsTr("Accel 2: %1").arg(_activeVehicle.vibration.clipCount2.rawValue)
} }
QGCLabel { QGCLabel {
text: qsTr("Accel 3: ") + (_activeVehicle.vibration.clipCount3.rawValueString) text: qsTr("Accel 3: %1").arg(_activeVehicle.vibration.clipCount3.rawValue)
} }
} }

Loading…
Cancel
Save