diff options
author | Alex Wilson <alex.wilson@nokia.com> | 2012-02-28 13:05:02 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-05 04:22:24 +0100 |
commit | 0287bfee05840511c12100f06f9142e3e2b8f7d5 (patch) | |
tree | f5386e27a4b012877d37ab0b99dfc1d5a08705c5 /src/location/maps/qgeoserviceprovider.h | |
parent | c1d56bdae90f79d466769aa7a357d78a4f2ca6c7 (diff) |
New plugin API changes, centralized geoservice feature detection
This change adapts geoservice plugins to use the new Qt5 plugin API,
performing boolean feature detection all through the JSON blobs
rather than methods on factories or managers.
As a result of this centralisation, it was also necessary to rework
the QML API for the Plugin element a little. Some additional changes
were made to the declarative places plugin to prevent it crashing
due to plugins becoming available later than they did previously.
Task-number: QTBUG-24331
Change-Id: I26149987344b67091480449103ab1712c869b2a5
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/location/maps/qgeoserviceprovider.h')
-rw-r--r-- | src/location/maps/qgeoserviceprovider.h | 77 |
1 files changed, 73 insertions, 4 deletions
diff --git a/src/location/maps/qgeoserviceprovider.h b/src/location/maps/qgeoserviceprovider.h index 6f8eb9b6..6d5a0281 100644 --- a/src/location/maps/qgeoserviceprovider.h +++ b/src/location/maps/qgeoserviceprovider.h @@ -45,6 +45,7 @@ #include <QMap> #include <QVariant> #include <QString> +#include <QObject> #include <QtLocation/qlocationglobal.h> @@ -52,8 +53,7 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - - +class QLocale; class QStringList; class QGeocodingManager; class QGeoMappingManager; @@ -65,8 +65,10 @@ class QGeoRoutingManagerEngine; class QPlaceManagerEngine; class QGeoServiceProviderPrivate; -class Q_LOCATION_EXPORT QGeoServiceProvider +class Q_LOCATION_EXPORT QGeoServiceProvider : public QObject { + Q_OBJECT + public: enum Error { NoError, @@ -76,12 +78,75 @@ public: ConnectionError }; + enum RoutingFeature { + NoRoutingFeatures = 0, + OnlineRoutingFeature = (1<<0), + OfflineRoutingFeature = (1<<1), + LocalizedRoutingFeature = (1<<2), + RouteUpdatesFeature = (1<<3), + AlternativeRoutesFeature = (1<<4), + ExcludeAreasRoutingFeature = (1<<5), + AnyRoutingFeatures = ~(0) + }; + + enum GeocodingFeature { + NoGeocodingFeatures = 0, + OnlineGeocodingFeature = (1<<0), + OfflineGeocodingFeature = (1<<1), + ReverseGeocodingFeature = (1<<2), + LocalizedGeocodingFeature = (1<<3), + AnyGeocodingFeatures = ~(0) + }; + + enum MappingFeature { + NoMappingFeatures = 0, + OnlineMappingFeature = (1<<0), + OfflineMappingFeature = (1<<1), + LocalizedMappingFeature = (1<<2), + AnyMappingFeatures = ~(0) + }; + + enum PlacesFeature { + NoPlacesFeatures = 0, + OnlinePlacesFeature = (1<<0), + OfflinePlacesFeature = (1<<1), + SavePlaceFeature = (1<<2), + RemovePlaceFeature = (1<<3), + SaveCategoryFeature = (1<<4), + RemoveCategoryFeature = (1<<5), + PlaceRecommendationsFeature = (1<<6), + SearchSuggestionsFeature = (1<<7), + CorrectionsFeature = (1<<8), + LocalizedPlacesFeature = (1<<9), + NotificationsFeature = (1<<10), + PlaceMatchingFeature = (1<<11), + AnyPlacesFeatures = ~(0) + }; + + Q_DECLARE_FLAGS(RoutingFeatures, RoutingFeature) + Q_FLAGS(RoutingFeatures) + + Q_DECLARE_FLAGS(GeocodingFeatures, GeocodingFeature) + Q_FLAGS(GeocodingFeatures) + + Q_DECLARE_FLAGS(MappingFeatures, MappingFeature) + Q_FLAGS(MappingFeatures) + + Q_DECLARE_FLAGS(PlacesFeatures, PlacesFeature) + Q_FLAGS(PlacesFeatures) + static QStringList availableServiceProviders(); QGeoServiceProvider(const QString &providerName, - const QMap<QString,QVariant> ¶meters = (QMap<QString,QVariant>())); + const QMap<QString,QVariant> ¶meters = (QMap<QString,QVariant>()), + bool allowExperimental = false); ~QGeoServiceProvider(); + RoutingFeatures routingFeatures() const; + GeocodingFeatures geocodingFeatures() const; + MappingFeatures mappingFeatures() const; + PlacesFeatures placesFeatures() const; + QGeocodingManager* geocodingManager() const; QGeoMappingManager* mappingManager() const; QGeoRoutingManager* routingManager() const; @@ -90,6 +155,10 @@ public: Error error() const; QString errorString() const; + void setParameters(const QMap<QString, QVariant> ¶meters); + void setLocale(const QLocale &locale); + void setAllowExperimental(bool allow); + private: QGeoServiceProviderPrivate* d_ptr; }; |