7import QGroundControl.Controls
8import QGroundControl.FlyView
11 spacing: 0.8 * ScreenTools.defaultFontPixelWidth
13 property real _verticalMargin: ScreenTools.defaultFontPixelHeight / 2
17 source: "qrc:/qml/QGroundControl/FlyView/DefaultChecklist.qml"
20 property bool allChecksPassed: false
21 property var vehicleCopy: globals.activeVehicle
23 onVehicleCopyChanged: {
24 if (checkListRepeater.model) {
25 checkListRepeater.model.reset()
29 onAllChecksPassedChanged: {
30 if (allChecksPassed) {
31 globals.activeVehicle.checkListState = Vehicle.CheckListPassed
33 globals.activeVehicle.checkListState = Vehicle.CheckListFailed
37 function _handleGroupPassedChanged(index, passed) {
39 // Collapse current group
40 var group = checkListRepeater.itemAt(index)
41 group._checked = false
43 if (index + 1 < checkListRepeater.count) {
44 group = checkListRepeater.itemAt(index + 1)
50 // Walk the list and check if any group is failing
52 for (var i=0; i < checkListRepeater.count; i++) {
53 if (!checkListRepeater.itemAt(i).passed) {
58 allChecksPassed = allPassed;
61 //-- Pick a checklist model that matches the current airframe type (if any)
62 function _updateModel() {
63 var vehicle = globals.activeVehicle
65 vehicle = QGroundControl.multiVehicleManager.offlineEditingVehicle
68 if(vehicle.multiRotor) {
69 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/MultiRotorChecklist.qml"
70 } else if(vehicle.vtol) {
71 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/VTOLChecklist.qml"
72 } else if(vehicle.rover) {
73 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/RoverChecklist.qml"
74 } else if(vehicle.sub) {
75 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/SubChecklist.qml"
76 } else if(vehicle.fixedWing) {
77 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/FixedWingChecklist.qml"
79 modelContainer.source = "qrc:/qml/QGroundControl/FlyView/DefaultChecklist.qml"
84 Component.onCompleted: {
89 if(globals.activeVehicle) {
96 // We delay the updates when a group passes so the user can see all items green for a moment prior to hiding
98 id: delayedGroupPassed
103 onTriggered: _handleGroupPassedChanged(index, true /* passed */)
106 function groupPassedChanged(index, passed) {
108 delayedGroupPassed.index = index
109 delayedGroupPassed.restart()
111 _handleGroupPassedChanged(index, passed)
115 // Header/title of checklist
117 Layout.fillWidth: true
118 height: 1.75 * ScreenTools.defaultFontPixelHeight
122 Layout.fillWidth: true
123 text: allChecksPassed ? qsTr("(Passed)") : qsTr("In Progress")
124 font.pointSize: ScreenTools.mediumFontPointSize
127 width: 1.2 * ScreenTools.defaultFontPixelHeight
128 height: 1.2 * ScreenTools.defaultFontPixelHeight
129 Layout.alignment: Qt.AlignVCenter
130 onClicked: checkListRepeater.model.reset()
133 source: "/qmlimages/MapSyncBlack.svg"
134 color: qgcPal.buttonText
140 // All check list items
142 id: checkListRepeater
143 model: modelContainer.item.model