diff --git a/src/QtLocationPlugin/QGCMapTileSet.cpp b/src/QtLocationPlugin/QGCMapTileSet.cpp index 7212614d460dbc793e96bf0d8d2f1ebcb0944a1f..525d8cb2d95dcb9b990f258b89396a8ad1baa5ce 100644 --- a/src/QtLocationPlugin/QGCMapTileSet.cpp +++ b/src/QtLocationPlugin/QGCMapTileSet.cpp @@ -29,13 +29,13 @@ This file is part of the QGROUNDCONTROL project * */ -#include -#include - #include "QGCMapEngine.h" #include "QGCMapTileSet.h" #include "QGCMapEngineManager.h" +#include +#include + QGC_LOGGING_CATEGORY(QGCCachedTileSetLog, "QGCCachedTileSetLog") #define TILE_BATCH_SIZE 256 diff --git a/src/QtLocationPlugin/QGCMapUrlEngine.cpp b/src/QtLocationPlugin/QGCMapUrlEngine.cpp index 0473d26fd887666e9106dc4e1907178b6fc642fa..2d4ab4cf9b04f4801fa8ffdbd060927818ba3c57 100644 --- a/src/QtLocationPlugin/QGCMapUrlEngine.cpp +++ b/src/QtLocationPlugin/QGCMapUrlEngine.cpp @@ -27,6 +27,8 @@ This file is part of the QGROUNDCONTROL project * Original work: The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. */ +#include "QGCMapEngine.h" + #include #include #include @@ -34,8 +36,6 @@ This file is part of the QGROUNDCONTROL project #include #include -#include "QGCMapEngine.h" - //----------------------------------------------------------------------------- UrlFactory::UrlFactory() : _timeout(5 * 1000) diff --git a/src/QtLocationPlugin/QGCTileCacheWorker.cpp b/src/QtLocationPlugin/QGCTileCacheWorker.cpp index c6a9b1f3cd732991edcec4470e3d80cad6b6f70f..60874209c79c0451f63399f4a63e9bcefa6106bf 100644 --- a/src/QtLocationPlugin/QGCTileCacheWorker.cpp +++ b/src/QtLocationPlugin/QGCTileCacheWorker.cpp @@ -29,6 +29,9 @@ This file is part of the QGROUNDCONTROL project * */ +#include "QGCMapEngine.h" +#include "QGCMapTileSet.h" + #include #include #include @@ -39,9 +42,6 @@ This file is part of the QGROUNDCONTROL project #include "time.h" -#include "QGCMapEngine.h" -#include "QGCMapTileSet.h" - const char* kDefaultSet = "Default Tile Set"; const QString kSession = QLatin1String("QGeoTileWorkerSession"); diff --git a/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp b/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp index aeca6d4b5862e63ffe4e673914038b40f6121d6e..9bac1c7b89a2cde2c122199b69818153b72e1a0b 100644 --- a/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp +++ b/src/QtLocationPlugin/QGeoCodeReplyQGC.cpp @@ -44,6 +44,8 @@ ** ****************************************************************************/ +#include "QGeoCodeReplyQGC.h" + #include #include #include @@ -54,8 +56,6 @@ #include #include -#include "QGeoCodeReplyQGC.h" - enum QGeoCodeTypeGoogle { GeoCodeTypeUnknown, StreetAddress, // indicates a precise street address. @@ -193,7 +193,7 @@ void QGeoCodeReplyQGC::networkReplyFinished() QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); QJsonObject object = document.object(); - + if (object.value(QStringLiteral("status")) != QStringLiteral("OK")) { QString error = object.value(QStringLiteral("status")).toString(); qWarning() << m_reply->url() << "returned" << error; @@ -210,13 +210,13 @@ void QGeoCodeReplyQGC::networkReplyFinished() continue; QJsonObject geocode = results[i].toObject(); - + QGeoAddress address; if (geocode.contains(QStringLiteral("formatted_address"))) { address.setText(geocode.value(QStringLiteral("formatted_address")).toString()); } - - + + if (geocode.contains(QStringLiteral("address_components"))) { QJsonArray ac = geocode.value(QStringLiteral("address_components")).toArray(); diff --git a/src/QtLocationPlugin/QGeoCodingManagerEngineQGC.cpp b/src/QtLocationPlugin/QGeoCodingManagerEngineQGC.cpp index 384c1ac18705c691933c90349fb31dadcc43b079..2e3b6409f2126690aaf2a0a0947debfe3c3f0e40 100644 --- a/src/QtLocationPlugin/QGeoCodingManagerEngineQGC.cpp +++ b/src/QtLocationPlugin/QGeoCodingManagerEngineQGC.cpp @@ -44,6 +44,9 @@ ** ****************************************************************************/ +#include "QGeoCodingManagerEngineQGC.h" +#include "QGeoCodeReplyQGC.h" + #include #include #include @@ -55,10 +58,6 @@ #include #include #include -#include - -#include "QGeoCodingManagerEngineQGC.h" -#include "QGeoCodeReplyQGC.h" static QString addressToQuery(const QGeoAddress &address) { @@ -120,7 +119,7 @@ QGeoCodeReply *QGeoCodingManagerEngineQGC::geocode(const QString &address, int l url.setQuery(query); request.setUrl(url); //qDebug() << url; - + QNetworkReply *reply = m_networkManager->get(request); reply->setParent(0); diff --git a/src/QtLocationPlugin/QGeoMapReplyQGC.cpp b/src/QtLocationPlugin/QGeoMapReplyQGC.cpp index 30d69e919cde031f224c5e0f7bda4ef89331a257..2e1ec5bdcbf87bbe5f985b3d50634a1348a5a4d0 100644 --- a/src/QtLocationPlugin/QGeoMapReplyQGC.cpp +++ b/src/QtLocationPlugin/QGeoMapReplyQGC.cpp @@ -44,13 +44,13 @@ ** ****************************************************************************/ +#include "QGCMapEngine.h" +#include "QGeoMapReplyQGC.h" + #include #include #include -#include "QGCMapEngine.h" -#include "QGeoMapReplyQGC.h" - //----------------------------------------------------------------------------- QGeoTiledMapReplyQGC::QGeoTiledMapReplyQGC(QNetworkAccessManager *networkManager, const QNetworkRequest &request, const QGeoTileSpec &spec, QObject *parent) : QGeoTiledMapReply(spec, parent) diff --git a/src/QtLocationPlugin/QGeoServiceProviderPluginQGC.cpp b/src/QtLocationPlugin/QGeoServiceProviderPluginQGC.cpp index 1b24429ebfe357207ce82e6d645bbd600bf6b911..49438e14574c552da4f37c8c692fbe1544d6ddf8 100644 --- a/src/QtLocationPlugin/QGeoServiceProviderPluginQGC.cpp +++ b/src/QtLocationPlugin/QGeoServiceProviderPluginQGC.cpp @@ -44,13 +44,12 @@ ** ****************************************************************************/ -#include - -#include "qdebug.h" #include "QGeoServiceProviderPluginQGC.h" #include "QGeoTiledMappingManagerEngineQGC.h" #include "QGeoCodingManagerEngineQGC.h" +#include + Q_EXTERN_C Q_DECL_EXPORT const char *qt_plugin_query_metadata(); Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance(); diff --git a/src/QtLocationPlugin/QGeoTileFetcherQGC.cpp b/src/QtLocationPlugin/QGeoTileFetcherQGC.cpp index c9e34958a23c4612d8f78b3d5541199ea30a25d9..485154716e0014b4aeba0510930118d800ef8ea1 100644 --- a/src/QtLocationPlugin/QGeoTileFetcherQGC.cpp +++ b/src/QtLocationPlugin/QGeoTileFetcherQGC.cpp @@ -44,14 +44,14 @@ ** ****************************************************************************/ -#include -#include -#include - #include "QGCMapEngine.h" #include "QGeoTileFetcherQGC.h" #include "QGeoMapReplyQGC.h" +#include +#include +#include + //----------------------------------------------------------------------------- QGeoTileFetcherQGC::QGeoTileFetcherQGC(QGeoTiledMappingManagerEngine *parent) : QGeoTileFetcher(parent) diff --git a/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp b/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp index b3f1b85b7c468ba9223704d827092bc6fe39f01f..2a75c711789fd6526495351c779990fd429ccd69 100644 --- a/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp +++ b/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp @@ -44,6 +44,10 @@ ** ****************************************************************************/ +#include "QGCMapEngine.h" +#include "QGeoTiledMappingManagerEngineQGC.h" +#include "QGeoTileFetcherQGC.h" + #include #include #if QT_VERSION < 0x050500 @@ -54,10 +58,6 @@ #include #include -#include "QGCMapEngine.h" -#include "QGeoTiledMappingManagerEngineQGC.h" -#include "QGeoTileFetcherQGC.h" - #if QT_VERSION >= 0x050500 //----------------------------------------------------------------------------- QGeoTiledMapQGC::QGeoTiledMapQGC(QGeoTiledMappingManagerEngine *engine, QObject *parent) diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index ae245db8533bd75ec04b4706f13bdec781643163..4c78e3e6e8820c5226beda293a6ddfbb3b80a1d3 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -611,171 +611,178 @@ Rectangle { anchors.bottom: parent.bottom anchors.margins: ScreenTools.defaultFontPixelWidth visible: false - - Column { - width: parent.width - spacing: ScreenTools.defaultFontPixelHeight - Item { - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: 1 - } - Rectangle { - width: infoWidth - height: nameLabel.height + (ScreenTools.defaultFontPixelHeight * 2) - color: __qgcPal.window - radius: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - id: nameLabel - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.name : "" - font.pixelSize: ScreenTools.isAndroid ? ScreenTools.mediumFontPixelSize : ScreenTools.largeFontPixelSize - anchors.centerIn: parent + QGCFlickable { + id: infoScroll + anchors.fill: parent + contentHeight: infoColumn.height + flickableDirection: Flickable.VerticalFlick + clip: true + Column { + id: infoColumn + width: parent.width + spacing: ScreenTools.defaultFontPixelHeight + Item { + height: ScreenTools.defaultFontPixelHeight * 0.5 + width: 1 } - } - QGCLabel { - id: descLabel - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.description : "" - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle { - id: infoRect - width: infoWidth - height: infoGrid.height + (ScreenTools.defaultFontPixelHeight * 4) - color: __qgcPal.window - radius: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - GridLayout { - id: infoGrid - columns: 2 - anchors.centerIn: parent - anchors.margins: ScreenTools.defaultFontPixelWidth * 2 - rowSpacing: ScreenTools.defaultFontPixelWidth - columnSpacing: ScreenTools.defaultFontPixelHeight * 2 - QGCLabel { - text: "Map Type:" - visible: !isDefaultSet - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.mapTypeStr : "" - visible: !isDefaultSet - } - QGCLabel { - text: "Min Zoom:" - visible: !isDefaultSet - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.minZoom : "" - visible: !isDefaultSet - } - QGCLabel { - text: "Max Zoom:" - visible: !isDefaultSet - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.maxZoom : "" - visible: !isDefaultSet - } - QGCLabel { - text: isDefaultSet ? "Default Set Size:" : "Total Size:" - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.tilesSizeStr : "" - } - QGCLabel { - text: isDefaultSet ? "Default Set Tile Count:" : "Total Tile Count:" - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.numTilesStr : "" - } - QGCLabel { - text: isDefaultSet ? "Total Size (All Sets):" : "Downloaded Size:" - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.savedSizeStr : "" - } - QGCLabel { - text: isDefaultSet ? "Total Count (All Sets):" : "Downloaded Count:" - } - QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.savedTilesStr : "" - } - QGCLabel { - text: "Error Count:" - visible: !isDefaultSet && _offlineMapRoot._currentSelection && !_offlineMapRoot._currentSelection.complete - } + Rectangle { + width: infoWidth + height: nameLabel.height + (ScreenTools.defaultFontPixelHeight * 2) + color: __qgcPal.window + radius: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.horizontalCenter: parent.horizontalCenter QGCLabel { - text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.errorCountStr : "" - visible: !isDefaultSet && _offlineMapRoot._currentSelection && !_offlineMapRoot._currentSelection.complete + id: nameLabel + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.name : "" + font.pixelSize: ScreenTools.isAndroid ? ScreenTools.mediumFontPixelSize : ScreenTools.largeFontPixelSize + anchors.centerIn: parent } } - } - Item { - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: 1 - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: ScreenTools.defaultFontPixelWidth - QGCButton { - width: ScreenTools.defaultFontPixelWidth * 18 - text: "Delete" - enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting) - onClicked: { - if(_offlineMapRoot._currentSelection) - deleteDialog.visible = true + QGCLabel { + id: descLabel + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.description : "" + anchors.horizontalCenter: parent.horizontalCenter + } + Rectangle { + id: infoRect + width: infoWidth + height: infoGrid.height + (ScreenTools.defaultFontPixelHeight * 4) + color: __qgcPal.window + radius: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.horizontalCenter: parent.horizontalCenter + GridLayout { + id: infoGrid + columns: 2 + anchors.centerIn: parent + anchors.margins: ScreenTools.defaultFontPixelWidth * 2 + rowSpacing: ScreenTools.defaultFontPixelWidth + columnSpacing: ScreenTools.defaultFontPixelHeight * 2 + QGCLabel { + text: "Map Type:" + visible: !isDefaultSet + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.mapTypeStr : "" + visible: !isDefaultSet + } + QGCLabel { + text: "Min Zoom:" + visible: !isDefaultSet + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.minZoom : "" + visible: !isDefaultSet + } + QGCLabel { + text: "Max Zoom:" + visible: !isDefaultSet + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.maxZoom : "" + visible: !isDefaultSet + } + QGCLabel { + text: isDefaultSet ? "Default Set Size:" : "Total Size:" + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.tilesSizeStr : "" + } + QGCLabel { + text: isDefaultSet ? "Default Set Tile Count:" : "Total Tile Count:" + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.numTilesStr : "" + } + QGCLabel { + text: isDefaultSet ? "Total Size (All Sets):" : "Downloaded Size:" + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.savedSizeStr : "" + } + QGCLabel { + text: isDefaultSet ? "Total Count (All Sets):" : "Downloaded Count:" + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.savedTilesStr : "" + } + QGCLabel { + text: "Error Count:" + visible: !isDefaultSet && _offlineMapRoot._currentSelection && !_offlineMapRoot._currentSelection.complete + } + QGCLabel { + text: _offlineMapRoot._currentSelection ? _offlineMapRoot._currentSelection.errorCountStr : "" + visible: !isDefaultSet && _offlineMapRoot._currentSelection && !_offlineMapRoot._currentSelection.complete + } } - MessageDialog { - id: deleteDialog - visible: false - icon: StandardIcon.Warning - standardButtons: StandardButton.Yes | StandardButton.No - title: "Delete Tile Set" - text: { - if(_offlineMapRoot._currentSelection) { - var blurb = "Delete " + _offlineMapRoot._currentSelection.name + " and all its tiles.\nIs this really what you want?" - if(_offlineMapRoot._currentSelection.defaultSet) - return blurb + "\nNote that deleteting the Default Set deletes all tiles from all sets." - else - return blurb + } + Item { + height: ScreenTools.defaultFontPixelHeight * 0.5 + width: 1 + } + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: ScreenTools.defaultFontPixelWidth + QGCButton { + width: ScreenTools.defaultFontPixelWidth * 18 + text: "Delete" + enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting) + onClicked: { + if(_offlineMapRoot._currentSelection) + deleteDialog.visible = true + } + MessageDialog { + id: deleteDialog + visible: false + icon: StandardIcon.Warning + standardButtons: StandardButton.Yes | StandardButton.No + title: "Delete Tile Set" + text: { + if(_offlineMapRoot._currentSelection) { + var blurb = "Delete " + _offlineMapRoot._currentSelection.name + " and all its tiles.\nIs this really what you want?" + if(_offlineMapRoot._currentSelection.defaultSet) + return blurb + "\nNote that deleteting the Default Set deletes all tiles from all sets." + else + return blurb + } + return "" + } + onYes: { + if(_offlineMapRoot._currentSelection) + QGroundControl.mapEngineManager.deleteTileSet(_offlineMapRoot._currentSelection) + deleteDialog.visible = false + showList() + } + onNo: { + deleteDialog.visible = false } - return "" } - onYes: { + } + QGCButton { + text: "Resume Download" + width: ScreenTools.defaultFontPixelWidth * 18 + enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting && !_offlineMapRoot._currentSelection.downloading) + visible: !isDefaultSet && _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.complete && !_offlineMapRoot._currentSelection.downloading) + onClicked: { if(_offlineMapRoot._currentSelection) - QGroundControl.mapEngineManager.deleteTileSet(_offlineMapRoot._currentSelection) - deleteDialog.visible = false - showList() - } - onNo: { - deleteDialog.visible = false + _offlineMapRoot._currentSelection.resumeDownloadTask() } } - } - QGCButton { - text: "Resume Download" - width: ScreenTools.defaultFontPixelWidth * 18 - enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting && !_offlineMapRoot._currentSelection.downloading) - visible: !isDefaultSet && _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.complete && !_offlineMapRoot._currentSelection.downloading) - onClicked: { - if(_offlineMapRoot._currentSelection) - _offlineMapRoot._currentSelection.resumeDownloadTask() + QGCButton { + text: "Cancel Download" + width: ScreenTools.defaultFontPixelWidth * 18 + enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting && _offlineMapRoot._currentSelection.downloading) + visible: !isDefaultSet && _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.complete && _offlineMapRoot._currentSelection.downloading) + onClicked: { + if(_offlineMapRoot._currentSelection) + _offlineMapRoot._currentSelection.cancelDownloadTask() + } } - } - QGCButton { - text: "Cancel Download" - width: ScreenTools.defaultFontPixelWidth * 18 - enabled: _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.deleting && _offlineMapRoot._currentSelection.downloading) - visible: !isDefaultSet && _offlineMapRoot._currentSelection && (!_offlineMapRoot._currentSelection.complete && _offlineMapRoot._currentSelection.downloading) - onClicked: { - if(_offlineMapRoot._currentSelection) - _offlineMapRoot._currentSelection.cancelDownloadTask() + QGCButton { + text: "Back" + width: ScreenTools.defaultFontPixelWidth * 18 + onClicked: showList() } } - QGCButton { - text: "Back" - width: ScreenTools.defaultFontPixelWidth * 18 - onClicked: showList() - } } } } @@ -794,113 +801,121 @@ Rectangle { maxCacheMemSize.text = QGroundControl.mapEngineManager.maxMemCache } } - Column { - width: parent.width - spacing: ScreenTools.defaultFontPixelHeight - Item { - height: ScreenTools.defaultFontPixelHeight - width: 1 - } - Rectangle { - width: infoWidth - height: optionsLabel.height + (ScreenTools.defaultFontPixelHeight * 2) - color: __qgcPal.window - radius: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - id: optionsLabel - text: "Offline Map Options" - font.pixelSize: ScreenTools.isAndroid ? ScreenTools.mediumFontPixelSize : ScreenTools.largeFontPixelSize - anchors.centerIn: parent + QGCFlickable { + id: optionsScroll + anchors.fill: parent + contentHeight: optionsColumn.height + flickableDirection: Flickable.VerticalFlick + clip: true + Column { + id: optionsColumn + width: parent.width + spacing: ScreenTools.defaultFontPixelHeight + Item { + height: ScreenTools.defaultFontPixelHeight + width: 1 } - } - Rectangle { - id: optionsRect - width: optionsGrid.width + (ScreenTools.defaultFontPixelWidth * 4) - height: optionsGrid.height + (ScreenTools.defaultFontPixelHeight * 4) - color: __qgcPal.window - radius: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - GridLayout { - id: optionsGrid - columns: 2 - anchors.centerIn: parent - anchors.margins: ScreenTools.defaultFontPixelWidth * 2 - rowSpacing: ScreenTools.defaultFontPixelWidth * 1.5 - columnSpacing: ScreenTools.defaultFontPixelHeight * 2 - QGCLabel { - text: "Max Cache Disk Size (MB):" - } - QGCTextField { - id: maxCacheSize - maximumLength: 6 - inputMethodHints: Qt.ImhDigitsOnly - validator: IntValidator {bottom: 1; top: 262144;} - } + Rectangle { + width: infoWidth + height: optionsLabel.height + (ScreenTools.defaultFontPixelHeight * 2) + color: __qgcPal.window + radius: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.horizontalCenter: parent.horizontalCenter QGCLabel { - text: "Max Cache Memory Size (MB):" - } - QGCTextField { - id: maxCacheMemSize - maximumLength: 4 - inputMethodHints: Qt.ImhDigitsOnly - validator: IntValidator {bottom: 1; top: 4096;} + id: optionsLabel + text: "Offline Map Options" + font.pixelSize: ScreenTools.isAndroid ? ScreenTools.mediumFontPixelSize : ScreenTools.largeFontPixelSize + anchors.centerIn: parent } - Item { - Layout.columnSpan: 2 - Layout.fillWidth: true - implicitHeight: ScreenTools.defaultFontPixelHeight * 1.5 + } + Rectangle { + id: optionsRect + width: optionsGrid.width + (ScreenTools.defaultFontPixelWidth * 4) + height: optionsGrid.height + (ScreenTools.defaultFontPixelHeight * 4) + color: __qgcPal.window + radius: ScreenTools.defaultFontPixelHeight * 0.5 + anchors.horizontalCenter: parent.horizontalCenter + GridLayout { + id: optionsGrid + columns: 2 + anchors.centerIn: parent + anchors.margins: ScreenTools.defaultFontPixelWidth * 2 + rowSpacing: ScreenTools.defaultFontPixelWidth * 1.5 + columnSpacing: ScreenTools.defaultFontPixelHeight * 2 QGCLabel { - anchors.centerIn: parent - text: "Memory cache changes require a restart to take effect." - font.pixelSize: ScreenTools.defaultFontPixelSize * 0.85 + text: "Max Cache Disk Size (MB):" + } + QGCTextField { + id: maxCacheSize + maximumLength: 6 + inputMethodHints: Qt.ImhDigitsOnly + validator: IntValidator {bottom: 1; top: 262144;} + } + QGCLabel { + text: "Max Cache Memory Size (MB):" + } + QGCTextField { + id: maxCacheMemSize + maximumLength: 4 + inputMethodHints: Qt.ImhDigitsOnly + validator: IntValidator {bottom: 1; top: 4096;} + } + Item { + Layout.columnSpan: 2 + Layout.fillWidth: true + implicitHeight: ScreenTools.defaultFontPixelHeight * 1.5 + QGCLabel { + anchors.centerIn: parent + text: "Memory cache changes require a restart to take effect." + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.85 + } + } + Rectangle { + Layout.columnSpan: 2 + Layout.fillWidth: true + implicitHeight: 1 + color: __qgcPal.text } - } - Rectangle { - Layout.columnSpan: 2 - Layout.fillWidth: true - implicitHeight: 1 - color: __qgcPal.text - } - QGCLabel { - text: "MapBox Access Token" - } - QGCTextField { - id: mapBoxToken - Layout.fillWidth: true - maximumLength: 256 - implicitWidth : ScreenTools.defaultFontPixelWidth * 30 - } - Item { - Layout.columnSpan: 2 - Layout.fillWidth: true - implicitHeight: ScreenTools.defaultFontPixelHeight * 1.5 QGCLabel { - anchors.centerIn: parent - text: "With an access token, you can use MapBox Maps." - font.pixelSize: ScreenTools.defaultFontPixelSize * 0.85 + text: "MapBox Access Token" + } + QGCTextField { + id: mapBoxToken + Layout.fillWidth: true + maximumLength: 256 + implicitWidth : ScreenTools.defaultFontPixelWidth * 30 + } + Item { + Layout.columnSpan: 2 + Layout.fillWidth: true + implicitHeight: ScreenTools.defaultFontPixelHeight * 1.5 + QGCLabel { + anchors.centerIn: parent + text: "With an access token, you can use MapBox Maps." + font.pixelSize: ScreenTools.defaultFontPixelSize * 0.85 + } } } } - } - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: ScreenTools.defaultFontPixelWidth - QGCButton { - text: "Save" - width: ScreenTools.defaultFontPixelWidth * 18 - onClicked: { - QGroundControl.mapEngineManager.mapboxToken = mapBoxToken.text - QGroundControl.mapEngineManager.maxDiskCache = parseInt(maxCacheSize.text) - QGroundControl.mapEngineManager.maxMemCache = parseInt(maxCacheMemSize.text) - showList() + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: ScreenTools.defaultFontPixelWidth + QGCButton { + text: "Save" + width: ScreenTools.defaultFontPixelWidth * 18 + onClicked: { + QGroundControl.mapEngineManager.mapboxToken = mapBoxToken.text + QGroundControl.mapEngineManager.maxDiskCache = parseInt(maxCacheSize.text) + QGroundControl.mapEngineManager.maxMemCache = parseInt(maxCacheMemSize.text) + showList() + } } - } - QGCButton { - text: "Cancel" - width: ScreenTools.defaultFontPixelWidth * 18 - onClicked: { - showList() + QGCButton { + text: "Cancel" + width: ScreenTools.defaultFontPixelWidth * 18 + onClicked: { + showList() + } } } } diff --git a/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc b/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc index e506dcb42eb3ddeaef669014e79d9ce7f1e2662f..1c95ae2abfe23e69857ca44cd0efe5dd6e0ad156 100644 --- a/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc +++ b/src/QtLocationPlugin/QMLControl/QGCMapEngineManager.cc @@ -26,9 +26,10 @@ #include "QGCMapEngineManager.h" #include "QGCApplication.h" -#include #include "QGCMapTileSet.h" #include "QGCMapUrlEngine.h" + +#include #include #include