From 4d56870212940fae747390ce4d21555164300719 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Sun, 16 Jul 2017 12:59:12 +0200 Subject: 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 --- src/location/maps/qgeotilefetcher.cpp | 7 ++++++- src/location/maps/qgeotilefetcher_p.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) 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: -- cgit v1.2.1