diff --git a/src/QtLocationPlugin/QGCMapEngine.cpp b/src/QtLocationPlugin/QGCMapEngine.cpp index 38cf1d7b05edccc875bf29c4dc95d31637db0abc..e04decdbb899e196ae176c4ca5c5ac7036ecae28 100644 --- a/src/QtLocationPlugin/QGCMapEngine.cpp +++ b/src/QtLocationPlugin/QGCMapEngine.cpp @@ -362,6 +362,9 @@ QGCMapEngine::getMaxMemCache() _maxMemCache = settings.value(kMaxMemCacheKey, 128).toUInt(); #endif } + //-- Size in MB + if(_maxMemCache > 1024) + _maxMemCache = 1024; return _maxMemCache; } @@ -369,6 +372,9 @@ QGCMapEngine::getMaxMemCache() void QGCMapEngine::setMaxMemCache(quint32 size) { + //-- Size in MB + if(size > 1024) + size = 1024; QSettings settings; settings.setValue(kMaxMemCacheKey, size); _maxMemCache = size; diff --git a/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp b/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp index c663ff9042c20c0db6840c894358e1b8b05dbda7..116310d77ba874cb39d014e1a51d9e15c1780d43 100644 --- a/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp +++ b/src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp @@ -230,7 +230,10 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap ¶meters) //-- It won't work with less than 1M of memory cache if(memLimit < 1024 * 1024) memLimit = 1024 * 1024; - //-- Disable Qt's disk cache (set memory cache otherwise Qtlocation won't work) + //-- On the other hand, Qt uses signed 32-bit integers. Limit to 1G to round it down (you don't need more than that). + if(memLimit > 1024 * 1024 * 1024) + memLimit = 1024 * 1024 * 1024; + //-- Disable Qt's disk cache (sort of) #if QT_VERSION >= 0x050600 QAbstractGeoTileCache *pTileCache = new QGeoFileTileCache(cacheDir); setTileCache(pTileCache); @@ -241,6 +244,7 @@ QGeoTiledMappingManagerEngineQGC::_setCache(const QVariantMap ¶meters) { //-- We're basically telling it to use 100k of disk for cache. It doesn't like // values smaller than that and I could not find a way to make it NOT cache. + // We handle our own disk caching elsewhere. pTileCache->setMaxDiskUsage(1024 * 100); pTileCache->setMaxMemoryUsage(memLimit); } diff --git a/src/QtLocationPlugin/QMLControl/OfflineMap.qml b/src/QtLocationPlugin/QMLControl/OfflineMap.qml index f75a24302f58675089ee81048aae41225fceaafa..5d4396d61957c43acff068bfdacee377ff0700c9 100644 --- a/src/QtLocationPlugin/QMLControl/OfflineMap.qml +++ b/src/QtLocationPlugin/QMLControl/OfflineMap.qml @@ -246,7 +246,7 @@ QGCView { id: maxCacheMemSize maximumLength: 4 inputMethodHints: Qt.ImhDigitsOnly - validator: IntValidator {bottom: 1; top: 4096;} + validator: IntValidator {bottom: 1; top: 1024;} text: QGroundControl.mapEngineManager.maxMemCache }