diff options
author | juhvu <qt-info@nokia.com> | 2011-06-03 11:26:59 +1000 |
---|---|---|
committer | juhvu <qt-info@nokia.com> | 2011-06-03 11:26:59 +1000 |
commit | 7f812b12ac0002a543d2ab8edcbad74b4694bd5b (patch) | |
tree | b38fe2b8a29550f76d04532f968c1be3abe8fe2b /src/imports/location/location.cpp | |
parent | 323b91f4622ee53db7a2888addce471362a8cb87 (diff) | |
download | qtlocation-7f812b12ac0002a543d2ab8edcbad74b4694bd5b.tar.gz |
Imported the Qt5 location QML work from mobility repo to Qt5 repo.
Diffstat (limited to 'src/imports/location/location.cpp')
-rw-r--r-- | src/imports/location/location.cpp | 175 |
1 files changed, 112 insertions, 63 deletions
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp index e76809b9..8751e5df 100644 --- a/src/imports/location/location.cpp +++ b/src/imports/location/location.cpp @@ -7,29 +7,29 @@ ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** ** 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. +** Alternatively, 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 +** 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. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** 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. ** ** ** @@ -48,6 +48,7 @@ #include "qgeomapobject.h" #include "qdeclarativegeoboundingbox_p.h" +#include "qdeclarativegeoboundingcircle_p.h" #include "qdeclarativegeoaddress_p.h" #include "qdeclarativegeoplace_p.h" #include "qdeclarativecoordinate_p.h" @@ -66,11 +67,15 @@ #include "qdeclarativegeomapmousearea_p.h" #include "qdeclarativegeomapmouseevent_p.h" -//#include "qdeclarativegeocodemodel_p.h" -//#include "qdeclarativereversegeocodemodel_p.h" +#include "qdeclarativegeoroute_p.h" +#include "qdeclarativegeomaprouteobject_p.h" +#include "qdeclarativegeoroutemodel_p.h" +#include "qdeclarativegeocodemodel_p.h" +#include "qdeclarativegeomaneuver_p.h" #include <QtDeclarative/qdeclarativeextensionplugin.h> #include <QtDeclarative/qdeclarative.h> +#include <QDebug> QT_BEGIN_NAMESPACE QTM_USE_NAMESPACE @@ -81,47 +86,94 @@ class QLocationDeclarativeModule: public QDeclarativeExtensionPlugin public: virtual void registerTypes(const char* uri) { - Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMobility.location")); - // Elements available since Qt mobility 1.1: - qmlRegisterType<QDeclarativePosition>(uri, 1, 1, "Position"); - qmlRegisterType<QDeclarativePositionSource>(uri, 1, 1, "PositionSource"); - qmlRegisterType<QDeclarativeLandmark>(uri, 1, 1, "Landmark"); - qmlRegisterType<QDeclarativeLandmarkModel>(uri, 1, 1, "LandmarkModel"); - qmlRegisterType<QDeclarativeLandmarkNameFilter>(uri, 1, 1, "LandmarkNameFilter"); - qmlRegisterType<QDeclarativeLandmarkCategoryFilter>(uri, 1, 1, "LandmarkCategoryFilter"); - qmlRegisterType<QDeclarativeLandmarkBoxFilter>(uri, 1, 1, "LandmarkBoxFilter"); - qmlRegisterType<QDeclarativeLandmarkProximityFilter>(uri, 1, 1, "LandmarkProximityFilter"); - qmlRegisterType<QDeclarativeLandmarkUnionFilter>(uri, 1, 1, "LandmarkUnionFilter"); - qmlRegisterType<QDeclarativeLandmarkIntersectionFilter>(uri, 1, 1, "LandmarkIntersectionFilter"); - qmlRegisterType<QDeclarativeLandmarkCategory>(uri, 1, 1, "LandmarkCategory"); - qmlRegisterType<QDeclarativeLandmarkCategoryModel>(uri, 1, 1, "LandmarkCategoryModel"); - qmlRegisterUncreatableType<QDeclarativeLandmarkFilterBase>(uri, 1, 1, "LandmarkFilterBase", QDeclarativeLandmarkFilterBase::tr("LandmarkFilterBase is an abstract class")); - qmlRegisterUncreatableType<QDeclarativeLandmarkAbstractModel>(uri, 1, 1, "LandmarkAbstractModel", QDeclarativeLandmarkAbstractModel::tr("LandmarkAbstractModel is an abstract class")); - qmlRegisterType<QDeclarativeCoordinate>(uri, 1, 1, "Coordinate"); - qmlRegisterType<QDeclarativeGeoBoundingBox>(uri, 1, 1, "BoundingBox"); - qmlRegisterType<QDeclarativeGeoPlace>(uri, 1, 1, "Place"); - qmlRegisterType<QDeclarativeGeoAddress>(uri, 1, 1, "Address"); - - qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 1, 2, "Plugin"); - qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 1, 2, "PluginParameter"); - qmlRegisterType<QDeclarativeGraphicsGeoMap>(uri, 1, 2, "Map"); - qmlRegisterType<QDeclarativeGeoMapObjectBorder>(); // used as grouped property - qmlRegisterType<QGeoMapObject>(uri, 1, 2, "QGeoMapObject"); - qmlRegisterType<QDeclarativeGeoMapObject>(uri, 1, 2, "MapObject"); - qmlRegisterType<QDeclarativeGeoMapObjectView>(uri, 1, 2, "MapObjectView"); - qmlRegisterType<QDeclarativeGeoMapGroupObject>(uri, 1, 2, "MapGroup"); - qmlRegisterType<QDeclarativeGeoMapCircleObject>(uri, 1, 2, "MapCircle"); - qmlRegisterType<QDeclarativeGeoMapPolygonObject>(uri, 1, 2, "MapPolygon"); - qmlRegisterType<QDeclarativeGeoMapPolylineObject>(uri, 1, 2, "MapPolyline"); - qmlRegisterType<QDeclarativeGeoMapRectangleObject>(uri, 1, 2, "MapRectangle"); - qmlRegisterType<QDeclarativeGeoMapTextObject>(uri, 1, 2, "MapText"); - qmlRegisterType<QDeclarativeGeoMapPixmapObject>(uri, 1, 2, "MapImage"); - - qmlRegisterType<QDeclarativeGeoMapMouseArea>(uri, 1, 2, "MapMouseArea"); - qmlRegisterType<QDeclarativeGeoMapMouseEvent>(uri, 1, 2, "MapMouseEvent"); - - //qmlRegisterType<QDeclarativeGeocodeModel>(uri, 1, 3, "GeocodeModel"); - //qmlRegisterType<QDeclarativeReverseGeocodeModel>(uri, 1, 3, "ReverseGeocodeModel"); + if (QLatin1String(uri) == QLatin1String("QtMobility.location")) { + // Elements available since Qt mobility 1.1: + qmlRegisterType<QDeclarativePosition>(uri, 1, 1, "Position"); + qmlRegisterType<QDeclarativePositionSource>(uri, 1, 1, "PositionSource"); + qmlRegisterType<QDeclarativeLandmark>(uri, 1, 1, "Landmark"); + qmlRegisterType<QDeclarativeLandmarkModel>(uri, 1, 1, "LandmarkModel"); + qmlRegisterType<QDeclarativeLandmarkNameFilter>(uri, 1, 1, "LandmarkNameFilter"); + qmlRegisterType<QDeclarativeLandmarkCategoryFilter>(uri, 1, 1, "LandmarkCategoryFilter"); + qmlRegisterType<QDeclarativeLandmarkBoxFilter>(uri, 1, 1, "LandmarkBoxFilter"); + qmlRegisterType<QDeclarativeLandmarkProximityFilter>(uri, 1, 1, "LandmarkProximityFilter"); + qmlRegisterType<QDeclarativeLandmarkUnionFilter>(uri, 1, 1, "LandmarkUnionFilter"); + qmlRegisterType<QDeclarativeLandmarkIntersectionFilter>(uri, 1, 1, "LandmarkIntersectionFilter"); + qmlRegisterType<QDeclarativeLandmarkCategory>(uri, 1, 1, "LandmarkCategory"); + qmlRegisterType<QDeclarativeLandmarkCategoryModel>(uri, 1, 1, "LandmarkCategoryModel"); + qmlRegisterUncreatableType<QDeclarativeLandmarkFilterBase>(uri, 1, 1, "LandmarkFilterBase", QDeclarativeLandmarkFilterBase::tr("LandmarkFilterBase is an abstract class")); + qmlRegisterUncreatableType<QDeclarativeLandmarkAbstractModel>(uri, 1, 1, "LandmarkAbstractModel", QDeclarativeLandmarkAbstractModel::tr("LandmarkAbstractModel is an abstract class")); + qmlRegisterType<QDeclarativeCoordinate>(uri, 1, 1, "Coordinate"); + qmlRegisterType<QDeclarativeGeoBoundingBox>(uri, 1, 1, "BoundingBox"); + qmlRegisterType<QDeclarativeGeoPlace>(uri, 1, 1, "Place"); + qmlRegisterType<QDeclarativeGeoAddress>(uri, 1, 1, "Address"); + + qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 1, 2, "Plugin"); + qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 1, 2, "PluginParameter"); + qmlRegisterType<QDeclarativeGraphicsGeoMap>(uri, 1, 2, "Map"); + qmlRegisterType<QDeclarativeGeoMapObjectBorder>(); // used as grouped property + qmlRegisterType<QGeoMapObject>(uri, 1, 2, "QGeoMapObject"); + qmlRegisterType<QDeclarativeGeoMapObject>(uri, 1, 2, "MapObject"); + qmlRegisterType<QDeclarativeGeoMapObjectView>(uri, 1, 2, "MapObjectView"); + qmlRegisterType<QDeclarativeGeoMapGroupObject>(uri, 1, 2, "MapGroup"); + qmlRegisterType<QDeclarativeGeoMapCircleObject>(uri, 1, 2, "MapCircle"); + qmlRegisterType<QDeclarativeGeoMapPolygonObject>(uri, 1, 2, "MapPolygon"); + qmlRegisterType<QDeclarativeGeoMapPolylineObject>(uri, 1, 2, "MapPolyline"); + qmlRegisterType<QDeclarativeGeoMapRectangleObject>(uri, 1, 2, "MapRectangle"); + qmlRegisterType<QDeclarativeGeoMapTextObject>(uri, 1, 2, "MapText"); + qmlRegisterType<QDeclarativeGeoMapPixmapObject>(uri, 1, 2, "MapImage"); + qmlRegisterType<QDeclarativeGeoMapMouseArea>(uri, 1, 2, "MapMouseArea"); + qmlRegisterType<QDeclarativeGeoMapMouseEvent>(uri, 1, 2, "MapMouseEvent"); + + } else if (QLatin1String(uri) == QLatin1String("Qt.location")) { + // This version numbering is not correct. It is just something to get going + // until the proper versioning scheme of QML plugins in Qt5 is agreed upon. + qmlRegisterType<QDeclarativePosition>(uri, 5, 0, "Position"); + qmlRegisterType<QDeclarativePositionSource>(uri, 5, 0, "PositionSource"); + qmlRegisterType<QDeclarativeLandmark>(uri, 5, 0, "Landmark"); + qmlRegisterType<QDeclarativeLandmarkModel>(uri, 5, 0, "LandmarkModel"); + qmlRegisterType<QDeclarativeLandmarkNameFilter>(uri, 5, 0, "LandmarkNameFilter"); + qmlRegisterType<QDeclarativeLandmarkCategoryFilter>(uri, 5, 0, "LandmarkCategoryFilter"); + qmlRegisterType<QDeclarativeLandmarkBoxFilter>(uri, 5, 0, "LandmarkBoxFilter"); + qmlRegisterType<QDeclarativeLandmarkProximityFilter>(uri, 5, 0, "LandmarkProximityFilter"); + qmlRegisterType<QDeclarativeLandmarkUnionFilter>(uri, 5, 0, "LandmarkUnionFilter"); + qmlRegisterType<QDeclarativeLandmarkIntersectionFilter>(uri, 5, 0, "LandmarkIntersectionFilter"); + qmlRegisterType<QDeclarativeLandmarkCategory>(uri, 5, 0, "LandmarkCategory"); + qmlRegisterType<QDeclarativeLandmarkCategoryModel>(uri, 5, 0, "LandmarkCategoryModel"); + qmlRegisterUncreatableType<QDeclarativeLandmarkFilterBase>(uri, 5, 0, "LandmarkFilterBase", QDeclarativeLandmarkFilterBase::tr("LandmarkFilterBase is an abstract class")); + qmlRegisterUncreatableType<QDeclarativeLandmarkAbstractModel>(uri, 5, 0, "LandmarkAbstractModel", QDeclarativeLandmarkAbstractModel::tr("LandmarkAbstractModel is an abstract class")); + qmlRegisterType<QDeclarativeCoordinate>(uri, 5, 0, "Coordinate"); + qmlRegisterType<QDeclarativeGeoBoundingBox>(uri, 5, 0, "BoundingBox"); + qmlRegisterType<QDeclarativeGeoPlace>(uri, 5, 0, "Place"); + qmlRegisterType<QDeclarativeGeoAddress>(uri, 5, 0, "Address"); + + qmlRegisterType<QDeclarativeGeoServiceProvider>(uri, 5, 0, "Plugin"); + qmlRegisterType<QDeclarativeGeoServiceProviderParameter>(uri, 5, 0, "PluginParameter"); + qmlRegisterType<QDeclarativeGraphicsGeoMap>(uri, 5, 0, "Map"); + qmlRegisterType<QDeclarativeGeoMapObjectBorder>(); // used as grouped property + qmlRegisterType<QGeoMapObject>(uri, 5, 0, "QGeoMapObject"); + qmlRegisterType<QDeclarativeGeoMapObject>(uri, 5, 0, "MapObject"); + qmlRegisterType<QDeclarativeGeoMapObjectView>(uri, 5, 0, "MapObjectView"); + qmlRegisterType<QDeclarativeGeoMapGroupObject>(uri, 5, 0, "MapGroup"); + qmlRegisterType<QDeclarativeGeoMapCircleObject>(uri, 5, 0, "MapCircle"); + qmlRegisterType<QDeclarativeGeoMapPolygonObject>(uri, 5, 0, "MapPolygon"); + qmlRegisterType<QDeclarativeGeoMapPolylineObject>(uri, 5, 0, "MapPolyline"); + qmlRegisterType<QDeclarativeGeoMapRectangleObject>(uri, 5, 0, "MapRectangle"); + qmlRegisterType<QDeclarativeGeoMapTextObject>(uri, 5, 0, "MapText"); + qmlRegisterType<QDeclarativeGeoMapPixmapObject>(uri, 5, 0, "MapImage"); + qmlRegisterType<QDeclarativeGeoMapMouseArea>(uri, 5, 0, "MapMouseArea"); + qmlRegisterType<QDeclarativeGeoMapMouseEvent>(uri, 5, 0, "MapMouseEvent"); + + 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<QDeclarativeGeoMapRouteObject>(uri, 5, 0, "MapRoute"); // graphical presentation + qmlRegisterType<QDeclarativeGeoRouteSegment>(uri, 5, 0, "RouteSegment"); + qmlRegisterType<QDeclarativeGeoManeuver>(uri, 5, 0, "RouteManeuver"); + qmlRegisterType<QDeclarativeGeoBoundingCircle>(uri, 5, 0, "BoundingCircle"); + } else { + qDebug() << "Unsupported URI given to load location QML plugin: " << QLatin1String(uri); + } } }; @@ -129,6 +181,3 @@ QT_END_NAMESPACE #include "location.moc" Q_EXPORT_PLUGIN2(declarative_location, QT_PREPEND_NAMESPACE(QLocationDeclarativeModule)); - - - |