diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-09-04 14:02:09 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-09-07 17:58:16 +0000 |
commit | dcac944e0bf04e8fbe56c0c00d5ceb6d22980494 (patch) | |
tree | e2d3d0b39fc1393d25ddb502910a2bdf828671c2 /src/plugins/geoservices/osm/qgeomapreplyosm.cpp | |
parent | 8fb58aa448de42ebeb17bc5d9c74e6ee78319292 (diff) | |
download | qtlocation-dcac944e0bf04e8fbe56c0c00d5ceb6d22980494.tar.gz |
Fix disfunctional disk cache with OSM
The MapQuest servers use JPEG, not PNG. The disk cache, unlike the memory
one, passed in the extension as the format to loadFromData(). This failed
for JPEG files with an extension of .png.
In addition, using split('.')[1] to determine the file extension is bogus.
On Linux for example, a directory of "$HOME/.cache/QtLocation/..." results
in putting "cache/..." into format which is then conveniently ignored by
QImageReader. On OS X however there is no dot, so it "correctly" picks
"png" for the JPEG data, hence the console is flooded with warnings about
failed tile loading.
On top of the above, the disk cache is made more robust by not relying on the
format string. As long as only formats supported by QImageReader are in use,
it can recognize the correct format from the data. (the memory cache does this
already anyway)
Change-Id: I90ece5bd157d457afa0025527c84070427a60313
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/plugins/geoservices/osm/qgeomapreplyosm.cpp')
-rw-r--r-- | src/plugins/geoservices/osm/qgeomapreplyosm.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp index b540683b..d020716e 100644 --- a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp +++ b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp @@ -75,7 +75,11 @@ void QGeoMapReplyOsm::networkReplyFinished() QByteArray a = m_reply->readAll(); setMapImageData(a); - setMapImageFormat("png"); + int mapId = tileSpec().mapId(); + if (mapId == 1 || mapId == 2) + setMapImageFormat(QStringLiteral("jpg")); + else + setMapImageFormat(QStringLiteral("png")); setFinished(true); |