diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2015-05-22 14:04:55 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2015-05-27 12:14:36 +0000 |
commit | df1b7cc4c9b423c730354925bd35cc8bca63c6ca (patch) | |
tree | e3a989f1f47855eabdaa6ce8caa980742242f447 | |
parent | 445c799514388ae15bc513419a48461a6c7bd573 (diff) | |
download | qtlocation-df1b7cc4c9b423c730354925bd35cc8bca63c6ca.tar.gz |
Add "here" prefix to all Here geoservices parameters
Task-number: QTBUG-42151
Change-Id: I3d71ee77327478dfdda23af709bee489f83bb9f6
Reviewed-by: Michal Klocek <michal.klocek@theqtcompany.com>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
14 files changed, 69 insertions, 62 deletions
diff --git a/src/imports/location/qdeclarativegeoserviceprovider.cpp b/src/imports/location/qdeclarativegeoserviceprovider.cpp index 226a723a..a4a4ffb1 100644 --- a/src/imports/location/qdeclarativegeoserviceprovider.cpp +++ b/src/imports/location/qdeclarativegeoserviceprovider.cpp @@ -762,8 +762,8 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid \code Plugin { name: "here" - PluginParameter { name: "app_id"; value: "EXAMPLE_API_ID" } - PluginParameter { name: "token"; value: "EXAMPLE_TOKEN_123" } + PluginParameter { name: "here.app_id"; value: "EXAMPLE_API_ID" } + PluginParameter { name: "here.token"; value: "EXAMPLE_TOKEN_123" } } \endcode */ diff --git a/src/location/doc/src/plugins/nokia.qdoc b/src/location/doc/src/plugins/nokia.qdoc index 296cab06..f1a6828a 100644 --- a/src/location/doc/src/plugins/nokia.qdoc +++ b/src/location/doc/src/plugins/nokia.qdoc @@ -56,10 +56,10 @@ The following table lists mandatory parameters that \e must be passed to the HER \li Parameter \li Description \row - \li app_id + \li here.app_id \li Client \e app_id part of the app_id/token pair used for authentication by all managers. \row - \li token + \li here.token \li Client \e token part of the app_id/token pair for the service used for authentication by all managers. \endtable @@ -69,46 +69,50 @@ application with the HERE services. To obtain an application id and token pair \section2 Optional parameters The following table lists optional parameters that can be passed to the HERE plugin. + +\note Since Qt 5.5 all parameters below must be prefixed with \c here. Previous versions did not require +a prefix. + \table \header \li Parameter \li Description \row - \li proxy + \li here.proxy \li Proxy server URL used by all managers. For usage of the system proxy just pass "system" as value. \note See the notes in \l{QNetworkProxyFactory::systemProxyForQuery()} for further information. \row - \li mapping.host + \li here.mapping.host \li Base map tile service URL used by mapping manager. \row - \li mapping.host.aerial + \li here.mapping.host.aerial \li Aerial map tile service URL used by mapping manager. For all satellite, hybrid and terrain schemes. \row - \li mapping.cache.directory + \li here.mapping.cache.directory \li Absolute path to map tile cache directory used as network disk cache. Default place for the cache is "QtLocation" directory in \l {QStandardPaths::writableLocation()} {QStandardPaths::writableLocation}(\l{QStandardPaths::GenericCacheLocation}). \row - \li mapping.cache.disk.size + \li here.mapping.cache.disk.size \li Map tile disk cache size in bytes. Default size of the cache is 20MB. \row - \li mapping.cache.memory.size + \li here.mapping.cache.memory.size \li Map tile memory cache size in bytes. Default size of the cache is 3MB. \row - \li mapping.cache.texture.size + \li here.mapping.cache.texture.size \li Map tile texture cache size in bytes. Default size of the cache is 6MB. Note that the texture cache has a hard minimum size which depends on the size of the map viewport (it must contain enough data to display the tiles currently visible on the display). This value is the amount of cache to be used in addition to the bare minimum. \row - \li geocoding.host + \li here.geocoding.host \li Geocoding service URL used by geocoding manager. \row - \li routing.host + \li here.routing.host \li Routing service URL used by routing manager. \row - \li places.host + \li here.places.host \li Search service URL used by search manager. \row - \li places.api_version + \li here.places.api_version \li Version of the REST API used by the places manager. Currently versions 1 and 2 are supported. The version 1 is deprecated and will not be part of the final Qt release. The default is version 2. \endtable @@ -124,8 +128,8 @@ authentication. \code Plugin { name: "here" - PluginParameter { name: "app_id"; value: "myapp" } - PluginParameter { name: "token"; value: "abcdefg12345" } + PluginParameter { name: "here.app_id"; value: "myapp" } + PluginParameter { name: "here.token"; value: "abcdefg12345" } } \endcode @@ -133,8 +137,8 @@ Plugin { \code QMap<QString,QVariant> params; -params["app_id"] = "myapp"; -params["token"] = "abcdefg12345"; +params["here.app_id"] = "myapp"; +params["here.token"] = "abcdefg12345"; QGeoServiceProvider *gsp = new QGeoServiceProvider("here", params); \endcode diff --git a/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp index 055beec9..2e0eae42 100644 --- a/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeocodingmanagerengine_nokia.cpp @@ -56,18 +56,16 @@ QGeoCodingManagerEngineNokia::QGeoCodingManagerEngineNokia( QString *errorString) : QGeoCodingManagerEngine(parameters) , m_networkManager(networkManager) - , m_uriProvider(new QGeoUriProvider(this, parameters, "geocoding.host", GEOCODING_HOST, GEOCODING_HOST_CN)) + , m_uriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.geocoding.host"), GEOCODING_HOST, GEOCODING_HOST_CN)) { Q_ASSERT(networkManager); m_networkManager->setParent(this); - if (parameters.contains("token")) { - m_token = parameters.value("token").toString(); - } + if (parameters.contains(QStringLiteral("here.token"))) + m_token = parameters.value(QStringLiteral("here.token")).toString(); - if (parameters.contains("app_id")) { - m_applicationId = parameters.value("app_id").toString(); - } + if (parameters.contains(QStringLiteral("here.app_id"))) + m_applicationId = parameters.value(QStringLiteral("here.app_id")).toString(); if (error) *error = QGeoServiceProvider::NoError; diff --git a/src/plugins/geoservices/nokia/qgeointrinsicnetworkaccessmanager.cpp b/src/plugins/geoservices/nokia/qgeointrinsicnetworkaccessmanager.cpp index 6ae7ca28..267c4cae 100644 --- a/src/plugins/geoservices/nokia/qgeointrinsicnetworkaccessmanager.cpp +++ b/src/plugins/geoservices/nokia/qgeointrinsicnetworkaccessmanager.cpp @@ -59,7 +59,7 @@ QGeoIntrinsicNetworkAccessManager::QGeoIntrinsicNetworkAccessManager(const QVari void QGeoIntrinsicNetworkAccessManager::configure(const QVariantMap ¶meters) { - QString proxy = parameters.value(QStringLiteral("proxy")).toString(); + QString proxy = parameters.value(QStringLiteral("here.proxy")).toString(); if (proxy.isEmpty() && !m_customProxyToken.isEmpty()) proxy = parameters.value(m_customProxyToken).toString(); diff --git a/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp index 921d2487..af6cbcf0 100644 --- a/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeoroutingmanagerengine_nokia.cpp @@ -54,14 +54,14 @@ QGeoRoutingManagerEngineNokia::QGeoRoutingManagerEngineNokia( QString *errorString) : QGeoRoutingManagerEngine(parameters) , m_networkManager(networkManager) - , m_uriProvider(new QGeoUriProvider(this, parameters, "routing.host", ROUTING_HOST)) + , m_uriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.routing.host"), ROUTING_HOST)) { Q_ASSERT(networkManager); m_networkManager->setParent(this); - m_appId = parameters.value(QStringLiteral("app_id")).toString(); - m_token = parameters.value(QStringLiteral("token")).toString(); + m_appId = parameters.value(QStringLiteral("here.app_id")).toString(); + m_token = parameters.value(QStringLiteral("here.token")).toString(); QGeoRouteRequest::FeatureTypes featureTypes; featureTypes |= QGeoRouteRequest::TollFeature; diff --git a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp index 0192b6ce..f6d05c36 100644 --- a/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeoserviceproviderplugin_nokia.cpp @@ -75,14 +75,19 @@ namespace void checkUsageTerms(const QVariantMap ¶meters, QGeoServiceProvider::Error *error, QString *errorString) { - const QString appId = parameters.value(QStringLiteral("app_id")).toString(); - const QString token = parameters.value(QStringLiteral("token")).toString(); + QString appId, token; - if (!isValidParameter(appId) || !isValidParameter(token)) { + appId = parameters.value(QStringLiteral("here.app_id")).toString(); + token = parameters.value(QStringLiteral("here.token")).toString(); - *error = QGeoServiceProvider::MissingRequiredParameterError; - *errorString = QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, MISSED_CREDENTIALS); - } + if (isValidParameter(appId) && isValidParameter(token)) + return; + + if (parameters.contains(QStringLiteral("app_id")) || parameters.contains(QStringLiteral("token"))) + qWarning() << QStringLiteral("Please prefix 'app_id' and 'token' with prefix 'here' (e.g.: 'here.app_id')"); + + *error = QGeoServiceProvider::MissingRequiredParameterError; + *errorString = QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, MISSED_CREDENTIALS); } template<class TInstance> diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp index f96e0a74..0074fca9 100644 --- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp @@ -102,8 +102,8 @@ QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia( // don't need this boilerplate or hardcode plugin name QString cacheDir; - if (parameters.contains(QStringLiteral("mapping.cache.directory"))) { - cacheDir = parameters.value(QStringLiteral("mapping.cache.directory")).toString(); + if (parameters.contains(QStringLiteral("here.mapping.cache.directory"))) { + cacheDir = parameters.value(QStringLiteral("here.mapping.cache.directory")).toString(); } else { // managerName() is not yet set, we have to hardcode the plugin name below cacheDir = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) @@ -112,23 +112,23 @@ QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia( QGeoTileCache *tileCache = createTileCacheWithDir(cacheDir); - if (parameters.contains(QStringLiteral("mapping.cache.disk.size"))) { + if (parameters.contains(QStringLiteral("here.mapping.cache.disk.size"))) { bool ok = false; - int cacheSize = parameters.value(QStringLiteral("mapping.cache.disk.size")).toString().toInt(&ok); + int cacheSize = parameters.value(QStringLiteral("here.mapping.cache.disk.size")).toString().toInt(&ok); if (ok) tileCache->setMaxDiskUsage(cacheSize); } - if (parameters.contains(QStringLiteral("mapping.cache.memory.size"))) { + if (parameters.contains(QStringLiteral("here.mapping.cache.memory.size"))) { bool ok = false; - int cacheSize = parameters.value(QStringLiteral("mapping.cache.memory.size")).toString().toInt(&ok); + int cacheSize = parameters.value(QStringLiteral("here.mapping.cache.memory.size")).toString().toInt(&ok); if (ok) tileCache->setMaxMemoryUsage(cacheSize); } - if (parameters.contains(QStringLiteral("mapping.cache.texture.size"))) { + if (parameters.contains(QStringLiteral("here.mapping.cache.texture.size"))) { bool ok = false; - int cacheSize = parameters.value(QStringLiteral("mapping.cache.texture.size")).toString().toInt(&ok); + int cacheSize = parameters.value(QStringLiteral("here.mapping.cache.texture.size")).toString().toInt(&ok); if (ok) tileCache->setExtraTextureUsage(cacheSize); } diff --git a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp index 0e76fbdf..50acc2a0 100644 --- a/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp +++ b/src/plugins/geoservices/nokia/qgeotilefetcher_nokia.cpp @@ -77,14 +77,14 @@ QGeoTileFetcherNokia::QGeoTileFetcherNokia(const QVariantMap ¶meters, const QSize &tileSize) : QGeoTileFetcher(engine), m_engineNokia(engine), m_networkManager(networkManager), m_tileSize(tileSize), m_copyrightsReply(0), - m_baseUriProvider(new QGeoUriProvider(this, parameters, "mapping.host", MAP_TILES_HOST)), - m_aerialUriProvider(new QGeoUriProvider(this, parameters, "mapping.host.aerial", MAP_TILES_HOST_AERIAL)) + m_baseUriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.mapping.host"), MAP_TILES_HOST)), + m_aerialUriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.mapping.host.aerial"), MAP_TILES_HOST_AERIAL)) { Q_ASSERT(networkManager); m_networkManager->setParent(this); - m_applicationId = parameters.value(QStringLiteral("app_id")).toString(); - m_token = parameters.value(QStringLiteral("token")).toString(); + m_applicationId = parameters.value(QStringLiteral("here.app_id")).toString(); + m_token = parameters.value(QStringLiteral("here.token")).toString(); } QGeoTileFetcherNokia::~QGeoTileFetcherNokia() diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp index 52a3eaaf..ac20c262 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp @@ -200,15 +200,15 @@ QPlaceManagerEngineNokiaV2::QPlaceManagerEngineNokiaV2( QString *errorString) : QPlaceManagerEngine(parameters) , m_manager(networkManager) - , m_uriProvider(new QGeoUriProvider(this, parameters, "places.host", PLACES_HOST, PLACES_HOST_CN)) + , m_uriProvider(new QGeoUriProvider(this, parameters, QStringLiteral("here.places.host"), PLACES_HOST, PLACES_HOST_CN)) { Q_ASSERT(networkManager); m_manager->setParent(this); m_locales.append(QLocale()); - m_appId = parameters.value(QStringLiteral("app_id")).toString(); - m_appCode = parameters.value(QStringLiteral("token")).toString(); + m_appId = parameters.value(QStringLiteral("here.app_id")).toString(); + m_appCode = parameters.value(QStringLiteral("here.token")).toString(); m_theme = parameters.value(IconThemeKey, QString()).toString(); diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml index 6717bc2a..7b485256 100644 --- a/tests/auto/declarative_ui/tst_map.qml +++ b/tests/auto/declarative_ui/tst_map.qml @@ -45,11 +45,11 @@ Item { Plugin { id: herePlugin; name: "here"; parameters: [ PluginParameter { - name: "app_id" + name: "here.app_id" value: "stub" }, PluginParameter { - name: "token" + name: "here.token" value: "stub" } ] diff --git a/tests/auto/declarative_ui/tst_map_maptype.qml b/tests/auto/declarative_ui/tst_map_maptype.qml index 2f015552..26290399 100644 --- a/tests/auto/declarative_ui/tst_map_maptype.qml +++ b/tests/auto/declarative_ui/tst_map_maptype.qml @@ -45,11 +45,11 @@ TestCase { name: "here" parameters: [ PluginParameter { - name: "app_id" + name: "here.app_id" value: "stub" }, PluginParameter { - name: "token" + name: "here.token" value: "stub" } ] diff --git a/tests/auto/nokia_services/places_semiauto/tst_places.cpp b/tests/auto/nokia_services/places_semiauto/tst_places.cpp index 9fe564b5..75f3f4ef 100644 --- a/tests/auto/nokia_services/places_semiauto/tst_places.cpp +++ b/tests/auto/nokia_services/places_semiauto/tst_places.cpp @@ -116,11 +116,11 @@ void tst_QPlaceManagerNokia::initTestCase() if (!(env.contains(AppIdEnv) && env.contains(TokenEnv))) QSKIP("NOKIA_APPID and NOKIA_TOKEN environment variables not set");\ - params.insert(QStringLiteral("app_id"), env.value(AppIdEnv)); - params.insert(QStringLiteral("token"), env.value(TokenEnv)); + params.insert(QStringLiteral("here.app_id"), env.value(AppIdEnv)); + params.insert(QStringLiteral("here.token"), env.value(TokenEnv)); if (env.contains(ProxyEnv)) - params.insert(QStringLiteral("proxy"), env.value(ProxyEnv)); + params.insert(QStringLiteral("here.proxy"), env.value(ProxyEnv)); #else QSKIP("Cannot parse process environment, NOKIA_APPID and NOKIA_TOKEN not set"); #endif diff --git a/tests/auto/nokia_services/routing/tst_routing.cpp b/tests/auto/nokia_services/routing/tst_routing.cpp index 53deb55d..21ab95ad 100644 --- a/tests/auto/nokia_services/routing/tst_routing.cpp +++ b/tests/auto/nokia_services/routing/tst_routing.cpp @@ -329,8 +329,8 @@ void tst_nokia_routing::initTestCase() QVariantMap parameters; parameters.insert(QStringLiteral("nam"), QVariant::fromValue<void*>(m_networkManager)); - parameters.insert(QStringLiteral("app_id"), "stub"); - parameters.insert(QStringLiteral("token"), "stub"); + parameters.insert(QStringLiteral("here.app_id"), "stub"); + parameters.insert(QStringLiteral("here.token"), "stub"); m_geoServiceProvider = new QGeoServiceProvider(QStringLiteral("here"), parameters); QVERIFY(m_geoServiceProvider); diff --git a/tests/auto/qplacemanager_nokia/tst_qplacemanager_nokia.cpp b/tests/auto/qplacemanager_nokia/tst_qplacemanager_nokia.cpp index b761d430..eb118326 100644 --- a/tests/auto/qplacemanager_nokia/tst_qplacemanager_nokia.cpp +++ b/tests/auto/qplacemanager_nokia/tst_qplacemanager_nokia.cpp @@ -84,8 +84,8 @@ void tst_QPlaceManagerNokia::initTestCase() QStringList providers = QGeoServiceProvider::availableServiceProviders(); QVariantMap params; - params.insert("app_id", "stub"); - params.insert("token", "stub"); + params.insert(QStringLiteral("here.app_id"), "stub"); + params.insert(QStringLiteral("here.token"), "stub"); provider = new QGeoServiceProvider("here", params); placeManager = provider->placeManager(); QVERIFY(placeManager); |