summaryrefslogtreecommitdiff
path: root/src/plugins/geoservices/osm
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/osm
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/osm')
-rw-r--r--src/plugins/geoservices/osm/qgeotileproviderosm.cpp24
-rw-r--r--src/plugins/geoservices/osm/qgeotileproviderosm.h1
2 files changed, 24 insertions, 1 deletions
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