diff options
author | Vladimir Bezkorovainyi <vladimir.bezkorovainyi@nokia.com> | 2012-05-30 18:13:28 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-31 17:57:34 +0200 |
commit | 1c356029e308283c4c305dda855a094cf16e19ef (patch) | |
tree | 028cc1e9aef5f0dcb0a2966b065b854428df44b1 /src | |
parent | f72688998639d168444eec32f0b5ec04320369bb (diff) | |
download | qtlocation-1c356029e308283c4c305dda855a094cf16e19ef.tar.gz |
Move hard-codded messages into separate file and declare constants for them.
Change-Id: I35a2a5ca9d4c4dc20e291051666bb88f4264ab33
Reviewed-by: Jean Gressmann <jean.gressmann@nokia.com>
Diffstat (limited to 'src')
27 files changed, 431 insertions, 79 deletions
diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp index 696e803c..2c7df625 100644 --- a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp @@ -42,10 +42,12 @@ #include "qdeclarativecategory_p.h" #include "qdeclarativeplaceicon_p.h" #include "qdeclarativegeoserviceprovider_p.h" +#include "error_messages.h" #include <QtQml/QQmlInfo> #include <QtLocation/QGeoServiceProvider> #include <QtLocation/QPlaceManager> +#include <QCoreApplication> QT_USE_NAMESPACE @@ -148,7 +150,7 @@ void QDeclarativeCategory::pluginReady() QGeoServiceProvider *serviceProvider = m_plugin->sharedGeoServiceProvider(); QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager || serviceProvider->error() != QGeoServiceProvider::NoError) { - m_errorString = tr("Places not supported by %1 plugin.").arg(m_plugin->name()); + m_errorString = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); setStatus(Error); return; } @@ -438,20 +440,20 @@ QPlaceManager *QDeclarativeCategory::manager() } if (!m_plugin) { - m_errorString = tr("Plugin property not set."); + m_errorString = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_PROPERTY_NOT_SET); setStatus(Error); return 0; } QGeoServiceProvider *serviceProvider = m_plugin->sharedGeoServiceProvider(); if (!serviceProvider) { - m_errorString = tr("Plugin not valid"); + m_errorString = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_NOT_VALID); setStatus(Error); return 0; } QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - m_errorString = tr("Places not supported by %1 plugin.").arg(m_plugin->name()); + m_errorString = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); setStatus(Error); return 0; } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp index a1013081..6197d62c 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplace.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplace.cpp @@ -44,6 +44,7 @@ #include "qdeclarativegeoserviceprovider_p.h" #include "qdeclarativeplaceattribute_p.h" #include "qdeclarativeplaceicon_p.h" +#include "error_messages.h" #include <QtQml/QQmlEngine> #include <QtQml/QQmlInfo> @@ -53,6 +54,7 @@ #include <QtLocation/QPlaceReply> #include <QtLocation/QPlaceIdReply> #include <QtLocation/QPlaceContactDetail> +#include <QCoreApplication> QT_USE_NAMESPACE @@ -247,8 +249,7 @@ void QDeclarativePlace::pluginReady() QGeoServiceProvider *serviceProvider = m_plugin->sharedGeoServiceProvider(); QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager || serviceProvider->error() != QGeoServiceProvider::NoError) { - qmlInfo(this) << tr("Warning: Plugin does not support places. Error message: %1") - .arg(serviceProvider->errorString()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES).arg(serviceProvider->errorString()); return; } } @@ -1194,7 +1195,7 @@ QPlaceManager *QDeclarativePlace::manager() } if (!m_plugin) { - qmlInfo(this) << tr("Plugin not assigned to place"); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_NOT_ASSIGNED_TO_PLACE); return 0; } @@ -1205,7 +1206,7 @@ QPlaceManager *QDeclarativePlace::manager() QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Places not supported by %1 Plugin.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return 0; } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp index 0a3b5f65..f9c66280 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplacecontentmodel.cpp @@ -43,6 +43,7 @@ #include "qdeclarativeplace_p.h" #include "qdeclarativegeoserviceprovider_p.h" #include "qdeclarativeplaceuser_p.h" +#include "error_messages.h" #include <QtQml/QQmlInfo> #include <QtLocation/QGeoServiceProvider> @@ -293,7 +294,7 @@ void QDeclarativePlaceContentModel::fetchMore(const QModelIndex &parent) QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Places not supported by %1 Plugin.").arg(plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(plugin->name()); return; } diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceicon.cpp b/src/imports/location/declarativeplaces/qdeclarativeplaceicon.cpp index 4f781493..1c08c40c 100644 --- a/src/imports/location/declarativeplaces/qdeclarativeplaceicon.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativeplaceicon.cpp @@ -40,10 +40,12 @@ ****************************************************************************/ #include "qdeclarativeplaceicon_p.h" +#include "error_messages.h" #include <QtLocation/QGeoServiceProvider> #include <QtLocation/QPlaceManager> #include <QtQml/QQmlInfo> +#include <QCoreApplication> QT_USE_NAMESPACE @@ -201,8 +203,7 @@ void QDeclarativePlaceIcon::pluginReady() QGeoServiceProvider *serviceProvider = m_plugin->sharedGeoServiceProvider(); QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager || serviceProvider->error() != QGeoServiceProvider::NoError) { - qmlInfo(this) << tr("Warning: Plugin does not support places. Error message: %1") - .arg(serviceProvider->errorString()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES).arg(serviceProvider->errorString()); return; } } @@ -214,7 +215,7 @@ void QDeclarativePlaceIcon::pluginReady() QPlaceManager *QDeclarativePlaceIcon::manager() const { if (!m_plugin) { - qmlInfo(this) << tr("Plugin not assigned to place icon"); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_NOT_ASSIGNED_TO_PLACE_ICON); return 0; } @@ -225,7 +226,7 @@ QPlaceManager *QDeclarativePlaceIcon::manager() const QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Places not supported by %1 Plugin.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return 0; } diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.cpp b/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.cpp index ea2fdba6..daa378bd 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativesearchmodelbase.cpp @@ -41,6 +41,7 @@ #include "qdeclarativesearchmodelbase.h" #include "qdeclarativeplace_p.h" +#include "error_messages.h" #include <QtQml/QQmlInfo> #include <QtLocation/QGeoServiceProvider> @@ -177,7 +178,7 @@ void QDeclarativeSearchModelBase::update() QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Places not supported by %1 Plugin.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return; } diff --git a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp index 5f5e4427..ade7c56b 100644 --- a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp +++ b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel.cpp @@ -42,7 +42,9 @@ #include "qdeclarativesupportedcategoriesmodel_p.h" #include "qdeclarativeplaceicon_p.h" #include "qgeoserviceprovider.h" +#include "error_messages.h" +#include <QCoreApplication> #include <QtQml/QQmlInfo> #include <QtLocation/QPlaceManager> #include <QtLocation/QPlaceIcon> @@ -469,7 +471,7 @@ void QDeclarativeSupportedCategoriesModel::connectNotificationSignals() QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Plugin %1 does not support places.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return; } @@ -502,7 +504,7 @@ void QDeclarativeSupportedCategoriesModel::update() QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Plugin %1 does not support places.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return; } @@ -513,7 +515,7 @@ void QDeclarativeSupportedCategoriesModel::update() setStatus(QDeclarativeSupportedCategoriesModel::Updating); } else { setStatus(QDeclarativeSupportedCategoriesModel::Error); - m_errorString = tr("Unable to initialize categories"); + m_errorString = QCoreApplication::translate(CONTEXT_NAME, CATEGORIES_NOT_INITIALIZED); } } } @@ -532,7 +534,7 @@ void QDeclarativeSupportedCategoriesModel::updateLayout() QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Plugin %1 does not support places.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return; } @@ -674,7 +676,7 @@ QPlaceManager *QDeclarativeSupportedCategoriesModel::manager(bool checkState) } if (!m_plugin) { - qmlInfo(this) << tr("Plugin not assigned to place"); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_NOT_ASSIGNED_TO_PLACE); return 0; } @@ -685,7 +687,7 @@ QPlaceManager *QDeclarativeSupportedCategoriesModel::manager(bool checkState) QPlaceManager *placeManager = serviceProvider->placeManager(); if (!placeManager) { - qmlInfo(this) << tr("Plugin %1 does not support places.").arg(m_plugin->name()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_PLACES2).arg(m_plugin->name()); return 0; } diff --git a/src/imports/location/error_messages.cpp b/src/imports/location/error_messages.cpp new file mode 100644 index 00000000..8567e296 --- /dev/null +++ b/src/imports/location/error_messages.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include "error_messages.h" + +QT_BEGIN_NAMESPACE + +const char CONTEXT_NAME[] = "QtLocationQML"; + +const char PLUGIN_DOESNOT_SUPPORT_ROUTING[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error: Plugin does not support routing.\nError message: %1"); +const char PLUGIN_DOESNOT_SUPPORT_MAPPING[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error: Plugin does not support mapping.\nError message: %1"); +const char PLUGIN_DOESNOT_SUPPORT_GEOCODING[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error: Plugin does not support (reverse) geocoding.\nError message: %1"); +const char PLUGIN_DOESNOT_SUPPORT_PLACES[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error: Plugin does not support places.\nError message: %1"); +const char PLUGIN_DOESNOT_SUPPORT_PLACES2[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin %1 does not support places."); + +const char NOT_SUPPORTED_BY[] = QT_TRANSLATE_NOOP("QtLocationQML", "%1 not supported by %2 plugin."); +const char PLUGIN_PROPERTY_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin property is not set."); +const char PLUGIN_NOT_VALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is not valid"); +const char PLUGIN_NOT_ASSIGNED_TO_PLACE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is not assigned to place."); +const char PLUGIN_NOT_ASSIGNED_TO_PLACE_ICON[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is not assigned to place icon."); +const char CATEGORIES_NOT_INITIALIZED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to initialize categories"); +const char NOT_INSTANTIABLE_BY_DEVELOPER[] = QT_TRANSLATE_NOOP("QtLocationQML", "%1 is not intended instantiable by developer."); + +const char UNSUPPORTED_BOUND_TYPE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unsupported bound type (Box and Circle supported)"); +const char UNSUPPORTED_QUERY_TYPE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unsupported query type for geocode model (Coordinate, string and Address supported)."); +const char PLUGIN_SET_ONCE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is a write-once property, and cannot be set again."); + +const char PINCH_ROTATE_GESTURE_ACTIVATED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Pinchrotation gesture activated. Note that it is experimental feature."); +const char PINCH_TILT_GESTURE_ACTIVATED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Pinchtilt gesture activated. Note that it is experimental feature."); + +const char INDEX_INVALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error, invalid index for get(): %1"); +const char INDEX_OUT_OF_RANGE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error, too big or small index in get(): %1"); + +const char MODEL_INDEX_INVALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error in indexing route model's data (invalid index)."); +const char MODEL_INDEX_OUT_OF_RANGE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Fatal error in indexing route model's data (index overflow)."); + +const char GEOCODE_PLUGIN_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot geocode, plugin not set."); +const char GEOCODE_MGR_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot geocode, geocode manager not set."); +const char GEOCODE_QUERY_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot geocode, valid query not set."); + +const char ROUTE_PLUGIN_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot route, plugin not set."); +const char ROUTE_MGR_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot route, route manager not set."); +const char ROUTE_QUERY_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot route, valid query not set."); +const char ROUTE_WAYPOINTS_NOT_SET[] = QT_TRANSLATE_NOOP("QtLocationQML", "Not enough waypoints for routing."); + +const char CANNOT_REMOVE_AREA[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot remove nonexistent area."); +const char CANNOT_ADD_NULL_WAYPOINT[] = QT_TRANSLATE_NOOP("QtLocationQML", "Not adding null waypoint."); +const char CANNOT_ADD_INVALID_WAYPOINT[] = QT_TRANSLATE_NOOP("QtLocationQML", "Not adding invalid waypoint."); +const char CANNOT_REMOVE_WAYPOINT[] = QT_TRANSLATE_NOOP("QtLocationQML", "Cannot remove nonexistent waypoint."); +const char COORD_NOT_BELONG_TO[] = QT_TRANSLATE_NOOP("QtLocationQML", "Coordinate does not belong to %1"); +const char MISSED_NMEA_FILE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Nmea file not found."); + +QT_END_NAMESPACE diff --git a/src/imports/location/error_messages.h b/src/imports/location/error_messages.h new file mode 100644 index 00000000..2fa536a1 --- /dev/null +++ b/src/imports/location/error_messages.h @@ -0,0 +1,94 @@ + +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#ifndef ERROR_MESSAGES_H +#define ERROR_MESSAGES_H + +#include <QString> + +QT_BEGIN_NAMESPACE + +extern const char CONTEXT_NAME[]; + +extern const char PLUGIN_DOESNOT_SUPPORT_MAPPING[]; +extern const char PLUGIN_DOESNOT_SUPPORT_ROUTING[]; +extern const char PLUGIN_DOESNOT_SUPPORT_GEOCODING[]; +extern const char PLUGIN_DOESNOT_SUPPORT_PLACES[]; +extern const char PLUGIN_DOESNOT_SUPPORT_PLACES2[]; + +extern const char PLUGIN_PROPERTY_NOT_SET[]; +extern const char PLUGIN_NOT_VALID[]; +extern const char PLUGIN_NOT_ASSIGNED_TO_PLACE[]; +extern const char PLUGIN_NOT_ASSIGNED_TO_PLACE_ICON[]; +extern const char CATEGORIES_NOT_INITIALIZED[]; +extern const char NOT_INSTANTIABLE_BY_DEVELOPER[]; + +extern const char UNSUPPORTED_BOUND_TYPE[]; +extern const char UNSUPPORTED_QUERY_TYPE[]; +extern const char PLUGIN_SET_ONCE[]; + +extern const char PINCH_ROTATE_GESTURE_ACTIVATED[]; +extern const char PINCH_TILT_GESTURE_ACTIVATED[]; + +extern const char INDEX_INVALID[]; +extern const char INDEX_OUT_OF_RANGE[]; +extern const char MODEL_INDEX_INVALID[]; +extern const char MODEL_INDEX_OUT_OF_RANGE[]; + +extern const char GEOCODE_PLUGIN_NOT_SET[]; +extern const char GEOCODE_MGR_NOT_SET[]; +extern const char GEOCODE_QUERY_NOT_SET[]; + +extern const char ROUTE_PLUGIN_NOT_SET[]; +extern const char ROUTE_MGR_NOT_SET[]; +extern const char ROUTE_QUERY_NOT_SET[]; +extern const char ROUTE_WAYPOINTS_NOT_SET[]; + +extern const char CANNOT_REMOVE_AREA[]; +extern const char CANNOT_ADD_NULL_WAYPOINT[]; +extern const char CANNOT_ADD_INVALID_WAYPOINT[]; +extern const char CANNOT_REMOVE_WAYPOINT[]; +extern const char COORD_NOT_BELONG_TO[]; +extern const char MISSED_NMEA_FILE[]; + +QT_END_NAMESPACE + +#endif // ERROR_MESSAGES_H diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index e9445ddd..9b6e0b67 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -84,6 +84,7 @@ #include "qdeclarativesupportedcategoriesmodel_p.h" #include "qdeclarativesearchresultmodel_p.h" #include "qdeclarativesearchsuggestionmodel_p.h" +#include "error_messages.h" #include <QtQml/qqmlextensionplugin.h> #include <QtQml/qqml.h> @@ -112,17 +113,17 @@ public: qmlRegisterType<QDeclarativePosition>(uri, 5, 0, "Position"); qmlRegisterType<QDeclarativePositionSource>(uri, 5, 0, "PositionSource"); qmlRegisterType<QDeclarativeCoordinate>(uri, 5, 0, "Coordinate"); - qmlRegisterUncreatableType<QDeclarativeGeoBoundingArea>(uri, 5, 0, "BoundingArea", QDeclarativeGeoBoundingArea::tr("(Positioning)BoundingArea is not intended instantiable by developer.")); + qmlRegisterUncreatableType<QDeclarativeGeoBoundingArea>(uri, 5, 0, "BoundingArea", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("(Positioning)BoundingArea")); qmlRegisterType<QDeclarativeGeoBoundingBox>(uri, 5, 0, "BoundingBox"); qmlRegisterType<QDeclarativeGeoBoundingCircle>(uri, 5, 0, "BoundingCircle"); qmlRegisterType<QDeclarativeGeoAddress>(uri, 5, 0, "Address"); qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 5, 0, "Plugin"); qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 5, 0, "PluginParameter"); - qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, 5, 0, "PluginRequirements", QDeclarativeGeoMapItemBase::tr("PluginRequirements is not intended instantiable by developer")); + qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, 5, 0, "PluginRequirements", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("PluginRequirements")); qmlRegisterType<QDeclarativeGeoMap>(uri, 5, 0, "Map"); - qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase>(uri, 5, 0, "GeoMapItemBase",QDeclarativeGeoMapItemBase::tr("GeoMapItemBase is not intended instantiable by developer.")); + qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase>(uri, 5, 0, "GeoMapItemBase", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("GeoMapItemBase")); qmlRegisterType<QDeclarativeGeoMapQuickItem>(uri, 5, 0, "MapQuickItem"); qmlRegisterType<QDeclarativeGeoMapItemView>(uri, 5, 0, "MapItemView"); qmlRegisterType<QDeclarativeGeoMapMouseArea>(uri, 5, 0, "MapMouseArea"); @@ -134,11 +135,11 @@ public: qmlRegisterType<QDeclarativeGeoRoute>(uri, 5, 0, "Route"); // data type qmlRegisterType<QDeclarativeGeoRouteSegment>(uri, 5, 0, "RouteSegment"); qmlRegisterType<QDeclarativeGeoManeuver>(uri, 5, 0, "RouteManeuver"); - qmlRegisterUncreatableType<QDeclarativeGeoMapFlickable>(uri, 5, 0, "MapFlickable", QDeclarativeGeoMapFlickable::tr("(Map)Flickable is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapPinchArea>(uri, 5, 0, "MapPinchArea", QDeclarativeGeoMapPinchArea::tr("(Map)PinchArea is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent>(uri, 5, 0, "MapPinchEvent", QDeclarativeGeoMapPinchEvent::tr("(Map)PinchEvent is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, 5, 0, "MapGestureArea", QDeclarativeGeoMapGestureArea::tr("(Map)GestureArea is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapType>(uri, 5, 0, "MapType",QDeclarativeGeoMapType::tr("MapType is not intended instantiable by developer.")); + qmlRegisterUncreatableType<QDeclarativeGeoMapFlickable>(uri, 5, 0, "MapFlickable", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("(Map)Flickable")); + qmlRegisterUncreatableType<QDeclarativeGeoMapPinchArea>(uri, 5, 0, "MapPinchArea", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("(Map)PinchArea")); + qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent>(uri, 5, 0, "MapPinchEvent", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("(Map)PinchEvent")); + qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, 5, 0, "MapGestureArea", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("(Map)GestureArea")); + qmlRegisterUncreatableType<QDeclarativeGeoMapType>(uri, 5, 0, "MapType", QCoreApplication::translate(CONTEXT_NAME, NOT_INSTANTIABLE_BY_DEVELOPER).arg("MapType")); qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category"); qmlRegisterType<QDeclarativePlaceEditorialModel>(uri, 5, 0, "EditorialModel"); qmlRegisterType<QDeclarativeGeoLocation>(uri, 5, 0, "Location"); diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro index 0c0c5411..e72eacd6 100644 --- a/src/imports/location/location.pro +++ b/src/imports/location/location.pro @@ -58,7 +58,8 @@ HEADERS += qdeclarativeposition_p.h \ qdeclarativeroutemapitem_p.h \ qgeomapitemgeometry_p.h \ qdeclarativegeomapcopyrightsnotice_p.h \ - qdeclarativegeomapgesturearea_p.h + qdeclarativegeomapgesturearea_p.h \ + error_messages.h SOURCES += qdeclarativeposition.cpp \ location.cpp \ @@ -92,7 +93,8 @@ SOURCES += qdeclarativeposition.cpp \ qdeclarativeroutemapitem.cpp \ qgeomapitemgeometry.cpp \ qdeclarativegeomapcopyrightsnotice.cpp \ - qdeclarativegeomapgesturearea.cpp + qdeclarativegeomapgesturearea.cpp \ + error_messages.cpp include(declarativeplaces/declarativeplaces.pri) diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp index 8e750a9e..1b783bae 100644 --- a/src/imports/location/qdeclarativegeocodemodel.cpp +++ b/src/imports/location/qdeclarativegeocodemodel.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qdeclarativegeocodemodel_p.h" +#include "error_messages.h" #include "qdeclarativegeolocation_p.h" #include <QtQml/qqmlinfo.h> @@ -170,7 +171,7 @@ void QDeclarativeGeocodeModel::update() return; if (!plugin_) { - qmlInfo(this) << tr("Cannot geocode, plugin not set."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, GEOCODE_PLUGIN_NOT_SET); return; } @@ -180,13 +181,13 @@ void QDeclarativeGeocodeModel::update() QGeocodingManager *geocodingManager = serviceProvider->geocodingManager(); if (!geocodingManager) { - qmlInfo(this) << tr("Cannot geocode, search manager (/plugin) not set."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, GEOCODE_MGR_NOT_SET); return; } if ((!coordinate_ || !coordinate_->coordinate().isValid()) && (!address_ || address_->address().isEmpty()) && (searchString_.isEmpty())) { - qmlInfo(this) << tr("Cannot geocode, valid query not set."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, GEOCODE_QUERY_NOT_SET); return; } abortRequest(); // abort possible previous requests @@ -306,8 +307,7 @@ void QDeclarativeGeocodeModel::pluginReady() QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider(); QGeocodingManager *geocodingManager = serviceProvider->geocodingManager(); if (!geocodingManager || serviceProvider->error() != QGeoServiceProvider::NoError) { - qmlInfo(this) << tr("Warning: Plugin does not support (reverse) geocoding. Error message: %1") - .arg(serviceProvider->errorString()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_GEOCODING).arg(serviceProvider->errorString()); return; } connect(geocodingManager, SIGNAL(finished(QGeocodeReply*)), @@ -340,7 +340,7 @@ void QDeclarativeGeocodeModel::setBounds(QObject *bounds) } else if (qobject_cast<QDeclarativeGeoBoundingCircle *>(bounds)) { boundingCircle_ = qobject_cast<QDeclarativeGeoBoundingCircle *>(bounds)->circle(); } else { - qmlInfo(this) << tr("Unsupported bound type (Box and Circle supported)"); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, UNSUPPORTED_BOUND_TYPE); return; } boundingArea_ = bounds; @@ -521,7 +521,7 @@ int QDeclarativeGeocodeModel::count() const QDeclarativeGeoLocation *QDeclarativeGeocodeModel::get(int index) { if (index < 0 || index >= declarativeLocations_.count()) { - qmlInfo(this) << tr("Error, too big or small index in get(): ") << index; + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, INDEX_OUT_OF_RANGE).arg(index); return 0; } return declarativeLocations_.at(index); @@ -677,7 +677,7 @@ void QDeclarativeGeocodeModel::setQuery(const QVariant &query) address_ = 0; coordinate_ = 0; } else { - qmlInfo(this) << tr("Unsupported query type for geocode model (Coordinate, string and Address supported)."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, UNSUPPORTED_QUERY_TYPE); return; } queryVariant_ = query; diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index 8c5ceb2b..aaf3264e 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -41,6 +41,7 @@ #include "qdeclarativegeomap_p.h" #include "qdeclarativegeomapmousearea_p.h" +#include "error_messages.h" #include "qdeclarativecirclemapitem_p.h" #include "qdeclarativegeomapquickitem_p.h" @@ -65,6 +66,7 @@ #include <QModelIndex> #include <QtQuick/QQuickCanvas> #include <QtGui/QGuiApplication> +#include <QCoreApplication> QT_BEGIN_NAMESPACE @@ -282,8 +284,8 @@ void QDeclarativeGeoMap::pluginReady() mappingManager_ = serviceProvider_->mappingManager(); if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { - qmlInfo(this) << tr("Warning: Plugin does not support mapping. Error message: %1") - .arg(serviceProvider_->errorString()); + QString msg = QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_MAPPING).arg(serviceProvider_->errorString()); + qmlInfo(this) << msg; return; } @@ -475,7 +477,7 @@ QSGNode *QDeclarativeGeoMap::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa void QDeclarativeGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin) { if (plugin_) { - qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_SET_ONCE); return; } plugin_ = plugin; diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp index c5f5a973..cb71bba4 100644 --- a/src/imports/location/qdeclarativegeomapgesturearea.cpp +++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp @@ -40,10 +40,13 @@ ** ****************************************************************************/ -#include <QtGui/QGuiApplication> + #include "qdeclarativegeomapgesturearea_p.h" #include "qdeclarativegeomap_p.h" #include "qdeclarativecoordinate_p.h" +#include "error_messages.h" + +#include <QtGui/QGuiApplication> #include <QtGui/qevent.h> #include <QtGui/QStyleHints> #include <QtQml/qqmlinfo.h> @@ -378,9 +381,9 @@ void QDeclarativeGeoMapGestureArea::setActiveGestures(ActiveGestures activeGestu return; activeGestures_ = activeGestures; if (activeGestures_ & RotationGesture) - qmlInfo(this) << tr("Pinchrotation gesture activated. Note that it is experimental feature."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PINCH_ROTATE_GESTURE_ACTIVATED); if (activeGestures_ & TiltGesture) - qmlInfo(this) << tr("Pinchtilt gesture activated. Note that it is experimental feature."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PINCH_TILT_GESTURE_ACTIVATED); emit activeGesturesChanged(); emit pinchDep_->activeGesturesChanged(); } diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp index ca4eab42..c541f19b 100644 --- a/src/imports/location/qdeclarativegeoroutemodel.cpp +++ b/src/imports/location/qdeclarativegeoroutemodel.cpp @@ -41,10 +41,12 @@ #include "qdeclarativegeoroutemodel_p.h" #include "qdeclarativegeoroute_p.h" +#include "error_messages.h" #include <qgeoserviceprovider.h> #include <qgeoroutingmanager.h> #include <QtQml/qqmlinfo.h> +#include <QCoreApplication> QT_BEGIN_NAMESPACE @@ -217,7 +219,7 @@ void QDeclarativeGeoRouteModel::abortRequest() QDeclarativeGeoRoute *QDeclarativeGeoRouteModel::get(int index) { if (index < 0 || index >= routes_.count()) { - qmlInfo(this) << tr("Error, invalid index for get(): ") << index; + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, INDEX_INVALID).arg(index); return 0; } return routes_.at(index); @@ -249,12 +251,12 @@ int QDeclarativeGeoRouteModel::rowCount(const QModelIndex &parent) const QVariant QDeclarativeGeoRouteModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { - qmlInfo(this) << tr("Error in indexing route model's data (invalid index)."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, MODEL_INDEX_INVALID); return QVariant(); } if (index.row() >= routes_.count()) { - qmlInfo(this) << tr("Fatal error in indexing route model's data (index overflow)."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, MODEL_INDEX_OUT_OF_RANGE); return QVariant(); } @@ -297,8 +299,7 @@ void QDeclarativeGeoRouteModel::pluginReady() QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider(); QGeoRoutingManager *routingManager = serviceProvider->routingManager(); if (!routingManager || serviceProvider->error() != QGeoServiceProvider::NoError) { - qmlInfo(this) << tr("Warning: Plugin does not support routing. Error message: %1") - .arg(serviceProvider->errorString()); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, PLUGIN_DOESNOT_SUPPORT_ROUTING).arg(serviceProvider->errorString()); return; } connect(routingManager, SIGNAL(finished(QGeoRouteReply*)), @@ -498,7 +499,7 @@ void QDeclarativeGeoRouteModel::update() return; if (!plugin_) { - qmlInfo(this) << tr("Plugin not set, cannot route."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_PLUGIN_NOT_SET); return; } @@ -508,17 +509,17 @@ void QDeclarativeGeoRouteModel::update() QGeoRoutingManager *routingManager = serviceProvider->routingManager(); if (!routingManager) { - qmlInfo(this) << tr("No routing manager available, cannot route."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_MGR_NOT_SET); return; } if (!routeQuery_) { - qmlInfo(this) << tr("Route query not set, cannot route."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_QUERY_NOT_SET); return; } abortRequest(); // Clear previus requests QGeoRouteRequest request = routeQuery_->routeRequest(); if (request.waypoints().count() < 2) { - qmlInfo(this) << tr("Not enough waypoints for routing."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_WAYPOINTS_NOT_SET); return; } @@ -863,7 +864,7 @@ void QDeclarativeGeoRouteQuery::removeExcludedArea(QDeclarativeGeoBoundingBox *a int index = exclusions_.lastIndexOf(area); if (index == -1) { - qmlInfo(this) << tr("Cannot remove nonexistent area."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, CANNOT_REMOVE_AREA); return; } exclusions_.removeAt(index); @@ -903,12 +904,12 @@ void QDeclarativeGeoRouteQuery::clearExcludedAreas() void QDeclarativeGeoRouteQuery::addWaypoint(QDeclarativeCoordinate *waypoint) { if (!waypoint) { - qmlInfo(this) << tr("Not adding null waypoint."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, CANNOT_ADD_NULL_WAYPOINT); return; } if (!waypoint->isValid()) { - qmlInfo(this) << tr("Not adding invalid waypoint."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, CANNOT_ADD_INVALID_WAYPOINT); return; } @@ -942,7 +943,7 @@ void QDeclarativeGeoRouteQuery::removeWaypoint(QDeclarativeCoordinate *waypoint) int index = waypoints_.lastIndexOf(waypoint); if (index == -1) { - qmlInfo(this) << tr("Cannot remove nonexistent waypoint."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, CANNOT_REMOVE_WAYPOINT); return; } waypoints_.removeAt(index); diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp index a73f43a6..79d3c589 100644 --- a/src/imports/location/qdeclarativepolygonmapitem.cpp +++ b/src/imports/location/qdeclarativepolygonmapitem.cpp @@ -42,6 +42,8 @@ #include "qdeclarativepolygonmapitem_p.h" #include "qgeocameracapabilities_p.h" #include "qlocationutils_p.h" +#include "error_messages.h" + #include <QtGui/private/qtriangulator_p.h> #include <QtQml/QQmlInfo> #include <QPainter> @@ -441,12 +443,12 @@ void QDeclarativePolygonMapItem::removeCoordinate(QDeclarativeCoordinate *coordi int index = coordPath_.lastIndexOf(coordinate); if (index == -1) { - qmlInfo(this) << tr("Coordinate does not belong to PolygonMapItem."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, COORD_NOT_BELONG_TO).arg("PolygonMapItem"); return; } if (path_.count() < index + 1) { - qmlInfo(this) << tr("Coordinate does not belong to PolygonMapItem."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, COORD_NOT_BELONG_TO).arg("PolygonMapItem"); return; } coordPath_.removeAt(index); diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp index 7a765a61..af86a0c7 100644 --- a/src/imports/location/qdeclarativepolylinemapitem.cpp +++ b/src/imports/location/qdeclarativepolylinemapitem.cpp @@ -42,6 +42,8 @@ #include "qdeclarativepolylinemapitem_p.h" #include "qgeocameracapabilities_p.h" #include "qlocationutils_p.h" +#include "error_messages.h" + #include <QtQml/QQmlInfo> #include <QPainter> #include <QPainterPath> @@ -577,12 +579,12 @@ void QDeclarativePolylineMapItem::removeCoordinate(QDeclarativeCoordinate *coord int index = coordPath_.lastIndexOf(coordinate); if (index == -1) { - qmlInfo(this) << tr("Coordinate does not belong to PolylineMapItem."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, COORD_NOT_BELONG_TO).arg("PolylineMapItem"); return; } if (path_.count() < index + 1) { - qmlInfo(this) << tr("Coordinate does not belong to PolylineMapItem."); + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, COORD_NOT_BELONG_TO).arg("PolylineMapItem"); return; } coordPath_.removeAt(index); diff --git a/src/imports/location/qdeclarativepositionsource.cpp b/src/imports/location/qdeclarativepositionsource.cpp index b79d07c4..a3ccb2f8 100644 --- a/src/imports/location/qdeclarativepositionsource.cpp +++ b/src/imports/location/qdeclarativepositionsource.cpp @@ -41,6 +41,7 @@ #include "qdeclarativepositionsource_p.h" #include "qdeclarativeposition_p.h" +#include "error_messages.h" #include <QtQml/qqmlinfo.h> #include <QtQml/qqml.h> @@ -243,7 +244,7 @@ void QDeclarativePositionSource::setNmeaSource(const QUrl &nmeaSource) QTimer::singleShot(0, this, SLOT(start())); } } else { - qmlInfo(this) << tr("Nmea file not found.") << localFileName; + qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, MISSED_NMEA_FILE) << localFileName; #ifdef QDECLARATIVE_POSITION_DEBUG qDebug() << "QDeclarativePositionSource NMEA File was not found: " << localFileName; #endif diff --git a/src/plugins/geoservices/nokia/nokia.pro b/src/plugins/geoservices/nokia/nokia.pro index 892d3392..d5bfe5da 100644 --- a/src/plugins/geoservices/nokia/nokia.pro +++ b/src/plugins/geoservices/nokia/nokia.pro @@ -30,7 +30,8 @@ HEADERS += \ qgeonetworkaccessmanager.h \ qgeointrinsicnetworkaccessmanager.h \ qgeouriprovider.h \ - uri_constants.h + uri_constants.h \ + qgeoerror_messages.h SOURCES += \ @@ -47,7 +48,8 @@ SOURCES += \ qgeoserviceproviderplugin_nokia.cpp \ qgeointrinsicnetworkaccessmanager.cpp \ qgeouriprovider.cpp \ - uri_constants.cpp + uri_constants.cpp \ + qgeoerror_messages.cpp include(placesv1/placesv1.pri) include(placesv2/placesv2.pri) diff --git a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp index 2266ae56..1617d438 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacecontentreplyimpl.cpp @@ -49,7 +49,9 @@ #include "jsonparserhelpers.h" #include "qplacecontentreplyimpl.h" #include "../qplacemanagerengine_nokiav2.h" +#include "../qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> @@ -94,7 +96,7 @@ void QPlaceContentReplyImpl::replyFinished() { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { - setError(ParseError, tr("Error parsing response.")); + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); return; } diff --git a/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp index 0f76b891..3fe94aee 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacedetailsreplyimpl.cpp @@ -49,7 +49,9 @@ #include "qplacedetailsreplyimpl.h" #include "jsonparserhelpers.h" #include "../qplacemanagerengine_nokiav2.h" +#include "../qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> @@ -133,7 +135,7 @@ void QPlaceDetailsReplyImpl::replyFinished() { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { - setError(ParseError, tr("Error parsing response.")); + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); return; } diff --git a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp index 3f24f937..cfbb6da9 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacerecommendationreplyimpl.cpp @@ -49,7 +49,9 @@ #include "qplacerecommendationreplyimpl.h" #include "jsonparserhelpers.h" #include "../qplacemanagerengine_nokiav2.h" +#include "../qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> @@ -94,7 +96,7 @@ void QPlaceRecommendationReplyImpl::replyFinished() { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { - setError(ParseError, tr("Error parsing response.")); + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); emit error(error(), errorString()); return; } diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp index 3c29cdc1..b4d6c2e5 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchreplyimpl.cpp @@ -49,7 +49,9 @@ #include "qplacesearchreplyimpl.h" #include "jsonparserhelpers.h" #include "../qplacemanagerengine_nokiav2.h" +#include "../qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> @@ -95,7 +97,7 @@ void QPlaceSearchReplyImpl::replyFinished() { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { - setError(ParseError, tr("Error parsing response.")); + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); emit error(error(), errorString()); return; } diff --git a/src/plugins/geoservices/nokia/placesv2/qplacesearchsuggestionreplyimpl.cpp b/src/plugins/geoservices/nokia/placesv2/qplacesearchsuggestionreplyimpl.cpp index ce4cd3b2..37820e3a 100644 --- a/src/plugins/geoservices/nokia/placesv2/qplacesearchsuggestionreplyimpl.cpp +++ b/src/plugins/geoservices/nokia/placesv2/qplacesearchsuggestionreplyimpl.cpp @@ -47,7 +47,9 @@ ****************************************************************************/ #include "qplacesearchsuggestionreplyimpl.h" +#include "../qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> @@ -90,7 +92,7 @@ void QPlaceSearchSuggestionReplyImpl::replyFinished() { QJsonDocument document = QJsonDocument::fromJson(m_reply->readAll()); if (!document.isObject()) { - setError(ParseError, tr("Error parsing response.")); + setError(ParseError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR)); emit error(error(), errorString()); return; } diff --git a/src/plugins/geoservices/nokia/qgeoerror_messages.cpp b/src/plugins/geoservices/nokia/qgeoerror_messages.cpp new file mode 100644 index 00000000..2bb1e1b8 --- /dev/null +++ b/src/plugins/geoservices/nokia/qgeoerror_messages.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +** This file is part of the Ovi services plugin for the Maps and +** Navigation API. The use of these services, whether by use of the +** plugin or by other means, is governed by the terms and conditions +** described by the file OVI_SERVICES_TERMS_AND_CONDITIONS.txt in +** this package, located in the directory containing the Ovi services +** plugin source code. +** +****************************************************************************/ + +#include "qgeoerror_messages.h" + +QT_BEGIN_NAMESPACE + +const char NOKIA_PLUGIN_CONTEXT_NAME[] = "QtLocationQML"; +const char MISSED_CREDENTIALS[] = QT_TRANSLATE_NOOP("QtLocationQML", "Qt Location requires app_id and token parameters.\nPlease register at https://api.developer.nokia.com/ to get your personal application credentials."); +const char SAVING_PLACE_NOT_SUPPORTED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Saving places is not supported."); +const char REMOVING_PLACE_NOT_SUPPORTED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Removing places is not supported."); +const char SAVING_CATEGORY_NOT_SUPPORTED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Saving categories is not supported."); +const char REMOVING_CATEGORY_NOT_SUPPORTED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Removing categories is not supported."); +const char PARSE_ERROR[] = QT_TRANSLATE_NOOP("QtLocationQML", "Error parsing response."); +const char NETWORK_ERROR[] = QT_TRANSLATE_NOOP("QtLocationQML", "Network error."); + +QT_END_NAMESPACE diff --git a/src/plugins/geoservices/nokia/qgeoerror_messages.h b/src/plugins/geoservices/nokia/qgeoerror_messages.h new file mode 100644 index 00000000..08d54e2c --- /dev/null +++ b/src/plugins/geoservices/nokia/qgeoerror_messages.h @@ -0,0 +1,68 @@ + +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtLocation module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +** This file is part of the Ovi services plugin for the Maps and +** Navigation API. The use of these services, whether by use of the +** plugin or by other means, is governed by the terms and conditions +** described by the file OVI_SERVICES_TERMS_AND_CONDITIONS.txt in +** this package, located in the directory containing the Ovi services +** plugin source code. +** +****************************************************************************/ + +#ifndef QGEOERROR_MESSAGES_H +#define QGEOERROR_MESSAGES_H + +#include <qglobal.h> + +QT_BEGIN_NAMESPACE + +extern const char NOKIA_PLUGIN_CONTEXT_NAME[]; +extern const char MISSED_CREDENTIALS[]; +extern const char SAVING_PLACE_NOT_SUPPORTED[]; +extern const char REMOVING_PLACE_NOT_SUPPORTED[]; +extern const char SAVING_CATEGORY_NOT_SUPPORTED[]; +extern const char REMOVING_CATEGORY_NOT_SUPPORTED[]; +extern const char PARSE_ERROR[]; +extern const char NETWORK_ERROR[]; + +QT_END_NAMESPACE + +#endif // QGEOERROR_MESSAGES_H diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav1.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav1.cpp index f55db408..3b72e572 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav1.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav1.cpp @@ -47,7 +47,9 @@ ****************************************************************************/ #include "qplacemanagerengine_nokiav1.h" +#include "qgeoerror_messages.h" +#include <QCoreApplication> #include <QtLocation/QPlaceContentRequest> #include "placesv1/qplacecategoriesrepository.h" @@ -219,7 +221,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV1::savePlace(const QPlace &place) { IdReply *reply = new IdReply(QPlaceIdReply::SavePlace, this); reply->setId(place.placeId()); - reply->triggerDone(QPlaceReply::UnsupportedError, tr("Saving places is not supported")); + reply->triggerDone(QPlaceReply::UnsupportedError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, SAVING_PLACE_NOT_SUPPORTED)); return reply; } @@ -227,7 +229,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV1::removePlace(const QString &placeId) { IdReply *reply = new IdReply(QPlaceIdReply::RemovePlace, this); reply->setId(placeId); - reply->triggerDone(QPlaceReply::UnsupportedError, tr("Removing places is not supported")); + reply->triggerDone(QPlaceReply::UnsupportedError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, REMOVING_PLACE_NOT_SUPPORTED)); return reply; } @@ -237,7 +239,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV1::saveCategory(const QPlaceCategory &ca IdReply *reply = new IdReply(QPlaceIdReply::SaveCategory, this); reply->setId(category.categoryId()); - reply->triggerDone(QPlaceReply::UnsupportedError, tr("Saving categories is not supported")); + reply->triggerDone(QPlaceReply::UnsupportedError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, SAVING_CATEGORY_NOT_SUPPORTED)); return reply; } @@ -245,7 +247,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV1::removeCategory(const QString &categor { IdReply *reply = new IdReply(QPlaceIdReply::RemoveCategory, this); reply->setId(categoryId); - reply->triggerDone(QPlaceReply::UnsupportedError, tr("Removing categories is not supported")); + reply->triggerDone(QPlaceReply::UnsupportedError, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, REMOVING_CATEGORY_NOT_SUPPORTED)); return reply; } diff --git a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp index c833df10..5cbc431a 100644 --- a/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp +++ b/src/plugins/geoservices/nokia/qplacemanagerengine_nokiav2.cpp @@ -58,7 +58,9 @@ #include "qgeonetworkaccessmanager.h" #include "qgeouriprovider.h" #include "uri_constants.h" +#include "qgeoerror_messages.h" +#include <QCoreApplication> #include <QtCore/QFile> #include <QtCore/QJsonArray> #include <QtCore/QJsonDocument> @@ -527,7 +529,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV2::savePlace(const QPlace &place) reply->setId(place.placeId()); QMetaObject::invokeMethod(reply, "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::UnsupportedError), - Q_ARG(QString, tr("Saving places is not supported."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, SAVING_PLACE_NOT_SUPPORTED))); connect(reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString))); @@ -540,7 +542,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV2::removePlace(const QString &placeId) reply->setId(placeId); QMetaObject::invokeMethod(reply, "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::UnsupportedError), - Q_ARG(QString, tr("Removing places is not supported."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, REMOVING_PLACE_NOT_SUPPORTED))); connect(reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString))); @@ -555,7 +557,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV2::saveCategory(const QPlaceCategory &ca reply->setId(category.categoryId()); QMetaObject::invokeMethod(reply, "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::UnsupportedError), - Q_ARG(QString, tr("Saving categories is not supported."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, SAVING_CATEGORY_NOT_SUPPORTED))); connect(reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString))); @@ -568,7 +570,7 @@ QPlaceIdReply *QPlaceManagerEngineNokiaV2::removeCategory(const QString &categor reply->setId(categoryId); QMetaObject::invokeMethod(reply, "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::UnsupportedError), - Q_ARG(QString, tr("Removing categories is not supported."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, REMOVING_CATEGORY_NOT_SUPPORTED))); connect(reply, SIGNAL(finished()), this, SLOT(replyFinished())); connect(reply, SIGNAL(error(QPlaceReply::Error,QString)), this, SLOT(replyError(QPlaceReply::Error,QString))); @@ -747,7 +749,7 @@ void QPlaceManagerEngineNokiaV2::categoryReplyFinished() if (m_categoryReply) { QMetaObject::invokeMethod(m_categoryReply.data(), "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::ParseError), - Q_ARG(QString, tr("Error parsing response."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, PARSE_ERROR))); } return; } @@ -779,7 +781,7 @@ void QPlaceManagerEngineNokiaV2::categoryReplyError() if (m_categoryReply) { QMetaObject::invokeMethod(m_categoryReply.data(), "setError", Qt::QueuedConnection, Q_ARG(QPlaceReply::Error, QPlaceReply::CommunicationError), - Q_ARG(QString, tr("Network error."))); + Q_ARG(QString, QCoreApplication::translate(NOKIA_PLUGIN_CONTEXT_NAME, NETWORK_ERROR))); } } |