diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-24 09:22:38 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-26 16:29:16 +0100 |
commit | 450793356b6f62b70a896b85011070760c5d1d56 (patch) | |
tree | 15e4f006f947087e708ea1ed5775a0372446cf83 /src/imports/location/location.cpp | |
parent | 1ca75bd6bc109c6e5ad47fd5c236709d3f64c466 (diff) | |
download | qtlocation-450793356b6f62b70a896b85011070760c5d1d56.tar.gz |
Fix QtLocation QML API and its version.
Despite missing QtLocation 5.3 release we will fix the QML Location
API as of 5.3 release time. This does not affect the C++ API.
We keep the 5.0 version tag but 5.3 becomes the defacto standard.
Change-Id: I93838a97a01c8b886a86e8b2bab3dedc595a2ee6
Reviewed-by: Aaron McCarthy <mccarthy.aaron@gmail.com>
Diffstat (limited to 'src/imports/location/location.cpp')
-rw-r--r-- | src/imports/location/location.cpp | 100 |
1 files changed, 55 insertions, 45 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index 7308c4eb..8af789b8 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -91,64 +91,74 @@ class QLocationDeclarativeModule: public QQmlExtensionPlugin public: virtual void registerTypes(const char *uri) { - if (QLatin1String(uri) == QLatin1String("QtMobility.location")) { - qWarning("QtMobility.location is not supported. Use QtLocation instead."); - } else if (QLatin1String(uri) == QLatin1String("Qt.location")) { - qWarning("Qt.location is not supported. Use QtLocation instead."); - } else if (QLatin1String(uri) == QLatin1String("QtLocation")) { + if (QLatin1String(uri) == QLatin1String("QtLocation")) { - // @uri QtLocation 5.0 + // @uri QtLocation + int major = 5; + int minor = 0; - qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 5, 0, "Plugin"); - qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 5, 0, "PluginParameter"); - qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, 5, 0, "PluginRequirements", + // Register the 5.0 types + // 5.0 is siltent and not advertised + + qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin"); + qmlRegisterType<QDeclarativeGeoServiceProviderParameter >(uri, major, minor, "PluginParameter"); + qmlRegisterUncreatableType<QDeclarativeGeoServiceProviderRequirements>(uri, major, minor, "PluginRequirements", QStringLiteral("PluginRequirements is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeGeoMap>(uri, 5, 0, "Map"); + qmlRegisterType<QDeclarativeGeoMap >(uri, major, minor, "Map"); - qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase>(uri, 5, 0, "GeoMapItemBase", + qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase >(uri, major, minor, "GeoMapItemBase", QStringLiteral("HeoMapItemBase is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeGeoMapQuickItem>(uri, 5, 0, "MapQuickItem"); - qmlRegisterType<QDeclarativeGeoMapItemView>(uri, 5, 0, "MapItemView"); - - qmlRegisterType<QDeclarativeGeocodeModel>(uri, 5, 0, "GeocodeModel"); // geocoding and reverse geocoding - qmlRegisterType<QDeclarativeGeoRouteModel>(uri, 5, 0, "RouteModel"); - qmlRegisterType<QDeclarativeGeoRouteQuery>(uri, 5, 0, "RouteQuery"); - qmlRegisterType<QDeclarativeGeoRoute>(uri, 5, 0, "Route"); // data type - qmlRegisterType<QDeclarativeGeoRouteSegment>(uri, 5, 0, "RouteSegment"); - qmlRegisterType<QDeclarativeGeoManeuver>(uri, 5, 0, "RouteManeuver"); - qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent>(uri, 5, 0, "MapPinchEvent", + qmlRegisterType<QDeclarativeGeoMapQuickItem >(uri, major, minor, "MapQuickItem"); + qmlRegisterType<QDeclarativeGeoMapItemView >(uri, major, minor, "MapItemView"); + + qmlRegisterType<QDeclarativeGeocodeModel >(uri, major, minor, "GeocodeModel"); // geocoding and reverse geocoding + qmlRegisterType<QDeclarativeGeoRouteModel >(uri, major, minor, "RouteModel"); + qmlRegisterType<QDeclarativeGeoRouteQuery >(uri, major, minor, "RouteQuery"); + qmlRegisterType<QDeclarativeGeoRoute >(uri, major, minor, "Route"); // data type + qmlRegisterType<QDeclarativeGeoRouteSegment >(uri, major, minor, "RouteSegment"); + qmlRegisterType<QDeclarativeGeoManeuver >(uri, major, minor, "RouteManeuver"); + qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent >(uri, major, minor, "MapPinchEvent", QStringLiteral("(Map)PinchEvent is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, 5, 0, "MapGestureArea", + qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, major, minor, "MapGestureArea", QStringLiteral("(Map)HestureArea is not intended instantiable by developer.")); - qmlRegisterUncreatableType<QDeclarativeGeoMapType>(uri, 5, 0, "MapType", + qmlRegisterUncreatableType<QDeclarativeGeoMapType >(uri, major, minor, "MapType", QStringLiteral("MapType is not intended instantiable by developer.")); - qmlRegisterType<QDeclarativeCategory>(uri, 5, 0, "Category"); - qmlRegisterType<QDeclarativePlaceEditorialModel>(uri, 5, 0, "EditorialModel"); - qmlRegisterType<QDeclarativePlaceImageModel>(uri, 5, 0, "ImageModel"); - qmlRegisterType<QDeclarativePlace>(uri, 5, 0, "Place"); - qmlRegisterType<QDeclarativePlaceIcon>(uri, 5, 0, "Icon"); - qmlRegisterType<QDeclarativeRatings>(uri, 5, 0, "Ratings"); - qmlRegisterType<QDeclarativeReviewModel>(uri, 5, 0, "ReviewModel"); - qmlRegisterType<QDeclarativeSupplier>(uri, 5, 0, "Supplier"); - qmlRegisterType<QDeclarativePlaceUser>(uri, 5, 0, "User"); - qmlRegisterType<QDeclarativeRectangleMapItem>(uri, 5, 0, "MapRectangle"); - qmlRegisterType<QDeclarativeCircleMapItem>(uri, 5, 0, "MapCircle"); + qmlRegisterType<QDeclarativeCategory >(uri, major, minor, "Category"); + qmlRegisterType<QDeclarativePlaceEditorialModel >(uri, major, minor, "EditorialModel"); + qmlRegisterType<QDeclarativePlaceImageModel >(uri, major, minor, "ImageModel"); + qmlRegisterType<QDeclarativePlace >(uri, major, minor, "Place"); + qmlRegisterType<QDeclarativePlaceIcon >(uri, major, minor, "Icon"); + qmlRegisterType<QDeclarativeRatings >(uri, major, minor, "Ratings"); + qmlRegisterType<QDeclarativeReviewModel >(uri, major, minor, "ReviewModel"); + qmlRegisterType<QDeclarativeSupplier >(uri, major, minor, "Supplier"); + qmlRegisterType<QDeclarativePlaceUser >(uri, major, minor, "User"); + qmlRegisterType<QDeclarativeRectangleMapItem >(uri, major, minor, "MapRectangle"); + qmlRegisterType<QDeclarativeCircleMapItem >(uri, major, minor, "MapCircle"); qmlRegisterType<QDeclarativeMapLineProperties>(); - qmlRegisterType<QDeclarativePolylineMapItem>(uri, 5, 0, "MapPolyline"); - qmlRegisterType<QDeclarativePolygonMapItem>(uri, 5, 0, "MapPolygon"); - qmlRegisterType<QDeclarativeRouteMapItem>(uri, 5, 0, "MapRoute"); - - qmlRegisterType<QDeclarativeSupportedCategoriesModel>(uri, 5, 0, "CategoryModel"); - qmlRegisterType<QDeclarativeSearchResultModel>(uri, 5, 0, "PlaceSearchModel"); - qmlRegisterType<QDeclarativeSearchSuggestionModel>(uri, 5, 0, "PlaceSearchSuggestionModel"); - qmlRegisterType<QDeclarativePlaceAttribute>(uri, 5,0, "PlaceAttribute"); - qmlRegisterUncreatableType<QQmlPropertyMap>(uri, 5, 0, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. " + qmlRegisterType<QDeclarativePolylineMapItem >(uri, major, minor, "MapPolyline"); + qmlRegisterType<QDeclarativePolygonMapItem >(uri, major, minor, "MapPolygon"); + qmlRegisterType<QDeclarativeRouteMapItem >(uri, major, minor, "MapRoute"); + + qmlRegisterType<QDeclarativeSupportedCategoriesModel >(uri, major, minor, "CategoryModel"); + qmlRegisterType<QDeclarativeSearchResultModel >(uri, major, minor, "PlaceSearchModel"); + qmlRegisterType<QDeclarativeSearchSuggestionModel >(uri, major, minor, "PlaceSearchSuggestionModel"); + qmlRegisterType<QDeclarativePlaceAttribute >(uri, major, minor, "PlaceAttribute"); + qmlRegisterUncreatableType<QQmlPropertyMap >(uri, major, minor, "ExtendedAttributes", "ExtendedAttributes instances cannot be instantiated. " "Only Place types have ExtendedAttributes and they cannot be re-assigned " "(but can be modified)."); - qmlRegisterType<QDeclarativeContactDetail>(uri, 5, 0, "ContactDetail"); - qmlRegisterUncreatableType<QDeclarativeContactDetails>(uri, 5, 0, "ContactDetails", "ContactDetails instances cannot be instantiated. " + qmlRegisterType<QDeclarativeContactDetail >(uri, major, minor, "ContactDetail"); + qmlRegisterUncreatableType<QDeclarativeContactDetails >(uri, major, minor, "ContactDetails", "ContactDetails instances cannot be instantiated. " "Only Place types have ContactDetails and they cannot " "be re-assigned (but can be modified)."); + + // Register the 5.3 types + // Introduction of 5.3 version; existing 5.0 exports automatically become available under 5.3 as well + // 5.3 is committed QML API despite missing release of QtLocation 5.3 + minor = 3; + // For now there are no new types; just reregister one existing 5.0 type + qmlRegisterType<QDeclarativeGeoServiceProvider >(uri, major, minor, "Plugin"); + + //registrations below are version independent qRegisterMetaType<QPlaceCategory>("QPlaceCategory"); qRegisterMetaType<QPlace>("QPlace"); qRegisterMetaType<QPlaceIcon>("QPlaceIcon"); |