From 97bce501d5dc0f8e09e9607c24943ecd72fb7545 Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 8 Sep 2017 15:14:04 +0200 Subject: Remove HERE plugin from tests It keeps causing errors saying that host requires autentication, every now and then. Change-Id: I9fc96aee8793ca865cbcc88c7340f2363d08fc1f Reviewed-by: Alex Blasche --- tests/auto/declarative_ui/tst_map.qml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 5c9deca2..c36ebc0e 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -38,18 +38,6 @@ Item { // General-purpose elements for the test: Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true } Plugin { id: testPlugin2; name: "gmlgeo.test.plugin"; allowExperimental: true } - Plugin { id: herePlugin; name: "here"; - parameters: [ - PluginParameter { - name: "here.app_id" - value: "stub" - }, - PluginParameter { - name: "here.token" - value: "stub" - } - ] - } Plugin { id: testPluginLazyParameter; name: "qmlgeo.test.plugin" @@ -111,13 +99,13 @@ Item { Map {id: mapPar; plugin: testPlugin; center: coordinate1; width: 512; height: 512} - Map {id: coordinateMap; plugin: herePlugin; center: coordinate3; + Map {id: coordinateMap; plugin: testPlugin; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15 } Map {id: mapTiltBearing; plugin: testPlugin; center: coordinate1; width: 1000; height: 1000; zoomLevel: 4; bearing: 45.0; tilt: 25.0 } - Map {id: mapTiltBearingHere; plugin: herePlugin; center: coordinate1; + Map {id: mapTiltBearingHere; plugin: testPlugin; center: coordinate1; width: 1000; height: 1000; zoomLevel: 4; bearing: 45.0; tilt: 25.0 } Map { -- cgit v1.2.1 From 7e6c4b8229ea03b25a271a7a61094f28abc504eb Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 8 Sep 2017 17:11:43 +0200 Subject: Prevent MapItemView from fitting viewport on map when not ready Change-Id: I4c066c858801f9d80974018c00b245ec86c05d1e Reviewed-by: Alex Blasche --- src/location/declarativemaps/qdeclarativegeomapitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp index a17bf672..8207caa5 100644 --- a/src/location/declarativemaps/qdeclarativegeomapitemview.cpp +++ b/src/location/declarativemaps/qdeclarativegeomapitemview.cpp @@ -378,7 +378,7 @@ void QDeclarativeGeoMapItemView::setAutoFitViewport(const bool &fitViewport) */ void QDeclarativeGeoMapItemView::fitViewport() { - if (!map_ || !fitViewport_ || m_repopulating) + if (!map_ || !map_->mapReady() || !fitViewport_ || m_repopulating) return; if (map_->mapItems().size() > 0) -- cgit v1.2.1 From f09e5fb2eaba4a3d3f131fa4a4392ec49d02af0d Mon Sep 17 00:00:00 2001 From: Paolo Angelelli Date: Fri, 8 Sep 2017 13:00:15 +0200 Subject: Fix tile cache not honoring cost 0 This patch fixes the case of disabling the various caches. Currently setting the cache size to 0 results in default initial values instead. Change-Id: I019cd15ac23b6479e4367a3e102dd661895a7fda Reviewed-by: Alex Blasche --- src/location/maps/qgeofiletilecache.cpp | 38 +++++++++++++++++++++++++-------- src/location/maps/qgeofiletilecache_p.h | 4 ++++ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/location/maps/qgeofiletilecache.cpp b/src/location/maps/qgeofiletilecache.cpp index d40ad825..df89c889 100644 --- a/src/location/maps/qgeofiletilecache.cpp +++ b/src/location/maps/qgeofiletilecache.cpp @@ -88,6 +88,7 @@ QGeoCachedTileDisk::~QGeoCachedTileDisk() QGeoFileTileCache::QGeoFileTileCache(const QString &directory, QObject *parent) : QAbstractGeoTileCache(parent), directory_(directory), minTextureUsage_(0), extraTextureUsage_(0) ,costStrategyDisk_(ByteSize), costStrategyMemory_(ByteSize), costStrategyTexture_(ByteSize) + ,isDiskCostSet_(false), isMemoryCostSet_(false), isTextureCostSet_(false) { } @@ -120,21 +121,21 @@ void QGeoFileTileCache::init() QDir::root().mkpath(directory_); // default values - if (!diskCache_.maxCost()) { // If setMaxDiskUsage has not been called yet + if (!isDiskCostSet_) { // If setMaxDiskUsage has not been called yet if (costStrategyDisk_ == ByteSize) setMaxDiskUsage(50 * 1024 * 1024); else setMaxDiskUsage(1000); } - if (!memoryCache_.maxCost()) { // If setMaxMemoryUsage has not been called yet + if (!isMemoryCostSet_) { // If setMaxMemoryUsage has not been called yet if (costStrategyMemory_ == ByteSize) setMaxMemoryUsage(3 * 1024 * 1024); else setMaxMemoryUsage(100); } - if (!textureCache_.maxCost()) { // If setExtraTextureUsage has not been called yet + if (!isTextureCostSet_) { // If setExtraTextureUsage has not been called yet if (costStrategyTexture_ == ByteSize) setExtraTextureUsage(6 * 1024 * 1024); else @@ -240,6 +241,7 @@ void QGeoFileTileCache::printStats() void QGeoFileTileCache::setMaxDiskUsage(int diskUsage) { diskCache_.setMaxCost(diskUsage); + isDiskCostSet_ = true; } int QGeoFileTileCache::maxDiskUsage() const @@ -255,6 +257,7 @@ int QGeoFileTileCache::diskUsage() const void QGeoFileTileCache::setMaxMemoryUsage(int memoryUsage) { memoryCache_.setMaxCost(memoryUsage); + isMemoryCostSet_ = true; } int QGeoFileTileCache::maxMemoryUsage() const @@ -271,6 +274,7 @@ void QGeoFileTileCache::setExtraTextureUsage(int textureUsage) { extraTextureUsage_ = textureUsage; textureCache_.setMaxCost(minTextureUsage_ + extraTextureUsage_); + isTextureCostSet_ = true; } void QGeoFileTileCache::setMinTextureUsage(int textureUsage) @@ -384,12 +388,7 @@ void QGeoFileTileCache::insert(const QGeoTileSpec &spec, if (areas & QAbstractGeoTileCache::DiskCache) { QString filename = tileSpecToFilename(spec, format, directory_); - QFile file(filename); - file.open(QIODevice::WriteOnly); - file.write(bytes); - file.close(); - - addToDiskCache(spec, filename); + addToDiskCache(spec, filename, bytes); } if (areas & QAbstractGeoTileCache::MemoryCache) { @@ -491,6 +490,27 @@ QSharedPointer QGeoFileTileCache::addToDiskCache(const QGeoT return td; } +bool QGeoFileTileCache::addToDiskCache(const QGeoTileSpec &spec, const QString &filename, const QByteArray &bytes) +{ + QSharedPointer td(new QGeoCachedTileDisk); + td->spec = spec; + td->filename = filename; + td->cache = this; + + int cost = 1; + if (costStrategyDisk_ == ByteSize) + cost = bytes.size(); + + if (diskCache_.insert(spec, td, cost)) { + QFile file(filename); + file.open(QIODevice::WriteOnly); + file.write(bytes); + file.close(); + return true; + } + return false; +} + void QGeoFileTileCache::addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format) { if (isTileBogus(bytes)) diff --git a/src/location/maps/qgeofiletilecache_p.h b/src/location/maps/qgeofiletilecache_p.h index e319e2a2..1712a9e3 100644 --- a/src/location/maps/qgeofiletilecache_p.h +++ b/src/location/maps/qgeofiletilecache_p.h @@ -147,6 +147,7 @@ protected: QString directory() const; QSharedPointer addToDiskCache(const QGeoTileSpec &spec, const QString &filename); + bool addToDiskCache(const QGeoTileSpec &spec, const QString &filename, const QByteArray &bytes); void addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format); QSharedPointer addToTextureCache(const QGeoTileSpec &spec, const QImage &image); QSharedPointer getFromMemory(const QGeoTileSpec &spec); @@ -167,6 +168,9 @@ protected: CostStrategy costStrategyDisk_; CostStrategy costStrategyMemory_; CostStrategy costStrategyTexture_; + bool isDiskCostSet_; + bool isMemoryCostSet_; + bool isTextureCostSet_; }; QT_END_NAMESPACE -- cgit v1.2.1 From b13ff055eb64970f545ba590735a38652de7689b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 11 Sep 2017 09:17:21 +0200 Subject: Fix disabling redirection for providers that have no local fallback Currently these providers would not turn ready when disableRedirection() is called, while they also get disconnected, thus never being tried to be resolved, resulting in stalling the completion of the provider's resolution process Task-number: QTBUG-63033 Change-Id: I316b858fbc66b82bc124b8814b25fe29bc0c21a1 Reviewed-by: Alex Blasche --- .../geoservices/osm/qgeotiledmappingmanagerengineosm.cpp | 15 ++++++++------- src/plugins/geoservices/osm/qgeotileproviderosm.cpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp index da7b61d2..45e7efbe 100644 --- a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp @@ -220,15 +220,16 @@ QGeoTiledMappingManagerEngineOsm::QGeoTiledMappingManagerEngineOsm(const QVarian if (parameters.contains(QStringLiteral("osm.mapping.providersrepository.disabled"))) disableRedirection = parameters.value(QStringLiteral("osm.mapping.providersrepository.disabled")).toBool(); - foreach (QGeoTileProviderOsm * provider, m_providers) { + for (QGeoTileProviderOsm * provider: qAsConst(m_providers)) { // Providers are parented inside QGeoFileTileCacheOsm, as they are used in its destructor. - if (disableRedirection) + if (disableRedirection) { provider->disableRedirection(); - - connect(provider, &QGeoTileProviderOsm::resolutionFinished, - this, &QGeoTiledMappingManagerEngineOsm::onProviderResolutionFinished); - connect(provider, &QGeoTileProviderOsm::resolutionError, - this, &QGeoTiledMappingManagerEngineOsm::onProviderResolutionError); + } else { + connect(provider, &QGeoTileProviderOsm::resolutionFinished, + this, &QGeoTiledMappingManagerEngineOsm::onProviderResolutionFinished); + connect(provider, &QGeoTileProviderOsm::resolutionError, + this, &QGeoTiledMappingManagerEngineOsm::onProviderResolutionError); + } } updateMapTypes(); diff --git a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp index 563ac161..a0cbd843 100644 --- a/src/plugins/geoservices/osm/qgeotileproviderosm.cpp +++ b/src/plugins/geoservices/osm/qgeotileproviderosm.cpp @@ -174,11 +174,11 @@ void QGeoTileProviderOsm::disableRedirection() if (p->isValid() && !found) { m_provider = p; m_providerId = m_providerList.indexOf(p); - m_status = Resolved; found = true; } p->disconnect(this); } + m_status = Resolved; } void QGeoTileProviderOsm::onResolutionFinished(TileProvider *provider) -- cgit v1.2.1