Unverified Commit eb793fc5 authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #7996 from DonLakeFlyer/ResumeMission

Mission Complete dialog rework
parents 0cb4bf8b bec15660
...@@ -144,33 +144,31 @@ Item { ...@@ -144,33 +144,31 @@ Item {
} }
} }
// The following code is used to track vehicle states such that we prompt to remove mission from vehicle when mission completes // The following code is used to track vehicle states for showing the mission complete dialog
property bool vehicleArmed: activeVehicle ? activeVehicle.armed : true // true here prevents pop up from showing during shutdown
property bool vehicleArmed: activeVehicle ? activeVehicle.armed : true // true here prevents pop up from showing during shutdown property bool vehicleWasArmed: false
property bool vehicleWasArmed: false property bool vehicleInMissionFlightMode: activeVehicle ? (activeVehicle.flightMode === activeVehicle.missionFlightMode) : false
property bool vehicleInMissionFlightMode: activeVehicle ? (activeVehicle.flightMode === activeVehicle.missionFlightMode) : false property bool vehicleWasInMissionFlightMode: false
property bool promptForMissionRemove: false property bool showMissionCompleteDialog: vehicleWasArmed && vehicleWasInMissionFlightMode &&
(_missionController.containsItems || _geoFenceController.containsItems || _rallyPointController.containsItems ||
(activeVehicle ? activeVehicle.cameraTriggerPoints.count !== 0 : false))
onVehicleArmedChanged: { onVehicleArmedChanged: {
if (vehicleArmed) { if (vehicleArmed) {
if (!promptForMissionRemove) { vehicleWasArmed = true
promptForMissionRemove = vehicleInMissionFlightMode vehicleWasInMissionFlightMode = vehicleInMissionFlightMode
vehicleWasArmed = true
}
} else { } else {
if (promptForMissionRemove && (_missionController.containsItems || _geoFenceController.containsItems || _rallyPointController.containsItems)) { if (showMissionCompleteDialog) {
// ArduPilot has a strange bug which prevents mission clear from working at certain times, so we can't show this dialog mainWindow.showComponentDialog(missionCompleteDialogComponent, qsTr("Flight Plan complete"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
if (!activeVehicle.apmFirmware) {
mainWindow.showComponentDialog(missionCompleteDialogComponent, qsTr("Flight Plan complete"), mainWindow.showDialogDefaultWidth, StandardButton.Close)
}
} }
promptForMissionRemove = false vehicleWasArmed = false
vehicleWasInMissionFlightMode = false
} }
} }
onVehicleInMissionFlightModeChanged: { onVehicleInMissionFlightModeChanged: {
if (!promptForMissionRemove && vehicleArmed) { if (vehicleInMissionFlightMode && vehicleArmed) {
promptForMissionRemove = true vehicleWasInMissionFlightMode = true
} }
} }
...@@ -193,46 +191,47 @@ Item { ...@@ -193,46 +191,47 @@ Item {
anchors.margins: _margins anchors.margins: _margins
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight
ColumnLayout { QGCLabel {
Layout.fillWidth: true Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelHeight text: qsTr("%1 Images Taken").arg(activeVehicle.cameraTriggerPoints.count)
visible: !activeVehicle.connectionLost || !_guidedController.showResumeMission horizontalAlignment: Text.AlignHCenter
visible: activeVehicle.cameraTriggerPoints.count !== 0
}
QGCLabel { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("%1 Images Taken").arg(activeVehicle.cameraTriggerPoints.count) text: qsTr("Remove plan from vehicle")
horizontalAlignment: Text.AlignHCenter visible: !activeVehicle.connectionLost// && !activeVehicle.apmFirmware // ArduPilot has a bug somewhere with mission clear
visible: activeVehicle.cameraTriggerPoints.count !== 0 onClicked: {
_planController.removeAllFromVehicle()
hideDialog()
} }
}
QGCButton { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
text: qsTr("Remove plan from vehicle") Layout.alignment: Qt.AlignHCenter
onClicked: { text: qsTr("Leave plan on vehicle")
_planController.removeAllFromVehicle() onClicked: hideDialog()
hideDialog() }
}
}
QGCButton { Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter color: qgcPal.text
text: qsTr("Leave plan on vehicle") height: 1
onClicked: hideDialog() }
}
Rectangle { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
color: qgcPal.text spacing: ScreenTools.defaultFontPixelHeight
height: 1 visible: !activeVehicle.connectionLost && _guidedController.showResumeMission
}
QGCButton { QGCButton {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
text: qsTr("Resume Mission From Waypoint %1").arg(_guidedController._resumeMissionIndex) text: qsTr("Resume Mission From Waypoint %1").arg(_guidedController._resumeMissionIndex)
visible: _guidedController.showResumeMission
onClicked: { onClicked: {
guidedController.executeAction(_guidedController.actionResumeMission, null, null) guidedController.executeAction(_guidedController.actionResumeMission, null, null)
...@@ -244,29 +243,15 @@ Item { ...@@ -244,29 +243,15 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("Resume Mission will rebuild the current mission from the last flown waypoint and upload it to the vehicle for the next flight.") text: qsTr("Resume Mission will rebuild the current mission from the last flown waypoint and upload it to the vehicle for the next flight.")
visible: _guidedController.showResumeMission
}
QGCLabel {
Layout.fillWidth: true
wrapMode: Text.WordWrap
color: qgcPal.warningText
text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle when communication is lost.")
visible: _guidedController.showResumeMission
} }
} }
ColumnLayout { QGCLabel {
Layout.fillWidth: true Layout.fillWidth: true
spacing: ScreenTools.defaultFontPixelHeight wrapMode: Text.WordWrap
visible: activeVehicle.connectionLost && _guidedController.showResumeMission color: qgcPal.warningText
text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle.")
QGCLabel { visible: _guidedController.showResumeMission
Layout.fillWidth: true
wrapMode: Text.WordWrap
color: qgcPal.warningText
text: qsTr("If you are changing batteries for Resume Mission do not disconnect from the vehicle.")
}
} }
} }
} }
......
...@@ -134,7 +134,7 @@ Item { ...@@ -134,7 +134,7 @@ Item {
spacing: ScreenTools.defaultFontPixelHeight spacing: ScreenTools.defaultFontPixelHeight
property bool noGPSLockVisible: activeVehicle && !activeVehicle.coordinate.isValid && mainIsMap property bool noGPSLockVisible: activeVehicle && !activeVehicle.coordinate.isValid && mainIsMap
property bool prearmErrorVisible: activeVehicle && activeVehicle.prearmError property bool prearmErrorVisible: activeVehicle && !activeVehicle.armed && activeVehicle.prearmError
QGCLabel { QGCLabel {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
......
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