OfflineMap.qml 48.3 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.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9

10 11
import QtQuick                  2.3
import QtQuick.Controls         1.2
12
import QtQuick.Controls.Styles  1.4
13
import QtQuick.Dialogs          1.2
14 15 16
import QtQuick.Layouts          1.2
import QtLocation               5.3
import QtPositioning            5.3
dogmaphobic's avatar
dogmaphobic committed
17

Don Gagne's avatar
Don Gagne committed
18 19 20 21 22
import QGroundControl               1.0
import QGroundControl.Controls      1.0
import QGroundControl.ScreenTools   1.0
import QGroundControl.Palette       1.0
import QGroundControl.FlightMap     1.0
dogmaphobic's avatar
dogmaphobic committed
23

Don Gagne's avatar
Don Gagne committed
24 25 26 27
QGCView {
    id:             offlineMapView
    viewPanel:      panel
    anchors.fill:   parent
dogmaphobic's avatar
dogmaphobic committed
28

dogmaphobic's avatar
dogmaphobic committed
29
    property var    _currentSelection:  null
dogmaphobic's avatar
dogmaphobic committed
30

dogmaphobic's avatar
dogmaphobic committed
31
    property string mapKey:             "lastMapType"
dogmaphobic's avatar
dogmaphobic committed
32

33
    property string mapType:            QGroundControl.flightMapSettings.mapProvider + " " + QGroundControl.flightMapSettings.mapType
34
    property bool   isMapInteractive:   false
35 36 37
    property var    savedCenter:        undefined
    property real   savedZoom:          3
    property string savedMapType:       ""
Don Gagne's avatar
Don Gagne committed
38
    property bool   _showPreview:       true
dogmaphobic's avatar
dogmaphobic committed
39
    property bool   _defaultSet:        offlineMapView && offlineMapView._currentSelection && offlineMapView._currentSelection.defaultSet
40 41
    property real   _margins:           ScreenTools.defaultFontPixelWidth * 0.5
    property real   _buttonSize:        ScreenTools.defaultFontPixelWidth * 12
Gus Grubba's avatar
Gus Grubba committed
42
    property real   _bigButtonSize:     ScreenTools.defaultFontPixelWidth * 16
dogmaphobic's avatar
dogmaphobic committed
43

dogmaphobic's avatar
dogmaphobic committed
44 45
    property bool   _saveRealEstate:          ScreenTools.isTinyScreen || ScreenTools.isShortScreen
    property real   _adjustableFontPointSize: _saveRealEstate ? ScreenTools.smallFontPointSize : ScreenTools.defaultFontPointSize
Don Gagne's avatar
Don Gagne committed
46

47 48
    property var    _mapAdjustedColor:  _map.isSatelliteMap ? "white" : "black"
    property bool   _tooManyTiles:      QGroundControl.mapEngineManager.tileCount > _maxTilesForDownload
Don Gagne's avatar
Don Gagne committed
49

Don Gagne's avatar
Don Gagne committed
50 51 52
    readonly property real minZoomLevel: 3
    readonly property real maxZoomLevel: 20

dogmaphobic's avatar
dogmaphobic committed
53
    readonly property int _maxTilesForDownload: 100000
54

Don Gagne's avatar
Don Gagne committed
55
    QGCPalette { id: qgcPal }
56

dogmaphobic's avatar
dogmaphobic committed
57 58 59
    Component.onCompleted: {
        QGroundControl.mapEngineManager.loadTileSets()
        updateMap()
DonLakeFlyer's avatar
DonLakeFlyer committed
60
        savedCenter = _map.toCoordinate(Qt.point(_map.width / 2, _map.height / 2), false /* clipToViewPort */)
dogmaphobic's avatar
dogmaphobic committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
    }

    Connections {
        target: QGroundControl.mapEngineManager
        onTileSetsChanged: {
            setName.text = QGroundControl.mapEngineManager.getUniqueName()
        }
        onErrorMessageChanged: {
            errorDialog.visible = true
        }
    }

    ExclusiveGroup { id: setGroup }

    function handleChanges() {
76
        if(isMapInteractive) {
Don Gagne's avatar
Don Gagne committed
77 78
            var xl = 0
            var yl = 0
79 80
            var xr = _map.width.toFixed(0) - 1  // Must be within boundaries of visible map
            var yr = _map.height.toFixed(0) - 1 // Must be within boundaries of visible map
DonLakeFlyer's avatar
DonLakeFlyer committed
81 82
            var c0 = _map.toCoordinate(Qt.point(xl, yl), false /* clipToViewPort */)
            var c1 = _map.toCoordinate(Qt.point(xr, yr), false /* clipToViewPort */)
83
            QGroundControl.mapEngineManager.updateForCurrentView(c0.longitude, c0.latitude, c1.longitude, c1.latitude, sliderMinZoom.value, sliderMaxZoom.value, mapType)
dogmaphobic's avatar
dogmaphobic committed
84 85 86 87 88 89 90 91 92 93 94 95 96
        }
    }

    function updateMap() {
        for (var i = 0; i < _map.supportedMapTypes.length; i++) {
            if (mapType === _map.supportedMapTypes[i].name) {
                _map.activeMapType = _map.supportedMapTypes[i]
                handleChanges()
                return
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
97
    function addNewSet() {
98
        isMapInteractive = true
99
        mapType = QGroundControl.flightMapSettings.mapProvider + " " + QGroundControl.flightMapSettings.mapType
100 101
        resetMapToDefaults()
        handleChanges()
102
        _map.visible = true
dogmaphobic's avatar
dogmaphobic committed
103
        _tileSetList.visible = false
Don Gagne's avatar
Don Gagne committed
104
        infoView.visible = false
105
        _exporTiles.visible = false
Don Gagne's avatar
Don Gagne committed
106
        addNewSetView.visible = true
dogmaphobic's avatar
dogmaphobic committed
107 108 109
    }

    function showList() {
110
        _exporTiles.visible = false
111
        isMapInteractive = false
112
        _map.visible = false
dogmaphobic's avatar
dogmaphobic committed
113
        _tileSetList.visible = true
Don Gagne's avatar
Don Gagne committed
114 115
        infoView.visible = false
        addNewSetView.visible = false
dogmaphobic's avatar
dogmaphobic committed
116 117
    }

118 119 120 121 122 123 124 125 126
    function showExport() {
        isMapInteractive = false
        _map.visible = false
        _tileSetList.visible = false
        infoView.visible = false
        addNewSetView.visible = false
        _exporTiles.visible = true
    }

dogmaphobic's avatar
dogmaphobic committed
127
    function showInfo() {
128
        isMapInteractive = false
Don Gagne's avatar
Don Gagne committed
129
        if(_currentSelection && !offlineMapView._currentSelection.deleting) {
130
            enterInfoView()
dogmaphobic's avatar
dogmaphobic committed
131 132 133 134
        } else
            showList()
    }

135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    function toRadian(deg) {
        return deg * Math.PI / 180
    }

    function toDegree(rad) {
        return rad * 180 / Math.PI
    }

    function midPoint(lat1, lat2, lon1, lon2) {
        var dLon = toRadian(lon2 - lon1);
        lat1 = toRadian(lat1);
        lat2 = toRadian(lat2);
        lon1 = toRadian(lon1);
        var Bx = Math.cos(lat2) * Math.cos(dLon);
        var By = Math.cos(lat2) * Math.sin(dLon);
        var lat3 = Math.atan2(Math.sin(lat1) + Math.sin(lat2), Math.sqrt((Math.cos(lat1) + Bx) * (Math.cos(lat1) + Bx) + By * By));
        var lon3 = lon1 + Math.atan2(By, Math.cos(lat1) + Bx);
        return QtPositioning.coordinate(toDegree(lat3), toDegree(lon3))
    }

    function enterInfoView() {
Don Gagne's avatar
Don Gagne committed
156 157
        _map.visible = true
        isMapInteractive = false
DonLakeFlyer's avatar
DonLakeFlyer committed
158
        savedCenter = _map.toCoordinate(Qt.point(_map.width / 2, _map.height / 2), false /* clipToViewPort */)
Don Gagne's avatar
Don Gagne committed
159 160
        savedZoom = _map.zoomLevel
        savedMapType = mapType
dogmaphobic's avatar
dogmaphobic committed
161
        if(!offlineMapView._currentSelection.defaultSet) {
Don Gagne's avatar
Don Gagne committed
162 163
            mapType = offlineMapView._currentSelection.mapTypeStr
            _map.center = midPoint(offlineMapView._currentSelection.topleftLat, offlineMapView._currentSelection.bottomRightLat, offlineMapView._currentSelection.topleftLon, offlineMapView._currentSelection.bottomRightLon)
164
            //-- Delineate Set Region
Don Gagne's avatar
Don Gagne committed
165 166 167 168
            var x0 = offlineMapView._currentSelection.topleftLon
            var x1 = offlineMapView._currentSelection.bottomRightLon
            var y0 = offlineMapView._currentSelection.topleftLat
            var y1 = offlineMapView._currentSelection.bottomRightLat
169 170 171
            mapBoundary.topLeft     = QtPositioning.coordinate(y0, x0)
            mapBoundary.bottomRight = QtPositioning.coordinate(y1, x1)
            mapBoundary.visible = true
dogmaphobic's avatar
dogmaphobic committed
172 173 174
            // Some times, for whatever reason, the bounding box is correct (around ETH for instance), but the rectangle is drawn across the planet.
            // When that happens, the "_map.fitViewportToMapItems()" below makes the map to zoom to the entire earth.
            //console.log("Map boundary: " + mapBoundary.topLeft + " " + mapBoundary.bottomRight)
175
            _map.fitViewportToMapItems()
176 177
        }
        _tileSetList.visible = false
178
        addNewSetView.visible = false
dogmaphobic's avatar
dogmaphobic committed
179
        infoView.visible = true
180 181 182
    }

    function leaveInfoView() {
183
        mapBoundary.visible = false
184 185 186
        _map.center = savedCenter
        _map.zoomLevel = savedZoom
        mapType = savedMapType
187 188 189 190 191
    }

    function resetMapToDefaults() {
        _map.center = QGroundControl.flightMapPosition
        _map.zoomLevel = QGroundControl.flightMapZoom
192 193
    }

dogmaphobic's avatar
dogmaphobic committed
194 195 196 197 198 199
    ExclusiveGroup {
        id: _dropButtonsExclusiveGroup
    }

    onMapTypeChanged: {
        updateMap()
200 201 202
        if(isMapInteractive) {
            QGroundControl.mapEngineManager.saveSetting(mapKey, mapType)
        }
dogmaphobic's avatar
dogmaphobic committed
203 204 205 206 207 208 209 210
    }

    MessageDialog {
        id:         errorDialog
        visible:    false
        text:       QGroundControl.mapEngineManager.errorMessage
        icon:       StandardIcon.Critical
        standardButtons: StandardButton.Ok
Don Gagne's avatar
Don Gagne committed
211
        title:      qsTr("Error Message")
dogmaphobic's avatar
dogmaphobic committed
212 213 214 215
        onYes: {
            errorDialog.visible = false
        }
    }
Don Gagne's avatar
Don Gagne committed
216

Don Gagne's avatar
Don Gagne committed
217 218 219 220 221 222 223 224 225 226 227
    Component {
        id: optionsDialogComponent

        QGCViewDialog {
            id: optionDialog

            function accept() {
                QGroundControl.mapEngineManager.mapboxToken  = mapBoxToken.text
                QGroundControl.mapEngineManager.maxDiskCache = parseInt(maxCacheSize.text)
                QGroundControl.mapEngineManager.maxMemCache  = parseInt(maxCacheMemSize.text)
                optionDialog.hideDialog()
dogmaphobic's avatar
dogmaphobic committed
228
            }
Don Gagne's avatar
Don Gagne committed
229

Don Gagne's avatar
Don Gagne committed
230 231 232
            QGCFlickable {
                anchors.fill:   parent
                contentHeight:  optionsColumn.height
233

Don Gagne's avatar
Don Gagne committed
234 235 236 237 238 239 240
                Column {
                    id:                 optionsColumn
                    anchors.margins:    ScreenTools.defaultFontPixelWidth
                    anchors.left:       parent.left
                    anchors.right:      parent.right
                    anchors.top:        parent.top
                    spacing:            ScreenTools.defaultFontPixelHeight / 2
241

Don Gagne's avatar
Don Gagne committed
242
                    QGCLabel { text:       qsTr("Max Cache Disk Size (MB):") }
243

Don Gagne's avatar
Don Gagne committed
244 245 246 247 248 249 250
                    QGCTextField {
                        id:                 maxCacheSize
                        maximumLength:      6
                        inputMethodHints:   Qt.ImhDigitsOnly
                        validator:          IntValidator {bottom: 1; top: 262144;}
                        text:               QGroundControl.mapEngineManager.maxDiskCache
                    }
251

Don Gagne's avatar
Don Gagne committed
252 253 254 255 256 257 258 259
                    Item { width: 1; height: 1 }

                    QGCLabel { text:       qsTr("Max Cache Memory Size (MB):") }

                    QGCTextField {
                        id:                 maxCacheMemSize
                        maximumLength:      4
                        inputMethodHints:   Qt.ImhDigitsOnly
260
                        validator:          IntValidator {bottom: 1; top: 1024;}
Don Gagne's avatar
Don Gagne committed
261
                        text:               QGroundControl.mapEngineManager.maxMemCache
dogmaphobic's avatar
dogmaphobic committed
262
                    }
Don Gagne's avatar
Don Gagne committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291

                    QGCLabel {
                        font.pointSize: _adjustableFontPointSize
                        text:           qsTr("Memory cache changes require a restart to take effect.")
                    }

                    Item { width: 1; height: 1 }

                    QGCLabel { text: qsTr("MapBox Access Token") }

                    QGCTextField {
                        id:             mapBoxToken
                        maximumLength:  256
                        width:          ScreenTools.defaultFontPixelWidth * 30
                        text:           QGroundControl.mapEngineManager.mapboxToken
                    }

                    QGCLabel {
                        text:           qsTr("With an access token, you can use MapBox Maps.")
                        font.pointSize: _adjustableFontPointSize
                    }
                } // GridLayout
            } // QGCFlickable
        } // QGCViewDialog - optionsDialog
    } // Component - optionsDialogComponent

    Component {
        id: deleteConfirmationDialogComponent
        QGCViewMessage {
dogmaphobic's avatar
dogmaphobic committed
292 293 294 295 296 297
            id:  deleteConfirmationDialog
            message: {
                if(offlineMapView._currentSelection.defaultSet)
                    return qsTr("This will delete all tiles INCLUDING the tile sets you have created yourself.\n\nIs this really what you want?");
                else
                    return qsTr("Delete %1 and all its tiles.\n\nIs this really what you want?").arg(offlineMapView._currentSelection.name);
dogmaphobic's avatar
dogmaphobic committed
298
            }
Don Gagne's avatar
Don Gagne committed
299 300
            function accept() {
                QGroundControl.mapEngineManager.deleteTileSet(offlineMapView._currentSelection)
dogmaphobic's avatar
dogmaphobic committed
301
                deleteConfirmationDialog.hideDialog()
Don Gagne's avatar
Don Gagne committed
302 303
                leaveInfoView()
                showList()
dogmaphobic's avatar
dogmaphobic committed
304 305
            }
        }
Don Gagne's avatar
Don Gagne committed
306 307 308 309 310 311 312 313 314
    }

    QGCViewPanel {
        id:                 panel
        anchors.fill:       parent

        Map {
            id:                 _map
            anchors.fill:       parent
315
            center:             QGroundControl.lastKnownHomePosition
Don Gagne's avatar
Don Gagne committed
316 317 318
            visible:            false
            gesture.flickDeceleration:  3000

Don Gagne's avatar
Don Gagne committed
319 320
            property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1

Don Gagne's avatar
Don Gagne committed
321 322 323 324 325 326 327 328 329 330 331
            plugin: Plugin { name: "QGroundControl" }

            MapRectangle {
                id:             mapBoundary
                border.width:   2
                border.color:   "red"
                color:          Qt.rgba(1,0,0,0.05)
                smooth:         true
                antialiasing:   true
            }

332
            Component.onCompleted: resetMapToDefaults()
Don Gagne's avatar
Don Gagne committed
333

334 335 336 337 338 339 340 341
            onCenterChanged:    handleChanges()
            onZoomLevelChanged: handleChanges()
            onWidthChanged:     handleChanges()
            onHeightChanged:    handleChanges()

            // Used to make pinch zoom work
            MouseArea {
                anchors.fill: parent
dogmaphobic's avatar
dogmaphobic committed
342
            }
343

344 345 346 347 348 349 350 351 352 353 354
            CenterMapDropButton {
                anchors.margins:    _margins
                anchors.left:       parent.left
                anchors.top:        parent.top
                map:                _map
                z:                  QGroundControl.zOrderTopMost
                showMission:        false
                showAllItems:       false
                visible:            addNewSetView.visible
            }

Don Gagne's avatar
Don Gagne committed
355 356 357 358 359 360
            MapScale {
                anchors.leftMargin:     ScreenTools.defaultFontPixelWidth / 2
                anchors.bottomMargin:   anchors.leftMargin
                anchors.left:           parent.left
                anchors.bottom:         parent.bottom
                mapControl:             _map
361
            }
Don Gagne's avatar
Don Gagne committed
362

dogmaphobic's avatar
dogmaphobic committed
363
            //-----------------------------------------------------------------
Don Gagne's avatar
Don Gagne committed
364 365 366
            //-- Show Set Info
            Rectangle {
                id:                 infoView
dogmaphobic's avatar
dogmaphobic committed
367
                anchors.margins:    ScreenTools.defaultFontPixelHeight
Don Gagne's avatar
Don Gagne committed
368
                anchors.right:      parent.right
dogmaphobic's avatar
dogmaphobic committed
369 370 371 372
                anchors.verticalCenter: parent.verticalCenter
                width:              tileInfoColumn.width  + (ScreenTools.defaultFontPixelWidth  * 2)
                height:             tileInfoColumn.height + (ScreenTools.defaultFontPixelHeight * 2)
                color:              Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.85)
Don Gagne's avatar
Don Gagne committed
373 374
                radius:             ScreenTools.defaultFontPixelWidth * 0.5
                visible:            false
375 376 377 378 379 380 381 382

                property bool       _extraButton: {
                    if(!offlineMapView._currentSelection)
                        return false;
                    var curSel = offlineMapView._currentSelection;
                    return !_defaultSet && ((!curSel.complete && !curSel.downloading) || (!curSel.complete && curSel.downloading));
                }

dogmaphobic's avatar
dogmaphobic committed
383 384
                property real       _labelWidth:    ScreenTools.defaultFontPixelWidth * 10
                property real       _valueWidth:    ScreenTools.defaultFontPixelWidth * 14
385
                Column {
dogmaphobic's avatar
dogmaphobic committed
386 387 388 389
                    id:                 tileInfoColumn
                    anchors.margins:    ScreenTools.defaultFontPixelHeight * 0.5
                    spacing:            ScreenTools.defaultFontPixelHeight * 0.5
                    anchors.centerIn:   parent
390
                    QGCLabel {
Don Gagne's avatar
Don Gagne committed
391 392 393 394 395 396
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
                        text:           offlineMapView._currentSelection ? offlineMapView._currentSelection.name : ""
                        font.pointSize: _saveRealEstate ? ScreenTools.defaultFontPointSize : ScreenTools.mediumFontPointSize
                        horizontalAlignment: Text.AlignHCenter
397 398
                    }
                    QGCLabel {
Don Gagne's avatar
Don Gagne committed
399 400 401
                        anchors.left:   parent.left
                        anchors.right:  parent.right
                        wrapMode:       Text.WordWrap
dogmaphobic's avatar
dogmaphobic committed
402 403 404 405 406 407 408 409 410
                        text: {
                            if(offlineMapView._currentSelection) {
                                if(offlineMapView._currentSelection.defaultSet)
                                    return qsTr("System Wide Tile Cache");
                                else
                                    return "(" + offlineMapView._currentSelection.mapTypeStr + ")"
                            } else
                                return "";
                        }
Don Gagne's avatar
Don Gagne committed
411
                        horizontalAlignment: Text.AlignHCenter
412
                    }
dogmaphobic's avatar
dogmaphobic committed
413 414 415 416 417 418 419
                    //-- Tile Sets
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    !_defaultSet
                        QGCLabel {  text: qsTr("Zoom Levels:"); width: infoView._labelWidth; }
                        QGCLabel {  text: offlineMapView._currentSelection ? (offlineMapView._currentSelection.minZoom + " - " + offlineMapView._currentSelection.maxZoom) : ""; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
420
                    }
dogmaphobic's avatar
dogmaphobic committed
421 422 423 424 425 426 427 428 429 430 431 432 433
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    !_defaultSet
                        QGCLabel {  text: qsTr("Total:"); width: infoView._labelWidth; }
                        QGCLabel {  text: (offlineMapView._currentSelection ? offlineMapView._currentSelection.totalTileCountStr : "") + " (" + (offlineMapView._currentSelection ? offlineMapView._currentSelection.totalTilesSizeStr : "") + ")"; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
                    }
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    offlineMapView && offlineMapView._currentSelection && !_defaultSet && offlineMapView._currentSelection.uniqueTileCount > 0
                        QGCLabel {  text: qsTr("Unique:"); width: infoView._labelWidth; }
                        QGCLabel {  text: (offlineMapView._currentSelection ? offlineMapView._currentSelection.uniqueTileCountStr : "") + " (" + (offlineMapView._currentSelection ? offlineMapView._currentSelection.uniqueTileSizeStr : "") + ")"; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
434
                    }
Don Gagne's avatar
Don Gagne committed
435

dogmaphobic's avatar
dogmaphobic committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    offlineMapView && offlineMapView._currentSelection && !_defaultSet && !offlineMapView._currentSelection.complete
                        QGCLabel {  text: qsTr("Downloaded:"); width: infoView._labelWidth; }
                        QGCLabel {  text: (offlineMapView._currentSelection ? offlineMapView._currentSelection.savedTileCountStr : "") + " (" + (offlineMapView._currentSelection ? offlineMapView._currentSelection.savedTileSizeStr : "") + ")"; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
                    }
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    offlineMapView && offlineMapView._currentSelection && !_defaultSet && !offlineMapView._currentSelection.complete && offlineMapView._currentSelection.errorCount > 0
                        QGCLabel {  text: qsTr("Error Count:"); width: infoView._labelWidth; }
                        QGCLabel {  text: offlineMapView._currentSelection ? offlineMapView._currentSelection.errorCountStr : ""; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
                    }
                    //-- Default Tile Set
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    _defaultSet
                        QGCLabel { text: qsTr("Size:"); width: infoView._labelWidth; }
                        QGCLabel { text: offlineMapView._currentSelection ? offlineMapView._currentSelection.savedTileSizeStr  : ""; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
                    }
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
                        visible:    _defaultSet
                        QGCLabel { text: qsTr("Tile Count:"); width: infoView._labelWidth; }
                        QGCLabel { text: offlineMapView._currentSelection ? offlineMapView._currentSelection.savedTileCountStr : ""; horizontalAlignment: Text.AlignRight; width: infoView._valueWidth; }
                    }
                    Row {
                        spacing:    ScreenTools.defaultFontPixelWidth
                        anchors.horizontalCenter: parent.horizontalCenter
Don Gagne's avatar
Don Gagne committed
468 469
                        QGCButton {
                            text:       qsTr("Resume Download")
dogmaphobic's avatar
dogmaphobic committed
470 471
                            visible:    offlineMapView._currentSelection && offlineMapView._currentSelection && !_defaultSet && (!offlineMapView._currentSelection.complete && !offlineMapView._currentSelection.downloading)
                            width:      ScreenTools.defaultFontPixelWidth * 16
Don Gagne's avatar
Don Gagne committed
472 473 474 475
                            onClicked: {
                                if(offlineMapView._currentSelection)
                                    offlineMapView._currentSelection.resumeDownloadTask()
                            }
476
                        }
Don Gagne's avatar
Don Gagne committed
477 478
                        QGCButton {
                            text:       qsTr("Cancel Download")
dogmaphobic's avatar
dogmaphobic committed
479 480
                            visible:    offlineMapView._currentSelection && offlineMapView._currentSelection && !_defaultSet && (!offlineMapView._currentSelection.complete && offlineMapView._currentSelection.downloading)
                            width:      ScreenTools.defaultFontPixelWidth * 16
Don Gagne's avatar
Don Gagne committed
481 482 483 484
                            onClicked: {
                                if(offlineMapView._currentSelection)
                                    offlineMapView._currentSelection.cancelDownloadTask()
                            }
485
                        }
Don Gagne's avatar
Don Gagne committed
486 487
                        QGCButton {
                            text:       qsTr("Delete")
dogmaphobic's avatar
dogmaphobic committed
488
                            width:      ScreenTools.defaultFontPixelWidth * (infoView._extraButton ? 6 : 10)
Don Gagne's avatar
Don Gagne committed
489
                            onClicked:  showDialog(deleteConfirmationDialogComponent, qsTr("Confirm Delete"), qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
490
                        }
Don Gagne's avatar
Don Gagne committed
491
                        QGCButton {
dogmaphobic's avatar
dogmaphobic committed
492 493 494 495 496 497
                            text:       qsTr("Close")
                            width:      ScreenTools.defaultFontPixelWidth * (infoView._extraButton ? 6 : 10)
                            onClicked: {
                                leaveInfoView()
                                showList()
                            }
498
                        }
dogmaphobic's avatar
dogmaphobic committed
499 500 501
                    }
                }
            } // Rectangle - infoView
Don Gagne's avatar
Don Gagne committed
502

dogmaphobic's avatar
dogmaphobic committed
503 504
            //-----------------------------------------------------------------
            //-- Add new set
Don Gagne's avatar
Don Gagne committed
505 506 507 508
            Item {
                id:             addNewSetView
                anchors.fill:   parent
                visible:        false
Don Gagne's avatar
Don Gagne committed
509

510 511 512 513 514 515 516 517 518 519
                Column {
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.leftMargin:     _margins
                    anchors.left:           parent.left
                    spacing:                _margins

                    QGCButton {
                        text:       "Show zoom previews"
                        visible:    !_showPreview
                        onClicked:  _showPreview = !_showPreview
Don Gagne's avatar
Don Gagne committed
520
                    }
521

522 523 524 525 526 527 528 529 530 531
                    Map {
                        id:                 minZoomPreview
                        width:              addNewSetView.width / 4
                        height:             addNewSetView.height / 4
                        center:             _map.center
                        activeMapType:      _map.activeMapType
                        zoomLevel:          sliderMinZoom.value
                        gesture.enabled:    false
                        visible:            _showPreview

532 533
                        property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1

534 535 536 537 538 539 540 541 542
                        plugin: Plugin { name: "QGroundControl" }

                        MapScale {
                            anchors.leftMargin:     ScreenTools.defaultFontPixelWidth / 2
                            anchors.bottomMargin:   anchors.leftMargin
                            anchors.left:           parent.left
                            anchors.bottom:         parent.bottom
                            mapControl:             parent
                        }
Don Gagne's avatar
Don Gagne committed
543

544 545 546 547
                        Rectangle {
                            anchors.fill:   parent
                            border.color:   _mapAdjustedColor
                            color:          "transparent"
Don Gagne's avatar
Don Gagne committed
548

549
                            QGCMapLabel {
550
                                anchors.centerIn:   parent
551
                                map:                minZoomPreview
552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570
                                text:               qsTr("Min Zoom: %1").arg(sliderMinZoom.value)
                            }
                            MouseArea {
                                anchors.fill:   parent
                                onClicked:      _showPreview = false
                            }
                        }
                    } // Map

                    Map {
                        id:                 maxZoomPreview
                        width:              minZoomPreview.width
                        height:             minZoomPreview.height
                        center:             _map.center
                        activeMapType:      _map.activeMapType
                        zoomLevel:          sliderMaxZoom.value
                        gesture.enabled:    false
                        visible:            _showPreview

571 572
                        property bool isSatelliteMap: activeMapType.name.indexOf("Satellite") > -1 || activeMapType.name.indexOf("Hybrid") > -1

573 574 575 576 577 578 579 580 581 582 583 584 585 586
                        plugin: Plugin { name: "QGroundControl" }

                        MapScale {
                            anchors.leftMargin:     ScreenTools.defaultFontPixelWidth / 2
                            anchors.bottomMargin:   anchors.leftMargin
                            anchors.left:           parent.left
                            anchors.bottom:         parent.bottom
                            mapControl:             parent
                        }

                        Rectangle {
                            anchors.fill:   parent
                            border.color:   _mapAdjustedColor
                            color:          "transparent"
Don Gagne's avatar
Don Gagne committed
587

588
                            QGCMapLabel {
589
                                anchors.centerIn:   parent
590
                                map:                maxZoomPreview
591 592 593 594 595 596 597 598
                                text:               qsTr("Max Zoom: %1").arg(sliderMaxZoom.value)
                            }
                            MouseArea {
                                anchors.fill:   parent
                                onClicked:      _showPreview = false
                            }
                        }
                    } // Map
Don Gagne's avatar
Don Gagne committed
599 600 601 602 603
                }

                //-- Add new set dialog
                Rectangle {
                    anchors.margins:    ScreenTools.defaultFontPixelWidth
dogmaphobic's avatar
dogmaphobic committed
604
                    anchors.verticalCenter: parent.verticalCenter
Don Gagne's avatar
Don Gagne committed
605
                    anchors.right:      parent.right
606
                    width:              ScreenTools.defaultFontPixelWidth * (ScreenTools.isTinyScreen ? 24 : 28)
607
                    height:             Math.min(parent.height - (anchors.margins * 2), addNewSetFlickable.y + addNewSetColumn.height + addNewSetLabel.anchors.margins)
dogmaphobic's avatar
dogmaphobic committed
608
                    color:              Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.85)
Don Gagne's avatar
Don Gagne committed
609 610 611 612 613 614 615 616 617 618 619 620 621
                    radius:             ScreenTools.defaultFontPixelWidth * 0.5

                    QGCLabel {
                        id:                 addNewSetLabel
                        anchors.margins:    ScreenTools.defaultFontPixelHeight / 2
                        anchors.top:        parent.top
                        anchors.left:       parent.left
                        anchors.right:      parent.right
                        wrapMode:           Text.WordWrap
                        text:               qsTr("Add New Set")
                        font.pointSize:     _saveRealEstate ? ScreenTools.defaultFontPointSize : ScreenTools.mediumFontPointSize
                        horizontalAlignment: Text.AlignHCenter
                    }
Don Gagne's avatar
Don Gagne committed
622

Don Gagne's avatar
Don Gagne committed
623 624 625 626 627 628 629 630 631 632 633 634
                    QGCFlickable {
                        id:                     addNewSetFlickable
                        anchors.leftMargin:     ScreenTools.defaultFontPixelWidth
                        anchors.rightMargin:    anchors.leftMargin
                        anchors.topMargin:      ScreenTools.defaultFontPixelWidth / 3
                        anchors.bottomMargin:   anchors.topMargin
                        anchors.top:            addNewSetLabel.bottom
                        anchors.left:           parent.left
                        anchors.right:          parent.right
                        anchors.bottom:         parent.bottom
                        clip:                   true
                        contentHeight:          addNewSetColumn.height
Don Gagne's avatar
Don Gagne committed
635 636

                        Column {
Don Gagne's avatar
Don Gagne committed
637
                            id:                 addNewSetColumn
Don Gagne's avatar
Don Gagne committed
638 639
                            anchors.left:       parent.left
                            anchors.right:      parent.right
640
                            spacing:            ScreenTools.defaultFontPixelHeight * (ScreenTools.isTinyScreen ? 0.25 : 0.5)
Don Gagne's avatar
Don Gagne committed
641
                            Column {
642
                                spacing:            ScreenTools.isTinyScreen ? 0 : ScreenTools.defaultFontPixelHeight * 0.25
Don Gagne's avatar
Don Gagne committed
643 644 645 646 647 648 649
                                anchors.left:       parent.left
                                anchors.right:      parent.right
                                QGCLabel { text: qsTr("Name:") }
                                QGCTextField {
                                    id:             setName
                                    anchors.left:   parent.left
                                    anchors.right:  parent.right
Don Gagne's avatar
Don Gagne committed
650
                                }
dogmaphobic's avatar
dogmaphobic committed
651
                            }
Don Gagne's avatar
Don Gagne committed
652
                            Column {
653
                                spacing:            ScreenTools.isTinyScreen ? 0 : ScreenTools.defaultFontPixelHeight * 0.25
Don Gagne's avatar
Don Gagne committed
654 655 656
                                anchors.left:       parent.left
                                anchors.right:      parent.right
                                QGCLabel {
Don Gagne's avatar
Don Gagne committed
657 658
                                    text:       qsTr("Map type:")
                                    visible:    !_saveRealEstate
Don Gagne's avatar
Don Gagne committed
659
                                }
Don Gagne's avatar
Don Gagne committed
660 661 662 663 664 665 666 667 668 669
                                QGCComboBox {
                                    id:             mapCombo
                                    anchors.left:   parent.left
                                    anchors.right:  parent.right
                                    model:          QGroundControl.mapEngineManager.mapList
                                    onActivated: {
                                        mapType = textAt(index)
                                        if(_dropButtonsExclusiveGroup.current)
                                            _dropButtonsExclusiveGroup.current.checked = false
                                        _dropButtonsExclusiveGroup.current = null
Don Gagne's avatar
Don Gagne committed
670
                                    }
Don Gagne's avatar
Don Gagne committed
671 672 673 674 675 676
                                    Component.onCompleted: {
                                        var index = mapCombo.find(mapType)
                                        if (index === -1) {
                                            console.warn("Active map name not in combo", mapType)
                                        } else {
                                            mapCombo.currentIndex = index
Don Gagne's avatar
Don Gagne committed
677 678
                                        }
                                    }
Don Gagne's avatar
Don Gagne committed
679 680
                                }
                            }
Don Gagne's avatar
Don Gagne committed
681

Don Gagne's avatar
Don Gagne committed
682 683 684
                            Rectangle {
                                anchors.left:   parent.left
                                anchors.right:  parent.right
685
                                height:         zoomColumn.height + ScreenTools.defaultFontPixelHeight * 0.5
Don Gagne's avatar
Don Gagne committed
686 687 688 689 690 691
                                color:          qgcPal.window
                                border.color:   qgcPal.text
                                radius:         ScreenTools.defaultFontPixelWidth * 0.5

                                Column {
                                    id:                 zoomColumn
dogmaphobic's avatar
dogmaphobic committed
692
                                    anchors.margins:    ScreenTools.defaultFontPixelHeight * 0.25
Don Gagne's avatar
Don Gagne committed
693 694 695
                                    anchors.top:        parent.top
                                    anchors.left:       parent.left
                                    anchors.right:      parent.right
Don Gagne's avatar
Don Gagne committed
696 697

                                    QGCLabel {
Don Gagne's avatar
Don Gagne committed
698
                                        text:           qsTr("Min Zoom: %1").arg(sliderMinZoom.value)
Don Gagne's avatar
Don Gagne committed
699 700 701
                                        font.pointSize: _adjustableFontPointSize
                                    }

Don Gagne's avatar
Don Gagne committed
702 703 704 705 706 707 708 709 710 711
                                    Slider {
                                        id:                         sliderMinZoom
                                        anchors.left:               parent.left
                                        anchors.right:              parent.right
                                        height:                     setName.height
                                        minimumValue:               minZoomLevel
                                        maximumValue:               maxZoomLevel
                                        stepSize:                   1
                                        updateValueWhileDragging:   true
                                        property real _savedZoom
dogmaphobic's avatar
dogmaphobic committed
712
                                        Component.onCompleted:      Math.max(sliderMinZoom.value = _map.zoomLevel - 4, 2)
Don Gagne's avatar
Don Gagne committed
713 714 715 716 717 718 719 720
                                        onValueChanged: {
                                            if(sliderMinZoom.value > sliderMaxZoom.value) {
                                                sliderMaxZoom.value = sliderMinZoom.value
                                            }
                                            handleChanges()
                                        }
                                    } // Slider - min zoom

Don Gagne's avatar
Don Gagne committed
721
                                    QGCLabel {
dogmaphobic's avatar
dogmaphobic committed
722 723
                                        text:                       qsTr("Max Zoom: %1").arg(sliderMaxZoom.value)
                                        font.pointSize:             _adjustableFontPointSize
Don Gagne's avatar
Don Gagne committed
724
                                    }
Don Gagne's avatar
Don Gagne committed
725 726 727 728 729 730 731 732 733 734 735

                                    Slider {
                                        id:                         sliderMaxZoom
                                        anchors.left:               parent.left
                                        anchors.right:              parent.right
                                        height:                     setName.height
                                        minimumValue:               minZoomLevel
                                        maximumValue:               maxZoomLevel
                                        stepSize:                   1
                                        updateValueWhileDragging:   true
                                        property real _savedZoom
dogmaphobic's avatar
dogmaphobic committed
736
                                        Component.onCompleted:      Math.min(sliderMaxZoom.value = _map.zoomLevel + 2, 20)
Don Gagne's avatar
Don Gagne committed
737 738 739 740 741 742 743 744 745 746
                                        onValueChanged: {
                                            if(sliderMaxZoom.value < sliderMinZoom.value) {
                                                sliderMinZoom.value = sliderMaxZoom.value
                                            }
                                            handleChanges()
                                        }
                                    } // Slider - max zoom

                                    GridLayout {
                                        columns:    2
747
                                        rowSpacing: ScreenTools.isTinyScreen ? 0 : ScreenTools.defaultFontPixelHeight * 0.5
Don Gagne's avatar
Don Gagne committed
748
                                        QGCLabel {
dogmaphobic's avatar
dogmaphobic committed
749
                                            text:           qsTr("Count:")
Don Gagne's avatar
Don Gagne committed
750 751 752
                                            font.pointSize: _adjustableFontPointSize
                                        }
                                        QGCLabel {
dogmaphobic's avatar
dogmaphobic committed
753
                                            text:            QGroundControl.mapEngineManager.tileCountStr
Don Gagne's avatar
Don Gagne committed
754 755 756 757
                                            font.pointSize: _adjustableFontPointSize
                                        }

                                        QGCLabel {
dogmaphobic's avatar
dogmaphobic committed
758
                                            text:           qsTr("Est Size:")
Don Gagne's avatar
Don Gagne committed
759 760 761 762 763 764
                                            font.pointSize: _adjustableFontPointSize
                                        }
                                        QGCLabel {
                                            text:           QGroundControl.mapEngineManager.tileSizeStr
                                            font.pointSize: _adjustableFontPointSize
                                        }
Don Gagne's avatar
Don Gagne committed
765
                                    }
Don Gagne's avatar
Don Gagne committed
766 767
                                } // Column - Zoom info
                            } // Rectangle - Zoom info
Don Gagne's avatar
Don Gagne committed
768

769 770 771 772 773 774 775
                            QGCLabel {
                                text:       qsTr("Too many tiles")
                                visible:    _tooManyTiles
                                color:      qgcPal.warningText
                                anchors.horizontalCenter: parent.horizontalCenter
                            }

dogmaphobic's avatar
dogmaphobic committed
776 777
                            Row {
                                spacing: ScreenTools.defaultFontPixelWidth
Don Gagne's avatar
Don Gagne committed
778
                                anchors.horizontalCenter: parent.horizontalCenter
dogmaphobic's avatar
dogmaphobic committed
779
                                QGCButton {
780 781
                                    id:         downloadButton
                                    text:       qsTr("Download")
dogmaphobic's avatar
dogmaphobic committed
782 783 784 785 786 787 788 789 790 791 792
                                    enabled:    !_tooManyTiles && setName.text.length > 0
                                    onClicked: {
                                        if(QGroundControl.mapEngineManager.findName(setName.text)) {
                                            duplicateName.visible = true
                                        } else {
                                            QGroundControl.mapEngineManager.startDownload(setName.text, mapType);
                                            showList()
                                        }
                                    }
                                }
                                QGCButton {
793 794
                                    text:   qsTr("Cancel")
                                    width:  downloadButton.width
dogmaphobic's avatar
dogmaphobic committed
795
                                    onClicked: {
Don Gagne's avatar
Don Gagne committed
796 797
                                        showList()
                                    }
Don Gagne's avatar
Don Gagne committed
798
                                }
dogmaphobic's avatar
dogmaphobic committed
799
                            }
dogmaphobic's avatar
dogmaphobic committed
800

Don Gagne's avatar
Don Gagne committed
801 802 803 804
                        } // Column
                    } // QGCFlickable
                } // Rectangle - Add new set dialog
            } // Item - Add new set view
Don Gagne's avatar
Don Gagne committed
805 806 807 808 809 810 811
        } // Map

        QGCFlickable {
            id:                 _tileSetList
            clip:               true
            anchors.margins:    ScreenTools.defaultFontPixelWidth
            anchors.top:        parent.top
812
            anchors.bottom:     _listButtonRow.top
Don Gagne's avatar
Don Gagne committed
813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
            anchors.left:       parent.left
            anchors.right:      parent.right
            contentHeight:      _cacheList.height

            Column {
                id:         _cacheList
                width:      Math.min(_tileSetList.width, (ScreenTools.defaultFontPixelWidth  * 50).toFixed(0))
                spacing:    ScreenTools.defaultFontPixelHeight * 0.5
                anchors.horizontalCenter: parent.horizontalCenter
                OfflineMapButton {
                    id:             firstButton
                    text:           qsTr("Add new set")
                    width:          _cacheList.width
                    height:         ScreenTools.defaultFontPixelHeight * 2
                    onClicked: {
                        offlineMapView._currentSelection = null
                        addNewSet()
dogmaphobic's avatar
dogmaphobic committed
830 831
                    }
                }
Don Gagne's avatar
Don Gagne committed
832 833 834 835 836
                Repeater {
                    model: QGroundControl.mapEngineManager.tileSets
                    delegate: OfflineMapButton {
                        text:           object.name
                        size:           object.downloadStatus
dogmaphobic's avatar
dogmaphobic committed
837
                        tiles:          object.totalTileCount
Don Gagne's avatar
Don Gagne committed
838 839 840 841 842 843
                        complete:       object.complete
                        width:          firstButton.width
                        height:         ScreenTools.defaultFontPixelHeight * 2
                        onClicked: {
                            offlineMapView._currentSelection = object
                            showInfo()
dogmaphobic's avatar
dogmaphobic committed
844
                        }
dogmaphobic's avatar
dogmaphobic committed
845 846 847 848
                    }
                }
            }
        }
849 850 851 852 853 854
        Row {
            id:                 _listButtonRow
            visible:            _tileSetList.visible
            spacing:            _margins
            anchors.bottom:     parent.bottom
            anchors.margins:    ScreenTools.defaultFontPixelWidth
Gus Grubba's avatar
Gus Grubba committed
855
            anchors.horizontalCenter: parent.horizontalCenter
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871
            QGCButton {
                text:           qsTr("Import")
                width:          _buttonSize
            }
            QGCButton {
                text:           qsTr("Export")
                width:          _buttonSize
                enabled:        QGroundControl.mapEngineManager.tileSets.count > 1
                onClicked:      showExport()
            }
            QGCButton {
                text:           qsTr("Options")
                width:          _buttonSize
                onClicked:      showDialog(optionsDialogComponent, qsTr("Offline Maps Options"), qgcView.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
            }
        }
Don Gagne's avatar
Don Gagne committed
872

873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
        //-- Export Tile Sets
        QGCFlickable {
            id:                 _exporTiles
            clip:               true
            visible:            false
            anchors.margins:    ScreenTools.defaultFontPixelWidth
            anchors.top:        parent.top
            anchors.bottom:     _exportButtonRow.top
            anchors.left:       parent.left
            anchors.right:      parent.right
            contentHeight:      _exportList.height
            Column {
                id:         _exportList
                width:      Math.min(_exporTiles.width, (ScreenTools.defaultFontPixelWidth  * 50).toFixed(0))
                spacing:    ScreenTools.defaultFontPixelHeight * 0.5
                anchors.horizontalCenter: parent.horizontalCenter
                QGCLabel {
                    text:           qsTr("Select Tile Sets to Export")
                    font.pointSize: ScreenTools.mediumFontPointSize
                }
                Item { width: 1; height: ScreenTools.defaultFontPixelHeight; }
                Repeater {
                    model: QGroundControl.mapEngineManager.tileSets
                    delegate: QGCCheckBox {
                        text:           object.name
                        checked:        object.selected
                        onClicked: {
                            object.selected = checked
                        }
                    }
                }
            }
        }
        Row {
            id:                 _exportButtonRow
            visible:            _exporTiles.visible
            spacing:            _margins
            anchors.bottom:     parent.bottom
            anchors.margins:    ScreenTools.defaultFontPixelWidth
Gus Grubba's avatar
Gus Grubba committed
912
            anchors.horizontalCenter: parent.horizontalCenter
913
            QGCButton {
Gus Grubba's avatar
Gus Grubba committed
914 915
                text:           qsTr("Select All")
                width:          _bigButtonSize
916 917 918
                onClicked:      QGroundControl.mapEngineManager.selectAll()
            }
            QGCButton {
Gus Grubba's avatar
Gus Grubba committed
919 920
                text:           qsTr("Select None")
                width:          _bigButtonSize
921 922 923
                onClicked:      QGroundControl.mapEngineManager.selectNone()
            }
            QGCButton {
Gus Grubba's avatar
Gus Grubba committed
924 925 926 927 928 929 930 931 932 933 934 935
                text:           qsTr("Export to Disk")
                width:          _bigButtonSize
                enabled:        QGroundControl.mapEngineManager.selectedCount > 0
                onClicked: {
                    showList();
                    QGroundControl.mapEngineManager.exportSets()
                    rootLoader.sourceComponent = exportToDiskProgress
                }
            }
            QGCButton {
                text:           qsTr("Export to Device")
                width:          _bigButtonSize
936 937 938 939 940 941 942 943
                enabled:        QGroundControl.mapEngineManager.selectedCount > 0
                onClicked: {
                    QGroundControl.mapEngineManager.exportSets()
                    showList()
                }
            }
            QGCButton {
                text:           qsTr("Cancel")
Gus Grubba's avatar
Gus Grubba committed
944
                width:          _bigButtonSize
945 946
                onClicked:       showList()
            }
Don Gagne's avatar
Don Gagne committed
947 948
        }
    } // QGCViewPanel
Gus Grubba's avatar
Gus Grubba committed
949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003

    Component {
        id: exportToDiskProgress
        Rectangle {
            width:      mainWindow.width
            height:     mainWindow.height
            color:      "black"
            anchors.centerIn: parent
            Rectangle {
                width:  parent.width  * 0.5
                height: cameraSettingsCol.height * 1.25
                radius: ScreenTools.defaultFontPixelWidth
                color:  qgcPal.windowShadeDark
                border.color: qgcPal.text
                anchors.centerIn: parent
                Column {
                    id:                 cameraSettingsCol
                    spacing:            ScreenTools.defaultFontPixelHeight
                    width:              parent.width
                    anchors.centerIn:   parent
                    QGCLabel {
                        text:               QGroundControl.mapEngineManager.exporting ? qsTr("Tile Set Export Progress") : qsTr("Tile Set Export Completed")
                        font.family:        ScreenTools.demiboldFontFamily
                        font.pointSize:     ScreenTools.mediumFontPointSize
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                    ProgressBar {
                        id:             progressBar
                        width:          parent.width * 0.45
                        maximumValue:   100
                        value:          QGroundControl.mapEngineManager.exportProgress
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                    BusyIndicator {
                        visible:        QGroundControl.mapEngineManager.exporting
                        running:        QGroundControl.mapEngineManager.exporting
                        width:          exportCloseButton.height
                        height:         exportCloseButton.height
                        anchors.horizontalCenter: parent.horizontalCenter
                    }
                    QGCButton {
                        id:             exportCloseButton
                        text:           qsTr("Close")
                        width:          _buttonSize
                        visible:        !QGroundControl.mapEngineManager.exporting
                        anchors.horizontalCenter: parent.horizontalCenter
                        onClicked: {
                            rootLoader.sourceComponent = null
                        }
                    }
                }
            }
        }
    }

Don Gagne's avatar
Don Gagne committed
1004
} // QGCView