7import QGroundControl.Controls
9/// Dialog which shows up when a flight completes. Prompts the user for things like whether they should remove the plan from the vehicle.
11 id: missionCompleteDialogHelper
14 property var missionController
15 property var geoFenceController
16 property var rallyPointController
18 // The following code is used to track vehicle states for showing the mission complete dialog
19 property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle
20 property bool _vehicleArmed: _activeVehicle ? _activeVehicle.armed : true // true here prevents pop up from showing during shutdown
21 property bool _vehicleWasArmed: false
22 property bool _vehicleInMissionFlightMode: _activeVehicle ? (_activeVehicle.flightMode === _activeVehicle.missionFlightMode) : false
23 property bool _vehicleWasInMissionFlightMode: false
24 property bool _showMissionCompleteDialog: _vehicleWasArmed && _vehicleWasInMissionFlightMode &&
25 (missionController.containsItems || geoFenceController.containsItems || rallyPointController.containsItems ||
26 (_activeVehicle ? _activeVehicle.cameraTriggerPoints.count !== 0 : false))
28 on_VehicleArmedChanged: {
30 _vehicleWasArmed = true
31 _vehicleWasInMissionFlightMode = _vehicleInMissionFlightMode
33 if (_showMissionCompleteDialog) {
34 missionCompleteDialogFactory.open()
36 _vehicleWasArmed = false
37 _vehicleWasInMissionFlightMode = false
41 on_VehicleInMissionFlightModeChanged: {
42 if (_vehicleInMissionFlightMode && _vehicleArmed) {
43 _vehicleWasInMissionFlightMode = true
47 QGCPopupDialogFactory {
48 id: missionCompleteDialogFactory
50 dialogComponent: missionCompleteDialogComponent
54 id: missionCompleteDialogComponent
57 id: missionCompleteDialog
58 title: qsTr("Flight Plan complete")
61 property var activeVehicleCopy: _activeVehicle
62 onActiveVehicleCopyChanged:
63 if (!activeVehicleCopy) {
64 missionCompleteDialog.close()
69 width: 40 * ScreenTools.defaultFontPixelWidth
70 spacing: ScreenTools.defaultFontPixelHeight
73 Layout.fillWidth: true
74 text: qsTr("%1 Images Taken").arg(_activeVehicle.cameraTriggerPoints.count)
75 horizontalAlignment: Text.AlignHCenter
76 visible: _activeVehicle.cameraTriggerPoints.count !== 0
80 Layout.fillWidth: true
81 text: qsTr("Remove plan from vehicle")
82 visible: !_activeVehicle.communicationLost// && !_activeVehicle.apmFirmware // ArduPilot has a bug somewhere with mission clear
84 _planController.removeAllFromVehicle()
85 missionCompleteDialog.close()
90 Layout.fillWidth: true
91 Layout.alignment: Qt.AlignHCenter
92 text: qsTr("Leave plan on vehicle")
93 onClicked: missionCompleteDialog.close()
98 Layout.fillWidth: true
104 Layout.fillWidth: true
105 spacing: ScreenTools.defaultFontPixelHeight
106 visible: !_activeVehicle.communicationLost && globals.guidedControllerFlyView.showResumeMission
109 Layout.fillWidth: true
110 Layout.alignment: Qt.AlignHCenter
111 text: qsTr("Resume Mission From Waypoint %1").arg(globals.guidedControllerFlyView._resumeMissionIndex)
114 globals.guidedControllerFlyView.executeAction(globals.guidedControllerFlyView.actionResumeMission, null, null)
115 missionCompleteDialog.close()
120 Layout.fillWidth: true
121 wrapMode: Text.WordWrap
122 text: qsTr("Resume Mission will rebuild the current mission from the last flown waypoint and upload it to the vehicle for the next flight.")
127 Layout.fillWidth: true
128 wrapMode: Text.WordWrap
129 color: qgcPal.warningText
130 text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle.")
131 visible: globals.guidedControllerFlyView.showResumeMission