summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-01 08:01:56 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-01 08:01:56 +0200
commit5ea190ac941ed9889de049df221b56db065529d0 (patch)
treec0b7b4b2a6bb30c4ec1a653715760c50d9e34ce9 /src/plugins/geoservices
parent5389a65dc7434c4ed269a5d0c5cb93f5b12823ba (diff)
parent5c3e3464c2ccf960ef3aaee4286f3d5b4cde12ac (diff)
downloadqtlocation-5ea190ac941ed9889de049df221b56db065529d0.tar.gz
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts: .qmake.conf Change-Id: I5700c90ee86873599b5e7c9ccb6cef7ca48153e7
Diffstat (limited to 'src/plugins/geoservices')
-rw-r--r--src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp2
-rw-r--r--src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp39
-rw-r--r--src/plugins/geoservices/osm/qgeotileproviderosm.cpp24
-rw-r--r--src/plugins/geoservices/osm/qgeotileproviderosm.h1
4 files changed, 48 insertions, 18 deletions
diff --git a/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp b/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp
index 2792ee78..3be66c72 100644
--- a/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp
+++ b/src/plugins/geoservices/mapbox/qgeofiletilecachemapbox.cpp
@@ -90,7 +90,7 @@ QGeoTileSpec QGeoFileTileCacheMapbox::filenameToTileSpec(const QString &filename
if (parts.length() != 3) // 3 because the map name has always a dot in it.
return QGeoTileSpec();
- QString name = parts.at(0) + parts.at(1);
+ QString name = parts.at(0) + QChar('.') + parts.at(1);
QStringList fields = name.split('-');
int length = fields.length();
diff --git a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
index d2463106..5cbde041 100644
--- a/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
+++ b/src/plugins/geoservices/mapboxgl/qgeomappingmanagerenginemapboxgl.cpp
@@ -73,40 +73,43 @@ QGeoMappingManagerEngineMapboxGL::QGeoMappingManagerEngineMapboxGL(const QVarian
m_useChinaEndpoint = parameters.value(QStringLiteral("mapboxgl.china")).toBool();
}
+ QVariantMap metadata;
+ metadata["isHTTPS"] = true;
+
if (m_useChinaEndpoint) {
m_settings.setApiBaseUrl(QStringLiteral("https://api.mapbox.cn"));
mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox://styles/mapbox/streets-zh-v1"),
- tr("China Streets"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("China Streets"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::GrayStreetMap, QStringLiteral("mapbox://styles/mapbox/light-zh-v1"),
- tr("China Light"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("China Light"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::GrayStreetMap, QStringLiteral("mapbox://styles/mapbox/dark-zh-v1"),
- tr("China Dark"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("China Dark"), false, false, ++mapId, pluginName, cameraCaps, metadata);
} else {
mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox://styles/mapbox/streets-v10"),
- tr("Streets"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Streets"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox://styles/mapbox/basic-v9"),
- tr("Basic"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Basic"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::StreetMap, QStringLiteral("mapbox://styles/mapbox/bright-v9"),
- tr("Bright"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Bright"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::TerrainMap, QStringLiteral("mapbox://styles/mapbox/outdoors-v10"),
- tr("Outdoors"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Outdoors"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::SatelliteMapDay, QStringLiteral("mapbox://styles/mapbox/satellite-v9"),
- tr("Satellite"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Satellite"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::HybridMap, QStringLiteral("mapbox://styles/mapbox/satellite-streets-v10"),
- tr("Satellite Streets"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Satellite Streets"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::GrayStreetMap, QStringLiteral("mapbox://styles/mapbox/light-v9"),
- tr("Light"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Light"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::GrayStreetMap, QStringLiteral("mapbox://styles/mapbox/dark-v9"),
- tr("Dark"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Dark"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::TransitMap, QStringLiteral("mapbox://styles/mapbox/navigation-preview-day-v2"),
- tr("Navigation Preview Day"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Navigation Preview Day"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::TransitMap, QStringLiteral("mapbox://styles/mapbox/navigation-preview-night-v2"),
- tr("Navigation Preview Night"), false, true, ++mapId, pluginName, cameraCaps);
+ tr("Navigation Preview Night"), false, true, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::CarNavigationMap, QStringLiteral("mapbox://styles/mapbox/navigation-guidance-day-v2"),
- tr("Navigation Guidance Day"), false, false, ++mapId, pluginName, cameraCaps);
+ tr("Navigation Guidance Day"), false, false, ++mapId, pluginName, cameraCaps, metadata);
mapTypes << QGeoMapType(QGeoMapType::CarNavigationMap, QStringLiteral("mapbox://styles/mapbox/navigation-guidance-night-v2"),
- tr("Navigation Guidance Night"), false, true, ++mapId, pluginName, cameraCaps);
+ tr("Navigation Guidance Night"), false, true, ++mapId, pluginName, cameraCaps, metadata);
}
if (parameters.contains(QStringLiteral("mapboxgl.mapping.additional_style_urls"))) {
@@ -116,9 +119,13 @@ QGeoMappingManagerEngineMapboxGL::QGeoMappingManagerEngineMapboxGL(const QVarian
for (auto it = idList.crbegin(), end = idList.crend(); it != end; ++it) {
if ((*it).isEmpty())
continue;
+ if ((*it).startsWith(QStringLiteral("http:")))
+ metadata["isHTTPS"] = false;
+ else
+ metadata["isHTTPS"] = true;
mapTypes.prepend(QGeoMapType(QGeoMapType::CustomMap, *it,
- tr("User provided style"), false, false, ++mapId, pluginName, cameraCaps));
+ tr("User provided style"), false, false, ++mapId, pluginName, cameraCaps, metadata));
}
}
diff --git a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
index c0837024..f52968b0 100644
--- a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp
@@ -45,6 +45,16 @@ QT_BEGIN_NAMESPACE
static const int maxValidZoom = 30;
static const QDateTime defaultTs = QDateTime::fromString(QStringLiteral("2016-06-01T00:00:00"), Qt::ISODate);
+static void setSSL(QGeoMapType &mapType, bool isHTTPS)
+{
+ QVariantMap metadata = mapType.metadata();
+ metadata["isHTTPS"] = isHTTPS;
+
+ mapType = QGeoMapType(mapType.style(), mapType.name(), mapType.description(), mapType.mobile(),
+ mapType.night(), mapType.mapId(), mapType.pluginName(), mapType.cameraCapabilities(),
+ metadata);
+}
+
QGeoTileProviderOsm::QGeoTileProviderOsm(QNetworkAccessManager *nm,
const QGeoMapType &mapType,
const QVector<TileProvider *> &providers,
@@ -61,6 +71,9 @@ QGeoTileProviderOsm::QGeoTileProviderOsm(QNetworkAccessManager *nm,
if (!m_provider || m_provider->isValid())
m_status = Resolved;
+ if (m_provider && m_provider->isValid())
+ setSSL(m_mapType, m_provider->isHTTPS());
+
connect(this, &QGeoTileProviderOsm::resolutionFinished, this, &QGeoTileProviderOsm::updateCameraCapabilities);
}
@@ -237,7 +250,11 @@ void QGeoTileProviderOsm::updateCameraCapabilities()
m_cameraCapabilities.setMaximumZoomLevel(maximumZoomLevel());
m_mapType = QGeoMapType(m_mapType.style(), m_mapType.name(), m_mapType.description(), m_mapType.mobile(),
- m_mapType.night(), m_mapType.mapId(), m_mapType.pluginName(), m_cameraCapabilities);
+ m_mapType.night(), m_mapType.mapId(), m_mapType.pluginName(), m_cameraCapabilities,
+ m_mapType.metadata());
+
+ if (m_provider && m_provider->isValid())
+ setSSL(m_mapType, m_provider->isHTTPS());
}
void QGeoTileProviderOsm::addProvider(TileProvider *provider)
@@ -604,6 +621,11 @@ bool TileProvider::isHighDpi() const
return m_highDpi;
}
+bool TileProvider::isHTTPS() const
+{
+ return m_urlTemplate.startsWith(QStringLiteral("https"));
+}
+
void TileProvider::setStyleCopyRight(const QString &copyright)
{
m_copyRightStyle = copyright;
diff --git a/src/plugins/geoservices/osm/qgeotileproviderosm.h b/src/plugins/geoservices/osm/qgeotileproviderosm.h
index 54f8049d..ab4e2294 100644
--- a/src/plugins/geoservices/osm/qgeotileproviderosm.h
+++ b/src/plugins/geoservices/osm/qgeotileproviderosm.h
@@ -93,6 +93,7 @@ public:
inline int maximumZoomLevel() const;
inline const QDateTime &timestamp() const;
inline bool isHighDpi() const;
+ inline bool isHTTPS() const;
QUrl tileAddress(int x, int y, int z) const;
// Optional properties, not needed to construct a provider