summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp41
-rw-r--r--src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h9
-rw-r--r--tests/auto/declarative_core/tst_plugin.qml2
-rw-r--r--tests/auto/geotestplugin/geotestplugin.json3
-rw-r--r--tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h4
5 files changed, 52 insertions, 7 deletions
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
index b594d2dc..aa1db493 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider.cpp
@@ -192,7 +192,8 @@ void QDeclarativeGeoServiceProvider::componentComplete()
|| required_->mappingRequirements() != NoMappingFeatures
|| required_->routingRequirements() != NoRoutingFeatures
|| required_->geocodingRequirements() != NoGeocodingFeatures
- || required_->placesRequirements() != NoPlacesFeatures) {
+ || required_->placesRequirements() != NoPlacesFeatures
+ || required_->navigationRequirements() != NoNavigationFeatures) {
QStringList providers = QGeoServiceProvider::availableServiceProviders();
@@ -673,7 +674,8 @@ QDeclarativeGeoServiceProviderRequirements::QDeclarativeGeoServiceProviderRequir
mapping_(QDeclarativeGeoServiceProvider::NoMappingFeatures),
routing_(QDeclarativeGeoServiceProvider::NoRoutingFeatures),
geocoding_(QDeclarativeGeoServiceProvider::NoGeocodingFeatures),
- places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures)
+ places_(QDeclarativeGeoServiceProvider::NoPlacesFeatures),
+ navigation_(QDeclarativeGeoServiceProvider::NoNavigationFeatures)
{
}
@@ -769,6 +771,27 @@ void QDeclarativeGeoServiceProviderRequirements::setPlacesRequirements(const QDe
/*!
\internal
*/
+QDeclarativeGeoServiceProvider::NavigationFeatures QDeclarativeGeoServiceProviderRequirements::navigationRequirements() const
+{
+ return navigation_;
+}
+
+/*!
+ \internal
+*/
+void QDeclarativeGeoServiceProviderRequirements::setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features)
+{
+ if (navigation_ == features)
+ return;
+
+ navigation_ = features;
+ emit navigationRequirementsChanged(navigation_);
+ emit requirementsChanged();
+}
+
+/*!
+ \internal
+*/
bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvider *provider) const
{
QGeoServiceProvider::MappingFeatures mapping =
@@ -817,13 +840,25 @@ bool QDeclarativeGeoServiceProviderRequirements::matches(const QGeoServiceProvid
return false;
}
+ QGeoServiceProvider::NavigationFeatures navigation =
+ static_cast<QGeoServiceProvider::NavigationFeatures>(int(navigation_));
+
+ if (navigation == QGeoServiceProvider::AnyNavigationFeatures) {
+ if (provider->navigationFeatures() == QGeoServiceProvider::NoNavigationFeatures)
+ return false;
+ } else {
+ if ((provider->navigationFeatures() & navigation) != navigation)
+ return false;
+ }
+
return true;
}
bool QDeclarativeGeoServiceProviderRequirements::operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const
{
return (mapping_ == rhs.mapping_ && routing_ == rhs.routing_
- && geocoding_ == rhs.geocoding_ && places_ == rhs.places_);
+ && geocoding_ == rhs.geocoding_ && places_ == rhs.places_
+ && navigation_ == rhs.navigation_);
}
/*******************************************************************************
diff --git a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
index f6a663f3..3d5592c0 100644
--- a/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
+++ b/src/location/declarativemaps/qdeclarativegeoserviceprovider_p.h
@@ -257,6 +257,9 @@ class Q_LOCATION_PRIVATE_EXPORT QDeclarativeGeoServiceProviderRequirements : pub
Q_PROPERTY(QDeclarativeGeoServiceProvider::PlacesFeatures places
READ placesRequirements WRITE setPlacesRequirements
NOTIFY placesRequirementsChanged)
+ Q_PROPERTY(QDeclarativeGeoServiceProvider::NavigationFeatures navigation
+ READ navigationRequirements WRITE setNavigationRequirements
+ NOTIFY navigationRequirementsChanged)
public:
explicit QDeclarativeGeoServiceProviderRequirements(QObject *parent = 0);
@@ -274,6 +277,9 @@ public:
QDeclarativeGeoServiceProvider::PlacesFeatures placesRequirements() const;
void setPlacesRequirements(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
+ QDeclarativeGeoServiceProvider::NavigationFeatures navigationRequirements() const;
+ void setNavigationRequirements(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
+
Q_INVOKABLE bool matches(const QGeoServiceProvider *provider) const;
bool operator == (const QDeclarativeGeoServiceProviderRequirements &rhs) const;
@@ -283,6 +289,7 @@ Q_SIGNALS:
void routingRequirementsChanged(const QDeclarativeGeoServiceProvider::RoutingFeatures &features);
void geocodingRequirementsChanged(const QDeclarativeGeoServiceProvider::GeocodingFeatures &features);
void placesRequirementsChanged(const QDeclarativeGeoServiceProvider::PlacesFeatures &features);
+ void navigationRequirementsChanged(const QDeclarativeGeoServiceProvider::NavigationFeatures &features);
void requirementsChanged();
@@ -291,7 +298,7 @@ private:
QDeclarativeGeoServiceProvider::RoutingFeatures routing_;
QDeclarativeGeoServiceProvider::GeocodingFeatures geocoding_;
QDeclarativeGeoServiceProvider::PlacesFeatures places_;
-
+ QDeclarativeGeoServiceProvider::NavigationFeatures navigation_;
};
QT_END_NAMESPACE
diff --git a/tests/auto/declarative_core/tst_plugin.qml b/tests/auto/declarative_core/tst_plugin.qml
index 7b880f1d..23c1ff9f 100644
--- a/tests/auto/declarative_core/tst_plugin.qml
+++ b/tests/auto/declarative_core/tst_plugin.qml
@@ -54,6 +54,7 @@ Item {
mapping: Plugin.OfflineMappingFeature;
geocoding: Plugin.OfflineGeocodingFeature;
places: Plugin.AnyPlacesFeatures;
+ navigation: Plugin.AnyNavigationFeatures;
}
}
@@ -120,6 +121,7 @@ Item {
verify(requiredPlugin.supportsMapping(requiredPlugin.required.mapping))
verify(requiredPlugin.supportsGeocoding(requiredPlugin.required.geocoding))
verify(requiredPlugin.supportsPlaces(requiredPlugin.required.places))
+ verify(requiredPlugin.supportsNavigation(requiredPlugin.required.navigation))
}
function test_placesFeatures() {
diff --git a/tests/auto/geotestplugin/geotestplugin.json b/tests/auto/geotestplugin/geotestplugin.json
index 52721715..f6218b67 100644
--- a/tests/auto/geotestplugin/geotestplugin.json
+++ b/tests/auto/geotestplugin/geotestplugin.json
@@ -14,6 +14,7 @@
"OfflinePlacesFeature",
"SavePlaceFeature",
"SaveCategoryFeature",
- "SearchSuggestionsFeature"
+ "SearchSuggestionsFeature",
+ "OfflineNavigationFeature"
]
}
diff --git a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
index c606fdb0..ac195d69 100644
--- a/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
+++ b/tests/auto/geotestplugin/qgeoserviceproviderplugin_test.h
@@ -34,10 +34,10 @@
QT_USE_NAMESPACE
-class QGeoServiceProviderFactoryTest: public QObject, public QGeoServiceProviderFactory
+class QGeoServiceProviderFactoryTest: public QObject, public QGeoServiceProviderFactoryV2
{
Q_OBJECT
- Q_INTERFACES(QGeoServiceProviderFactory)
+ Q_INTERFACES(QGeoServiceProviderFactoryV2)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.geoservice.serviceproviderfactory/5.0"
FILE "geotestplugin.json")