summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Angelelli <paolo.angelelli@qt.io>2017-07-16 12:59:12 +0200
committerPaolo Angelelli <paolo.angelelli@qt.io>2017-07-17 11:42:18 +0000
commit4d56870212940fae747390ce4d21555164300719 (patch)
treed17e5f6edd224e9ef43e96e54088af6765cd1b19
parent40b8d8f0b1c4d3dfdb63994f1c5d9e16760496f7 (diff)
downloadqtlocation-4d56870212940fae747390ce4d21555164300719.tar.gz
Add virtual fetchingEnabled in QGeoTileFetcher
With this, a plugin can programmatically prevent the fetcher from acessing the network. E.g., by using a QNetworkConfigurationManager. The change introduced in this patch does however not allow the user to dynamically enable/disable the fetcher's network access. For that, additional support, together with public API, is necessary. Change-Id: I8250cd3dc8d4b2c36ccf243b5ddeab2878b549b4 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/location/maps/qgeotilefetcher.cpp7
-rw-r--r--src/location/maps/qgeotilefetcher_p.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/location/maps/qgeotilefetcher.cpp b/src/location/maps/qgeotilefetcher.cpp
index 70ebbcd1..bab75034 100644
--- a/src/location/maps/qgeotilefetcher.cpp
+++ b/src/location/maps/qgeotilefetcher.cpp
@@ -126,7 +126,7 @@ void QGeoTileFetcher::requestNextTile()
const QGeoCameraCapabilities & cameraCaps = d->engine_->cameraCapabilities(ts.mapId());
// the ZL in QGeoTileSpec is relative to the native tile size of the provider.
// It gets denormalized in QGeoTiledMap.
- if (ts.zoom() < cameraCaps.minimumZoomLevel() || ts.zoom() > cameraCaps.maximumZoomLevel())
+ if (ts.zoom() < cameraCaps.minimumZoomLevel() || ts.zoom() > cameraCaps.maximumZoomLevel() || !fetchingEnabled())
return;
QGeoTiledMapReply *reply = getTileImage(ts);
@@ -189,6 +189,11 @@ bool QGeoTileFetcher::initialized() const
return true;
}
+bool QGeoTileFetcher::fetchingEnabled() const
+{
+ return true;
+}
+
void QGeoTileFetcher::handleReply(QGeoTiledMapReply *reply, const QGeoTileSpec &spec)
{
Q_D(QGeoTileFetcher);
diff --git a/src/location/maps/qgeotilefetcher_p.h b/src/location/maps/qgeotilefetcher_p.h
index d052a8a8..88880424 100644
--- a/src/location/maps/qgeotilefetcher_p.h
+++ b/src/location/maps/qgeotilefetcher_p.h
@@ -89,6 +89,7 @@ protected:
void timerEvent(QTimerEvent *event);
QAbstractGeoTileCache::CacheAreas cacheHint() const;
virtual bool initialized() const;
+ virtual bool fetchingEnabled() const;
private: