Commit 0a745de8 authored by DonLakeFlyer's avatar DonLakeFlyer

Allow exit from Fly with auto-sync on and no upload

parent d1e85330
...@@ -42,15 +42,16 @@ QGCView { ...@@ -42,15 +42,16 @@ QGCView {
readonly property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2) readonly property real _toolButtonTopMargin: parent.height - ScreenTools.availableHeight + (ScreenTools.defaultFontPixelHeight / 2)
readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276) readonly property var _defaultVehicleCoordinate: QtPositioning.coordinate(37.803784, -122.462276)
property var _visualItems: missionController.visualItems property var _visualItems: missionController.visualItems
property var _currentMissionItem property var _currentMissionItem
property int _currentMissionIndex: 0 property int _currentMissionIndex: 0
property bool _lightWidgetBorders: editorMap.isSatelliteMap property bool _lightWidgetBorders: editorMap.isSatelliteMap
property bool _addWaypointOnClick: false property bool _addWaypointOnClick: false
property bool _singleComplexItem: missionController.complexMissionItemNames.length === 1 property bool _singleComplexItem: missionController.complexMissionItemNames.length === 1
property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight property real _toolbarHeight: _qgcView.height - ScreenTools.availableHeight
property int _editingLayer: _layerMission property int _editingLayer: _layerMission
property bool _autoSync: QGroundControl.settingsManager.appSettings.automaticMissionUpload.rawValue != 0 property bool _autoSync: QGroundControl.settingsManager.appSettings.automaticMissionUpload.rawValue != 0
property bool _switchToFlyAfterUpload: false
/// The controller which should be called for load/save, send to/from vehicle calls /// The controller which should be called for load/save, send to/from vehicle calls
property var _syncDropDownController: missionController property var _syncDropDownController: missionController
...@@ -141,8 +142,19 @@ QGCView { ...@@ -141,8 +142,19 @@ QGCView {
onClicked: { onClicked: {
_activeVehicle.flightMode = _activeVehicle.pauseFlightMode _activeVehicle.flightMode = _activeVehicle.pauseFlightMode
missionController.sendToVehicle() missionController.sendToVehicle()
toolbar.showFlyView()
hideDialog() hideDialog()
if (_switchToFlyAfterUpload) {
toolbar.showFlyView()
}
}
}
QGCButton {
text: qsTr("Exit planning (no upload)")
visible: _switchToFlyAfterUpload
onClicked: {
hideDialog()
toolbar.showFlyView()
} }
} }
} }
...@@ -159,8 +171,9 @@ QGCView { ...@@ -159,8 +171,9 @@ QGCView {
setCurrentItem(0) setCurrentItem(0)
} }
function _denyUpload() { function _denyUpload(switchToFly) {
if (_activeVehicle && _activeVehicle.armed && _activeVehicle.flightMode === _activeVehicle.missionFlightMode) { if (_activeVehicle && _activeVehicle.armed && _activeVehicle.flightMode === _activeVehicle.missionFlightMode) {
_switchToFlyAfterUpload = switchToFly
_qgcView.showDialog(activeMissionUploadDialogComponent, qsTr("Mission Upload"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel) _qgcView.showDialog(activeMissionUploadDialogComponent, qsTr("Mission Upload"), _qgcView.showDialogDefaultWidth, StandardButton.Cancel)
return true return true
} else { } else {
...@@ -171,7 +184,7 @@ QGCView { ...@@ -171,7 +184,7 @@ QGCView {
// Users is switching away from Plan View // Users is switching away from Plan View
function uploadOnSwitch() { function uploadOnSwitch() {
if (missionController.dirty && _autoSync) { if (missionController.dirty && _autoSync) {
if (_denyUpload()) { if (_denyUpload(true /* switchToFly */)) {
return false return false
} else { } else {
sendToVehicle() sendToVehicle()
...@@ -181,7 +194,7 @@ QGCView { ...@@ -181,7 +194,7 @@ QGCView {
} }
function upload() { function upload() {
if (!_denyUpload()) { if (!_denyUpload(false /* switchToFly */)) {
sendToVehicle() sendToVehicle()
} }
} }
...@@ -376,6 +389,7 @@ QGCView { ...@@ -376,6 +389,7 @@ QGCView {
mapName: "MissionEditor" mapName: "MissionEditor"
allowGCSLocationCenter: true allowGCSLocationCenter: true
allowVehicleLocationCenter: true allowVehicleLocationCenter: true
planView: true
// This is the center rectangle of the map which is not obscured by tools // This is the center rectangle of the map which is not obscured by tools
property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight) property rect centerViewport: Qt.rect(_leftToolWidth, _toolbarHeight, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight - _toolbarHeight)
......
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