diff --git a/src/FlightDisplay/GuidedActionsController.qml b/src/FlightDisplay/GuidedActionsController.qml index 68ed0b0c9e5..fa8e19bb7f6 100644 --- a/src/FlightDisplay/GuidedActionsController.qml +++ b/src/FlightDisplay/GuidedActionsController.qml @@ -58,6 +58,7 @@ Item { readonly property string setHomeTitle: qsTr("Set Home") readonly property string actionListTitle: qsTr("Action") readonly property string setEstimatorOriginTitle: qsTr("Set Estimator origin") + readonly property string setFlightMode: qsTr("Set Flight Mode") readonly property string armMessage: qsTr("Arm the vehicle.") readonly property string forceArmMessage: qsTr("WARNING: This will force arming of the vehicle bypassing any safety checks.") @@ -84,6 +85,7 @@ Item { readonly property string roiMessage: qsTr("Make the specified location a Region Of Interest.") readonly property string setHomeMessage: qsTr("Set vehicle home as the specified location. This will affect Return to Home position") readonly property string setEstimatorOriginMessage: qsTr("Make the specified location the estimator origin.") + readonly property string setFlightModeMessage: qsTr("Set the vehicle flight mode to %1").arg(_actionData) readonly property int actionRTL: 1 readonly property int actionLand: 2 @@ -113,8 +115,8 @@ Item { readonly property int actionGripper: 26 readonly property int actionSetHome: 27 readonly property int actionSetEstimatorOrigin: 28 + readonly property int actionSetFlightMode: 29 - property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle property var _flyViewSettings: QGroundControl.settingsManager.flyViewSettings property var _unitsConversion: QGroundControl.unitsConversion @@ -538,6 +540,10 @@ Item { confirmDialog.title = setEstimatorOriginTitle confirmDialog.message = setEstimatorOriginMessage break + case actionSetFlightMode: + confirmDialog.title = setFlightMode + confirmDialog.message = setFlightModeMessage + break default: console.warn("Unknown actionCode", actionCode) return @@ -644,6 +650,9 @@ Item { case actionSetEstimatorOrigin: _activeVehicle.setEstimatorOrigin(actionData) break + case actionSetFlightMode: + _activeVehicle.flightMode = actionData + break default: console.warn(qsTr("Internal error: unknown actionCode"), actionCode) break diff --git a/src/UI/toolbar/FlightModeIndicator.qml b/src/UI/toolbar/FlightModeIndicator.qml index 03536f9cf3d..6957722cc31 100644 --- a/src/UI/toolbar/FlightModeIndicator.qml +++ b/src/UI/toolbar/FlightModeIndicator.qml @@ -144,7 +144,8 @@ RowLayout { parent.children[1].toggle() parent.children[1].clicked() } else { - activeVehicle.flightMode = modelData + var controller = globals.guidedControllerFlyView + controller.confirmAction(controller.actionSetFlightMode, modelData) mainWindow.closeIndicatorDrawer() } }