Browse Source

Fix Pre-Flight checklist (#9194)

* Fix for multi-battery changes

* Change to QGCPopupDialog and Control 2 fixes
QGC4.4
Don Gagne 5 years ago committed by GitHub
parent
commit
5d401e5592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml
  2. 8
      src/FlightDisplay/FlyViewWidgetLayer.qml
  3. 3
      src/FlightDisplay/PreFlightBatteryCheck.qml
  4. 46
      src/FlightDisplay/PreFlightCheckList.qml
  5. 2
      src/FlightDisplay/PreFlightRCCheck.qml
  6. 17
      src/QmlControls/PreFlightCheckButton.qml

17
src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml

@ -9,23 +9,17 @@
import QtQuick 2.11 import QtQuick 2.11
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Dialogs 1.3
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.Vehicle 1.0
import QGroundControl.Controls 1.0
/// Popup container for preflight checklists /// Popup container for preflight checklists
Popup { QGCPopupDialog {
id: _root id: _root
height: checkList.height title: qsTr("Pre-Flight Checklist")
width: checkList.width buttons: StandardButton.Close
modal: true
focus: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
background: Rectangle {
anchors.fill: parent
color: Qt.rgba(0,0,0,0)
clip: true
}
property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
@ -62,7 +56,6 @@ Popup {
Loader { Loader {
id: checkList id: checkList
anchors.centerIn: parent
source: QGroundControl.corePlugin.options.preFlightChecklistUrl source: QGroundControl.corePlugin.options.preFlightChecklistUrl
} }

8
src/FlightDisplay/FlyViewWidgetLayer.qml

@ -178,7 +178,7 @@ Item {
maxHeight: parent.height - y - parentToolInsets.bottomEdgeLeftInset - _toolsMargin maxHeight: parent.height - y - parentToolInsets.bottomEdgeLeftInset - _toolsMargin
visible: !QGroundControl.videoManager.fullScreen visible: !QGroundControl.videoManager.fullScreen
onDisplayPreFlightChecklist: preFlightChecklistPopup.open() onDisplayPreFlightChecklist: mainWindow.showPopupDialogFromComponent(preFlightChecklistPopup)
property real leftInset: x + width property real leftInset: x + width
} }
@ -208,9 +208,9 @@ Item {
property real centerInset: visible ? parent.height - y : 0 property real centerInset: visible ? parent.height - y : 0
} }
FlyViewPreFlightChecklistPopup { Component {
id: preFlightChecklistPopup id: preFlightChecklistPopup
x: toolStrip.x + toolStrip.width + (ScreenTools.defaultFontPixelWidth * 2) FlyViewPreFlightChecklistPopup {
y: toolStrip.y }
} }
} }

3
src/FlightDisplay/PreFlightBatteryCheck.qml

@ -25,7 +25,8 @@ PreFlightCheckButton {
property int failurePercent: 40 property int failurePercent: 40
property bool allowFailurePercentOverride: false property bool allowFailurePercentOverride: false
property var _batteryValue: globals.activeVehicle ? globals.activeVehicle.battery.percentRemaining.value : 0 property var _batteryGroup: globals.activeVehicle && globals.activeVehicle.batteries.count ? globals.activeVehicle.batteries.get(0) : undefined
property var _batteryValue: _batteryGroup ? _batteryGroup.percentRemaining.value : 0
property var _batPercentRemaining: isNaN(_batteryValue) ? 0 : _batteryValue property var _batPercentRemaining: isNaN(_batteryValue) ? 0 : _batteryValue
property bool _batLow: _batPercentRemaining < failurePercent property bool _batLow: _batPercentRemaining < failurePercent
} }

46
src/FlightDisplay/PreFlightCheckList.qml

