@@ -11,7 +11,6 @@ import QtQuick
1111import QtQuick.Controls
1212import QtQuick.Layouts
1313import QtQuick.Dialogs
14- import QtQuick.Controls
1514import QtLocation
1615import QtPositioning
1716
@@ -35,8 +34,9 @@ FlightMap {
3534
3635 property var _settingsManager: QGroundControl .settingsManager
3736 property var _settings: _settingsManager ? _settingsManager .offlineMapsSettings : null
37+ property var _mapsSettings: _settingsManager ? _settingsManager .mapsSettings : null
3838 property var _fmSettings: _settingsManager ? _settingsManager .flightMapSettings : null
39- property var _appSettings: _settingsManager .appSettings
39+ property var _appSettings: _settingsManager ? _settingsManager .appSettings : null
4040 property Fact _tiandituFact: _settingsManager ? _settingsManager .appSettings .tiandituToken : null
4141 property Fact _mapboxFact: _settingsManager ? _settingsManager .appSettings .mapboxToken : null
4242 property Fact _mapboxAccountFact: _settingsManager ? _settingsManager .appSettings .mapboxAccount : null
@@ -72,18 +72,26 @@ FlightMap {
7272 QGCPalette { id: qgcPal }
7373
7474 Component .onCompleted : {
75- QGroundControl .mapEngineManager .loadTileSets ()
75+ if (QGroundControl .mapEngineManager .tileSets .count === 0 ) {
76+ QGroundControl .mapEngineManager .loadTileSets ()
77+ }
7678 resetMapToDefaults ()
7779 updateMap ()
7880 savedCenter = _map .toCoordinate (Qt .point (_map .width / 2 , _map .height / 2 ), false /* clipToViewPort */ )
7981 settingsPage .enabled = false // Prevent mouse events from bleeding through to the settings page which is below this in hierarchy
8082 }
8183
82- Component .onDestruction : settingsPage .enabled = true
84+ Component .onDestruction : {
85+ settingsPage .enabled = true
86+ }
8387
8488 Connections {
8589 target: QGroundControl .mapEngineManager
86- onErrorMessageChanged: errorDialogComponent .createObject (mainWindow).open ()
90+ function onErrorMessageChanged () {
91+ var dialog = errorDialogComponent .createObject (mainWindow)
92+ dialog .closing .connect (function () { dialog .destroy () })
93+ dialog .open ()
94+ }
8795 }
8896
8997 function handleChanges () {
@@ -212,12 +220,7 @@ FlightMap {
212220 color: Qt .rgba (qgcPal .window .r , qgcPal .window .g , qgcPal .window .b , 0.85 )
213221 radius: ScreenTools .defaultFontPixelWidth * 0.5
214222
215- property bool _extraButton: {
216- if (! tileSet)
217- return false ;
218- var curSel = tileSet;
219- return ! _defaultSet && ((! curSel .complete && ! curSel .downloading ) || (! curSel .complete && curSel .downloading ));
220- }
223+ property bool _extraButton: tileSet && ! _defaultSet && ! tileSet .complete
221224
222225 property real _labelWidth: ScreenTools .defaultFontPixelWidth * 10
223226 property real _valueWidth: ScreenTools .defaultFontPixelWidth * 14
@@ -309,32 +312,55 @@ FlightMap {
309312 QGCLabel { text: qsTr (" Tile Count:" ); width: infoView ._labelWidth ; }
310313 QGCLabel { text: tileSet ? tileSet .savedTileCountStr : " " ; horizontalAlignment: Text .AlignRight ; width: infoView ._valueWidth ; }
311314 }
315+ Row {
316+ spacing: ScreenTools .defaultFontPixelWidth
317+ anchors .horizontalCenter : parent .horizontalCenter
318+ visible: tileSet && ! _defaultSet
319+ QGCLabel { text: qsTr (" Queue:" ); width: infoView ._labelWidth ; }
320+ QGCLabel {
321+ width: infoView ._valueWidth
322+ horizontalAlignment: Text .AlignRight
323+ text: tileSet ? qsTr (" %1 pending / %2 active / %3 error" )
324+ .arg (tileSet .pendingTiles )
325+ .arg (tileSet .downloadingTiles )
326+ .arg (tileSet .errorTiles ) : " "
327+ }
328+ }
312329 Row {
313330 spacing: ScreenTools .defaultFontPixelWidth
314331 anchors .horizontalCenter : parent .horizontalCenter
315332 QGCButton {
316333 text: qsTr (" Resume Download" )
317- visible: tileSet && tileSet && ! _defaultSet && (! tileSet .complete && ! tileSet .downloading )
334+ visible: tileSet && ! _defaultSet && (! tileSet .complete && ! tileSet .downloading )
318335 width: ScreenTools .defaultFontPixelWidth * 16
319336 onClicked: {
320337 if (tileSet)
321338 tileSet .resumeDownloadTask ()
322339 }
323340 }
324341 QGCButton {
325- text: qsTr (" Cancel Download" )
326- visible: tileSet && tileSet && ! _defaultSet && (! tileSet .complete && tileSet .downloading )
342+ text: qsTr (" Pause Download" )
343+ visible: tileSet && ! _defaultSet && (! tileSet .complete && tileSet .downloading )
327344 width: ScreenTools .defaultFontPixelWidth * 16
328345 onClicked: {
329346 if (tileSet)
330- tileSet .cancelDownloadTask ()
347+ tileSet .pauseDownloadTask ()
348+ }
349+ }
350+ QGCButton {
351+ text: qsTr (" Retry Failed (%1)" ).arg (tileSet ? tileSet .errorTiles : 0 )
352+ visible: tileSet && ! _defaultSet && (tileSet .errorTiles > 0 )
353+ width: ScreenTools .defaultFontPixelWidth * 16
354+ onClicked: {
355+ if (tileSet)
356+ tileSet .retryFailedTiles ()
331357 }
332358 }
333359 QGCButton {
334360 text: qsTr (" Delete" )
335361 width: ScreenTools .defaultFontPixelWidth * (infoView ._extraButton ? 6 : 10 )
336362 onClicked: deleteConfirmationDialogComponent .createObject (mainWindow).open ()
337- enabled: tileSet ? (tileSet .savedTileSize > 0 ) : false
363+ enabled: tileSet ? (! tileSet .deleting && (_defaultSet ? tileSet . savedTileSize > 0 : true ) ) : false
338364 }
339365 QGCButton {
340366 text: qsTr (" Ok" )
@@ -691,10 +717,13 @@ FlightMap {
691717 } // Rectangle - Zoom info
692718
693719 QGCLabel {
694- text: qsTr (" Too many tiles" )
720+ text: qsTr (" Too many tiles: %1 exceeds limit of %2 " ). arg ( QGroundControl . mapEngineManager . tileCountStr ). arg (_settings ? _settings . maxTilesForDownload . valueString : " " )
695721 visible: _tooManyTiles
696722 color: qgcPal .warningText
697- anchors .horizontalCenter : parent .horizontalCenter
723+ wrapMode: Text .WordWrap
724+ anchors .left : parent .left
725+ anchors .right : parent .right
726+ horizontalAlignment: Text .AlignHCenter
698727 }
699728
700729 Row {
@@ -765,4 +794,3 @@ FlightMap {
765794 }
766795 }
767796}
768-
0 commit comments