summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@jollamobile.com>2014-01-08 09:12:40 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-13 04:52:27 +0100
commite268fe0a973244ff9e1d596a0dada056a1d7df3b (patch)
tree2e4cc9ba07b5ac81cd993a8622154bedfd4fef1a /src
parentd4b1cfc2e9345f25b0669bb225d05b04bb3fc72c (diff)
downloadqtlocation-e268fe0a973244ff9e1d596a0dada056a1d7df3b.tar.gz
Remove RouteModel::locale property.
I missed that the functionality was already available in Plugin. The measurementSystem property is retained. Change-Id: Id65aa29cb7078d3be7310081278a032edc25bf0d Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel.cpp75
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel_p.h5
2 files changed, 22 insertions, 58 deletions
diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp
index 110ffbb1..829398cf 100644
--- a/src/imports/location/qdeclarativegeoroutemodel.cpp
+++ b/src/imports/location/qdeclarativegeoroutemodel.cpp
@@ -286,7 +286,14 @@ void QDeclarativeGeoRouteModel::setPlugin(QDeclarativeGeoServiceProvider *plugin
return;
reset(); // reset the model
+
+ if (plugin_)
+ disconnect(plugin_, SIGNAL(localesChanged()), this, SIGNAL(measurementSystemChanged()));
+ if (plugin)
+ connect(plugin, SIGNAL(localesChanged()), this, SIGNAL(measurementSystemChanged()));
+
plugin_ = plugin;
+
if (complete_)
emit pluginChanged();
@@ -408,59 +415,14 @@ bool QDeclarativeGeoRouteModel::autoUpdate() const
}
/*!
- \qmlproperty Locale QtLocation::RouteModel::locale
-
- This property holds the locale which will be used when calculating the route. Setting this
- property also sets the \l {QtLocation::RouteModel::measurementSystem}{measurementSystem}
- property.
-*/
-void QDeclarativeGeoRouteModel::setLocale(const QLocale &locale)
-{
- if (!plugin_) {
- qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_PLUGIN_NOT_SET);
- return;
- }
-
- QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
- if (!serviceProvider)
- return;
-
- QGeoRoutingManager *routingManager = serviceProvider->routingManager();
- if (!routingManager) {
- qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_MGR_NOT_SET);
- return;
- }
-
- if (routingManager->locale() == locale)
- return;
-
- routingManager->setLocale(locale);
- emit localeChanged();
-}
-
-QLocale QDeclarativeGeoRouteModel::locale() const
-{
- if (!plugin_)
- return QLocale();
-
- QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
- if (!serviceProvider)
- return QLocale();
-
- QGeoRoutingManager *routingManager = serviceProvider->routingManager();
- if (!routingManager) {
- qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_MGR_NOT_SET);
- return QLocale();
- }
-
- return routingManager->locale();
-}
-
-/*!
\qmlproperty Locale::MeasurementSystem QtLocation::RouteModel::measurementSystem
This property holds the measurement system which will be used when calculating the route. This
- property is changed when the \l {QtLocation::RouteModel::locale}{locale} property is changed.
+ property is changed when the \l {QtLocation::Plugin::locales}{Plugin::locales} property of
+ \l {QtLocation::RouteModel::plugin}{plugin} changes.
+
+ If setting this property it must be set after the \l {QtLocation::RouteModel::plugin}{plugin}
+ property is set.
*/
void QDeclarativeGeoRouteModel::setMeasurementSystem(QLocale::MeasurementSystem ms)
{
@@ -492,13 +454,20 @@ QLocale::MeasurementSystem QDeclarativeGeoRouteModel::measurementSystem() const
return QLocale().measurementSystem();
QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
- if (!serviceProvider)
- return QLocale().measurementSystem();
+ if (!serviceProvider) {
+ if (plugin_->locales().isEmpty())
+ return QLocale().measurementSystem();
+
+ return QLocale(plugin_->locales().first()).measurementSystem();
+ }
QGeoRoutingManager *routingManager = serviceProvider->routingManager();
if (!routingManager) {
qmlInfo(this) << QCoreApplication::translate(CONTEXT_NAME, ROUTE_MGR_NOT_SET);
- return QLocale().measurementSystem();
+ if (plugin_->locales().isEmpty())
+ return QLocale().measurementSystem();
+
+ return QLocale(plugin_->locales().first()).measurementSystem();
}
return routingManager->measurementSystem();
diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h
index ebaf386a..bd9b9718 100644
--- a/src/imports/location/qdeclarativegeoroutemodel_p.h
+++ b/src/imports/location/qdeclarativegeoroutemodel_p.h
@@ -77,7 +77,6 @@ class QDeclarativeGeoRouteModel : public QAbstractListModel, public QQmlParserSt
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
Q_PROPERTY(RouteError error READ error NOTIFY errorChanged)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged)
Q_PROPERTY(QLocale::MeasurementSystem measurementSystem READ measurementSystem WRITE setMeasurementSystem NOTIFY measurementSystemChanged)
Q_INTERFACES(QQmlParserStatus)
@@ -124,9 +123,6 @@ public:
void setAutoUpdate(bool autoUpdate);
bool autoUpdate() const;
- void setLocale(const QLocale &locale);
- QLocale locale() const;
-
void setMeasurementSystem(QLocale::MeasurementSystem ms);
QLocale::MeasurementSystem measurementSystem() const;
@@ -148,7 +144,6 @@ Q_SIGNALS:
void errorStringChanged();
void errorChanged();
void routesChanged();
- void localeChanged();
void measurementSystemChanged();
public Q_SLOTS: