diff --git a/src/PlanView/PlanView.qml b/src/PlanView/PlanView.qml index 3b8fdc999ebf5e483d88641173e95840f1aa61d0..d22dc46e3d57fd9ee3fe55a31c446a1d1eaa8424 100644 --- a/src/PlanView/PlanView.qml +++ b/src/PlanView/PlanView.qml @@ -115,6 +115,40 @@ QGCView { } } + Component { + id: activeMissionUploadDialogComponent + + QGCViewDialog { + + Column { + anchors.fill: parent + spacing: ScreenTools.defaultFontPixelHeight + + QGCLabel { + width: parent.width + wrapMode: Text.WordWrap + text: qsTr("Your vehicle is currently flying a mission. In order to upload a new or modified mission the current mission will be paused.") + } + + QGCLabel { + width: parent.width + wrapMode: Text.WordWrap + text: qsTr("After the mission is uploaded you can adjust the current waypoint and start the mission.") + } + + QGCButton { + text: qsTr("Pause and Upload") + onClicked: { + _activeVehicle.flightMode = _activeVehicle.pauseFlightMode + missionController.sendToVehicle() + toolbar.showFlyView() + hideDialog() + } + } + } + } + } + MissionController { id: missionController @@ -127,7 +161,7 @@ QGCView { function _denyUpload() { if (_activeVehicle && _activeVehicle.armed && _activeVehicle.flightMode === _activeVehicle.missionFlightMode) { - _qgcView.showMessage(qsTr("Mission Upload"), qsTr("Your vehicle is currently flying a mission. Upload is not allowed."), StandardButton.Ok) + _qgcView.showDialog(activeMissionUploadDialogComponent, qsTr("Mission Upload"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel) return true } else { return false @@ -137,7 +171,9 @@ QGCView { // Users is switching away from Plan View function uploadOnSwitch() { if (missionController.dirty && _autoSync) { - if (!_denyUpload()) { + if (_denyUpload()) { + return false + } else { sendToVehicle() } } @@ -145,9 +181,9 @@ QGCView { } function upload() { - if (!_denyUpload()) { - sendToVehicle() - } + if (!_denyUpload()) { + sendToVehicle() + } } function loadFromSelectedFile() {