@ -10,6 +10,7 @@
import QtQuick 2.11 import QtQuick 2.11
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQml.Models 2.1 import QtQml.Models 2.1
import QtQuick.Layouts 1.12
import QGroundControl 1.0 import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
@ -17,11 +18,8 @@ import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0 import QGroundControl.FlightDisplay 1.0
import QGroundControl.Vehicle 1.0 import QGroundControl.Vehicle 1.0
Rectangle { ColumnLayout {
width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3 spacing: 0.8 * ScreenTools.defaultFontPixelWidth
height: Math.min(mainWindow.height - (_verticalMargin * 2), mainColumn.height + ScreenTools.defaultFontPixelHeight)
color: qgcPal.windowShade
radius: 3
property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2 property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2
@ -34,8 +32,10 @@ Rectangle {
property var vehicleCopy: globals.activeVehicle property var vehicleCopy: globals.activeVehicle
onVehicleCopyChanged: { onVehicleCopyChanged: {
if (checkListRepeater.model) {
checkListRepeater.model.reset() checkListRepeater.model.reset()
} }
}
onAllChecksPassedChanged: { onAllChecksPassedChanged: {
if (allChecksPassed) { if (allChecksPassed) {
@ -114,25 +114,6 @@ Rectangle {
onTriggered: _handleGroupPassedChanged(index, true /* passed */) onTriggered: _handleGroupPassedChanged(index, true /* passed */)
} }
QGCFlickable {
id: flickable
anchors.topMargin: _verticalMargin
anchors.bottomMargin: _verticalMargin
anchors.leftMargin: _horizontalMargin
anchors.rightMargin: _horizontalMargin
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
contentWidth: mainColumn.width
contentHeight: mainColumn.height
property real _horizontalMargin: 1.5 * ScreenTools.defaultFontPixelWidth
property real _verticalMargin: 0.6 * ScreenTools.defaultFontPixelWidth
Column {
id: mainColumn
width: 40 * ScreenTools.defaultFontPixelWidth
spacing: 0.8 * ScreenTools.defaultFontPixelWidth
function groupPassedChanged(index, passed) { function groupPassedChanged(index, passed) {
if (passed) { if (passed) {
delayedGroupPassed.index = index delayedGroupPassed.index = index
@ -143,23 +124,20 @@ Rectangle {
} }
// Header/title of checklist // Header/title of checklist
Item { RowLayout {
width: parent.width Layout.fillWidth: true
height: 1.75 * ScreenTools.defaultFontPixelHeight height: 1.75 * ScreenTools.defaultFontPixelHeight
spacing: 0
QGCLabel { QGCLabel {
text: qsTr("Pre-Flight Checklist %1").arg(allChecksPassed ? qsTr("(passed)") : "") Layout.fillWidth: true
anchors.left: parent.left text: allChecksPassed ? qsTr("(Passed)") : qsTr("In Progress")
anchors.verticalCenter: parent.verticalCenter
font.pointSize: ScreenTools.mediumFontPointSize font.pointSize: ScreenTools.mediumFontPointSize
} }
QGCButton { QGCButton {
width: 1.2 * ScreenTools.defaultFontPixelHeight width: 1.2 * ScreenTools.defaultFontPixelHeight
height: 1.2 * ScreenTools.defaultFontPixelHeight height: 1.2 * ScreenTools.defaultFontPixelHeight
anchors.right: parent.right Layout.alignment: Qt.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)")
onClicked: checkListRepeater.model.reset() onClicked: checkListRepeater.model.reset()
QGCColoredImage { QGCColoredImage {
@ -175,6 +153,4 @@ Rectangle {
id: checkListRepeater id: checkListRepeater
model: modelContainer.item.model model: modelContainer.item.model
} }
}
}
} }

2
src/FlightDisplay/PreFlightRCCheck.qml

@ -17,7 +17,7 @@ PreFlightCheckButton {
name: qsTr("Radio Control") name: qsTr("Radio Control")
manualText: qsTr("Receiving signal. Perform range test & confirm.") manualText: qsTr("Receiving signal. Perform range test & confirm.")
telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.") telemetryTextFailure: qsTr("No signal or invalid autopilot-RC config. Check RC and console.")
telemetryFailure: _unhealthySensors & Vehicle.SysStatusSensorRCReceiver telemetryFailure: false//_unhealthySensors & Vehicle.SysStatusSensorRCReceiver
property int _unhealthySensors: globals.activeVehicle ? globals.activeVehicle.sensorsUnhealthyBits : 0 property int _unhealthySensors: globals.activeVehicle ? globals.activeVehicle.sensorsUnhealthyBits : 0
} }

17
src/QmlControls/PreFlightCheckButton.qml

@ -61,14 +61,10 @@ QGCButton {
_failedColor)) _failedColor))
width: 40 * ScreenTools.defaultFontPixelWidth width: 40 * ScreenTools.defaultFontPixelWidth
topPadding: _verticalPadding
style: ButtonStyle { bottomPadding: _verticalPadding
padding { leftPadding: (_horizontalPadding * 2) + _stateFlagWidth
top: _verticalPadding rightPadding: _horizontalPadding
bottom: _verticalPadding
left: (_horizontalPadding * 2) + _stateFlagWidth
right: _horizontalPadding
}
background: Rectangle { background: Rectangle {
color: qgcPal.button color: qgcPal.button
@ -83,12 +79,11 @@ QGCButton {
} }
} }
label: Label { contentItem: QGCLabel {
text: _text
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
color: qgcPal.buttonText color: qgcPal.buttonText
} text: _text
} }
function _updateTelemetryState() { function _updateTelemetryState() {

Loading…
Cancel
Save