summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Meyer <dev@meh.at>2015-10-24 16:58:27 +0200
committerHarald Meyer <dev@meh.at>2015-10-26 08:42:07 +0000
commit60874a570beaf3b8612161339c6b2b66d6d0dc09 (patch)
treee97c3e9c6275670b4215f3c621e519792d70b080
parent211fd58142a03387b8a693f20a6054a8578e9f8a (diff)
downloadqtlocation-60874a570beaf3b8612161339c6b2b66d6d0dc09.tar.gz
Added method to set the map cache
This update adds a new method "setTileCache" to the QGeoTiledMappingManagerEngine class. The method allows custom map implementations to set their own cache. The update also fixes a compiler warning (ctor variable order) and adds Q_DECL_OVERRIDE checks. Change-Id: I22cfdb218ae5c9af145d688f11aab655f4ed3e4b Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/location/maps/qabstractgeotilecache_p.h3
-rw-r--r--src/location/maps/qgeofiletilecache_p.h32
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine.cpp6
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine_p.h1
4 files changed, 25 insertions, 17 deletions
diff --git a/src/location/maps/qabstractgeotilecache_p.h b/src/location/maps/qabstractgeotilecache_p.h
index a679b430..e368066f 100644
--- a/src/location/maps/qabstractgeotilecache_p.h
+++ b/src/location/maps/qabstractgeotilecache_p.h
@@ -87,7 +87,6 @@ class Q_LOCATION_EXPORT QAbstractGeoTileCache : public QObject
{
Q_OBJECT
public:
- QAbstractGeoTileCache(QObject *parent = 0);
virtual ~QAbstractGeoTileCache();
virtual void setMaxDiskUsage(int diskUsage);
@@ -115,6 +114,8 @@ public:
static QString baseCacheDirectory();
protected:
+ QAbstractGeoTileCache(QObject *parent = 0);
+
virtual void printStats() = 0;
};
diff --git a/src/location/maps/qgeofiletilecache_p.h b/src/location/maps/qgeofiletilecache_p.h
index 1ed2aabc..6bd1ad2b 100644
--- a/src/location/maps/qgeofiletilecache_p.h
+++ b/src/location/maps/qgeofiletilecache_p.h
@@ -102,21 +102,21 @@ public:
QGeoFileTileCache(const QString &directory = QString(), QObject *parent = 0);
~QGeoFileTileCache();
- void setMaxDiskUsage(int diskUsage);
- int maxDiskUsage() const;
- int diskUsage() const;
+ void setMaxDiskUsage(int diskUsage) Q_DECL_OVERRIDE;
+ int maxDiskUsage() const Q_DECL_OVERRIDE;
+ int diskUsage() const Q_DECL_OVERRIDE;
- void setMaxMemoryUsage(int memoryUsage);
- int maxMemoryUsage() const;
- int memoryUsage() const;
+ void setMaxMemoryUsage(int memoryUsage) Q_DECL_OVERRIDE;
+ int maxMemoryUsage() const Q_DECL_OVERRIDE;
+ int memoryUsage() const Q_DECL_OVERRIDE;
- void setMinTextureUsage(int textureUsage);
- void setExtraTextureUsage(int textureUsage);
- int maxTextureUsage() const;
- int minTextureUsage() const;
- int textureUsage() const;
+ void setMinTextureUsage(int textureUsage) Q_DECL_OVERRIDE;
+ void setExtraTextureUsage(int textureUsage) Q_DECL_OVERRIDE;
+ int maxTextureUsage() const Q_DECL_OVERRIDE;
+ int minTextureUsage() const Q_DECL_OVERRIDE;
+ int textureUsage() const Q_DECL_OVERRIDE;
- QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec);
+ QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec) Q_DECL_OVERRIDE;
// can be called without a specific tileCache pointer
static void evictFromDiskCache(QGeoCachedTileDisk *td);
@@ -125,10 +125,10 @@ public:
void insert(const QGeoTileSpec &spec,
const QByteArray &bytes,
const QString &format,
- QGeoTiledMappingManagerEngine::CacheAreas areas = QGeoTiledMappingManagerEngine::AllCaches);
+ QGeoTiledMappingManagerEngine::CacheAreas areas = QGeoTiledMappingManagerEngine::AllCaches) Q_DECL_OVERRIDE;
private:
- void printStats();
+ void printStats() Q_DECL_OVERRIDE;
void loadTiles();
QString directory() const;
@@ -144,10 +144,10 @@ private:
QCache3Q<QGeoTileSpec, QGeoCachedTileMemory > memoryCache_;
QCache3Q<QGeoTileSpec, QGeoTileTexture > textureCache_;
+ QString directory_;
+
int minTextureUsage_;
int extraTextureUsage_;
-
- QString directory_;
};
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeotiledmappingmanagerengine.cpp b/src/location/maps/qgeotiledmappingmanagerengine.cpp
index 1c61305b..20121dfc 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine.cpp
+++ b/src/location/maps/qgeotiledmappingmanagerengine.cpp
@@ -275,6 +275,12 @@ void QGeoTiledMappingManagerEngine::setCacheHint(QGeoTiledMappingManagerEngine::
d->cacheHint_ = cacheHint;
}
+void QGeoTiledMappingManagerEngine::setTileCache(QAbstractGeoTileCache *cache)
+{
+ Q_D(QGeoTiledMappingManagerEngine);
+ d->tileCache_ = cache;
+}
+
QAbstractGeoTileCache *QGeoTiledMappingManagerEngine::createTileCacheWithDir(const QString &cacheDirectory)
{
Q_D(QGeoTiledMappingManagerEngine);
diff --git a/src/location/maps/qgeotiledmappingmanagerengine_p.h b/src/location/maps/qgeotiledmappingmanagerengine_p.h
index b4ce173b..f3b42f3f 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine_p.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine_p.h
@@ -112,6 +112,7 @@ protected:
void setTileSize(const QSize &tileSize);
void setTileVersion(int version);
void setCacheHint(QGeoTiledMappingManagerEngine::CacheAreas cacheHint);
+ void setTileCache(QAbstractGeoTileCache *cache);
QAbstractGeoTileCache *createTileCacheWithDir(const QString &cacheDirectory);