PlanView.qml 47.4 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
Don Gagne's avatar
Don Gagne committed
9 10


11 12
import QtQuick          2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
13
import QtQuick.Dialogs  1.2
14 15 16
import QtLocation       5.3
import QtPositioning    5.3
import QtQuick.Layouts  1.2
17
import QtQuick.Window   2.2
Don Gagne's avatar
Don Gagne committed
18

19 20 21 22 23 24 25 26 27 28 29
import QGroundControl                   1.0
import QGroundControl.FlightMap         1.0
import QGroundControl.ScreenTools       1.0
import QGroundControl.Controls          1.0
import QGroundControl.FactSystem        1.0
import QGroundControl.FactControls      1.0
import QGroundControl.Palette           1.0
import QGroundControl.Controllers       1.0
import QGroundControl.ShapeFileHelper   1.0
import QGroundControl.Airspace          1.0
import QGroundControl.Airmap            1.0
Don Gagne's avatar
Don Gagne committed
30 31

/// Mission Editor
Don Gagne's avatar
Don Gagne committed
32

33
Item {
34

Gus Grubba's avatar
Gus Grubba committed
35 36
    property bool planControlColapsed: false

37
    readonly property int   _decimalPlaces:             8
Gus Grubba's avatar
Gus Grubba committed
38
    readonly property real  _horizontalMargin:          ScreenTools.defaultFontPixelWidth  * 0.5
39
    readonly property real  _margin:                    ScreenTools.defaultFontPixelHeight * 0.5
Gus Grubba's avatar
Gus Grubba committed
40
    readonly property real  _radius:                    ScreenTools.defaultFontPixelWidth  * 0.5
41
    readonly property real  _rightPanelWidth:           Math.min(parent.width / 3, ScreenTools.defaultFontPixelWidth * 30)
Gus Grubba's avatar
Gus Grubba committed
42
    readonly property real  _toolButtonTopMargin:       ScreenTools.defaultFontPixelHeight * 0.5
43 44
    readonly property var   _defaultVehicleCoordinate:  QtPositioning.coordinate(37.803784, -122.462276)
    readonly property bool  _waypointsOnlyMode:         QGroundControl.corePlugin.options.missionWaypointsOnly
45

Gus Grubba's avatar
Gus Grubba committed
46
    property bool   _airspaceEnabled:                    QGroundControl.airmapSupported ? (QGroundControl.settingsManager.airMapSettings.enableAirMap.rawValue && QGroundControl.airspaceManager.connected): false
Gus Grubba's avatar
Gus Grubba committed
47 48 49 50 51 52 53 54
    property var    _missionController:                 _planMasterController.missionController
    property var    _geoFenceController:                _planMasterController.geoFenceController
    property var    _rallyPointController:              _planMasterController.rallyPointController
    property var    _visualItems:                       _missionController.visualItems
    property bool   _lightWidgetBorders:                editorMap.isSatelliteMap
    property bool   _addWaypointOnClick:                false
    property bool   _addROIOnClick:                     false
    property bool   _singleComplexItem:                 _missionController.complexMissionItemNames.length === 1
Gus Grubba's avatar
Gus Grubba committed
55
    property int    _editingLayer:                      bar.currentIndex ? _layers[bar.currentIndex] : _layerMission
Gus Grubba's avatar
Gus Grubba committed
56
    property int    _toolStripBottom:                   toolStrip.height + toolStrip.y
57
    property var    _appSettings:                       QGroundControl.settingsManager.appSettings
58

Gus Grubba's avatar
Gus Grubba committed
59 60
    readonly property var       _layers:                [_layerMission, _layerGeoFence, _layerRallyPoints]

61 62 63 64
    readonly property int       _layerMission:              1
    readonly property int       _layerGeoFence:             2
    readonly property int       _layerRallyPoints:          3
    readonly property string    _armedVehicleUploadPrompt:  qsTr("Vehicle is currently armed. Do you want to upload the mission to the vehicle?")
65

66 67
    function addComplexItem(complexItemName) {
        var coordinate = editorMap.center
68
        coordinate.latitude  = coordinate.latitude.toFixed(_decimalPlaces)
69
        coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
70
        coordinate.altitude  = coordinate.altitude.toFixed(_decimalPlaces)
71
        insertComplexMissionItem(complexItemName, coordinate, _missionController.visualItems.count)
72 73 74
    }

    function insertComplexMissionItem(complexItemName, coordinate, index) {
75
        var sequenceNumber = _missionController.insertComplexMissionItem(complexItemName, coordinate, index)
76
        _missionController.setCurrentPlanViewIndex(sequenceNumber, true)
77 78
    }

79 80
    function insertComplexMissionItemFromKMLOrSHP(complexItemName, file, index) {
        var sequenceNumber = _missionController.insertComplexMissionItemFromKMLOrSHP(complexItemName, file, index)
81 82 83
        _missionController.setCurrentPlanViewIndex(sequenceNumber, true)
    }

84
    function updateAirspace(reset) {
85 86 87 88
        if(_airspaceEnabled) {
            var coordinateNW = editorMap.toCoordinate(Qt.point(0,0), false /* clipToViewPort */)
            var coordinateSE = editorMap.toCoordinate(Qt.point(width,height), false /* clipToViewPort */)
            if(coordinateNW.isValid && coordinateSE.isValid) {
89
                QGroundControl.airspaceManager.setROI(coordinateNW, coordinateSE, true /*planView*/, reset)
90 91 92 93
            }
        }
    }

94 95 96 97 98
    property bool _firstMissionLoadComplete:    false
    property bool _firstFenceLoadComplete:      false
    property bool _firstRallyLoadComplete:      false
    property bool _firstLoadComplete:           false

99
    MapFitFunctions {
100
        id:                         mapFitFunctions  // The name for this id cannot be changed without breaking references outside of this code. Beware!
101 102
        map:                        editorMap
        usePlannedHomePosition:     true
103
        planMasterController:       _planMasterController
104 105
    }

106
    on_AirspaceEnabledChanged: {
107
        if(QGroundControl.airmapSupported) {
108 109
            if(_airspaceEnabled) {
                planControlColapsed = QGroundControl.airspaceManager.airspaceVisible
110
                updateAirspace(true)
111 112 113
            } else {
                planControlColapsed = false
            }
114
        } else {
Gus Grubba's avatar
Gus Grubba committed
115 116 117 118
            planControlColapsed = false
        }
    }

DonLakeFlyer's avatar
DonLakeFlyer committed
119
    Connections {
Gus Grubba's avatar
Gus Grubba committed
120
        target: _appSettings ? _appSettings.defaultMissionItemAltitude : null
DonLakeFlyer's avatar
DonLakeFlyer committed
121 122
        onRawValueChanged: {
            if (_visualItems.count > 1) {
123
                mainWindow.showComponentDialog(applyNewAltitude, qsTr("Apply new alititude"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
DonLakeFlyer's avatar
DonLakeFlyer committed
124 125 126 127 128 129 130 131 132 133
            }
        }
    }

    Component {
        id: applyNewAltitude
        QGCViewMessage {
            message:    qsTr("You have changed the default altitude for mission items. Would you like to apply that altitude to all the items in the current mission?")
            function accept() {
                hideDialog()
134
                _missionController.applyDefaultMissionAltitude()
DonLakeFlyer's avatar
DonLakeFlyer committed
135 136 137 138
            }
        }
    }

139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
    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: {
Gus Grubba's avatar
Gus Grubba committed
158
                        activeVehicle.flightMode = activeVehicle.pauseFlightMode
159
                        _planMasterController.sendToVehicle()
160
                        hideDialog()
161 162 163 164 165 166
                    }
                }
            }
        }
    }

