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 | |
parent | 323b91f4622ee53db7a2888addce471362a8cb87 (diff) | |
download | qtlocation-7f812b12ac0002a543d2ab8edcbad74b4694bd5b.tar.gz |
Imported the Qt5 location QML work from mobility repo to Qt5 repo.
Diffstat (limited to 'src')
64 files changed, 3158 insertions, 1148 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)); - - - diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro index cbbf10d6..48c999b7 100644 --- a/src/imports/location/location.pro +++ b/src/imports/location/location.pro @@ -23,8 +23,6 @@ target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH #INCLUDEPATH += ../../../src/location/maps #INCLUDEPATH += . -# The header and source files of this project. Note that qmake generates dependency information -# and automatically adds necessary 'moc' files as it sees Q_OBJECT macros' in header files HEADERS += qdeclarativeposition_p.h \ qdeclarativepositionsource_p.h \ qdeclarativelandmark_p.h \ @@ -41,21 +39,21 @@ HEADERS += qdeclarativeposition_p.h \ qdeclarativegeomappolygonobject_p.h \ qdeclarativegeomappolylineobject_p.h \ qdeclarativegeomaprectangleobject_p.h \ - qdeclarativegeomaptextobject_p.h \ + qdeclarativegeomaptextobject_p.h \ qdeclarativegeomapmouseevent_p.h \ qdeclarativegeomapmousearea_p.h \ qdeclarativegeoserviceprovider_p.h \ qdeclarativegraphicsgeomap_p.h \ qdeclarativegeoplace_p.h \ qdeclarativegeoaddress_p.h \ - qdeclarativegeoboundingbox_p.h -# qdeclarativegeosearchmodel_p.h \ -# qdeclarativegeocodemodel_p.h \ -# qdeclarativereversegeocodemodel_p.h \ -# qdeclarativegeoroutingmodel_p.h \ -# qdeclarativegeoroute_p.h \ -# qdeclarativegeoroutesegment_p.h \ -# qdeclarativegeomaneuver_p.h + qdeclarativegeoboundingbox_p.h \ + qdeclarativegeocodemodel_p.h \ + qdeclarativegeoroutemodel_p.h \ + qdeclarativegeoroute_p.h \ + qdeclarativegeoroutesegment_p.h \ + qdeclarativegeomaneuver_p.h \ + qdeclarativegeomaprouteobject_p.h \ + qdeclarativegeoboundingcircle_p.h SOURCES += qdeclarativeposition.cpp \ location.cpp \ @@ -81,14 +79,15 @@ SOURCES += qdeclarativeposition.cpp \ qdeclarativegraphicsgeomap.cpp \ qdeclarativegeoplace.cpp \ qdeclarativegeoaddress.cpp \ - qdeclarativegeoboundingbox.cpp -# qdeclarativegeosearchmodel.cpp \ -# qdeclarativegeocodemodel.cpp \ -# qdeclarativereversegeocodemodel.cpp \ -# qdeclarativegeoroutingmodel.cpp \ -# qdeclarativegeoroute.cpp \ -# qdeclarativegeoroutesegment.cpp \ -# qdeclarativegeomaneuver.cpp + qdeclarativegeoboundingbox.cpp \ + qdeclarativegeocodemodel.cpp \ + qdeclarativegeoroutemodel.cpp \ + qdeclarativegeoroute.cpp \ + qdeclarativegeoroutesegment.cpp \ + qdeclarativegeomaneuver.cpp \ + qdeclarativegeomaprouteobject.cpp \ + qdeclarativegeoboundingcircle.cpp + # Tell qmake to create such makefile that qmldir and target (i.e. declarative_location) # are both copied to qt/imports/QtMobility/location -directory, @@ -99,18 +98,3 @@ qmldir.files += $$PWD/qmldir qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH INSTALLS += target qmldir - -symbian { - # In Symbian, a library should enjoy _largest_ possible capability set. - # However, really needs only Location capability so feel free to reduce - # depending on your signing capabilities. - TARGET.CAPABILITY = ALL -TCB - # Allow writable DLL data - TARGET.EPOCALLOWDLLDATA = 1 - # Target UID, makes every Symbian app unique - TARGET.UID3 = 0x20033007 - # Specifies what files shall be deployed: the plugin itself and the qmldir file. - importFiles.sources = $$DESTDIR/declarative_location$${QT_LIBINFIX}.dll qmldir - importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH - DEPLOYMENT = importFiles - } diff --git a/src/imports/location/qdeclarativecoordinate.cpp b/src/imports/location/qdeclarativecoordinate.cpp index 99b60e80..31aec957 100644 --- a/src/imports/location/qdeclarativecoordinate.cpp +++ b/src/imports/location/qdeclarativecoordinate.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativecoordinate_p.h b/src/imports/location/qdeclarativecoordinate_p.h index c954f1b2..c1bf61d9 100644 --- a/src/imports/location/qdeclarativecoordinate_p.h +++ b/src/imports/location/qdeclarativecoordinate_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoaddress.cpp b/src/imports/location/qdeclarativegeoaddress.cpp index 08d0e1af..621a101c 100644 --- a/src/imports/location/qdeclarativegeoaddress.cpp +++ b/src/imports/location/qdeclarativegeoaddress.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoaddress_p.h b/src/imports/location/qdeclarativegeoaddress_p.h index 39ade700..b750fb3c 100644 --- a/src/imports/location/qdeclarativegeoaddress_p.h +++ b/src/imports/location/qdeclarativegeoaddress_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoboundingbox.cpp b/src/imports/location/qdeclarativegeoboundingbox.cpp index f709b8b8..f454877d 100644 --- a/src/imports/location/qdeclarativegeoboundingbox.cpp +++ b/src/imports/location/qdeclarativegeoboundingbox.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -85,7 +85,6 @@ QGeoBoundingBox QDeclarativeGeoBoundingBox::box() return m_box; } - QDeclarativeCoordinate* QDeclarativeGeoBoundingBox::bottomLeft() { return &m_declarativeBottomLeft; @@ -111,6 +110,13 @@ void QDeclarativeGeoBoundingBox::setBottomLeft(QDeclarativeCoordinate *coordinat emit bottomLeftChanged(); } +Q_INVOKABLE bool QDeclarativeGeoBoundingBox::contains(QDeclarativeCoordinate* coordinate) +{ + if (!coordinate) + return false; + return m_box.contains(coordinate->coordinate()); +} + QDeclarativeCoordinate* QDeclarativeGeoBoundingBox::bottomRight() { return &m_declarativeBottomRight; diff --git a/src/imports/location/qdeclarativegeoboundingbox_p.h b/src/imports/location/qdeclarativegeoboundingbox_p.h index 1c8d6c44..39ea80dc 100644 --- a/src/imports/location/qdeclarativegeoboundingbox_p.h +++ b/src/imports/location/qdeclarativegeoboundingbox_p.h @@ -1,35 +1,35 @@ /**************************************************************************** ** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -67,6 +67,7 @@ public: void setBox(const QGeoBoundingBox& box); QGeoBoundingBox box(); + Q_INVOKABLE bool contains(QDeclarativeCoordinate* coordinate); QDeclarativeCoordinate* bottomLeft(); void setBottomLeft(QDeclarativeCoordinate* coordinate); QDeclarativeCoordinate* bottomRight(); diff --git a/src/imports/location/qdeclarativegeoboundingcircle.cpp b/src/imports/location/qdeclarativegeoboundingcircle.cpp new file mode 100644 index 00000000..2ef547b7 --- /dev/null +++ b/src/imports/location/qdeclarativegeoboundingcircle.cpp @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +***************************************************************************/ + +#include <qnumeric.h> +#include "qdeclarativegeoboundingcircle_p.h" + +QTM_BEGIN_NAMESPACE + +/*! + \qmlclass Yippiaiee! TODO +*/ + +QDeclarativeGeoBoundingCircle::QDeclarativeGeoBoundingCircle(QObject* parent) : + QObject(parent) +{ +} + +QDeclarativeGeoBoundingCircle::QDeclarativeGeoBoundingCircle(const QGeoBoundingCircle& circle, QObject* parent) : + QObject(parent), + center_(0), + circle_(circle) +{ +} + +void QDeclarativeGeoBoundingCircle::setCircle(const QGeoBoundingCircle& circle) +{ + circle_ = circle; +} + +QGeoBoundingCircle QDeclarativeGeoBoundingCircle::circle() +{ + return circle_; +} + +Q_INVOKABLE bool QDeclarativeGeoBoundingCircle::contains(QDeclarativeCoordinate* coordinate) +{ + if (!coordinate) + return false; + return circle_.contains(coordinate->coordinate()); +} + +QDeclarativeCoordinate* QDeclarativeGeoBoundingCircle::center() +{ + return center_; +} + +void QDeclarativeGeoBoundingCircle::setCenter(QDeclarativeCoordinate *coordinate) +{ + if (coordinate == center_) + return; + center_ = coordinate; + if (center_) + circle_.setCenter(center_->coordinate()); + else + circle_.setCenter(QGeoCoordinate()); + emit centerChanged(); +} + +qreal QDeclarativeGeoBoundingCircle::radius() const +{ + return circle_.radius(); +} + +void QDeclarativeGeoBoundingCircle::setRadius(const qreal radius) +{ + if (radius == circle_.radius()) + return; + circle_.setRadius(radius); + emit radiusChanged(); +} + +#include "moc_qdeclarativegeoboundingcircle_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeoboundingcircle_p.h b/src/imports/location/qdeclarativegeoboundingcircle_p.h new file mode 100644 index 00000000..0dcb625d --- /dev/null +++ b/src/imports/location/qdeclarativegeoboundingcircle_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +***************************************************************************/ + +#ifndef QDECLARATIVEGEOBOUNDINGCIRCLE_P_H +#define QDECLARATIVEGEOBOUNDINGCIRCLE_P_H + +#include "qdeclarativecoordinate_p.h" +#include <qgeoboundingcircle.h> + +#include <QtCore> +#include <QPointer> +#include <QtDeclarative/qdeclarative.h> + +QTM_BEGIN_NAMESPACE + +class QDeclarativeGeoBoundingCircle : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeCoordinate* center READ center WRITE setCenter NOTIFY centerChanged) + Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) + +public: + explicit QDeclarativeGeoBoundingCircle(QObject* parent = 0); + QDeclarativeGeoBoundingCircle(const QGeoBoundingCircle& circle, QObject* parent = 0); + void setCircle(const QGeoBoundingCircle& circle); + QGeoBoundingCircle circle(); + + Q_INVOKABLE bool contains(QDeclarativeCoordinate* coordinate); + QDeclarativeCoordinate* center(); + void setCenter(QDeclarativeCoordinate* coordinate); + qreal radius() const; + void setRadius(const qreal radius); + +signals: + void centerChanged(); + void radiusChanged(); + +private: + QPointer<QDeclarativeCoordinate> center_; + QGeoBoundingCircle circle_; +}; + +QTM_END_NAMESPACE +QML_DECLARE_TYPE(QTM_PREPEND_NAMESPACE(QDeclarativeGeoBoundingCircle)); + +#endif diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp index 2f91f48b..5cb579e8 100644 --- a/src/imports/location/qdeclarativegeocodemodel.cpp +++ b/src/imports/location/qdeclarativegeocodemodel.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -41,82 +41,342 @@ #include "qdeclarativegeocodemodel_p.h" +#include "qdeclarativegeoplace_p.h" +#include <QtDeclarative/qdeclarativeinfo.h> + +#include <qgeoserviceprovider.h> #include <qgeosearchmanager.h> QTM_BEGIN_NAMESPACE -QDeclarativeGeocodeModel::QDeclarativeGeocodeModel(QObject *parent) - : QDeclarativeGeoSearchModel(parent), - complete_(false) {} +QDeclarativeGeocodeModel::QDeclarativeGeocodeModel(QObject* parent) + : QAbstractListModel(parent), + autoUpdate_(false), + complete_(false), + reply_(0), + plugin_(0), + serviceProvider_(0), + searchManager_(0), + boundingArea_(0), + status_(QDeclarativeGeocodeModel::Null), + coordinate_(0), + address_(0) +{ + QHash<int, QByteArray> roleNames; + roleNames = QAbstractItemModel::roleNames(); + roleNames.insert(PlaceRole, "place"); + setRoleNames(roleNames); +} + +QDeclarativeGeocodeModel::~QDeclarativeGeocodeModel() +{ + if (serviceProvider_) + delete serviceProvider_; + qDeleteAll(declarativePlaces_); + declarativePlaces_.clear(); + if (reply_) + delete reply_; +} + +// From QDeclarativeParserStatus +void QDeclarativeGeocodeModel::componentComplete() +{ + complete_ = true; + if (autoUpdate_) + update(); +} -QDeclarativeGeocodeModel::~QDeclarativeGeocodeModel() {} +QGeoBoundingArea* QDeclarativeGeocodeModel::boundingArea() +{ + if (qobject_cast<QDeclarativeGeoBoundingBox*>(boundingArea_) && boundingBox_.isValid()) { + return &boundingBox_; + } else if (qobject_cast<QDeclarativeGeoBoundingCircle*>(boundingArea_) && boundingCircle_.isValid()) { + return &boundingCircle_; + } + return 0; +} -void QDeclarativeGeocodeModel::setAddress(QDeclarativeGeoAddress *address) +void QDeclarativeGeocodeModel::update() { - if (address_.address() == address->address()) + if (!complete_) + return; + if (!searchManager_) { + qmlInfo(this) << tr("Cannot geocode, search manager (/plugin) not set."); + return; + } + if ((!coordinate_ || !coordinate_->coordinate().isValid()) && + (!address_ || address_->address().isEmpty())) { + qmlInfo(this) << tr("Cannot geocode, valid query not set."); return; + } + abortRequest(); // abort possible previous requests + setError(""); // clear previous error string - address_.setAddress(address->address()); + if (coordinate_) { + setStatus(QDeclarativeGeocodeModel::Loading); + reply_ = searchManager_->reverseGeocode( + coordinate_->coordinate(), + boundingArea()); + if (reply_->isFinished()) { + if (reply_->error() == QGeoSearchReply::NoError) { + searchFinished(reply_); + } else { + searchError(reply_, reply_->error(), reply_->errorString()); + } + } + } else if (address_) { + setStatus(QDeclarativeGeocodeModel::Loading); + reply_ = searchManager_->geocode( + address_->address(), + boundingArea()); + if (reply_->isFinished()) { + if (reply_->error() == QGeoSearchReply::NoError) { + searchFinished(reply_); + } else { + searchError(reply_, reply_->error(), reply_->errorString()); + } + } + } +} - emit addressChanged(&address_); +void QDeclarativeGeocodeModel::abortRequest() +{ + if (reply_) { + reply_->abort(); + reply_->deleteLater(); + reply_ = 0; + } +} - if (complete_) +void QDeclarativeGeocodeModel::queryContentChanged() +{ + if (autoUpdate_) update(); } -QDeclarativeGeoAddress* QDeclarativeGeocodeModel::address() +// From QAbstractListModel +int QDeclarativeGeocodeModel::rowCount(const QModelIndex &parent) const { - return &address_; + Q_UNUSED(parent) + return declarativePlaces_.count(); } -void QDeclarativeGeocodeModel::componentComplete() +QVariant QDeclarativeGeocodeModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) + return QVariant(); + if (index.row() >= declarativePlaces_.count()) + return QVariant(); + if (role == QDeclarativeGeocodeModel::PlaceRole) { + QObject* placeObject = declarativePlaces_.at(index.row()); + Q_ASSERT(placeObject); + return QVariant::fromValue(placeObject); + } + return QVariant(); +} + +void QDeclarativeGeocodeModel::setPlugin(QDeclarativeGeoServiceProvider *plugin) { - if (!searchManager()) + if (plugin_ == plugin) return; + reset(); // reset the model + plugin_ = plugin; + if (complete_) + emit pluginChanged(); + serviceProvider_ = new QGeoServiceProvider(plugin_->name(), + plugin_->parameterMap()); + searchManager_ = serviceProvider_->searchManager(); + if (!searchManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { + qmlInfo(this) << tr("Warning: Plugin does not support (reverse) geocoding."); + searchManager_ = 0; + return; + } + connect(searchManager_, + SIGNAL(finished(QGeoSearchReply*)), + this, + SLOT(searchFinished(QGeoSearchReply*))); + connect(searchManager_, + SIGNAL(error(QGeoSearchReply*, QGeoSearchReply::Error, QString)), + this, + SLOT(searchError(QGeoSearchReply*, QGeoSearchReply::Error, QString))); +} - complete_ = true; - update(); +QDeclarativeGeoServiceProvider* QDeclarativeGeocodeModel::plugin() const +{ + return plugin_; } -void QDeclarativeGeocodeModel::update() +void QDeclarativeGeocodeModel::setBounds(QObject* bounds) { - if (searchManager() && !address_.address().isEmpty()) { + if (boundingArea_ == bounds) + return; + if (qobject_cast<QDeclarativeGeoBoundingBox*>(bounds)) { + boundingBox_ = qobject_cast<QDeclarativeGeoBoundingBox*>(bounds)->box(); + } else if (qobject_cast<QDeclarativeGeoBoundingCircle*>(bounds)) { + boundingCircle_ = qobject_cast<QDeclarativeGeoBoundingCircle*>(bounds)->circle(); + } else { + qmlInfo(this) << tr("Unsupported bound type (Box and Circle supported)"); + return; + } + boundingArea_ = bounds; + emit boundsChanged(); +} + +QObject* QDeclarativeGeocodeModel::bounds() const +{ + return boundingArea_; +} + +void QDeclarativeGeocodeModel::searchFinished(QGeoSearchReply *reply) +{ + if (reply->error() != QGeoSearchReply::NoError) { + return; + } + int oldCount = declarativePlaces_.count(); + setPlaces(reply->places()); + setError(""); + setStatus(QDeclarativeGeocodeModel::Ready); + reply->deleteLater(); + reply_ = 0; + emit placesChanged(); + if (oldCount != declarativePlaces_.count()) + emit countChanged(); +} + +void QDeclarativeGeocodeModel::searchError(QGeoSearchReply *reply, + QGeoSearchReply::Error error, + const QString &errorString) +{ + Q_UNUSED(error); + setError(errorString); + setStatus(QDeclarativeGeocodeModel::Error); + reply->deleteLater(); + reply_ = 0; +} - setStatus(QDeclarativeGeoSearchModel::Loading); +QDeclarativeGeocodeModel::Status QDeclarativeGeocodeModel::status() const +{ + return status_; +} + +void QDeclarativeGeocodeModel::setStatus(QDeclarativeGeocodeModel::Status status) +{ + if (status_ == status) + return; + status_ = status; + emit statusChanged(); +} - searchManager()->geocode(address_.address()); +QString QDeclarativeGeocodeModel::error() const +{ + return error_; +} + +void QDeclarativeGeocodeModel::setError(const QString &error) +{ + if (error_ == error) + return; + error_ = error; + emit errorChanged(); +} - // TODO check for finished +void QDeclarativeGeocodeModel::setPlaces(const QList<QGeoPlace> &places) +{ + beginResetModel(); + qDeleteAll(declarativePlaces_); + declarativePlaces_.clear(); + for (int i = 0; i < places.count(); ++i) { + QDeclarativeGeoPlace* place = new QDeclarativeGeoPlace(places.at(i), this); + declarativePlaces_.append(place); } + endResetModel(); } -QVariant QDeclarativeGeocodeModel::data(const QModelIndex &index, int role) const +int QDeclarativeGeocodeModel::count() const { - if (!index.isValid()) - return QVariant(); + return declarativePlaces_.count(); +} - if (index.row() > places().count()) - return QVariant(); +Q_INVOKABLE QDeclarativeGeoPlace* QDeclarativeGeocodeModel::get(int index) +{ + if (index < 0 || index >= declarativePlaces_.count()) { + qmlInfo(this) << tr("Error, too big or small index in get(): ") << index; + return 0; + } + return declarativePlaces_.at(index); +} - QGeoPlace place = places().at(index.row()); +Q_INVOKABLE void QDeclarativeGeocodeModel::clear() +{ + setPlaces(QList<QGeoPlace>()); +} - if (role == Qt::DisplayRole) - return place.coordinate().toString(); +Q_INVOKABLE void QDeclarativeGeocodeModel::reset() +{ + clear(); + abortRequest(); + setError(""); + setStatus(QDeclarativeGeocodeModel::Null); +} - return QDeclarativeGeoSearchModel::data(index, role); +QVariant QDeclarativeGeocodeModel::query() const +{ + return queryVariant_; } -QVariant QDeclarativeGeocodeModel::headerData(int section, Qt::Orientation orientation, int role) const +void QDeclarativeGeocodeModel::setQuery(const QVariant& query) { - if (section != 0) - return QVariant(); + if (query == queryVariant_) + return; + QObject* object = qvariant_cast<QObject*>(query); + if (qobject_cast<QDeclarativeCoordinate*>(object)) { + if (coordinate_) + coordinate_->disconnect(this); + if (address_) + address_->disconnect(this); + coordinate_ = qobject_cast<QDeclarativeCoordinate*>(object); + address_ = 0; + connect(coordinate_, SIGNAL(latitudeChanged(double)), this, SLOT(queryContentChanged())); + connect(coordinate_, SIGNAL(longitudeChanged(double)), this, SLOT(queryContentChanged())); + connect(coordinate_, SIGNAL(altitudeChanged(double)), this, SLOT(queryContentChanged())); + } else if (qobject_cast<QDeclarativeGeoAddress*>(object)) { + if (address_) + address_->disconnect(this); + if (coordinate_) + coordinate_->disconnect(this); + address_ = qobject_cast<QDeclarativeGeoAddress*>(object); + connect(address_, SIGNAL(countryChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(countryCodeChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(stateChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(countyChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(cityChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(districtChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(streetChanged()), this, SLOT(queryContentChanged())); + connect(address_, SIGNAL(postcodeChanged()), this, SLOT(queryContentChanged())); + coordinate_ = 0; + } else { + qmlInfo(this) << tr("Unsupported query type for geocode model (Coordinate and Address supported)."); + return; + } + queryVariant_ = query; + emit queryChanged(); + if (autoUpdate_) + update(); +} - if (role == Qt::DisplayRole) - return QString("Coordinate"); - return QDeclarativeGeoSearchModel::headerData(section, orientation, role); +bool QDeclarativeGeocodeModel::autoUpdate() const +{ + return autoUpdate_; } +void QDeclarativeGeocodeModel::setAutoUpdate(bool update) +{ + if (autoUpdate_ == update) + return; + autoUpdate_ = update; + emit autoUpdateChanged(); +} #include "moc_qdeclarativegeocodemodel_p.cpp" diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h index 144046fa..09f4f53b 100644 --- a/src/imports/location/qdeclarativegeocodemodel_p.h +++ b/src/imports/location/qdeclarativegeocodemodel_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -42,41 +42,127 @@ #ifndef QDECLARATIVEGEOCODEMODEL_H #define QDECLARATIVEGEOCODEMODEL_H -#include "qdeclarativegeosearchmodel_p.h" +#include "qdeclarativegeoserviceprovider_p.h" -#include "qdeclarativegeoaddress_p.h" +#include "qdeclarativegeoboundingcircle_p.h" +#include <qgeosearchreply.h> + +#include <QtDeclarative/qdeclarative.h> +#include <QDeclarativeParserStatus> +#include "qdeclarativegeoplace_p.h" +#include <QAbstractListModel> +#include <QPointer> QTM_BEGIN_NAMESPACE -class QDeclarativeGeocodeModel : public QDeclarativeGeoSearchModel -{ +class QGeoServiceProvider; +class QGeoSearchManager; +class QDeclarativeGeoPlace; +class QDeclarativeGeocodeModel : public QAbstractListModel, public QDeclarativeParserStatus +{ Q_OBJECT + Q_ENUMS(Status) - Q_PROPERTY(QDeclarativeGeoAddress* address READ address WRITE setAddress NOTIFY addressChanged) + Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged) + Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(QString error READ error NOTIFY errorChanged) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(QVariant query READ query WRITE setQuery NOTIFY queryChanged) + Q_PROPERTY(QObject* bounds READ bounds WRITE setBounds NOTIFY boundsChanged) + Q_INTERFACES(QDeclarativeParserStatus) public: - explicit QDeclarativeGeocodeModel(QObject *parent = 0); - ~QDeclarativeGeocodeModel(); + enum Status { + Null, + Ready, + Loading, + Error + }; + + enum Roles { + PlaceRole = Qt::UserRole + 499 + }; - void setAddress(QDeclarativeGeoAddress *address); - QDeclarativeGeoAddress* address(); + explicit QDeclarativeGeocodeModel(QObject* parent = 0); + virtual ~QDeclarativeGeocodeModel(); // From QDeclarativeParserStatus + virtual void classBegin() {} virtual void componentComplete(); // From QAbstractListModel + virtual int rowCount(const QModelIndex &parent) const; virtual QVariant data(const QModelIndex &index, int role) const; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const; -Q_SIGNALS: - void addressChanged(QDeclarativeGeoAddress *address); + void setPlugin(QDeclarativeGeoServiceProvider *plugin); + QDeclarativeGeoServiceProvider* plugin() const; -private: + void setBounds(QObject* bounds); + QObject* bounds() const; + + Status status() const; + QString error() const; + + bool autoUpdate() const; + void setAutoUpdate(bool update); + + int count() const; + Q_INVOKABLE QDeclarativeGeoPlace* get(int index); + + QVariant query() const; + void setQuery(const QVariant& query); + Q_INVOKABLE void clear(); + Q_INVOKABLE void reset(); + +Q_SIGNALS: + void countChanged(); + void pluginChanged(); + void statusChanged(); + void errorChanged(); + void placesChanged(); + void autoUpdateChanged(); + void boundsChanged(); + void queryChanged(); + +public Q_SLOTS: void update(); +protected Q_SLOTS: + void queryContentChanged(); + void searchFinished(QGeoSearchReply *reply); + void searchError(QGeoSearchReply *reply, + QGeoSearchReply::Error error, + const QString &errorString); + +protected: + QGeoSearchManager* searchManager(); + void setStatus(Status status); + void setError(const QString &error); + bool autoUpdate_; bool complete_; - QDeclarativeGeoAddress address_; + +private: + void setPlaces(const QList<QGeoPlace> &places); + QGeoBoundingArea* boundingArea(); + void abortRequest(); + QGeoSearchReply* reply_; + + QDeclarativeGeoServiceProvider* plugin_; + QGeoServiceProvider* serviceProvider_; + QGeoSearchManager* searchManager_; + QPointer<QObject> boundingArea_; + QGeoBoundingBox boundingBox_; + QGeoBoundingCircle boundingCircle_; + + QList<QDeclarativeGeoPlace*> declarativePlaces_; + + Status status_; + QString error_; + QVariant queryVariant_; + QDeclarativeCoordinate* coordinate_; + QDeclarativeGeoAddress* address_; }; QTM_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeomaneuver.cpp b/src/imports/location/qdeclarativegeomaneuver.cpp index c2052a22..63d08ae8 100644 --- a/src/imports/location/qdeclarativegeomaneuver.cpp +++ b/src/imports/location/qdeclarativegeomaneuver.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomaneuver_p.h b/src/imports/location/qdeclarativegeomaneuver_p.h index 9c6ef4ec..b97016c0 100644 --- a/src/imports/location/qdeclarativegeomaneuver_p.h +++ b/src/imports/location/qdeclarativegeomaneuver_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapcircleobject.cpp b/src/imports/location/qdeclarativegeomapcircleobject.cpp index 47127455..59b64e06 100644 --- a/src/imports/location/qdeclarativegeomapcircleobject.cpp +++ b/src/imports/location/qdeclarativegeomapcircleobject.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapcircleobject_p.h b/src/imports/location/qdeclarativegeomapcircleobject_p.h index 6c3fdcef..57027232 100644 --- a/src/imports/location/qdeclarativegeomapcircleobject_p.h +++ b/src/imports/location/qdeclarativegeomapcircleobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapgroupobject.cpp b/src/imports/location/qdeclarativegeomapgroupobject.cpp index 8692c3b1..29cbb0c8 100644 --- a/src/imports/location/qdeclarativegeomapgroupobject.cpp +++ b/src/imports/location/qdeclarativegeomapgroupobject.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapgroupobject_p.h b/src/imports/location/qdeclarativegeomapgroupobject_p.h index 97398f1a..3ccf4db8 100644 --- a/src/imports/location/qdeclarativegeomapgroupobject_p.h +++ b/src/imports/location/qdeclarativegeomapgroupobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapmousearea.cpp b/src/imports/location/qdeclarativegeomapmousearea.cpp index d2d6621a..eb3c4d21 100644 --- a/src/imports/location/qdeclarativegeomapmousearea.cpp +++ b/src/imports/location/qdeclarativegeomapmousearea.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapmousearea_p.h b/src/imports/location/qdeclarativegeomapmousearea_p.h index 61dca549..d7c386c8 100644 --- a/src/imports/location/qdeclarativegeomapmousearea_p.h +++ b/src/imports/location/qdeclarativegeomapmousearea_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapmouseevent.cpp b/src/imports/location/qdeclarativegeomapmouseevent.cpp index 23f74585..51d717f7 100644 --- a/src/imports/location/qdeclarativegeomapmouseevent.cpp +++ b/src/imports/location/qdeclarativegeomapmouseevent.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapmouseevent_p.h b/src/imports/location/qdeclarativegeomapmouseevent_p.h index 45c4a5ac..5949e280 100644 --- a/src/imports/location/qdeclarativegeomapmouseevent_p.h +++ b/src/imports/location/qdeclarativegeomapmouseevent_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapobject.cpp b/src/imports/location/qdeclarativegeomapobject.cpp index 5e17e3c2..7ecb0c92 100644 --- a/src/imports/location/qdeclarativegeomapobject.cpp +++ b/src/imports/location/qdeclarativegeomapobject.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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,8 +48,6 @@ #include <QAbstractItemModel> #include <QDeclarativeContext> -#include <QDebug> - QTM_BEGIN_NAMESPACE QDeclarativeGeoMapObject::QDeclarativeGeoMapObject(QDeclarativeItem *parent) @@ -256,7 +254,7 @@ void QDeclarativeGeoMapObjectView::setModel(const QVariant &model) } modelVariant_ = model; model_ = itemModel; - // At the moment maps only works with landmark model. Because of this tight + // At the moment maps only works with selected models. Because of this tight // restriction, we are not listening to all change signals. QObject::connect(model_, SIGNAL(modelReset()), this, SLOT(modelReset())); QObject::connect(model_, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(modelRowsRemoved(QModelIndex, int, int))); @@ -397,34 +395,35 @@ QDeclarativeGeoMapObject* QDeclarativeGeoMapObjectView::createItem(int modelRow) QVariant modelData = model_->data(index, iterator.key()); if (!modelData.isValid()) continue; - // This call would fail for <QObject*> Need to be figured out why - // if the model support is leveraged. - QObject *data_ptr = modelData.value<QDeclarativeLandmark*>(); + + // Currently we only support QObject* type data. + QObject* data_ptr = modelData.value<QObject*>(); + if (!data_ptr) continue; itemContext->setContextProperty(QLatin1String(iterator.value().data()), data_ptr); + itemContext->setContextProperty(QLatin1String("model"), data_ptr); // To avoid name collisions (delegate has same named attribute as model's role) // one can add here that the data is accessible also e.g. via 'model'. // In case of landmarks, two of the following are then equivalent: // latitude : landmark.coordinate.latitude // latitude : model.landmark.coordinate.latitude - // itemContext->setContextProperty(QLatin1String("model."), data_ptr); - // At the time being, it is however uncertain how to make it from a - // QtMobility project (QDeclarativeVisualDataModel not available). - // This however needs to be figured out if model support is generalized. + // However this requires instantiating a dynamic qobject and assigning it the + // dynamic property as property. Dynamic meta object code from declarative + // code should be reused. In mobility, e.g. contacts should have an example. } QObject* obj = delegate_->create(itemContext); if (!obj) { qWarning() << "QDeclarativeGeoMapObject map object creation failed."; delete itemContext; - return NULL; + return 0; } QDeclarativeGeoMapObject *declMapObj = qobject_cast<QDeclarativeGeoMapObject*>(obj); if (!declMapObj) { qWarning() << "QDeclarativeGeoMapObject map object delegate is of unsupported type."; delete itemContext; - return NULL; + return 0; } itemContext->setParent(declMapObj); return declMapObj; diff --git a/src/imports/location/qdeclarativegeomapobject_p.h b/src/imports/location/qdeclarativegeomapobject_p.h index d6b5df7e..e17619ca 100644 --- a/src/imports/location/qdeclarativegeomapobject_p.h +++ b/src/imports/location/qdeclarativegeomapobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapobjectborder.cpp b/src/imports/location/qdeclarativegeomapobjectborder.cpp index 5d79aa28..aadb51ec 100644 --- a/src/imports/location/qdeclarativegeomapobjectborder.cpp +++ b/src/imports/location/qdeclarativegeomapobjectborder.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomapobjectborder_p.h b/src/imports/location/qdeclarativegeomapobjectborder_p.h index bc42bdeb..75f34a08 100644 --- a/src/imports/location/qdeclarativegeomapobjectborder_p.h +++ b/src/imports/location/qdeclarativegeomapobjectborder_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomappixmapobject.cpp b/src/imports/location/qdeclarativegeomappixmapobject.cpp index 75a01148..4533fe8f 100644 --- a/src/imports/location/qdeclarativegeomappixmapobject.cpp +++ b/src/imports/location/qdeclarativegeomappixmapobject.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomappixmapobject_p.h b/src/imports/location/qdeclarativegeomappixmapobject_p.h index 0eaddbce..bf869efb 100644 --- a/src/imports/location/qdeclarativegeomappixmapobject_p.h +++ b/src/imports/location/qdeclarativegeomappixmapobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomappolygonobject.cpp b/src/imports/location/qdeclarativegeomappolygonobject.cpp index e2aa6c6c..dfea44ef 100644 --- a/src/imports/location/qdeclarativegeomappolygonobject.cpp +++ b/src/imports/location/qdeclarativegeomappolygonobject.cpp @@ -8,29 +8,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -240,6 +240,7 @@ void QDeclarativeGeoMapPolygonObject::borderWidthChanged(int width) void QDeclarativeGeoMapPolygonObject::addCoordinate(QDeclarativeCoordinate* coordinate) { + Q_ASSERT(path_.count() == polygon_->path().count()); path_.append(coordinate); QList<QGeoCoordinate> p = polygon_->path(); p.append(coordinate->coordinate()); @@ -267,6 +268,7 @@ void QDeclarativeGeoMapPolygonObject::addCoordinate(QDeclarativeCoordinate* coor void QDeclarativeGeoMapPolygonObject::removeCoordinate(QDeclarativeCoordinate* coordinate) { + Q_ASSERT(path_.count() == polygon_->path().count()); int index = path_.lastIndexOf(coordinate); if (index == -1) { qmlInfo(this) << tr("Cannot remove nonexistent coordinate."); @@ -284,6 +286,26 @@ void QDeclarativeGeoMapPolygonObject::removeCoordinate(QDeclarativeCoordinate* c } /*! + \qmlmethod MapPolygon::clearCoordinates() + + Clears all coordinates. + + \sa removeCoordinate addCoordinate + +*/ + +Q_INVOKABLE void QDeclarativeGeoMapPolygonObject::clearCoordinates() +{ + Q_ASSERT(path_.count() == polygon_->path().count()); + if (polygon_->path().isEmpty() && path_.isEmpty()) + return; + QList<QGeoCoordinate> temp; + polygon_->setPath(temp); + path_.clear(); + emit pathChanged(); +} + +/*! \qmlproperty int MapPolygon::z This property holds the z-value of the polygon. diff --git a/src/imports/location/qdeclarativegeomappolygonobject_p.h b/src/imports/location/qdeclarativegeomappolygonobject_p.h index bc8ad017..700693d5 100644 --- a/src/imports/location/qdeclarativegeomappolygonobject_p.h +++ b/src/imports/location/qdeclarativegeomappolygonobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -70,6 +70,7 @@ public: Q_INVOKABLE void addCoordinate(QDeclarativeCoordinate* coordinate); Q_INVOKABLE void removeCoordinate(QDeclarativeCoordinate* coordinate); + Q_INVOKABLE void clearCoordinates(); QColor color() const; void setColor(const QColor &color); diff --git a/src/imports/location/qdeclarativegeomappolylineobject.cpp b/src/imports/location/qdeclarativegeomappolylineobject.cpp index 70eb0e5b..b10aed43 100644 --- a/src/imports/location/qdeclarativegeomappolylineobject.cpp +++ b/src/imports/location/qdeclarativegeomappolylineobject.cpp @@ -8,29 +8,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -223,6 +223,27 @@ void QDeclarativeGeoMapPolylineObject::addCoordinate(QDeclarativeCoordinate* coo emit pathChanged(); } + +/*! + \qmlmethod MapPolyline::clearCoordinates() + + Clears all coordinates. + + \sa removeCoordinate addCoordinate + +*/ + +Q_INVOKABLE void QDeclarativeGeoMapPolylineObject::clearCoordinates() +{ + Q_ASSERT(path_.count() == polyline_->path().count()); + if (polyline_->path().isEmpty() && path_.isEmpty()) + return; + QList<QGeoCoordinate> temp; + polyline_->setPath(temp); + path_.clear(); + emit pathChanged(); +} + /*! \qmlmethod MapPolyline::removeCoordinate(Coordinate) diff --git a/src/imports/location/qdeclarativegeomappolylineobject_p.h b/src/imports/location/qdeclarativegeomappolylineobject_p.h index dcf67e49..7bd63129 100644 --- a/src/imports/location/qdeclarativegeomappolylineobject_p.h +++ b/src/imports/location/qdeclarativegeomappolylineobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -67,6 +67,7 @@ public: Q_INVOKABLE void addCoordinate(QDeclarativeCoordinate* coordinate); Q_INVOKABLE void removeCoordinate(QDeclarativeCoordinate* coordinate); + Q_INVOKABLE void clearCoordinates(); // From QDeclarativeParserStatus virtual void classBegin() {} diff --git a/src/imports/location/qdeclarativegeomaprectangleobject.cpp b/src/imports/location/qdeclarativegeomaprectangleobject.cpp index cd117d9d..c49ea49e 100644 --- a/src/imports/location/qdeclarativegeomaprectangleobject.cpp +++ b/src/imports/location/qdeclarativegeomaprectangleobject.cpp @@ -10,29 +10,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomaprectangleobject_p.h b/src/imports/location/qdeclarativegeomaprectangleobject_p.h index 82bf9215..ccd5a4f3 100644 --- a/src/imports/location/qdeclarativegeomaprectangleobject_p.h +++ b/src/imports/location/qdeclarativegeomaprectangleobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomaprouteobject.cpp b/src/imports/location/qdeclarativegeomaprouteobject.cpp new file mode 100644 index 00000000..8739a2cf --- /dev/null +++ b/src/imports/location/qdeclarativegeomaprouteobject.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QPen> +#include "qdeclarativegeomaprouteobject_p.h" + +QTM_BEGIN_NAMESPACE + +QDeclarativeGeoMapRouteObject::QDeclarativeGeoMapRouteObject(QDeclarativeItem *parent) + : QDeclarativeGeoMapObject(parent), route_(0) +{ + route_ = new QGeoMapRouteObject(); // graphical object + setMapObject(route_); +} + +QDeclarativeGeoMapRouteObject::~QDeclarativeGeoMapRouteObject() +{ + delete route_; +} + +void QDeclarativeGeoMapRouteObject::setColor(const QColor &color) +{ + if (color_ == color) + return; + color_ = color; + QPen pen(color); + route_->setPen(pen); + emit colorChanged(); +} + +QColor QDeclarativeGeoMapRouteObject::color() const +{ + return color_; +} + +void QDeclarativeGeoMapRouteObject::setRoute(QDeclarativeGeoRoute* route) +{ + if (route == declarativeRoute_) + return; + declarativeRoute_ = route; + if (declarativeRoute_) { + route_->setRoute(declarativeRoute_->route_); + } else { + route_->setRoute(QGeoRoute()); + } + emit routeChanged(); +} + +QDeclarativeGeoRoute* QDeclarativeGeoMapRouteObject::route() +{ + return declarativeRoute_; +} + +void QDeclarativeGeoMapRouteObject::setDetailLevel(quint32 detailLevel) +{ + if (detailLevel == route_->detailLevel()) + return; + route_->setDetailLevel(detailLevel); + emit detailLevelChanged(); +} + +quint32 QDeclarativeGeoMapRouteObject::detailLevel() const +{ + return route_->detailLevel(); +} + +#include "moc_qdeclarativegeomaprouteobject_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeomaprouteobject_p.h b/src/imports/location/qdeclarativegeomaprouteobject_p.h new file mode 100644 index 00000000..04df9930 --- /dev/null +++ b/src/imports/location/qdeclarativegeomaprouteobject_p.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEGEOMAPROUTEOBJECT_H +#define QDECLARATIVEGEOMAPROUTEOBJECT_H + +#include "qdeclarativegeomapobject_p.h" +#include "qdeclarativecoordinate_p.h" +#include "qdeclarativegeoroute_p.h" +#include "qgeomaprouteobject.h" + +QTM_BEGIN_NAMESPACE + +class QDeclarativeGeoMapRouteObject : public QDeclarativeGeoMapObject +{ + Q_OBJECT + + Q_PROPERTY(QDeclarativeGeoRoute* route READ route WRITE setRoute NOTIFY routeChanged) + Q_PROPERTY(quint32 detailLevel READ detailLevel WRITE setDetailLevel NOTIFY detailLevelChanged) + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + +public: + QDeclarativeGeoMapRouteObject(QDeclarativeItem *parent = 0); + ~QDeclarativeGeoMapRouteObject(); + + QDeclarativeGeoRoute* route(); + void setRoute(QDeclarativeGeoRoute* route); + + quint32 detailLevel() const; + void setDetailLevel(quint32 radius); + + QColor color() const; + void setColor(const QColor &color); + +Q_SIGNALS: + void routeChanged(); + void detailLevelChanged(); + void colorChanged(); + +private: + // The declarative route (datatype) + QDeclarativeGeoRoute* declarativeRoute_; + // Used internally as the visual map object + QGeoMapRouteObject* route_; + QColor color_; +}; + +QTM_END_NAMESPACE + +QML_DECLARE_TYPE(QTM_PREPEND_NAMESPACE(QDeclarativeGeoMapRouteObject)); + +#endif diff --git a/src/imports/location/qdeclarativegeomaptextobject.cpp b/src/imports/location/qdeclarativegeomaptextobject.cpp index f8255a7f..b54943ca 100644 --- a/src/imports/location/qdeclarativegeomaptextobject.cpp +++ b/src/imports/location/qdeclarativegeomaptextobject.cpp @@ -8,29 +8,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeomaptextobject_p.h b/src/imports/location/qdeclarativegeomaptextobject_p.h index 0d596357..3f54b106 100644 --- a/src/imports/location/qdeclarativegeomaptextobject_p.h +++ b/src/imports/location/qdeclarativegeomaptextobject_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoplace.cpp b/src/imports/location/qdeclarativegeoplace.cpp index 21db221d..7e607207 100644 --- a/src/imports/location/qdeclarativegeoplace.cpp +++ b/src/imports/location/qdeclarativegeoplace.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoplace_p.h b/src/imports/location/qdeclarativegeoplace_p.h index abc46f82..fb638514 100644 --- a/src/imports/location/qdeclarativegeoplace_p.h +++ b/src/imports/location/qdeclarativegeoplace_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoroute.cpp b/src/imports/location/qdeclarativegeoroute.cpp index 9302767a..3b4e89aa 100644 --- a/src/imports/location/qdeclarativegeoroute.cpp +++ b/src/imports/location/qdeclarativegeoroute.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -44,13 +44,24 @@ QTM_BEGIN_NAMESPACE QDeclarativeGeoRoute::QDeclarativeGeoRoute(QObject *parent) - : QObject(parent) {} + : QObject(parent) +{ + this->init(); +} QDeclarativeGeoRoute::QDeclarativeGeoRoute(const QGeoRoute &route, QObject *parent) : QObject(parent), route_(route) { - bounds_ = new QDeclarativeGeoBoundingBox(route.bounds(), this); + this->init(); +} + +QDeclarativeGeoRoute::~QDeclarativeGeoRoute() {} + + +void QDeclarativeGeoRoute::init() +{ + bounds_ = new QDeclarativeGeoBoundingBox(route_.bounds(), this); for (int i = 0; i < route_.path().size(); ++i) path_.append(new QDeclarativeCoordinate(route_.path().at(i), this)); @@ -62,8 +73,6 @@ QDeclarativeGeoRoute::QDeclarativeGeoRoute(const QGeoRoute &route, QObject *pare } } -QDeclarativeGeoRoute::~QDeclarativeGeoRoute() {} - QDeclarativeGeoBoundingBox* QDeclarativeGeoRoute::bounds() const { return bounds_; diff --git a/src/imports/location/qdeclarativegeoroute_p.h b/src/imports/location/qdeclarativegeoroute_p.h index eda394f9..0f090ccf 100644 --- a/src/imports/location/qdeclarativegeoroute_p.h +++ b/src/imports/location/qdeclarativegeoroute_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -84,14 +84,15 @@ private: static QDeclarativeGeoRouteSegment* segments_at(QDeclarativeListProperty<QDeclarativeGeoRouteSegment> *prop, int index); static void segments_clear(QDeclarativeListProperty<QDeclarativeGeoRouteSegment> *prop); + void init(); + QGeoRoute route_; QDeclarativeGeoBoundingBox* bounds_; QList<QDeclarativeCoordinate*> path_; QList<QDeclarativeGeoRouteSegment*> segments_; + friend class QDeclarativeGeoMapRouteObject; }; - QTM_END_NAMESPACE #endif - diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp new file mode 100644 index 00000000..45ba1b72 --- /dev/null +++ b/src/imports/location/qdeclarativegeoroutemodel.cpp @@ -0,0 +1,700 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativegeoroutemodel_p.h" +#include "qdeclarativegeoroute_p.h" + +#include <qgeoserviceprovider.h> +#include <qgeoroutingmanager.h> +#include <QtDeclarative/qdeclarativeinfo.h> + +QTM_BEGIN_NAMESPACE + +QDeclarativeGeoRouteModel::QDeclarativeGeoRouteModel(QObject *parent) + : QAbstractListModel(parent), + complete_(false), + plugin_(0), + routeQuery_(0), + serviceProvider_(0), + routingManager_(0), + reply_(0), + autoUpdate_(false), + status_(QDeclarativeGeoRouteModel::Null) +{ + // Establish role names so that they can be queried from this model + QHash<int, QByteArray> roleNames; + roleNames = QAbstractItemModel::roleNames(); + roleNames.insert(RouteRole, "path"); + setRoleNames(roleNames); +} + +QDeclarativeGeoRouteModel::~QDeclarativeGeoRouteModel() +{ + if (serviceProvider_) + delete serviceProvider_; + if (!routes_.empty()) { + qDeleteAll(routes_); + routes_.clear(); + } + if (reply_) + delete reply_; +} + +int QDeclarativeGeoRouteModel::count() const +{ + return routes_.count(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteModel::clear() +{ + int oldCount = routes_.count(); + beginResetModel(); + qDeleteAll(routes_); + routes_.clear(); + if (oldCount) { + emit countChanged(); + emit routesChanged(); + } + endResetModel(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteModel::reset() +{ + clear(); + abortRequest(); + setError(""); + setStatus(QDeclarativeGeoRouteModel::Null); +} + +void QDeclarativeGeoRouteModel::abortRequest() +{ + if (reply_) { + reply_->abort(); + reply_->deleteLater(); + reply_ = 0; + } +} + +Q_INVOKABLE QDeclarativeGeoRoute* QDeclarativeGeoRouteModel::get(int index) +{ + if (index < 0 || index >= routes_.count()) { + qmlInfo(this) << tr("Error, too big index in get(): ") << index; + return 0; + } + return routes_.at(index); +} + +void QDeclarativeGeoRouteModel::componentComplete() +{ + complete_ = true; + if (autoUpdate_) { + update(); + } +} + +int QDeclarativeGeoRouteModel::rowCount(const QModelIndex &parent) const +{ + Q_UNUSED(parent) + return routes_.count(); +} + +QVariant QDeclarativeGeoRouteModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid()) { + qmlInfo(this) << tr("Error in indexing route model's data (invalid index)."); + return QVariant(); + } + + if (index.row() >= routes_.count()) { + qmlInfo(this) << tr("Fatal error in indexing route model's data (index overflow)."); + return QVariant(); + } + + if (role == RouteRole) { + QObject* route = routes_.at(index.row()); + return QVariant::fromValue(route); + } + return QVariant(); +} + +void QDeclarativeGeoRouteModel::setPlugin(QDeclarativeGeoServiceProvider *plugin) +{ + if (plugin_ == plugin) + return; + reset(); // reset the model + plugin_ = plugin; + if (complete_) + emit pluginChanged(); + serviceProvider_ = new QGeoServiceProvider(plugin_->name(), + plugin_->parameterMap()); + routingManager_ = serviceProvider_->routingManager(); + if (!routingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { + qmlInfo(this) << tr("Warning: Plugin does not support routing."); + routingManager_ = 0; + return; + } + connect(routingManager_, + SIGNAL(finished(QGeoRouteReply*)), + this, + SLOT(routingFinished(QGeoRouteReply*))); + connect(routingManager_, + SIGNAL(error(QGeoRouteReply*, QGeoRouteReply::Error, QString)), + this, + SLOT(routingError(QGeoRouteReply*, QGeoRouteReply::Error, QString))); +} + +void QDeclarativeGeoRouteModel::queryDetailsChanged() +{ + if (autoUpdate_ && complete_) + update(); +} + +QDeclarativeGeoServiceProvider* QDeclarativeGeoRouteModel::plugin() const +{ + return plugin_; +} + +void QDeclarativeGeoRouteModel::setQuery(QDeclarativeGeoRouteQuery* query) +{ + if (!query || query == routeQuery_) + return; + if (routeQuery_) + routeQuery_->disconnect(this); + routeQuery_ = query; + connect(query, SIGNAL(queryDetailsChanged()), this, SLOT(queryDetailsChanged())); + if (complete_) { + emit queryChanged(); + if (autoUpdate_) + update(); + } +} + +QDeclarativeGeoRouteQuery* QDeclarativeGeoRouteModel::query() const +{ + return routeQuery_; +} + +void QDeclarativeGeoRouteModel::setAutoUpdate(bool autoUpdate) +{ + if (autoUpdate_ == autoUpdate) + return; + autoUpdate_ = autoUpdate; + if (complete_) + emit autoUpdateChanged(); +} + +bool QDeclarativeGeoRouteModel::autoUpdate() const +{ + return autoUpdate_; +} + +void QDeclarativeGeoRouteModel::setStatus(QDeclarativeGeoRouteModel::Status status) +{ + if (status_ == status) + return; + + status_ = status; + + if (complete_) + emit statusChanged(); +} + +QDeclarativeGeoRouteModel::Status QDeclarativeGeoRouteModel::status() const +{ + return status_; +} + +void QDeclarativeGeoRouteModel::setError(const QString &error) +{ + if (error_ == error) + return; + + error_ = error; + + if (complete_) + emit errorChanged(); +} + +QString QDeclarativeGeoRouteModel::error() const +{ + return error_; +} + +void QDeclarativeGeoRouteModel::update() +{ + if (!complete_) + return; + if (!routingManager_) { + qmlInfo(this) << tr("No routing manager available, cannot route."); + return; + } + if (!routeQuery_) { + qmlInfo(this) << tr("Route query not set, cannot route."); + return; + } + abortRequest(); // Clear previus requests + QGeoRouteRequest request = routeQuery_->routeRequest(); + if (request.waypoints().count() < 2) { + qmlInfo(this) << tr("Not enough waypoints for routing."); + return; + } + + setError(""); // clear previous error string + + reply_ = routingManager_->calculateRoute(request); + setStatus(QDeclarativeGeoRouteModel::Loading); + if (reply_->isFinished()) { + if (reply_->error() == QGeoRouteReply::NoError) { + routingFinished(reply_); + } else { + routingError(reply_, reply_->error(), reply_->errorString()); + } + } +} + +void QDeclarativeGeoRouteModel::routingFinished(QGeoRouteReply *reply) +{ + if (reply->error() != QGeoRouteReply::NoError) { + return; + } + beginResetModel(); + int oldCount = routes_.count(); + qDeleteAll(routes_); + // Convert routes to declarative + routes_.clear(); + for (int i = 0; i < reply->routes().size(); ++i) + routes_.append(new QDeclarativeGeoRoute(reply->routes().at(i), this)); + endResetModel(); + + setError(""); + setStatus(QDeclarativeGeoRouteModel::Ready); + + reply->deleteLater(); + reply_ = 0; + + if (oldCount != 0 || routes_.count() != 0) + emit routesChanged(); + if (oldCount != routes_.count()) + emit countChanged(); +} + +void QDeclarativeGeoRouteModel::routingError(QGeoRouteReply *reply, + QGeoRouteReply::Error error, + const QString &errorString) +{ + Q_UNUSED(error) + setError(errorString); + setStatus(QDeclarativeGeoRouteModel::Error); + reply->deleteLater(); + reply_ = 0; +} + +// RouteQuery + +QDeclarativeGeoRouteQuery::QDeclarativeGeoRouteQuery(QObject *parent) + : QObject(parent), + complete_(false) +{ +} + +QDeclarativeGeoRouteQuery::~QDeclarativeGeoRouteQuery() +{ + if (!waypoints_.isEmpty()) + waypoints_.clear(); + if (!exclusions_.isEmpty()) + exclusions_.clear(); +} + +void QDeclarativeGeoRouteQuery::componentComplete() +{ + complete_ = true; +} + +QList<int> QDeclarativeGeoRouteQuery::featureTypes() +{ + QList<int> list; + for (int i = 0; i < request_.featureTypes().count(); i++) { + list.append(request_.featureTypes().at(i)); + } + return list; +} + +void QDeclarativeGeoRouteQuery::setNumberAlternativeRoutes(int numberAlternativeRoutes) +{ + if (numberAlternativeRoutes == request_.numberAlternativeRoutes()) + return; + + request_.setNumberAlternativeRoutes(numberAlternativeRoutes); + + if (complete_) { + emit numberAlternativeRoutesChanged(); + emit queryDetailsChanged(); + } +} + +int QDeclarativeGeoRouteQuery::numberAlternativeRoutes() const +{ + return request_.numberAlternativeRoutes(); +} + +QDeclarativeListProperty<QDeclarativeCoordinate> QDeclarativeGeoRouteQuery::waypoints() +{ + return QDeclarativeListProperty<QDeclarativeCoordinate>(this, + 0, + waypoints_append, + waypoints_count, + waypoints_at, + waypoints_clear); +} + +void QDeclarativeGeoRouteQuery::waypoints_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop, QDeclarativeCoordinate *waypoint) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + model->addWaypoint(waypoint); +} + +int QDeclarativeGeoRouteQuery::waypoints_count(QDeclarativeListProperty<QDeclarativeCoordinate> *prop) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + return model->waypoints_.count(); +} + +QDeclarativeCoordinate* QDeclarativeGeoRouteQuery::waypoints_at(QDeclarativeListProperty<QDeclarativeCoordinate> *prop, int index) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + Q_ASSERT(index < model->waypoints_.count()); + return model->waypoints_.at(index); +} + +void QDeclarativeGeoRouteQuery::waypoints_clear(QDeclarativeListProperty<QDeclarativeCoordinate> *prop) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + model->clearWaypoints(); +} + +QDeclarativeListProperty<QDeclarativeGeoBoundingBox> QDeclarativeGeoRouteQuery::excludedAreas() +{ + return QDeclarativeListProperty<QDeclarativeGeoBoundingBox>(this, + 0, + exclusions_append, + exclusions_count, + exclusions_at, + exclusions_clear); +} + +void QDeclarativeGeoRouteQuery::exclusions_append(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop, QDeclarativeGeoBoundingBox *area) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + model->addExcludedArea(area); +} + +int QDeclarativeGeoRouteQuery::exclusions_count(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + return model->exclusions_.count(); +} + +QDeclarativeGeoBoundingBox* QDeclarativeGeoRouteQuery::exclusions_at(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop, int index) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + Q_ASSERT(index < model->exclusions_.count()); + return model->exclusions_.at(index); +} + +void QDeclarativeGeoRouteQuery::exclusions_clear(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop) +{ + QDeclarativeGeoRouteQuery* model = static_cast<QDeclarativeGeoRouteQuery*>(prop->object); + model->clearExcludedAreas(); +} + + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::addExcludedArea(QDeclarativeGeoBoundingBox* area) +{ + if (!area) + return; + if (!exclusions_.contains(area)) { + connect(area, SIGNAL(bottomLeftChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(bottomRightChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(topLeftChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(topRightChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(centerChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(widthChanged()), this, SIGNAL(queryDetailsChanged())); + connect(area, SIGNAL(heightChanged()), this, SIGNAL(queryDetailsChanged())); + } + exclusions_.append(area); + if (complete_) { + emit excludedAreasChanged(); + emit queryDetailsChanged(); + } +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::removeExcludedArea(QDeclarativeGeoBoundingBox* area) +{ + if (!area) + return; + + int index = exclusions_.lastIndexOf(area); + if (index == -1) { + qmlInfo(this) << tr("Cannot remove nonexistent area."); + return; + } + exclusions_.removeAt(index); + if (!exclusions_.contains(area)) { + area->disconnect(this); + } + emit excludedAreasChanged(); + emit queryDetailsChanged(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::clearExcludedAreas() +{ + if (!exclusions_.count()) + return; + for (int i = 0; i < exclusions_.count(); i++) + exclusions_.at(i)->disconnect(this); + exclusions_.clear(); + emit excludedAreasChanged(); + emit queryDetailsChanged(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::addWaypoint(QDeclarativeCoordinate* waypoint) +{ + if (!waypoint) + return; + if (!waypoints_.contains(waypoint)) { + connect (waypoint, SIGNAL(latitudeChanged(double)), this, SIGNAL(queryDetailsChanged())); + connect (waypoint, SIGNAL(longitudeChanged(double)), this, SIGNAL(queryDetailsChanged())); + connect (waypoint, SIGNAL(altitudeChanged(double)), this, SIGNAL(queryDetailsChanged())); + } + waypoints_.append(waypoint); + if (complete_) { + emit waypointsChanged(); + emit queryDetailsChanged(); + } +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::removeWaypoint(QDeclarativeCoordinate* waypoint) +{ + if (!waypoint) + return; + + int index = waypoints_.lastIndexOf(waypoint); + if (index == -1) { + qmlInfo(this) << tr("Cannot remove nonexistent waypoint."); + return; + } + waypoints_.removeAt(index); + if (!waypoints_.contains(waypoint)) { + waypoint->disconnect(this); + } + emit waypointsChanged(); + emit queryDetailsChanged(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::clearWaypoints() +{ + if (!waypoints_.count()) + return; + for (int i = 0; i < waypoints_.count(); i++) + waypoints_.at(i)->disconnect(this); + waypoints_.clear(); + emit waypointsChanged(); + emit queryDetailsChanged(); +} + +Q_INVOKABLE void QDeclarativeGeoRouteQuery::setFeatureWeight(FeatureType featureType, FeatureWeight featureWeight) +{ + // Check if the weight changes, as we need to signal it + FeatureWeight originalWeight = static_cast<FeatureWeight>(request_.featureWeight(static_cast<QGeoRouteRequest::FeatureType>(featureType))); + if (featureWeight == originalWeight) + return; + + request_.setFeatureWeight(static_cast<QGeoRouteRequest::FeatureType>(featureType), + static_cast<QGeoRouteRequest::FeatureWeight>(featureWeight)); + if (complete_ && ((originalWeight == NeutralFeatureWeight) || (featureWeight == NeutralFeatureWeight))) { + // featureTypes should now give a different list, because the original and new weight + // were not same, and other one was neutral weight + emit featureTypesChanged(); + emit queryDetailsChanged(); + } +} + +Q_INVOKABLE int QDeclarativeGeoRouteQuery::featureWeight(FeatureType featureType) +{ + return request_.featureWeight(static_cast<QGeoRouteRequest::FeatureType>(featureType)); +} + +void QDeclarativeGeoRouteQuery::setTravelModes(QDeclarativeGeoRouteQuery::TravelModes travelModes) +{ + QGeoRouteRequest::TravelModes reqTravelModes; + + if (travelModes & QDeclarativeGeoRouteQuery::CarTravel) + reqTravelModes |= QGeoRouteRequest::CarTravel; + if (travelModes & QDeclarativeGeoRouteQuery::PedestrianTravel) + reqTravelModes |= QGeoRouteRequest::PedestrianTravel; + if (travelModes & QDeclarativeGeoRouteQuery::BicycleTravel) + reqTravelModes |= QGeoRouteRequest::BicycleTravel; + if (travelModes & QDeclarativeGeoRouteQuery::PublicTransitTravel) + reqTravelModes |= QGeoRouteRequest::PublicTransitTravel; + if (travelModes & QDeclarativeGeoRouteQuery::TruckTravel) + reqTravelModes |= QGeoRouteRequest::TruckTravel; + + if (reqTravelModes == request_.travelModes()) + return; + + request_.setTravelModes(reqTravelModes); + + if (complete_) { + emit travelModesChanged(); + emit queryDetailsChanged(); + } +} + +void QDeclarativeGeoRouteQuery::setSegmentDetail(SegmentDetail segmentDetail) +{ + if (static_cast<QGeoRouteRequest::SegmentDetail>(segmentDetail) == request_.segmentDetail()) + return; + request_.setSegmentDetail(static_cast<QGeoRouteRequest::SegmentDetail>(segmentDetail)); + if (complete_) { + emit segmentDetailChanged(); + emit queryDetailsChanged(); + } +} + +QDeclarativeGeoRouteQuery::SegmentDetail QDeclarativeGeoRouteQuery::segmentDetail() const +{ + return static_cast<QDeclarativeGeoRouteQuery::SegmentDetail>(request_.segmentDetail()); +} + +void QDeclarativeGeoRouteQuery::setManeuverDetail(ManeuverDetail maneuverDetail) +{ + if (static_cast<QGeoRouteRequest::ManeuverDetail>(maneuverDetail) == request_.maneuverDetail()) + return; + request_.setManeuverDetail(static_cast<QGeoRouteRequest::ManeuverDetail>(maneuverDetail)); + if (complete_) { + emit maneuverDetailChanged(); + emit queryDetailsChanged(); + } +} + +QDeclarativeGeoRouteQuery::ManeuverDetail QDeclarativeGeoRouteQuery::maneuverDetail() const +{ + return static_cast<QDeclarativeGeoRouteQuery::ManeuverDetail>(request_.maneuverDetail()); +} + +QDeclarativeGeoRouteQuery::TravelModes QDeclarativeGeoRouteQuery::travelModes() const +{ + QGeoRouteRequest::TravelModes reqTravelModes = request_.travelModes(); + QDeclarativeGeoRouteQuery::TravelModes travelModes; + + if (reqTravelModes & QGeoRouteRequest::CarTravel) + travelModes |= QDeclarativeGeoRouteQuery::CarTravel; + if (reqTravelModes & QGeoRouteRequest::PedestrianTravel) + travelModes |= QDeclarativeGeoRouteQuery::PedestrianTravel; + if (reqTravelModes & QGeoRouteRequest::BicycleTravel) + travelModes |= QDeclarativeGeoRouteQuery::BicycleTravel; + if (reqTravelModes & QGeoRouteRequest::PublicTransitTravel) + travelModes |= QDeclarativeGeoRouteQuery::PublicTransitTravel; + if (reqTravelModes & QGeoRouteRequest::TruckTravel) + travelModes |= QDeclarativeGeoRouteQuery::TruckTravel; + + return travelModes; +} + +void QDeclarativeGeoRouteQuery::setRouteOptimizations(QDeclarativeGeoRouteQuery::RouteOptimizations optimization) +{ + QGeoRouteRequest::RouteOptimizations reqOptimizations; + + if (optimization & QDeclarativeGeoRouteQuery::ShortestRoute) + reqOptimizations |= QGeoRouteRequest::ShortestRoute; + if (optimization & QDeclarativeGeoRouteQuery::FastestRoute) + reqOptimizations |= QGeoRouteRequest::FastestRoute; + if (optimization & QDeclarativeGeoRouteQuery::MostEconomicRoute) + reqOptimizations |= QGeoRouteRequest::MostEconomicRoute; + if (optimization & QDeclarativeGeoRouteQuery::MostScenicRoute) + reqOptimizations |= QGeoRouteRequest::MostScenicRoute; + + if (reqOptimizations == request_.routeOptimization()) + return; + + request_.setRouteOptimization(reqOptimizations); + + if (complete_) { + emit routeOptimizationsChanged(); + emit queryDetailsChanged(); + } +} + +QDeclarativeGeoRouteQuery::RouteOptimizations QDeclarativeGeoRouteQuery::routeOptimizations() const +{ + QGeoRouteRequest::RouteOptimizations reqOptimizations = request_.routeOptimization(); + QDeclarativeGeoRouteQuery::RouteOptimizations optimization; + + if (reqOptimizations & QGeoRouteRequest::ShortestRoute) + optimization |= QDeclarativeGeoRouteQuery::ShortestRoute; + if (reqOptimizations & QGeoRouteRequest::FastestRoute) + optimization |= QDeclarativeGeoRouteQuery::FastestRoute; + if (reqOptimizations & QGeoRouteRequest::MostEconomicRoute) + optimization |= QDeclarativeGeoRouteQuery::MostEconomicRoute; + if (reqOptimizations & QGeoRouteRequest::MostScenicRoute) + optimization |= QDeclarativeGeoRouteQuery::MostScenicRoute; + + return optimization; +} + +QGeoRouteRequest& QDeclarativeGeoRouteQuery::routeRequest() +{ + // Bit inefficient, but waypoint and excludearea count is not big + QList<QGeoCoordinate> waypoints; + for (int i = 0; i < waypoints_.count(); i++) + waypoints.append(waypoints_.at(i)->coordinate()); + QList<QGeoBoundingBox> exclusions; + for (int i = 0; i < exclusions_.count(); i++) + exclusions.append(exclusions_.at(i)->box()); + + request_.setWaypoints(waypoints); + request_.setExcludeAreas(exclusions); + return request_; +} + +#include "moc_qdeclarativegeoroutemodel_p.cpp" + +QTM_END_NAMESPACE diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h new file mode 100644 index 00000000..96143f9e --- /dev/null +++ b/src/imports/location/qdeclarativegeoroutemodel_p.h @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the Qt Mobility Components. +** +** $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 +** 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 +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEGEOROUTEMODEL_H +#define QDECLARATIVEGEOROUTEMODEL_H + +#include "qdeclarativegeoserviceprovider_p.h" + +#include "qdeclarativecoordinate_p.h" +#include "qdeclarativegeoboundingbox_p.h" + +#include <qgeorouterequest.h> +#include <qgeoroutereply.h> + +#include <QtDeclarative/qdeclarative.h> +#include <QDeclarativeParserStatus> +#include <QAbstractListModel> + +#include <QObject> + +QTM_BEGIN_NAMESPACE + +class QGeoServiceProvider; +class QGeoRoutingManager; +class QDeclarativeGeoRoute; +class QDeclarativeGeoRouteQuery; + +class QDeclarativeGeoRouteModel : public QAbstractListModel, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_ENUMS(Status) + + Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged) + Q_PROPERTY(QDeclarativeGeoRouteQuery* query READ query WRITE setQuery NOTIFY queryChanged) + Q_PROPERTY(int count READ count NOTIFY countChanged) + Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged) + Q_PROPERTY(Status status READ status NOTIFY statusChanged) + Q_PROPERTY(QString error READ error NOTIFY errorChanged) + Q_INTERFACES(QDeclarativeParserStatus) + +public: + enum Roles { + RouteRole = Qt::UserRole + 500 + }; + + enum Status { + Null, + Ready, + Loading, + Error + }; + + QDeclarativeGeoRouteModel(QObject *parent = 0); + ~QDeclarativeGeoRouteModel(); + + // From QDeclarativeParserStatus + void classBegin() {} + void componentComplete(); + + // From QAbstractListModel + int rowCount(const QModelIndex &parent) const; + QVariant data(const QModelIndex &index, int role) const; + + void setPlugin(QDeclarativeGeoServiceProvider *plugin); + QDeclarativeGeoServiceProvider* plugin() const; + + void setQuery(QDeclarativeGeoRouteQuery* query); + QDeclarativeGeoRouteQuery* query() const; + + void setAutoUpdate(bool autoUpdate); + bool autoUpdate() const; + + Status status() const; + QString error() const; + + int count() const; + Q_INVOKABLE QDeclarativeGeoRoute* get(int index); + Q_INVOKABLE void clear(); + Q_INVOKABLE void reset(); + +Q_SIGNALS: + void countChanged(); + void pluginChanged(); + void queryChanged(); + void autoUpdateChanged(); + void statusChanged(); + void errorChanged(); + void routesChanged(); + +public Q_SLOTS: + void update(); + +private Q_SLOTS: + void routingFinished(QGeoRouteReply *reply); + void routingError(QGeoRouteReply *reply, + QGeoRouteReply::Error error, + const QString &errorString); + void queryDetailsChanged(); + +private: + void setStatus(Status status); + void setError(const QString &error); + void abortRequest(); + + bool complete_; + + QDeclarativeGeoServiceProvider* plugin_; + QDeclarativeGeoRouteQuery* routeQuery_; + QGeoServiceProvider* serviceProvider_; + QGeoRoutingManager* routingManager_; + QGeoRouteReply* reply_; + + QList<QDeclarativeGeoRoute*> routes_; + bool autoUpdate_; + Status status_; + QString error_; +}; + +class QDeclarativeGeoRouteQuery : public QObject, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_ENUMS(TravelMode) + Q_ENUMS(FeatureType) + Q_ENUMS(FeatureWeight) + Q_ENUMS(SegmentDetail) + Q_ENUMS(ManeuverDetail) + Q_ENUMS(RouteOptimization) + Q_FLAGS(RouteOptimizations) + Q_FLAGS(ManeuverDetails) + Q_FLAGS(SegmentDetails) + Q_FLAGS(TravelModes) + + Q_PROPERTY(int numberAlternativeRoutes READ numberAlternativeRoutes WRITE setNumberAlternativeRoutes NOTIFY numberAlternativeRoutesChanged) + Q_PROPERTY(TravelModes travelModes READ travelModes WRITE setTravelModes NOTIFY travelModesChanged) + Q_PROPERTY(RouteOptimizations routeOptimizations READ routeOptimizations WRITE setRouteOptimizations NOTIFY routeOptimizationsChanged) + Q_PROPERTY(SegmentDetail segmentDetail READ segmentDetail WRITE setSegmentDetail NOTIFY segmentDetailChanged) + Q_PROPERTY(ManeuverDetail maneuverDetail READ maneuverDetail WRITE setManeuverDetail NOTIFY maneuverDetailChanged) + Q_PROPERTY(QDeclarativeListProperty<QDeclarativeCoordinate> waypoints READ waypoints NOTIFY waypointsChanged) + Q_PROPERTY(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> excludedAreas READ excludedAreas NOTIFY excludedAreasChanged) + Q_PROPERTY(QList<int> featureTypes READ featureTypes NOTIFY featureTypesChanged) + Q_INTERFACES(QDeclarativeParserStatus) + +public: + + QDeclarativeGeoRouteQuery(QObject *parent = 0); + ~QDeclarativeGeoRouteQuery(); + + // From QDeclarativeParserStatus + void classBegin() {} + void componentComplete(); + + QGeoRouteRequest& routeRequest(); + + enum TravelMode { + CarTravel = QGeoRouteRequest::CarTravel, + PedestrianTravel = QGeoRouteRequest::PedestrianTravel, + BicycleTravel = QGeoRouteRequest::BicycleTravel, + PublicTransitTravel = QGeoRouteRequest::PublicTransitTravel, + TruckTravel = QGeoRouteRequest::TruckTravel + }; + Q_DECLARE_FLAGS(TravelModes, TravelMode) + + enum FeatureType { + NoFeature = QGeoRouteRequest::NoFeature, + TollFeature = QGeoRouteRequest::TollFeature, + HighwayFeature = QGeoRouteRequest::HighwayFeature, + PublicTransitFeature = QGeoRouteRequest::PublicTransitFeature, + FerryFeature = QGeoRouteRequest::FerryFeature, + TunnelFeature = QGeoRouteRequest::TunnelFeature, + DirtRoadFeature = QGeoRouteRequest::DirtRoadFeature, + ParksFeature = QGeoRouteRequest::ParksFeature, + MotorPoolLaneFeature = QGeoRouteRequest::MotorPoolLaneFeature + }; + Q_DECLARE_FLAGS(FeatureTypes, FeatureType) + + enum FeatureWeight { + NeutralFeatureWeight = QGeoRouteRequest::NeutralFeatureWeight, + PreferFeatureWeight = QGeoRouteRequest::PreferFeatureWeight, + RequireFeatureWeight = QGeoRouteRequest::RequireFeatureWeight, + AvoidFeatureWeight = QGeoRouteRequest::AvoidFeatureWeight, + DisallowFeatureWeight = QGeoRouteRequest::DisallowFeatureWeight + }; + Q_DECLARE_FLAGS(FeatureWeights, FeatureWeight) + + enum RouteOptimization { + ShortestRoute = QGeoRouteRequest::ShortestRoute, + FastestRoute = QGeoRouteRequest::FastestRoute, + MostEconomicRoute = QGeoRouteRequest::MostEconomicRoute, + MostScenicRoute = QGeoRouteRequest::MostScenicRoute + }; + Q_DECLARE_FLAGS(RouteOptimizations, RouteOptimization) + + enum SegmentDetail { + NoSegmentData = 0x0000, + BasicSegmentData = 0x0001 + }; + Q_DECLARE_FLAGS(SegmentDetails, SegmentDetail) + + enum ManeuverDetail { + NoManeuvers = 0x0000, + BasicManeuvers = 0x0001 + }; + Q_DECLARE_FLAGS(ManeuverDetails, ManeuverDetail) + + void setNumberAlternativeRoutes(int numberAlternativeRoutes); + int numberAlternativeRoutes() const; + + QList<int> featureTypes(); + + // READ functions for list properties + QDeclarativeListProperty<QDeclarativeCoordinate> waypoints(); + QDeclarativeListProperty<QDeclarativeGeoBoundingBox> excludedAreas(); + + Q_INVOKABLE void addWaypoint(QDeclarativeCoordinate* waypoint); + Q_INVOKABLE void removeWaypoint(QDeclarativeCoordinate* waypoint); + Q_INVOKABLE void clearWaypoints(); + + Q_INVOKABLE void addExcludedArea(QDeclarativeGeoBoundingBox* area); + Q_INVOKABLE void removeExcludedArea(QDeclarativeGeoBoundingBox* area); + Q_INVOKABLE void clearExcludedAreas(); + + Q_INVOKABLE void setFeatureWeight(FeatureType featureType, FeatureWeight featureWeight); + Q_INVOKABLE int featureWeight(FeatureType featureType); + + /* + feature weights + */ + + void setTravelModes(TravelModes travelModes); + TravelModes travelModes() const; + + void setSegmentDetail(SegmentDetail segmentDetail); + SegmentDetail segmentDetail() const; + + void setManeuverDetail(ManeuverDetail maneuverDetail); + ManeuverDetail maneuverDetail() const; + + void setRouteOptimizations(RouteOptimizations optimization); + RouteOptimizations routeOptimizations() const; + +Q_SIGNALS: + void numberAlternativeRoutesChanged(); + void travelModesChanged(); + void routeOptimizationsChanged(); + + void waypointsChanged(); + void excludedAreasChanged(); + + void featureTypesChanged(); + void maneuverDetailChanged(); + void segmentDetailChanged(); + + void queryDetailsChanged(); + +private: + + static void waypoints_append(QDeclarativeListProperty<QDeclarativeCoordinate> *prop, QDeclarativeCoordinate *waypoint); + static int waypoints_count(QDeclarativeListProperty<QDeclarativeCoordinate> *prop); + static QDeclarativeCoordinate* waypoints_at(QDeclarativeListProperty<QDeclarativeCoordinate> *prop, int index); + static void waypoints_clear(QDeclarativeListProperty<QDeclarativeCoordinate> *prop); + + static void exclusions_append(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop, QDeclarativeGeoBoundingBox *area); + static int exclusions_count(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop); + static QDeclarativeGeoBoundingBox* exclusions_at(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop, int index); + static void exclusions_clear(QDeclarativeListProperty<QDeclarativeGeoBoundingBox> *prop); + + QList<QDeclarativeCoordinate*> waypoints_; + QList<QDeclarativeGeoBoundingBox*> exclusions_; + + QGeoRouteRequest request_; + bool complete_; + +}; + +QTM_END_NAMESPACE + +#endif diff --git a/src/imports/location/qdeclarativegeoroutesegment.cpp b/src/imports/location/qdeclarativegeoroutesegment.cpp index e900100b..a88a3239 100644 --- a/src/imports/location/qdeclarativegeoroutesegment.cpp +++ b/src/imports/location/qdeclarativegeoroutesegment.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoroutesegment_p.h b/src/imports/location/qdeclarativegeoroutesegment_p.h index 50e40a22..bbabd654 100644 --- a/src/imports/location/qdeclarativegeoroutesegment_p.h +++ b/src/imports/location/qdeclarativegeoroutesegment_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativegeoserviceprovider.cpp b/src/imports/location/qdeclarativegeoserviceprovider.cpp index 1ef2859e..91abe887 100644 --- a/src/imports/location/qdeclarativegeoserviceprovider.cpp +++ b/src/imports/location/qdeclarativegeoserviceprovider.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -40,6 +40,10 @@ ****************************************************************************/ #include "qdeclarativegeoserviceprovider_p.h" +#include "qgeoserviceprovider.h" +#include "qgeosearchmanager.h" +#include "qgeomappingmanager.h" +#include "qgeoroutingmanager.h" #include <QDebug> @@ -60,7 +64,14 @@ QTM_BEGIN_NAMESPACE */ QDeclarativeGeoServiceProvider::QDeclarativeGeoServiceProvider(QObject *parent) - : QObject(parent) {} + : QObject(parent), + supportsGeocoding_(false), + supportsReverseGeocoding_(false), + supportsRouting_(false), + supportsMapping_(false), + complete_(false) +{ +} QDeclarativeGeoServiceProvider::~QDeclarativeGeoServiceProvider() {} @@ -75,15 +86,137 @@ void QDeclarativeGeoServiceProvider::setName(const QString &name) return; name_ = name; - + if (complete_) + updateSupportStatus(); emit nameChanged(name_); } +void QDeclarativeGeoServiceProvider::updateSupportStatus() +{ + QGeoServiceProvider* serviceProvider = new QGeoServiceProvider(name(), parameterMap()); + if (!serviceProvider || serviceProvider->error() != QGeoServiceProvider::NoError) { + setSupportsGeocoding(false); + setSupportsReverseGeocoding(false); + setSupportsRouting(false); + setSupportsMapping(false); + return; + } + + QGeoSearchManager* searchManager = serviceProvider->searchManager(); + if (!searchManager || serviceProvider->error() != QGeoServiceProvider::NoError) { + setSupportsGeocoding(false); + setSupportsReverseGeocoding(false); + } else { + setSupportsGeocoding(searchManager->supportsGeocoding()); + setSupportsReverseGeocoding(searchManager->supportsReverseGeocoding()); + } + + QGeoRoutingManager* routingManager = serviceProvider->routingManager(); + if (!routingManager || serviceProvider->error() != QGeoServiceProvider::NoError) + setSupportsRouting(false); + else + setSupportsRouting(true); + + QGeoMappingManager* mappingManager = serviceProvider->mappingManager(); + if (!mappingManager || serviceProvider->error() != QGeoServiceProvider::NoError) + setSupportsMapping(false); + else + setSupportsMapping(true); + + delete serviceProvider; +} + +QStringList QDeclarativeGeoServiceProvider::availableServiceProviders() +{ + return QGeoServiceProvider::availableServiceProviders(); +} + +void QDeclarativeGeoServiceProvider::setSupportsGeocoding(bool supports) +{ + if (supports == supportsGeocoding_) + return; + supportsGeocoding_ = supports; + emit supportsGeocodingChanged(); +} + +void QDeclarativeGeoServiceProvider::setSupportsReverseGeocoding(bool supports) +{ + if (supports == supportsReverseGeocoding_) + return; + supportsReverseGeocoding_ = supports; + emit supportsReverseGeocodingChanged(); +} + +void QDeclarativeGeoServiceProvider::setSupportsRouting(bool supports) +{ + if (supports == supportsRouting_) + return; + supportsRouting_ = supports; + emit supportsRoutingChanged(); +} + +void QDeclarativeGeoServiceProvider::setSupportsMapping(bool supports) +{ + if (supports == supportsMapping_) + return; + supportsMapping_ = supports; + emit supportsMappingChanged(); +} + +void QDeclarativeGeoServiceProvider::componentComplete() +{ + complete_ = true; + if (!name_.isEmpty()) + updateSupportStatus(); +} + QString QDeclarativeGeoServiceProvider::name() const { return name_; } + + +/*! + \qmlproperty bool Plugin::supportsGeocoding + + This property holds whether plugin supports geocoding. +*/ +bool QDeclarativeGeoServiceProvider::supportsGeocoding() const +{ + return supportsGeocoding_; +} + +/*! + \qmlproperty bool Plugin::supportsReverseGeocoding + + This property holds whether plugin supports reverse geocoding. +*/ +bool QDeclarativeGeoServiceProvider::supportsReverseGeocoding() const +{ + return supportsReverseGeocoding_; +} + +/*! + \qmlproperty bool Plugin::supportsRouting + + This property holds whether plugin supports routing. +*/ +bool QDeclarativeGeoServiceProvider::supportsRouting() const +{ + return supportsRouting_; +} + +/*! + \qmlproperty bool Plugin::supportsMapping + + This property holds whether plugin supports mapping. +*/ +bool QDeclarativeGeoServiceProvider::supportsMapping() const +{ + return supportsMapping_; +} + /*! \qmlproperty list<PluginParameter> Plugin::parameters \default diff --git a/src/imports/location/qdeclarativegeoserviceprovider_p.h b/src/imports/location/qdeclarativegeoserviceprovider_p.h index 984e729c..d88b3b60 100644 --- a/src/imports/location/qdeclarativegeoserviceprovider_p.h +++ b/src/imports/location/qdeclarativegeoserviceprovider_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -77,38 +77,64 @@ private: QVariant value_; }; -class QDeclarativeGeoServiceProvider : public QObject +class QDeclarativeGeoServiceProvider : public QObject, public QDeclarativeParserStatus { Q_OBJECT - Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + Q_PROPERTY(QStringList availableServiceProviders READ availableServiceProviders CONSTANT) Q_PROPERTY(QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> parameters READ parameters) - + Q_PROPERTY(bool supportsGeocoding READ supportsGeocoding NOTIFY supportsGeocodingChanged) + Q_PROPERTY(bool supportsReverseGeocoding READ supportsReverseGeocoding NOTIFY supportsReverseGeocodingChanged) + Q_PROPERTY(bool supportsRouting READ supportsRouting NOTIFY supportsRoutingChanged) + Q_PROPERTY(bool supportsMapping READ supportsMapping NOTIFY supportsMappingChanged) Q_CLASSINFO("DefaultProperty", "parameters") + Q_INTERFACES(QDeclarativeParserStatus) public: QDeclarativeGeoServiceProvider(QObject *parent = 0); ~QDeclarativeGeoServiceProvider(); + // From QDeclarativeParserStatus + virtual void classBegin() {} + virtual void componentComplete(); + void setName(const QString &name); QString name() const; QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> parameters(); - QMap<QString, QVariant> parameterMap() const; + QStringList availableServiceProviders(); + bool supportsGeocoding() const; + bool supportsReverseGeocoding() const; + bool supportsRouting() const; + bool supportsMapping() const; + Q_SIGNALS: void nameChanged(const QString &name); + void supportsGeocodingChanged(); + void supportsReverseGeocodingChanged(); + void supportsRoutingChanged(); + void supportsMappingChanged(); private: static void parameter_append(QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> *prop, QDeclarativeGeoServiceProviderParameter *mapObject); static int parameter_count(QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> *prop); static QDeclarativeGeoServiceProviderParameter* parameter_at(QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> *prop, int index); static void parameter_clear(QDeclarativeListProperty<QDeclarativeGeoServiceProviderParameter> *prop); + void updateSupportStatus(); + void setSupportsGeocoding(bool supports); + void setSupportsReverseGeocoding(bool supports); + void setSupportsRouting(bool supports); + void setSupportsMapping(bool supports); QString name_; QList<QDeclarativeGeoServiceProviderParameter*> parameters_; - + bool supportsGeocoding_; + bool supportsReverseGeocoding_; + bool supportsRouting_; + bool supportsMapping_; + bool complete_; Q_DISABLE_COPY(QDeclarativeGeoServiceProvider) }; diff --git a/src/imports/location/qdeclarativegraphicsgeomap.cpp b/src/imports/location/qdeclarativegraphicsgeomap.cpp index 3cf8f93f..ed72cc53 100644 --- a/src/imports/location/qdeclarativegraphicsgeomap.cpp +++ b/src/imports/location/qdeclarativegraphicsgeomap.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -143,8 +143,6 @@ QDeclarativeGraphicsGeoMap::~QDeclarativeGraphicsGeoMap() } } -// todo: mixture of mapviews and mapobjects does not preserve the order (z). -// to be addressed when merged with other changes void QDeclarativeGraphicsGeoMap::componentComplete() { componentCompleted_ = true; @@ -218,11 +216,8 @@ void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugi qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again."); return; } - plugin_ = plugin; - emit pluginChanged(plugin_); - serviceProvider_ = new QGeoServiceProvider(plugin_->name(), plugin_->parameterMap()); @@ -232,7 +227,6 @@ void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugi serviceProvider_ = 0; return; } - mappingManager_ = serviceProvider_->mappingManager(); if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) { qWarning() << serviceProvider_->errorString(); @@ -242,7 +236,6 @@ void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugi mappingManager_ = 0; return; } - mapData_ = mappingManager_->createMapData(); mapData_->init(); //mapData_->setParentItem(this); @@ -405,9 +398,6 @@ qreal QDeclarativeGraphicsGeoMap::zoomLevel() const */ void QDeclarativeGraphicsGeoMap::setCenter(QDeclarativeCoordinate *center) { - if (center_ == center) - return; - if (center_) { center_->disconnect(this); } @@ -762,6 +752,7 @@ void QDeclarativeGraphicsGeoMap::mouseMoveEvent(QGraphicsSceneMouseEvent *event) void QDeclarativeGraphicsGeoMap::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { + Q_UNUSED(event); // qWarning() << "hover enter"; } @@ -831,6 +822,7 @@ void QDeclarativeGraphicsGeoMap::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void QDeclarativeGraphicsGeoMap::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { + Q_UNUSED(event); // qWarning() << "hover leave"; } diff --git a/src/imports/location/qdeclarativegraphicsgeomap_p.h b/src/imports/location/qdeclarativegraphicsgeomap_p.h index b75b557e..6b73b15c 100644 --- a/src/imports/location/qdeclarativegraphicsgeomap_p.h +++ b/src/imports/location/qdeclarativegraphicsgeomap_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -43,6 +43,7 @@ #define QDECLARATIVEGRAPHICSGEOMAP_H #include <qgraphicsgeomap.h> +#include <QPointer> #include <QtDeclarative/qdeclarativeitem.h> #include "qdeclarativegeomapobject_p.h" @@ -187,8 +188,9 @@ private: QGeoMapData* mapData_; qreal zoomLevel_; - QDeclarativeCoordinate* center_; - QGeoCoordinate *initialCoordinate; + QPointer<QDeclarativeCoordinate> center_; + + QGeoCoordinate* initialCoordinate; QDeclarativeGraphicsGeoMap::MapType mapType_; QDeclarativeGraphicsGeoMap::ConnectivityMode connectivityMode_; QSizeF size_; diff --git a/src/imports/location/qdeclarativelandmark.cpp b/src/imports/location/qdeclarativelandmark.cpp index d37f99ed..1e1527ba 100644 --- a/src/imports/location/qdeclarativelandmark.cpp +++ b/src/imports/location/qdeclarativelandmark.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmark_p.h b/src/imports/location/qdeclarativelandmark_p.h index 4d9316cd..177a5831 100644 --- a/src/imports/location/qdeclarativelandmark_p.h +++ b/src/imports/location/qdeclarativelandmark_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmarkcategory.cpp b/src/imports/location/qdeclarativelandmarkcategory.cpp index 6e7c78d0..78d480f7 100644 --- a/src/imports/location/qdeclarativelandmarkcategory.cpp +++ b/src/imports/location/qdeclarativelandmarkcategory.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmarkcategory_p.h b/src/imports/location/qdeclarativelandmarkcategory_p.h index 2c6fc156..9d890b46 100644 --- a/src/imports/location/qdeclarativelandmarkcategory_p.h +++ b/src/imports/location/qdeclarativelandmarkcategory_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmarkcategorymodel.cpp b/src/imports/location/qdeclarativelandmarkcategorymodel.cpp index 3d846987..9255cae8 100644 --- a/src/imports/location/qdeclarativelandmarkcategorymodel.cpp +++ b/src/imports/location/qdeclarativelandmarkcategorymodel.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmarkcategorymodel_p.h b/src/imports/location/qdeclarativelandmarkcategorymodel_p.h index 7531bb16..9d21e337 100644 --- a/src/imports/location/qdeclarativelandmarkcategorymodel_p.h +++ b/src/imports/location/qdeclarativelandmarkcategorymodel_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -42,10 +42,10 @@ #ifndef QDECLARATIVELANDMARKCATEGORYMODEL_P_H #define QDECLARATIVELANDMARKCATEGORYMODEL_P_H -#include "qdeclarativelandmark_p.h" -#include "qdeclarativelandmarkmodel_p.h" -#include "qdeclarativelandmarkcategory_p.h" -#include "qdeclarativelandmarkfilters_p.h" +#include <qdeclarativelandmark_p.h> +#include <qdeclarativelandmarkmodel_p.h> +#include <qdeclarativelandmarkcategory_p.h> +#include <qdeclarativelandmarkfilters_p.h> #include <qlandmarkcategory.h> #include <qlandmarkmanager.h> diff --git a/src/imports/location/qdeclarativelandmarkfilters.cpp b/src/imports/location/qdeclarativelandmarkfilters.cpp index a8850ef9..798698b6 100644 --- a/src/imports/location/qdeclarativelandmarkfilters.cpp +++ b/src/imports/location/qdeclarativelandmarkfilters.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativelandmarkfilters_p.h b/src/imports/location/qdeclarativelandmarkfilters_p.h index 4a9368af..bd000ed2 100644 --- a/src/imports/location/qdeclarativelandmarkfilters_p.h +++ b/src/imports/location/qdeclarativelandmarkfilters_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -44,13 +44,13 @@ #include <qlandmarkintersectionfilter.h> #include <qlandmarkproximityfilter.h> -#include "qdeclarativecoordinate_p.h" +#include <qdeclarativecoordinate_p.h> #include <qlandmarkunionfilter.h> #include <qlandmarknamefilter.h> #include <qlandmarkcategoryfilter.h> #include <qlandmarkboxfilter.h> #include <qlandmarkfilter.h> -#include "qdeclarativelandmarkcategory_p.h" +#include <qdeclarativelandmarkcategory_p.h> #include <QtDeclarative/qdeclarative.h> #include <QDeclarativeListProperty> diff --git a/src/imports/location/qdeclarativelandmarkmodel.cpp b/src/imports/location/qdeclarativelandmarkmodel.cpp index 462bbacc..969c0b7a 100644 --- a/src/imports/location/qdeclarativelandmarkmodel.cpp +++ b/src/imports/location/qdeclarativelandmarkmodel.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -347,6 +347,12 @@ void QDeclarativeLandmarkAbstractModel::setSortOrder(QDeclarativeLandmarkAbstrac emit sortOrderChanged(); } +QLandmarkManager* QDeclarativeLandmarkAbstractModel::landmarkManager() +{ + return m_manager; +} + + /*! \qmlclass LandmarkModel QDeclarativeLandmarkModel \brief The LandmarkModel element provides access to landmarks. @@ -410,12 +416,13 @@ int QDeclarativeLandmarkModel::rowCount(const QModelIndex& parent) const // Returns the stored under the given role for the item referred to by the index. QVariant QDeclarativeLandmarkModel::data(const QModelIndex& index, int role) const { - QDeclarativeLandmark *declarativeLandmark = m_declarativeLandmarks.at(index.row()); + //QDeclarativeLandmark *declarativeLandmark = m_declarativeLandmarks.at(index.row()); + QObject *declarativeLandmark = m_declarativeLandmarks.at(index.row()); switch (role) { case Qt::DisplayRole: if (declarativeLandmark) - return declarativeLandmark->landmark().name(); + return (qobject_cast<QDeclarativeLandmark*>(declarativeLandmark))->landmark().name(); case LandmarkRole: if (declarativeLandmark) return QVariant::fromValue(declarativeLandmark); diff --git a/src/imports/location/qdeclarativelandmarkmodel_p.h b/src/imports/location/qdeclarativelandmarkmodel_p.h index 7c7e29d2..86cb24ff 100644 --- a/src/imports/location/qdeclarativelandmarkmodel_p.h +++ b/src/imports/location/qdeclarativelandmarkmodel_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -42,8 +42,8 @@ #ifndef QDECLARATIVELANDMARKMODEL_P_H #define QDECLARATIVELANDMARKMODEL_P_H -#include "qdeclarativelandmark_p.h" -#include "qdeclarativelandmarkfilters_p.h" +#include <qdeclarativelandmark_p.h> +#include <qdeclarativelandmarkfilters_p.h> #include <qlandmark.h> #include <qlandmarkmanager.h> @@ -110,6 +110,8 @@ public: Q_INVOKABLE void setDbFileName(QString fileName); // testing purposes only virtual void startUpdate() = 0; + QLandmarkManager* landmarkManager(); + signals: void sortByChanged(); void sortOrderChanged(); diff --git a/src/imports/location/qdeclarativeposition.cpp b/src/imports/location/qdeclarativeposition.cpp index 9facb2b7..2619be69 100644 --- a/src/imports/location/qdeclarativeposition.cpp +++ b/src/imports/location/qdeclarativeposition.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativeposition_p.h b/src/imports/location/qdeclarativeposition_p.h index 8ae1bf8c..d851af33 100644 --- a/src/imports/location/qdeclarativeposition_p.h +++ b/src/imports/location/qdeclarativeposition_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** @@ -46,7 +46,7 @@ #include <QDateTime> #include <qgeopositioninfosource.h> #include <qgeopositioninfo.h> -#include "qdeclarativecoordinate_p.h" +#include <qdeclarativecoordinate_p.h> #include <QtDeclarative/qdeclarative.h> // Define this to get qDebug messages diff --git a/src/imports/location/qdeclarativepositionsource.cpp b/src/imports/location/qdeclarativepositionsource.cpp index 077dfdf2..86a194b9 100644 --- a/src/imports/location/qdeclarativepositionsource.cpp +++ b/src/imports/location/qdeclarativepositionsource.cpp @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** diff --git a/src/imports/location/qdeclarativepositionsource_p.h b/src/imports/location/qdeclarativepositionsource_p.h index b153f60c..edfe310f 100644 --- a/src/imports/location/qdeclarativepositionsource_p.h +++ b/src/imports/location/qdeclarativepositionsource_p.h @@ -7,29 +7,29 @@ ** This file is part of the Qt Mobility Components. ** ** $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. ** ** ** |