Browse Source

Merge pull request #8358 from dakejahl/pr-fix_checklist_flightview_interactions

Fixed interactions between PreFlightCheckList and the FlightView
QGC4.4
Don Gagne 5 years ago committed by GitHub
parent
commit
d52d9f1d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      src/FlightDisplay/FlightDisplayView.qml
  2. 10
      src/FlightDisplay/GuidedActionsController.qml
  3. 20
      src/FlightDisplay/PreFlightCheckList.qml

41
src/FlightDisplay/FlightDisplayView.qml

@ -50,7 +50,7 @@ Item { @@ -50,7 +50,7 @@ Item {
property bool _isPipVisible: QGroundControl.videoManager.hasVideo ? QGroundControl.loadBoolGlobalSetting(_PIPVisibleKey, true) : false
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
property bool _canArm: activeVehicle ? (_useChecklist ? (_enforceChecklist ? activeVehicle.checkListState === Vehicle.CheckListPassed : true) : true) : false
property bool _checklistComplete: activeVehicle && (activeVehicle.checkListState === Vehicle.CheckListPassed)
property real _margins: ScreenTools.defaultFontPixelWidth / 2
property real _pipSize: mainWindow.width * 0.2
property alias _guidedController: guidedActionsController
@ -70,6 +70,26 @@ Item { @@ -70,6 +70,26 @@ Item {
readonly property string _mainIsMapKey: "MainFlyWindowIsMap"
readonly property string _PIPVisibleKey: "IsPIPVisible"
onVisibleChanged: {
if (activeVehicle && !_checklistComplete && _enforceChecklist) {
checklistPopupTimer.restart()
}
}
Timer {
id: checklistPopupTimer
interval: 1000
repeat: false
onTriggered: {
if (visible && !_checklistComplete) {
checklistDropPanel.open()
}
else {
checklistDropPanel.close()
}
}
}
function setStates() {
QGroundControl.saveBoolGlobalSetting(_mainIsMapKey, mainIsMap)
if(mainIsMap) {
@ -597,7 +617,7 @@ Item { @@ -597,7 +617,7 @@ Item {
name: _guidedController.takeoffTitle,
iconSource: "/res/takeoff.svg",
buttonVisible: _guidedController.showTakeoff || !_guidedController.showLand,
buttonEnabled: _guidedController.showTakeoff && _canArm,
buttonEnabled: _guidedController.showTakeoff,
action: _guidedController.actionTakeoff
},
{
@ -625,7 +645,7 @@ Item { @@ -625,7 +645,7 @@ Item {
name: qsTr("Action"),
iconSource: "/res/action.svg",
buttonVisible: !_guidedController.showPause,
buttonEnabled: _anyActionAvailable && _canArm,
buttonEnabled: _anyActionAvailable,
action: -1
}
]
@ -659,7 +679,7 @@ Item { @@ -659,7 +679,7 @@ Item {
z: _flightVideoPipControl.z + 1
onShowStartMissionChanged: {
if (showStartMission && _canArm) {
if (showStartMission) {
confirmAction(actionStartMission)
}
}
@ -778,10 +798,23 @@ Item { @@ -778,10 +798,23 @@ Item {
color: Qt.rgba(0,0,0,0)
clip: true
}
Loader {
id: checkList
anchors.centerIn: parent
}
property alias checkListItem: checkList.item
Connections {
target: checkList.item
onAllChecksPassedChanged: {
if (target.allChecksPassed)
{
checklistPopupTimer.restart()
}
}
}
}
}

10
src/FlightDisplay/GuidedActionsController.qml

@ -96,13 +96,17 @@ Item { @@ -96,13 +96,17 @@ Item {
readonly property int actionVtolTransitionToMRFlight: 21
readonly property int actionROI: 22
property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
property bool _canArm: activeVehicle ? (_useChecklist ? (_enforceChecklist ? activeVehicle.checkListState === Vehicle.CheckListPassed : true) : true) : false
property bool showEmergenyStop: _guidedActionsEnabled && !_hideEmergenyStop && _vehicleArmed && _vehicleFlying
property bool showArm: _guidedActionsEnabled && !_vehicleArmed
property bool showArm: _guidedActionsEnabled && !_vehicleArmed && _canArm
property bool showDisarm: _guidedActionsEnabled && _vehicleArmed && !_vehicleFlying
property bool showRTL: _guidedActionsEnabled && _vehicleArmed && activeVehicle.guidedModeSupported && _vehicleFlying && !_vehicleInRTLMode
property bool showTakeoff: _guidedActionsEnabled && activeVehicle.takeoffVehicleSupported && !_vehicleFlying
property bool showTakeoff: _guidedActionsEnabled && activeVehicle.takeoffVehicleSupported && !_vehicleFlying && _canArm
property bool showLand: _guidedActionsEnabled && activeVehicle.guidedModeSupported && _vehicleArmed && !activeVehicle.fixedWing && !_vehicleInLandMode
property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying
property bool showStartMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && !_vehicleFlying && _canArm
property bool showContinueMission: _guidedActionsEnabled && _missionAvailable && !_missionActive && _vehicleArmed && _vehicleFlying && (_currentMissionIndex < _missionItemCount - 1)
property bool showPause: _guidedActionsEnabled && _vehicleArmed && activeVehicle.pauseVehicleSupported && _vehicleFlying && !_vehiclePaused && !_fixedWingOnApproach
property bool showChangeAlt: _guidedActionsEnabled && _vehicleFlying && activeVehicle.guidedModeSupported && _vehicleArmed && !_missionActive

20
src/FlightDisplay/PreFlightCheckList.qml

@ -30,7 +30,15 @@ Rectangle { @@ -30,7 +30,15 @@ Rectangle {
source: "/checklists/DefaultChecklist.qml"
}
property bool _passed: false
property bool allChecksPassed: false
onAllChecksPassedChanged: {
if (allChecksPassed) {
activeVehicle.checkListState = Vehicle.CheckListPassed
} else {
activeVehicle.checkListState = Vehicle.CheckListFailed
}
}
function _handleGroupPassedChanged(index, passed) {
if (passed) {
@ -53,7 +61,7 @@ Rectangle { @@ -53,7 +61,7 @@ Rectangle {
break
}
}
_passed = allPassed;
allChecksPassed = allPassed;
}
//-- Pick a checklist model that matches the current airframe type (if any)
@ -85,12 +93,6 @@ Rectangle { @@ -85,12 +93,6 @@ Rectangle {
if(activeVehicle) {
if(visible) {
_updateModel()
} else {
if(modelContainer.item.model.isPassed()) {
activeVehicle.checkListState = Vehicle.CheckListPassed
} else {
activeVehicle.checkListState = Vehicle.CheckListFailed
}
}
}
}
@ -139,7 +141,7 @@ Rectangle { @@ -139,7 +141,7 @@ Rectangle {
height: 1.75 * ScreenTools.defaultFontPixelHeight
QGCLabel {
text: qsTr("Pre-Flight Checklist %1").arg(_passed ? qsTr("(passed)") : "")
text: qsTr("Pre-Flight Checklist %1").arg(allChecksPassed ? qsTr("(passed)") : "")
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
font.pointSize: ScreenTools.mediumFontPointSize

Loading…
Cancel
Save