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 /src | |
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>
Diffstat (limited to 'src')
9 files changed, 58 insertions, 51 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(); |