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. 23
      src/FlightDisplay/FlyViewPreFlightChecklistPopup.qml
  2. 8
      src/FlightDisplay/FlyViewWidgetLayer.qml
  3. 3
      src/FlightDisplay/PreFlightBatteryCheck.qml
  4. 108
      src/FlightDisplay/PreFlightCheckList.qml
  5. 2
      src/FlightDisplay/PreFlightRCCheck.qml
  6. 49
      src/QmlControls/PreFlightCheckButton.qml

23
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
@ -61,9 +55,8 @@ Popup {
} }
Loader { Loader {
id: checkList id: checkList
anchors.centerIn: parent source: QGroundControl.corePlugin.options.preFlightChecklistUrl
source: QGroundControl.corePlugin.options.preFlightChecklistUrl
} }
property alias checkListItem: checkList.item property alias checkListItem: checkList.item

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
} }

108
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
@ -31,10 +29,12 @@ Rectangle {
} }
property bool allChecksPassed: false property bool allChecksPassed: false
property var vehicleCopy: globals.activeVehicle property var vehicleCopy: globals.activeVehicle
onVehicleCopyChanged: { onVehicleCopyChanged: {
checkListRepeater.model.reset() if (checkListRepeater.model) {
checkListRepeater.model.reset()
}
} }
onAllChecksPassedChanged: { onAllChecksPassedChanged: {
@ -73,7 +73,7 @@ Rectangle {
function _updateModel() { function _updateModel() {
var vehicle = globals.activeVehicle var vehicle = globals.activeVehicle
if (!vehicle) { if (!vehicle) {
vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
} }
if(vehicle.multiRotor) { if(vehicle.multiRotor) {
@ -114,67 +114,43 @@ Rectangle {
onTriggered: _handleGroupPassedChanged(index, true /* passed */) onTriggered: _handleGroupPassedChanged(index, true /* passed */)
} }
QGCFlickable { function groupPassedChanged(index, passed) {
id: flickable if (passed) {
anchors.topMargin: _verticalMargin delayedGroupPassed.index = index
anchors.bottomMargin: _verticalMargin delayedGroupPassed.restart()
anchors.leftMargin: _horizontalMargin } else {
anchors.rightMargin: _horizontalMargin _handleGroupPassedChanged(index, passed)
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) {
if (passed) {
delayedGroupPassed.index = index
delayedGroupPassed.restart()
} else {
_handleGroupPassedChanged(index, passed)
}
}
// 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 {
text: qsTr("Pre-Flight Checklist %1").arg(allChecksPassed ? qsTr("(passed)") : "")
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
font.pointSize: ScreenTools.mediumFontPointSize
}
QGCButton {
width: 1.2 * ScreenTools.defaultFontPixelHeight
height: 1.2 * ScreenTools.defaultFontPixelHeight
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)")
onClicked: checkListRepeater.model.reset()
QGCColoredImage {
source: "/qmlimages/MapSyncBlack.svg"
color: qgcPal.buttonText
anchors.fill: parent
}
}
}
// All check list items QGCLabel {
Repeater { Layout.fillWidth: true
id: checkListRepeater text: allChecksPassed ? qsTr("(Passed)") : qsTr("In Progress")
model: modelContainer.item.model font.pointSize: ScreenTools.mediumFontPointSize
}
QGCButton {
width: 1.2 * ScreenTools.defaultFontPixelHeight
height: 1.2 * ScreenTools.defaultFontPixelHeight
Layout.alignment: Qt.AlignVCenter
onClicked: checkListRepeater.model.reset()
QGCColoredImage {
source: "/qmlimages/MapSyncBlack.svg"
color: qgcPal.buttonText
anchors.fill: parent
} }
} }
} }
// All check list items
Repeater {
id: checkListRepeater
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
} }

49
src/QmlControls/PreFlightCheckButton.qml

@ -60,35 +60,30 @@ QGCButton {
_pendingColor : _pendingColor :
_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 background: Rectangle {
right: _horizontalPadding color: qgcPal.button
} border.color: qgcPal.button;
background: Rectangle { Rectangle {
color: qgcPal.button color: _color
border.color: qgcPal.button; anchors.left: parent.left
anchors.top: parent.top
Rectangle { anchors.bottom: parent.bottom
color: _color width: _stateFlagWidth
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: _stateFlagWidth
}
} }
}
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