Commit f5372ca1 authored by DonLakeFlyer's avatar DonLakeFlyer

Show remove mission from vehicle even if on Video

parent 1cf09f40
...@@ -96,6 +96,16 @@ QGCView { ...@@ -96,6 +96,16 @@ QGCView {
onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady) onResumeMissionReady: guidedActionsController.confirmAction(guidedActionsController.actionResumeMissionReady)
} }
GeoFenceController {
id: flyGeoFenceController
Component.onCompleted: start(false /* editMode */)
}
RallyPointController {
id: flyRallyPointController
Component.onCompleted: start(false /* editMode */)
}
MessageDialog { MessageDialog {
id: px4JoystickSupport id: px4JoystickSupport
text: qsTr("Joystick support requires MAVLink MANUAL_CONTROL support. ") + text: qsTr("Joystick support requires MAVLink MANUAL_CONTROL support. ") +
...@@ -123,6 +133,49 @@ QGCView { ...@@ -123,6 +133,49 @@ QGCView {
} }
} }
// The following code is used to track vehicle states such that we prompt to remove mission from vehicle when mission completes
property bool vehicleArmed: _activeVehicle ? _activeVehicle.armed : true // true here prevents pop up from showing during shutdown
property bool vehicleWasArmed: false
property bool vehicleInMissionFlightMode: _activeVehicle ? (_activeVehicle.flightMode === _activeVehicle.missionFlightMode) : false
property bool promptForMissionRemove: false
onVehicleArmedChanged: {
if (vehicleArmed) {
if (!promptForMissionRemove) {
promptForMissionRemove = vehicleInMissionFlightMode
vehicleWasArmed = true
}
} else {
if (promptForMissionRemove && (flyMissionController.containsItems || flyGeoFenceController.containsItems || flyRallyPointController.containsItems)) {
root.showDialog(removeMissionDialogComponent, qsTr("Flight complete"), showDialogDefaultWidth, StandardButton.No | StandardButton.Yes)
}
promptForMissionRemove = false
}
}
onVehicleInMissionFlightModeChanged: {
if (!promptForMissionRemove && vehicleArmed) {
promptForMissionRemove = true
}
}
Component {
id: removeMissionDialogComponent
QGCViewMessage {
message: qsTr("Do you want to remove the mission from the vehicle?")
function accept() {
flyMissionController.removeAllFromVehicle()
flyGeoFenceController.removeAllFromVehicle()
flyRallyPointController.removeAllFromVehicle()
hideDialog()
}
}
}
QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true } QGCMapPalette { id: mapPal; lightColors: _mainIsMap ? _flightMap.isSatelliteMap : true }
QGCViewPanel { QGCViewPanel {
...@@ -160,6 +213,8 @@ QGCView { ...@@ -160,6 +213,8 @@ QGCView {
id: _flightMap id: _flightMap
anchors.fill: parent anchors.fill: parent
missionController: flyMissionController missionController: flyMissionController
geoFenceController: flyGeoFenceController
rallyPointController: flyRallyPointController
guidedActionsController: _guidedController guidedActionsController: _guidedController
flightWidgets: flightDisplayViewWidgets flightWidgets: flightDisplayViewWidgets
rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9 rightPanelWidth: ScreenTools.defaultFontPixelHeight * 9
...@@ -356,7 +411,7 @@ QGCView { ...@@ -356,7 +411,7 @@ QGCView {
buttonVisible: [ _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true, _guidedController.smartShotsAvailable ] buttonVisible: [ _guidedController.showTakeoff || !_guidedController.showLand, _guidedController.showLand && !_guidedController.showTakeoff, true, true, true, _guidedController.smartShotsAvailable ]
buttonEnabled: [ _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable, _anySmartShotAvailable ] buttonEnabled: [ _guidedController.showTakeoff, _guidedController.showLand, _guidedController.showRTL, _guidedController.showPause, _anyActionAvailable, _anySmartShotAvailable ]
property bool _anyActionAvailable: _guidedController.showEmergenyStop || _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort property bool _anyActionAvailable: _guidedController.showStartMission || _guidedController.showResumeMission || _guidedController.showChangeAlt || _guidedController.showLandAbort
property bool _anySmartShotAvailable: _guidedController.showOrbit property bool _anySmartShotAvailable: _guidedController.showOrbit
property var _actionModel: [ property var _actionModel: [
{ {
......
...@@ -33,6 +33,8 @@ FlightMap { ...@@ -33,6 +33,8 @@ FlightMap {
property alias scaleState: mapScale.state property alias scaleState: mapScale.state
property var missionController property var missionController
property var geoFenceController
property var rallyPointController
property var guidedActionsController property var guidedActionsController
property var flightWidgets property var flightWidgets
property var rightPanelWidth property var rightPanelWidth
...@@ -137,59 +139,6 @@ FlightMap { ...@@ -137,59 +139,6 @@ FlightMap {
} }
} }
GeoFenceController {
id: geoFenceController
Component.onCompleted: start(false /* editMode */)
}
RallyPointController {
id: rallyPointController
Component.onCompleted: start(false /* editMode */)
}
// The following code is used to track vehicle states such that we prompt to remove mission from vehicle when mission completes
property bool vehicleArmed: _activeVehicle ? _activeVehicle.armed : false
property bool vehicleWasArmed: false
property bool vehicleInMissionFlightMode: _activeVehicle ? (_activeVehicle.flightMode === _activeVehicle.missionFlightMode) : false
property bool promptForMissionRemove: false
onVehicleArmedChanged: {
if (vehicleArmed) {
if (!promptForMissionRemove) {
promptForMissionRemove = vehicleInMissionFlightMode
vehicleWasArmed = true
}
} else {
if (promptForMissionRemove && (missionController.containsItems || geoFenceController.containsItems || rallyPointController.containsItems)) {
qgcView.showDialog(removeMissionDialogComponent, qsTr("Flight complete"), showDialogDefaultWidth, StandardButton.No | StandardButton.Yes)
}
promptForMissionRemove = false
}
}
onVehicleInMissionFlightModeChanged: {
if (!promptForMissionRemove && vehicleArmed) {
promptForMissionRemove = true
}
}
Component {
id: removeMissionDialogComponent
QGCViewMessage {
message: qsTr("Do you want to remove the mission from the vehicle?")
function accept() {
missionController.removeAllFromVehicle()
geoFenceController.removeAllFromVehicle()
rallyPointController.removeAllFromVehicle()
hideDialog()
}
}
}
ExclusiveGroup { ExclusiveGroup {
id: _mapTypeButtonsExclusiveGroup id: _mapTypeButtonsExclusiveGroup
} }
...@@ -239,7 +188,7 @@ FlightMap { ...@@ -239,7 +188,7 @@ FlightMap {
delegate: MissionItemMapVisual { delegate: MissionItemMapVisual {
map: flightMap map: flightMap
onClicked: guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, object.sequenceNumber) onClicked: guidedActionsController.confirmAction(guidedActionsController.actionSetWaypoint, Math.max(object.sequenceNumber, 1))
} }
} }
......
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