Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
04de1c37
Commit
04de1c37
authored
Jun 28, 2016
by
dogmaphobic
Browse files
Limit max memory cache for offline maps.
parent
f0b7195e
Changes
3
Show whitespace changes
Inline
Side-by-side
src/QtLocationPlugin/QGCMapEngine.cpp
View file @
04de1c37
...
...
@@ -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
;
...
...
src/QtLocationPlugin/QGeoTiledMappingManagerEngineQGC.cpp
View file @
04de1c37
...
...
@@ -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
);
}
...
...
src/QtLocationPlugin/QMLControl/OfflineMap.qml
View file @
04de1c37
...
...
@@ -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
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment