QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
FlyViewPreFlightChecklistPopup.qml
Go to the documentation of this file.
1import QtQuick
2import QtQuick.Controls
3import QtQuick.Dialogs
4
5import QGroundControl
6import QGroundControl.Controls
7
8/// Popup container for preflight checklists
9QGCPopupDialog {
10 id: _root
11 title: qsTr("Pre-Flight Checklist")
12 buttons: Dialog.Close
13
14 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
15 property bool _useChecklist: QGroundControl.settingsManager.appSettings.useChecklist.rawValue && QGroundControl.corePlugin.options.preFlightChecklistUrl.toString().length
16 property bool _enforceChecklist: _useChecklist && QGroundControl.settingsManager.appSettings.enforceChecklist.rawValue
17 property bool _checklistComplete: _activeVehicle && (_activeVehicle.checkListState === Vehicle.CheckListPassed)
18
19 on_ActiveVehicleChanged: _showPreFlightChecklistIfNeeded()
20
21 Connections {
22 target: mainWindow
23 onShowPreFlightChecklistIfNeeded: _root._showPreFlightChecklistIfNeeded()
24 }
25
26 function _showPreFlightChecklistIfNeeded() {
27 if (_activeVehicle && !_checklistComplete && _enforceChecklist) {
28 popupTimer.restart()
29 }
30 }
31
32 Timer {
33 id: popupTimer
34 interval: 1000
35 repeat: false
36 onTriggered: {
37 if (!_checklistComplete) {
38 _root.open()
39 } else {
40 _root.close()
41 }
42 }
43 }
44
45 Loader {
46 id: checkList
47 source: QGroundControl.corePlugin.options.preFlightChecklistUrl
48 }
49
50 property alias checkListItem: checkList.item
51
52 Connections {
53 target: checkList.item
54 onAllChecksPassedChanged: {
55 if (target.allChecksPassed) {
56 popupTimer.restart()
57 }
58 }
59 }
60}