Gus Grubba's avatar
Gus Grubba committed
167
    Connections {
168
        target: QGroundControl.airspaceManager
169
        onAirspaceVisibleChanged: {
170
            planControlColapsed = QGroundControl.airspaceManager.airspaceVisible
Gus Grubba's avatar
Gus Grubba committed
171 172 173
        }
    }

174 175 176 177 178 179 180
    Component {
        id: noItemForKML
        QGCViewMessage {
            message:    qsTr("You need at least one item to create a KML.")
        }
    }

181
    PlanMasterController {
Gus Grubba's avatar
Gus Grubba committed
182
        id: _planMasterController
183

184
        Component.onCompleted: {
185
            _planMasterController.start(false /* flyView */)
186
            _missionController.setCurrentPlanViewIndex(0, true)
Gus Grubba's avatar
Gus Grubba committed
187
            mainWindow.planMasterControllerPlan = _planMasterController
188 189
        }

190
        function waitingOnDataMessage() {
191
            mainWindow.showMessageDialog(qsTr("Unable to Save/Upload"), qsTr("Plan is waiting on terrain data from server for correct altitude values."))
192 193
        }

194
        function upload() {
195 196 197 198
            if (!readyForSaveSend()) {
                waitingOnDataMessage()
                return
            }
Gus Grubba's avatar
Gus Grubba committed
199
            if (activeVehicle && activeVehicle.armed && activeVehicle.flightMode === activeVehicle.missionFlightMode) {
200
                mainWindow.showComponentDialog(activeMissionUploadDialogComponent, qsTr("Plan Upload"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
201
            } else {
202 203
                sendToVehicle()
            }
DonLakeFlyer's avatar
DonLakeFlyer committed
204 205
        }

206
        function loadFromSelectedFile() {
207
            fileDialog.title =          qsTr("Select Plan File")
DonLakeFlyer's avatar
DonLakeFlyer committed
208
            fileDialog.planFiles =      true
209
            fileDialog.selectExisting = true
Gus Grubba's avatar
Gus Grubba committed
210
            fileDialog.nameFilters =    _planMasterController.loadNameFilters
211 212
            fileDialog.fileExtension =  _appSettings.planFileExtension
            fileDialog.fileExtension2 = _appSettings.missionFileExtension
213
            fileDialog.openForLoad()
214 215 216
        }

        function saveToSelectedFile() {
217 218 219 220
            if (!readyForSaveSend()) {
                waitingOnDataMessage()
                return
            }
221
            fileDialog.title =          qsTr("Save Plan")
222
            fileDialog.planFiles =      true
223
            fileDialog.selectExisting = false
Gus Grubba's avatar
Gus Grubba committed
224
            fileDialog.nameFilters =    _planMasterController.saveNameFilters
225 226
            fileDialog.fileExtension =  _appSettings.planFileExtension
            fileDialog.fileExtension2 = _appSettings.missionFileExtension
227
            fileDialog.openForSave()
228 229
        }

230
        function fitViewportToItems() {
231
            mapFitFunctions.fitMapViewportToMissionItems()
232
        }
233

234 235
        function loadShapeFromSelectedFile() {
            fileDialog.title =          qsTr("Load Shape")
236 237
            fileDialog.planFiles =      false
            fileDialog.selectExisting = true
238 239 240
            fileDialog.nameFilters =    ShapeFileHelper.fileDialogKMLOrSHPFilters
            fileDialog.fileExtension =  _appSettings.kmlFileExtension
            fileDialog.fileExtension2 = _appSettings.shpFileExtension
241 242 243
            fileDialog.openForLoad()
        }

244
        function saveKmlToSelectedFile() {
245 246 247 248
            if (!readyForSaveSend()) {
                waitingOnDataMessage()
                return
            }
249
            fileDialog.title =          qsTr("Save KML")
250
            fileDialog.planFiles =      false
251
            fileDialog.selectExisting = false
252 253
            fileDialog.nameFilters =    ShapeFileHelper.fileDialogKMLFilters
            fileDialog.fileExtension =  _appSettings.kmlFileExtension
254
            fileDialog.fileExtension2 = ""
255 256
            fileDialog.openForSave()
        }
257
    }
258

259 260
    Connections {
        target: _missionController
261
        onNewItemsFromVehicle: {
Gus Grubba's avatar
Gus Grubba committed
262
            if (_visualItems && _visualItems.count !== 1) {
263 264
                mapFitFunctions.fitMapViewportToMissionItems()
            }
265
            _missionController.setCurrentPlanViewIndex(0, true)
266 267
        }
    }
268

269 270 271 272
    /// Inserts a new simple mission item
    ///     @param coordinate Location to insert item
    ///     @param index Insert item at this index
    function insertSimpleMissionItem(coordinate, index) {
273
        var sequenceNumber = _missionController.insertSimpleMissionItem(coordinate, index)
274
        _missionController.setCurrentPlanViewIndex(sequenceNumber, true)
275 276
    }

277 278 279 280 281 282 283
    /// Inserts a new ROI mission item
    ///     @param coordinate Location to insert item
    ///     @param index Insert item at this index
    function insertROIMissionItem(coordinate, index) {
        var sequenceNumber = _missionController.insertROIMissionItem(coordinate, index)
        _missionController.setCurrentPlanViewIndex(sequenceNumber, true)
        _addROIOnClick = false
284
        toolStrip.lastClickedButton.checked = false
285 286
    }

287 288
    property int _moveDialogMissionItemIndex

289 290
    QGCFileDialog {
        id:             fileDialog
Gus Grubba's avatar
Gus Grubba committed
291
        folder:         _appSettings ? _appSettings.missionSavePath : ""
292

293 294
        property bool planFiles: true    ///< true: working with plan files, false: working with kml file

295
        onAcceptedForSave: {
296
            if (planFiles) {
Gus Grubba's avatar
Gus Grubba committed
297
                _planMasterController.saveToFile(file)
298
            } else {
Gus Grubba's avatar
Gus Grubba committed
299
                _planMasterController.saveToKml(file)
300
            }
301
            close()
302 303
        }

304
        onAcceptedForLoad: {
305
            if (planFiles) {
Gus Grubba's avatar
Gus Grubba committed
306 307
                _planMasterController.loadFromFile(file)
                _planMasterController.fitViewportToItems()
308 309
                _missionController.setCurrentPlanViewIndex(0, true)
            } else {
310 311
                var retList = ShapeFileHelper.determineShapeType(file)
                if (retList[0] == ShapeFileHelper.Error) {
312
                    mainWindow.showMessageDialog("Error", retList[1])
313
                } else if (retList[0] == ShapeFileHelper.Polygon) {
Gus Grubba's avatar
Gus Grubba committed
314
                     var editVehicle = activeVehicle ? activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
315 316 317 318
                    if (editVehicle.fixedWing) {
                        insertComplexMissionItemFromKMLOrSHP(_missionController.surveyComplexItemName, file, -1)
                    } else {
                        polygonSelectPatternFile = file
319
                        mainWindow.showComponentDialog(patternPolygonSelectDialog, fileDialog.title, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
320
                    }
321 322
                } else if (retList[0] == ShapeFileHelper.Polyline) {
                    insertComplexMissionItemFromKMLOrSHP(_missionController.corridorScanComplexItemName, file, -1)
323 324
                }
            }
325
            close()
326 327 328
        }
    }

329
    property string polygonSelectPatternFile
330
    Component {
331
        id: patternPolygonSelectDialog
332 333 334 335 336 337 338 339
        QGCViewDialog {
            function accept() {
                var complexItemName
                if (surveyRadio.checked) {
                    complexItemName = _missionController.surveyComplexItemName
                } else {
                    complexItemName = _missionController.structureScanComplexItemName
                }
340
                insertComplexMissionItemFromKMLOrSHP(complexItemName, polygonSelectPatternFile, -1)
341 342 343 344 345 346 347 348 349 350
                hideDialog()
            }
            Column {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        ScreenTools.defaultFontPixelHeight
                QGCLabel {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    wrapMode:       Text.WordWrap
351
                    text:           qsTr("Create which pattern type?")
352 353 354 355 356 357 358 359 360 361 362 363 364
                }
                QGCRadioButton {
                    id:             surveyRadio
                    text:           qsTr("Survey")
                    checked:        true
                }
                QGCRadioButton {
                    text:           qsTr("Structure Scan")
                }
            }
        }
    }

365 366 367 368 369
    Component {
        id: moveDialog
        QGCViewDialog {
            function accept() {
                var toIndex = toCombo.currentIndex
Gus Grubba's avatar
Gus Grubba committed
370
                if (toIndex === 0) {
371 372
                    toIndex = 1
                }
373
                _missionController.moveMissionItem(_moveDialogMissionItemIndex, toIndex)
374 375 376 377 378 379 380 381 382 383 384
                hideDialog()
            }
            Column {
                anchors.left:   parent.left
                anchors.right:  parent.right
                spacing:        ScreenTools.defaultFontPixelHeight

                QGCLabel {
                    anchors.left:   parent.left
                    anchors.right:  parent.right
                    wrapMode:       Text.WordWrap
385
                    text:           qsTr("Move the selected mission item to the be after following mission item:")
386 387 388 389
                }

                QGCComboBox {
                    id:             toCombo
390
                    model:          _visualItems.count
391 392 393 394 395 396
                    currentIndex:   _moveDialogMissionItemIndex
                }
            }
        }
    }

397
    Item {
Don Gagne's avatar
Don Gagne committed
398
        id:             panel
399
        anchors.fill:   parent
Don Gagne's avatar
Don Gagne committed
400

401
        FlightMap {
402 403 404 405 406
            id:                         editorMap
            anchors.fill:               parent
            mapName:                    "MissionEditor"
            allowGCSLocationCenter:     true
            allowVehicleLocationCenter: true
407
            planView:                   true
Don Gagne's avatar
Don Gagne committed
408

409
            // This is the center rectangle of the map which is not obscured by tools
410
            property rect centerViewport:   Qt.rect(_leftToolWidth, 0, editorMap.width - _leftToolWidth - _rightPanelWidth, editorMap.height - _statusHeight)
411

412 413
            property real _leftToolWidth:   toolStrip.x + toolStrip.width
            property real _statusHeight:    waypointValuesDisplay.visible ? editorMap.height - waypointValuesDisplay.y : 0
414

415
            readonly property real animationDuration: 500
416

417 418
            // Initial map position duplicates Fly view position
            Component.onCompleted: editorMap.center = QGroundControl.flightMapPosition
419

420 421 422 423 424 425
            Behavior on zoomLevel {
                NumberAnimation {
                    duration:       editorMap.animationDuration
                    easing.type:    Easing.InOutQuad
                }
            }
426

427 428
            QGCMapPalette { id: mapPal; lightColors: editorMap.isSatelliteMap }

429 430
            onZoomLevelChanged: updateAirspace(false)
            onCenterChanged:    updateAirspace(false)
431

432 433 434
            MouseArea {
                anchors.fill: parent
                onClicked: {
435 436
                    // Take focus to close any previous editing
                    editorMap.focus = true
437 438 439 440
                    var coordinate = editorMap.toCoordinate(Qt.point(mouse.x, mouse.y), false /* clipToViewPort */)
                    coordinate.latitude = coordinate.latitude.toFixed(_decimalPlaces)
                    coordinate.longitude = coordinate.longitude.toFixed(_decimalPlaces)
                    coordinate.altitude = coordinate.altitude.toFixed(_decimalPlaces)
441

442 443 444
                    switch (_editingLayer) {
                    case _layerMission:
                        if (_addWaypointOnClick) {
445
                            insertSimpleMissionItem(coordinate, _missionController.visualItems.count)
446 447 448
                        } else if (_addROIOnClick) {
                            _addROIOnClick = false
                            insertROIMissionItem(coordinate, _missionController.visualItems.count)
449
                        }
450 451
                        break
                    case _layerRallyPoints:
Gus Grubba's avatar
Gus Grubba committed
452
                        if (_rallyPointController.supported && _addWaypointOnClick) {
453
                            _rallyPointController.addPoint(coordinate)
454
                        }
455
                        break
Don Gagne's avatar
Don Gagne committed
456
                    }
Don Gagne's avatar
Don Gagne committed
457
                }
458
            }
Don Gagne's avatar
Don Gagne committed
459

460 461
            // Add the mission item visuals to the map
            Repeater {
462
                model: _editingLayer == _layerMission ? _missionController.visualItems : undefined
463 464
                delegate: MissionItemMapVisual {
                    map:        editorMap
465
                    onClicked:  _missionController.setCurrentPlanViewIndex(sequenceNumber, false)
466
                    visible:    _editingLayer == _layerMission
467
                }
468
            }
469

470 471
            // Add lines between waypoints
            MissionLineView {
472
                model: _editingLayer == _layerMission ? _missionController.waypointLines : undefined
473
            }
474

475 476 477 478 479 480 481 482 483 484 485
            MapItemView {
                model: _editingLayer == _layerMission ? _missionController.directionArrows : undefined

                delegate: MapLineArrow {
                    fromCoord:      object ? object.coordinate1 : undefined
                    toCoord:        object ? object.coordinate2 : undefined
                    arrowPosition:  2
                    z:              QGroundControl.zOrderWaypointLines
                }
            }

486 487 488 489 490 491 492
            // Add the vehicles to the map
            MapItemView {
                model: QGroundControl.multiVehicleManager.vehicles
                delegate:
                    VehicleMapItem {
                    vehicle:        object
                    coordinate:     object.coordinate
493
                    map:            editorMap
494 495
                    size:           ScreenTools.defaultFontPixelHeight * 3
                    z:              QGroundControl.zOrderMapItems - 1
496
                }
497
            }
498

499 500
            GeoFenceMapVisuals {
                map:                    editorMap
501
                myGeoFenceController:   _geoFenceController
502
                interactive:            _editingLayer == _layerGeoFence
503
                homePosition:           _missionController.plannedHomePosition
504 505
                planView:               true
            }
506

507 508
            RallyPointMapVisuals {
                map:                    editorMap
509
                myRallyPointController: _rallyPointController
510 511
                interactive:            _editingLayer == _layerRallyPoints
                planView:               true
512
            }
513

514 515
            // Airspace overlap support
            MapItemView {
516
                model:              _airspaceEnabled && QGroundControl.airspaceManager.airspaceVisible ? QGroundControl.airspaceManager.airspaces.circles : []
517 518 519
                delegate: MapCircle {
                    center:         object.center
                    radius:         object.radius
520
                    color:          object.color
Gus Grubba's avatar
Gus Grubba committed
521 522
                    border.color:   object.lineColor
                    border.width:   object.lineWidth
523 524 525 526
                }
            }

            MapItemView {
527
                model:              _airspaceEnabled && QGroundControl.airspaceManager.airspaceVisible ? QGroundControl.airspaceManager.airspaces.polygons : []
528 529
                delegate: MapPolygon {
                    path:           object.polygon
530
                    color:          object.color
Gus Grubba's avatar
Gus Grubba committed
531 532
                    border.color:   object.lineColor
                    border.width:   object.lineWidth
533 534
                }
            }
535
        }
536

537 538
        //-----------------------------------------------------------
        // Left tool strip
Gus Grubba's avatar
Gus Grubba committed
539
        ToolStrip {
540
            id:                 toolStrip
541
            anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
542 543 544 545
            anchors.left:       parent.left
            anchors.topMargin:  ScreenTools.defaultFontPixelHeight * 0.5
            anchors.top:        parent.top
            z:                  QGroundControl.zOrderWidgets
Gus Grubba's avatar
Gus Grubba committed
546
            maxHeight:          mapScale.y - toolStrip.y
547

Gus Grubba's avatar
Gus Grubba committed
548
            property bool _isRally:     _editingLayer == _layerRallyPoints
549

Gus Grubba's avatar
Gus Grubba committed
550 551 552 553 554 555
            model: [
                {
                    name:               qsTr("Fly"),
                    iconSource:         "/qmlimages/PaperPlane.svg",
                    buttonEnabled:      true,
                    buttonVisible:      true,
556
                },
557
                {
Gus Grubba's avatar
Gus Grubba committed
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595
                    name:               qsTr("File"),
                    iconSource:         "/qmlimages/MapSync.svg",
                    buttonEnabled:      !_planMasterController.syncInProgress,
                    buttonVisible:      true,
                    showAlternateIcon:  _planMasterController.dirty,
                    alternateIconSource:"/qmlimages/MapSyncChanged.svg",
                    dropPanelComponent: syncDropPanel
                },
                {
                    name:               _editingLayer == _layerRallyPoints ? qsTr("Rally Point") : qsTr("Waypoint"),
                    iconSource:         "/qmlimages/MapAddMission.svg",
                    buttonEnabled:      true,
                    buttonVisible:      true,
                    toggle:             true,
                    checked:            _addWaypointOnClick
                },
                {
                    name:               qsTr("ROI"),
                    iconSource:         "/qmlimages/MapAddMission.svg",
                    buttonEnabled:      true,
                    buttonVisible:      !_isRally && _waypointsOnlyMode,
                    toggle:             true
                },
                {
                    name:               _singleComplexItem ? _missionController.complexMissionItemNames[0] : qsTr("Pattern"),
                    iconSource:         "/qmlimages/MapDrawShape.svg",
                    buttonEnabled:      true,
                    buttonVisible:      !_isRally,
                    dropPanelComponent: _singleComplexItem ? undefined : patternDropPanel
                },
                {
                    name:               qsTr("Center"),
                    iconSource:         "/qmlimages/MapCenter.svg",
                    buttonEnabled:      true,
                    buttonVisible:      true,
                    dropPanelComponent: centerMapDropPanel
                }
            ]
596

Gus Grubba's avatar
Gus Grubba committed
597 598
            onClicked: {
                switch (index) {
599 600 601 602
                case 0:
                    mainWindow.showFlyView()
                    break;
                case 2:
Gus Grubba's avatar
Gus Grubba committed
603 604 605 606 607 608
                    if(_addWaypointOnClick) {
                        //-- Toggle it off
                        _addWaypointOnClick = false
                        _addROIOnClick = false
                        setChecked(index, false)
                    } else {
609
                        _addWaypointOnClick = checked
610
                        _addROIOnClick = false
Gus Grubba's avatar
Gus Grubba committed
611 612
                    }
                    break
613
                case 3:
Gus Grubba's avatar
Gus Grubba committed
614 615 616
                    _addROIOnClick = checked
                    _addWaypointOnClick = false
                    break
617
                case 4:
Gus Grubba's avatar
Gus Grubba committed
618 619 620 621
                    if (_singleComplexItem) {
                        addComplexItem(_missionController.complexMissionItemNames[0])
                    }
                    break
622 623
                }
            }
Gus Grubba's avatar
Gus Grubba committed
624
        }
625

Gus Grubba's avatar
Gus Grubba committed
626
        //-----------------------------------------------------------
627 628 629
        // Right pane for mission editing controls
        Rectangle {
            id:                 rightPanel
630
            height:             parent.height
631 632
            width:              _rightPanelWidth
            color:              qgcPal.window
633
            opacity:            planExpanded.visible ? 0.2 : 0
Gus Grubba's avatar
Gus Grubba committed
634 635 636
            anchors.bottom:     parent.bottom
            anchors.right:      parent.right
            anchors.rightMargin: ScreenTools.defaultFontPixelWidth
637
        }
Gus Grubba's avatar
Gus Grubba committed
638 639
        //-------------------------------------------------------
        // Right Panel Controls
640
        Item {
Gus Grubba's avatar
Gus Grubba committed
641
            anchors.fill:           rightPanel
Gus Grubba's avatar
Gus Grubba committed
642
            anchors.topMargin:      _toolButtonTopMargin
Gus Grubba's avatar
Gus Grubba committed
643 644 645
            DeadMouseArea {
                anchors.fill:   parent
            }
Gus Grubba's avatar
Gus Grubba committed
646 647
            Column {
                id:                 rightControls
Gus Grubba's avatar
Gus Grubba committed
648
                spacing:            ScreenTools.defaultFontPixelHeight * 0.5
649 650
                anchors.left:       parent.left
                anchors.right:      parent.right
Gus Grubba's avatar
Gus Grubba committed
651 652 653 654
                anchors.top:        parent.top
                //-------------------------------------------------------
                // Airmap Airspace Control
                AirspaceControl {
Gus Grubba's avatar
Gus Grubba committed
655 656
                    id:             airspaceControl
                    width:          parent.width
657
                    visible:        _airspaceEnabled
658
                    planView:       true
659
                    showColapse:    true
660
                }
Gus Grubba's avatar
Gus Grubba committed
661 662 663 664
                //-------------------------------------------------------
                // Mission Controls (Colapsed)
                Rectangle {
                    width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
665
                    height:     planControlColapsed ? colapsedRow.height + ScreenTools.defaultFontPixelHeight : 0
Gus Grubba's avatar
Gus Grubba committed
666 667
                    color:      qgcPal.missionItemEditor
                    radius:     _radius
668
                    visible:    planControlColapsed && _airspaceEnabled
Gus Grubba's avatar
Gus Grubba committed
669 670 671 672 673 674 675
                    Row {
                        id:                     colapsedRow
                        spacing:                ScreenTools.defaultFontPixelWidth
                        anchors.left:           parent.left
                        anchors.leftMargin:     ScreenTools.defaultFontPixelWidth
                        anchors.verticalCenter: parent.verticalCenter
                        QGCColoredImage {
676 677 678 679 680
                            width:              height
                            height:             ScreenTools.defaultFontPixelWidth * 2.5
                            sourceSize.height:  height
                            source:             "qrc:/res/waypoint.svg"
                            color:              qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
681 682 683
                            anchors.verticalCenter: parent.verticalCenter
                        }
                        QGCLabel {
684 685
                            text:               qsTr("Plan")
                            color:              qgcPal.text
Gus Grubba's avatar
Gus Grubba committed
686
                            anchors.verticalCenter: parent.verticalCenter
687 688
                        }
                    }
Gus Grubba's avatar
Gus Grubba committed
689 690 691 692
                    QGCColoredImage {
                        width:                  height
                        height:                 ScreenTools.defaultFontPixelWidth * 2.5
                        sourceSize.height:      height
693
                        source:                 QGroundControl.airmapSupported ? "qrc:/airmap/expand.svg" : ""
694
                        color:                  "white"
695
                        visible:                QGroundControl.airmapSupported
Gus Grubba's avatar
Gus Grubba committed
696 697 698 699 700 701
                        anchors.right:          parent.right
                        anchors.rightMargin:    ScreenTools.defaultFontPixelWidth
                        anchors.verticalCenter: parent.verticalCenter
                    }
                    MouseArea {
                        anchors.fill:   parent
702
                        enabled:        QGroundControl.airmapSupported
Gus Grubba's avatar
Gus Grubba committed
703
                        onClicked: {
704
                            QGroundControl.airspaceManager.airspaceVisible = false
Gus Grubba's avatar
Gus Grubba committed
705 706
                        }
                    }
Gus Grubba's avatar
Gus Grubba committed
707
                }
Gus Grubba's avatar
Gus Grubba committed
708 709 710 711 712
                //-------------------------------------------------------
                // Mission Controls (Expanded)
                Rectangle {
                    id:         planExpanded
                    width:      parent.width
Gus Grubba's avatar
Gus Grubba committed
713
                    height:     (!planControlColapsed || !_airspaceEnabled) ? bar.height + ScreenTools.defaultFontPixelHeight : 0
Gus Grubba's avatar
Gus Grubba committed
714 715
                    color:      qgcPal.missionItemEditor
                    radius:     _radius
Gus Grubba's avatar
Gus Grubba committed
716
                    visible:    (!planControlColapsed || !_airspaceEnabled) && QGroundControl.corePlugin.options.enablePlanViewSelector
Gus Grubba's avatar
Gus Grubba committed
717
                    Item {
Gus Grubba's avatar
Gus Grubba committed
718
                        height:             bar.height
Gus Grubba's avatar
Gus Grubba committed
719 720
                        anchors.left:       parent.left
                        anchors.right:      parent.right
Gus Grubba's avatar
Gus Grubba committed
721
                        anchors.margins:    ScreenTools.defaultFontPixelWidth
Gus Grubba's avatar
Gus Grubba committed
722
                        anchors.verticalCenter: parent.verticalCenter
Gus Grubba's avatar
Gus Grubba committed
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739
                        QGCTabBar {
                            id:             bar
                            width:          parent.width
                            anchors.centerIn: parent
                            Component.onCompleted: {
                                currentIndex = 0
                            }
                            QGCTabButton {
                                text:       qsTr("Mission")
                            }
                            QGCTabButton {
                                text:       qsTr("Fence")
                                enabled:    _geoFenceController.supported
                            }
                            QGCTabButton {
                                text:       qsTr("Rally")
                                enabled:    _rallyPointController.supported
Gus Grubba's avatar
Gus Grubba committed
740 741 742 743 744 745 746 747 748 749 750 751
                            }
                        }
                    }
                }
            }
            //-------------------------------------------------------
            // Mission Item Editor
            Item {
                id:                     missionItemEditor
                anchors.left:           parent.left
                anchors.right:          parent.right
                anchors.top:            rightControls.bottom
Gus Grubba's avatar
Gus Grubba committed
752
                anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.25
Gus Grubba's avatar
Gus Grubba committed
753 754 755 756
                anchors.bottom:         parent.bottom
                anchors.bottomMargin:   ScreenTools.defaultFontPixelHeight * 0.25
                visible:                _editingLayer == _layerMission && !planControlColapsed
                QGCListView {
Gus Grubba's avatar
Gus Grubba committed
757 758 759 760 761 762 763 764
                    id:                 missionItemEditorListView
                    anchors.fill:       parent
                    spacing:            ScreenTools.defaultFontPixelHeight / 4
                    orientation:        ListView.Vertical
                    model:              _missionController.visualItems
                    cacheBuffer:        Math.max(height * 2, 0)
                    clip:               true
                    currentIndex:       _missionController.currentPlanViewIndex
Gus Grubba's avatar
Gus Grubba committed
765
                    highlightMoveDuration: 250
Gus Grubba's avatar
Gus Grubba committed
766
                    visible:            _editingLayer == _layerMission && !planControlColapsed
Gus Grubba's avatar
Gus Grubba committed
767 768
                    //-- List Elements
                    delegate: MissionItemEditor {
Gus Grubba's avatar
Gus Grubba committed
769
                        map:            editorMap
Gus Grubba's avatar
Gus Grubba committed
770
                        masterController:  _planMasterController
Gus Grubba's avatar
Gus Grubba committed
771 772 773 774
                        missionItem:    object
                        width:          parent.width
                        readOnly:       false
                        onClicked:      _missionController.setCurrentPlanViewIndex(object.sequenceNumber, false)
Gus Grubba's avatar
Gus Grubba committed
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790
                        onRemove: {
                            var removeIndex = index
                            _missionController.removeMissionItem(removeIndex)
                            if (removeIndex >= _missionController.visualItems.count) {
                                removeIndex--
                            }
                            _missionController.setCurrentPlanViewIndex(removeIndex, true)
                        }
                        onInsertWaypoint:       insertSimpleMissionItem(editorMap.center, index)
                        onInsertComplexItem:    insertComplexMissionItem(complexItemName, editorMap.center, index)
                    }
                }
            }
            // GeoFence Editor
            GeoFenceEditor {
                anchors.top:            rightControls.bottom
Gus Grubba's avatar
Gus Grubba committed
791
                anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.25
Don Gagne's avatar
Don Gagne committed
792
                anchors.bottom:         parent.bottom
Gus Grubba's avatar
Gus Grubba committed
793 794 795 796 797 798 799 800 801 802
                anchors.left:           parent.left
                anchors.right:          parent.right
                myGeoFenceController:   _geoFenceController
                flightMap:              editorMap
                visible:                _editingLayer == _layerGeoFence
            }
            // Rally Point Editor
            RallyPointEditorHeader {
                id:                     rallyPointHeader
                anchors.top:            rightControls.bottom
Gus Grubba's avatar
Gus Grubba committed
803
                anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.25
Gus Grubba's avatar
Gus Grubba committed
804 805 806 807 808 809 810 811
                anchors.left:           parent.left
                anchors.right:          parent.right
                visible:                _editingLayer == _layerRallyPoints
                controller:             _rallyPointController
            }
            RallyPointItemEditor {
                id:                     rallyPointEditor
                anchors.top:            rallyPointHeader.bottom
Gus Grubba's avatar
Gus Grubba committed
812
                anchors.topMargin:      ScreenTools.defaultFontPixelHeight * 0.25
Gus Grubba's avatar
Gus Grubba committed
813 814 815 816 817
                anchors.left:           parent.left
                anchors.right:          parent.right
                visible:                _editingLayer == _layerRallyPoints && _rallyPointController.points.count
                rallyPoint:             _rallyPointController.currentRallyPoint
                controller:             _rallyPointController
818
            }
Gus Grubba's avatar
Gus Grubba committed
819
        }
820 821

        MapScale {
822 823 824 825 826 827 828 829 830 831 832
            id:                     mapScale
            anchors.margins:        ScreenTools.defaultFontPixelHeight * (0.66)
            anchors.bottom:         waypointValuesDisplay.visible ? waypointValuesDisplay.top : parent.bottom
            anchors.left:           parent.left
            mapControl:             editorMap
            buttonsOnLeft:          true
            terrainButtonVisible:   true
            visible:                _toolStripBottom < y && _editingLayer === _layerMission
            terrainButtonChecked:   waypointValuesDisplay.visible

            onTerrainButtonClicked: waypointValuesDisplay.toggleVisible()
833 834 835 836 837 838
        }

        MissionItemStatus {
            id:                 waypointValuesDisplay
            anchors.margins:    ScreenTools.defaultFontPixelWidth
            anchors.left:       parent.left
839
            height:             ScreenTools.defaultFontPixelHeight * 7
840
            maxWidth:           parent.width - rightPanel.width - x
841
            anchors.bottom:     parent.bottom
842
            missionItems:       _missionController.visualItems
843 844 845 846 847 848 849
            visible:            _internalVisible && _editingLayer === _layerMission && (_toolStripBottom + mapScale.height) < y && QGroundControl.corePlugin.options.showMissionStatus

            property bool _internalVisible: false

            function toggleVisible() {
                _internalVisible = !_internalVisible
            }
850
        }
Gus Grubba's avatar
Gus Grubba committed
851
    }
852

853 854 855 856
    Component {
        id: syncLoadFromVehicleOverwrite
        QGCViewMessage {
            id:         syncLoadFromVehicleCheck
Don Gagne's avatar
Don Gagne committed
857
            message:   qsTr("You have unsaved/unsent changes. Loading from the Vehicle will lose these changes. Are you sure you want to load from the Vehicle?")
858 859
            function accept() {
                hideDialog()
Gus Grubba's avatar
Gus Grubba committed
860
                _planMasterController.loadFromVehicle()
861 862 863 864 865 866 867 868
            }
        }
    }

    Component {
        id: syncLoadFromFileOverwrite
        QGCViewMessage {
            id:         syncLoadFromVehicleCheck
DonLakeFlyer's avatar
DonLakeFlyer committed
869
            message:   qsTr("You have unsaved/unsent changes. Loading from a file will lose these changes. Are you sure you want to load from a file?")
870 871
            function accept() {
                hideDialog()
Gus Grubba's avatar
Gus Grubba committed
872
                _planMasterController.loadFromSelectedFile()
873 874 875 876
            }
        }
    }

877 878 879
    Component {
        id: removeAllPromptDialog
        QGCViewMessage {
880
            message: qsTr("Are you sure you want to remove all items and create a new plan? ") +
881
                     (_planMasterController.offline ? "" : qsTr("This will also remove all items from the vehicle."))
882
            function accept() {
883
                if (_planMasterController.offline) {
Gus Grubba's avatar
Gus Grubba committed
884
                    _planMasterController.removeAll()
885
                } else {
Gus Grubba's avatar
Gus Grubba committed
886
                    _planMasterController.removeAllFromVehicle()
887
                }
888 889 890 891 892
                hideDialog()
            }
        }
    }

893 894 895 896 897
    Component {
        id: clearVehicleMissionDialog
        QGCViewMessage {
            message: qsTr("Are you sure you want to remove all mission items and clear the mission from the vehicle?")
            function accept() {
Gus Grubba's avatar
Gus Grubba committed
898
                _planMasterController.removeAllFromVehicle()
899 900 901 902 903
                hideDialog()
            }
        }
    }

904 905 906 907 908 909 910 911 912 913 914
    //- ToolStrip DropPanel Components

    Component {
        id: centerMapDropPanel

        CenterMapDropPanel {
            map:            editorMap
            fitFunctions:   mapFitFunctions
        }
    }

915 916 917 918 919 920 921 922 923
    Component {
        id: patternDropPanel

        ColumnLayout {
            spacing:    ScreenTools.defaultFontPixelWidth * 0.5

            QGCLabel { text: qsTr("Create complex pattern:") }

            Repeater {
924
                model: _missionController.complexMissionItemNames
925 926 927 928 929 930

                QGCButton {
                    text:               modelData
                    Layout.fillWidth:   true

                    onClicked: {
931
                        addComplexItem(modelData)
932 933 934 935
                        dropPanel.hide()
                    }
                }
            }
936 937 938 939 940 941 942 943 944 945 946 947 948

            Rectangle {
                width:              parent.width * 0.8
                height:             1
                color:              qgcPal.text
                opacity:            0.5
                Layout.fillWidth:   true
                Layout.columnSpan:  2
            }

            QGCButton {
                text:               qsTr("Load KML/SHP...")
                Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
949
                enabled:            !_planMasterController.syncInProgress
950
                onClicked: {
Gus Grubba's avatar
Gus Grubba committed
951
                    _planMasterController.loadShapeFromSelectedFile()
952 953 954
                    dropPanel.hide()
                }
            }
955 956
        } // Column
    }
957 958

    Component {
959
        id: syncDropPanel
960

961 962 963
        Column {
            id:         columnHolder
            spacing:    _margin
964

965
            property string _overwriteText: (_editingLayer == _layerMission) ? qsTr("Mission overwrite") : ((_editingLayer == _layerGeoFence) ? qsTr("GeoFence overwrite") : qsTr("Rally Points overwrite"))
966

967 968 969
            QGCLabel {
                width:      sendSaveGrid.width
                wrapMode:   Text.WordWrap
Gus Grubba's avatar
Gus Grubba committed
970
                text:       _planMasterController.dirty ?
Gus Grubba's avatar
Gus Grubba committed
971
                                (activeVehicle ?
972 973 974 975
                                     qsTr("You have unsaved changes. You should upload to your vehicle, or save to a file:") :
                                     qsTr("You have unsaved changes.")
                                ) :
                                qsTr("Plan File:")
976 977
            }

978 979 980 981 982 983
            GridLayout {
                id:                 sendSaveGrid
                columns:            2
                anchors.margins:    _margin
                rowSpacing:         _margin
                columnSpacing:      ScreenTools.defaultFontPixelWidth
984

985
                QGCButton {
986
                    text:               qsTr("New...")
987
                    Layout.fillWidth:   true
988
                    enabled:            _planMasterController.containsItems
989
                    onClicked:  {
990
                        dropPanel.hide()
991
                        mainWindow.showComponentDialog(removeAllPromptDialog, qsTr("New Plan"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
992 993
                    }
                }
994

995
                QGCButton {
996
                    text:               qsTr("Open...")
997
                    Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
998
                    enabled:            !_planMasterController.syncInProgress
999 1000
                    onClicked: {
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1001
                        if (_planMasterController.dirty) {
1002
                            mainWindow.showComponentDialog(syncLoadFromFileOverwrite, columnHolder._overwriteText, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
1003
                        } else {
Gus Grubba's avatar
Gus Grubba committed
1004
                            _planMasterController.loadFromSelectedFile()
1005 1006 1007
                        }
                    }
                }
1008

1009
                QGCButton {
1010
                    text:               qsTr("Save")
1011
                    Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
1012
                    enabled:            !_planMasterController.syncInProgress && _planMasterController.currentPlanFile !== ""
1013 1014
                    onClicked: {
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1015 1016
                        if(_planMasterController.currentPlanFile !== "") {
                            _planMasterController.saveToCurrent()
1017
                        } else {
Gus Grubba's avatar
Gus Grubba committed
1018
                            _planMasterController.saveToSelectedFile()
1019
                        }
1020 1021 1022 1023
                    }
                }

                QGCButton {
1024
                    text:               qsTr("Save As...")
1025
                    Layout.fillWidth:   true
1026
                    enabled:            !_planMasterController.syncInProgress && _planMasterController.containsItems
1027 1028
                    onClicked: {
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1029
                        _planMasterController.saveToSelectedFile()
1030 1031 1032 1033
                    }
                }

                QGCButton {
1034
                    text:               qsTr("Save Mission Waypoints As KML...")
1035
                    Layout.columnSpan:  2
Gus Grubba's avatar
Gus Grubba committed
1036
                    enabled:            !_planMasterController.syncInProgress && _visualItems.count > 1
1037
                    onClicked: {
1038
                        // First point does not count
1039
                        if (_visualItems.count < 2) {
1040
                            mainWindow.showComponentDialog(noItemForKML, qsTr("KML"), mainWindow.showDialogDefaultWidth, StandardButton.Cancel)
1041 1042
                            return
                        }
1043
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1044
                        _planMasterController.saveKmlToSelectedFile()
1045 1046
                    }
                }
1047

1048 1049 1050 1051 1052 1053 1054 1055 1056 1057
                Rectangle {
                    width:              parent.width * 0.8
                    height:             1
                    color:              qgcPal.text
                    opacity:            0.5
                    visible:            !QGroundControl.corePlugin.options.disableVehicleConnection
                    Layout.fillWidth:   true
                    Layout.columnSpan:  2
                }

1058
                QGCButton {
1059
                    text:               qsTr("Upload")
1060
                    Layout.fillWidth:   true
1061
                    enabled:            !_planMasterController.offline && !_planMasterController.syncInProgress && _planMasterController.containsItems
1062 1063
                    visible:            !QGroundControl.corePlugin.options.disableVehicleConnection
                    onClicked: {
1064
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1065
                        _planMasterController.upload()
1066 1067
                    }
                }
1068 1069 1070 1071

                QGCButton {
                    text:               qsTr("Download")
                    Layout.fillWidth:   true
Gus Grubba's avatar
Gus Grubba committed
1072
                    enabled:            !_planMasterController.offline && !_planMasterController.syncInProgress
1073 1074 1075
                    visible:            !QGroundControl.corePlugin.options.disableVehicleConnection
                    onClicked: {
                        dropPanel.hide()
Gus Grubba's avatar
Gus Grubba committed
1076
                        if (_planMasterController.dirty) {
1077
                            mainWindow.showComponentDialog(syncLoadFromVehicleOverwrite, columnHolder._overwriteText, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
1078
                        } else {
Gus Grubba's avatar
Gus Grubba committed
1079
                            _planMasterController.loadFromVehicle()
1080 1081 1082 1083 1084 1085 1086 1087
                        }
                    }
                }

                QGCButton {
                    text:               qsTr("Clear Vehicle Mission")
                    Layout.fillWidth:   true
                    Layout.columnSpan:  2
Gus Grubba's avatar
Gus Grubba committed
1088
                    enabled:            !_planMasterController.offline && !_planMasterController.syncInProgress
1089 1090 1091
                    visible:            !QGroundControl.corePlugin.options.disableVehicleConnection
                    onClicked: {
                        dropPanel.hide()
1092
                        mainWindow.showComponentDialog(clearVehicleMissionDialog, text, mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
1093 1094 1095
                    }
                }

1096
            }
1097 1098
        }
    }
Gus Grubba's avatar
Gus Grubba committed
1099
}