Commit 4e8d599d authored by Jacob Dahl's avatar Jacob Dahl

Fixed interactions between PreFlightCheckList and the FlightView

parent bd4bfe55
......@@ -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 {
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 {
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 {
name: qsTr("Action"),
iconSource: "/res/action.svg",
buttonVisible: !_guidedController.showPause,
buttonEnabled: _anyActionAvailable && _canArm,
buttonEnabled: _anyActionAvailable,
action: -1
}
]
......@@ -659,7 +679,7 @@ Item {
z: _flightVideoPipControl.z + 1
onShowStartMissionChanged: {
if (showStartMission && _canArm) {
if (showStartMission) {
confirmAction(actionStartMission)
}
}
......@@ -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()
}
}
}
}
}
......@@ -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
......
......@@ -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 {
break
}
}
_passed = allPassed;
allChecksPassed = allPassed;
}
//-- Pick a checklist model that matches the current airframe type (if any)
......@@ -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 {
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment