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

8
src/FlightDisplay/FlyViewWidgetLayer.qml

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

3
src/FlightDisplay/PreFlightBatteryCheck.qml

@ -25,7 +25,8 @@ PreFlightCheckButton { @@ -25,7 +25,8 @@ PreFlightCheckButton {
property int failurePercent: 40
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 bool _batLow: _batPercentRemaining < failurePercent
}

108
src/FlightDisplay/PreFlightCheckList.qml

@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
import QtQuick 2.11
import QtQuick.Controls 2.4
import QtQml.Models 2.1
import QtQuick.Layouts 1.12
import QGroundControl 1.0
import QGroundControl.ScreenTools 1.0
@ -17,11 +18,8 @@ import QGroundControl.Controls 1.0 @@ -17,11 +18,8 @@ import QGroundControl.Controls 1.0
import QGroundControl.FlightDisplay 1.0
import QGroundControl.Vehicle 1.0
Rectangle {
width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3
height: Math.min(mainWindow.height - (_verticalMargin * 2), mainColumn.height + ScreenTools.defaultFontPixelHeight)
color: qgcPal.windowShade
radius: 3
ColumnLayout {
spacing: 0.8 * ScreenTools.defaultFontPixelWidth
property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2
@ -31,10 +29,12 @@ Rectangle { @@ -31,10 +29,12 @@ Rectangle {
}
property bool allChecksPassed: false
property var vehicleCopy: globals.activeVehicle
property var vehicleCopy: globals.activeVehicle
onVehicleCopyChanged: {
checkListRepeater.model.reset()
if (checkListRepeater.model) {
checkListRepeater.model.reset()
}
}
onAllChecksPassedChanged: {
@ -73,7 +73,7 @@ Rectangle { @@ -73,7 +73,7 @@ Rectangle {
function _updateModel() {
var vehicle = globals.activeVehicle
if (!vehicle) {
vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
}
if(vehicle.multiRotor) {
@ -114,67 +114,43 @@ Rectangle { @@ -114,67 +114,43 @@ Rectangle {
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) {
if (passed) {
delayedGroupPassed.index = index
delayedGroupPassed.restart()
} else {
_handleGroupPassedChanged(index, passed)
}
}
function groupPassedChanged(index, passed) {
if (passed) {
delayedGroupPassed.index = index
delayedGroupPassed.restart()
} else {
_handleGroupPassedChanged(index, passed)
}
}
// Header/title of checklist
Item {
width: parent.width
height: 1.75 * ScreenTools.defaultFontPixelHeight
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
}
}
}
// Header/title of checklist
RowLayout {
Layout.fillWidth: true
height: 1.75 * ScreenTools.defaultFontPixelHeight
spacing: 0
// All check list items
Repeater {
id: checkListRepeater
model: modelContainer.item.model
QGCLabel {
Layout.fillWidth: true
text: allChecksPassed ? qsTr("(Passed)") : qsTr("In Progress")
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 { @@ -17,7 +17,7 @@ PreFlightCheckButton {
name: qsTr("Radio Control")
manualText: qsTr("Receiving signal. Perform range test & confirm.")
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
}

49
src/QmlControls/PreFlightCheckButton.qml

@ -60,35 +60,30 @@ QGCButton { @@ -60,35 +60,30 @@ QGCButton {
_pendingColor :
_failedColor))
width: 40 * ScreenTools.defaultFontPixelWidth
style: ButtonStyle {
padding {
top: _verticalPadding
bottom: _verticalPadding
left: (_horizontalPadding * 2) + _stateFlagWidth
right: _horizontalPadding
}
background: Rectangle {
color: qgcPal.button
border.color: qgcPal.button;
Rectangle {
color: _color
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: _stateFlagWidth
}
width: 40 * ScreenTools.defaultFontPixelWidth
topPadding: _verticalPadding
bottomPadding: _verticalPadding
leftPadding: (_horizontalPadding * 2) + _stateFlagWidth
rightPadding: _horizontalPadding
background: Rectangle {
color: qgcPal.button
border.color: qgcPal.button;
Rectangle {
color: _color
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
width: _stateFlagWidth
}
}
label: Label {
text: _text
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: qgcPal.buttonText
}
contentItem: QGCLabel {
wrapMode: Text.WordWrap
horizontalAlignment: Text.AlignHCenter
color: qgcPal.buttonText
text: _text
}
function _updateTelemetryState() {

Loading…
Cancel
Save