From 5e71363485b3760601544f6365b039ef3b986123 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 19 Jun 2015 12:25:59 +1000 Subject: Remove FIXME which is no longer relevant Gesture handling on rotated maps works as expected. Change-Id: I36dee2f3b933aa9c361694fc74f86868a882fc5d Reviewed-by: Michal Klocek Reviewed-by: Alex Blasche --- src/imports/location/qdeclarativegeomapgesturearea.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qdeclarativegeomapgesturearea.cpp index 2fabd2b3..68178e6d 100644 --- a/src/imports/location/qdeclarativegeomapgesturearea.cpp +++ b/src/imports/location/qdeclarativegeomapgesturearea.cpp @@ -1118,8 +1118,6 @@ bool QDeclarativeGeoMapGestureArea::tryStartFlick() /*! \internal */ -// FIXME: -// - not left right / up down flicking, so if map is rotated, will act unintuitively void QDeclarativeGeoMapGestureArea::startFlick(int dx, int dy, int timeMs) { if (timeMs < 0) -- cgit v1.2.1 From a990d458f752aedb8b91aeafb4a62bb7c8ed4c50 Mon Sep 17 00:00:00 2001 From: Michal Klocek Date: Fri, 10 Jul 2015 13:55:17 +0200 Subject: Update places-list and places-map examples Change position used in examples to Oslo. Update marker icons to be the same as in mapviewer example. Update screenshots, so they contain osm map. Add marker icon to places_list, so it does not look so boring. Add places title to places_map, so it is more readable. Change-Id: Ia321aa8577e77f76468c504cd4e6ce877712089c Reviewed-by: Alex Blasche --- examples/location/places_list/Marker.qml | 59 +++++++++++++++++++++ examples/location/places_list/marker.png | Bin 0 -> 1051 bytes examples/location/places_list/places_list.pro | 2 +- examples/location/places_list/places_list.qml | 19 ++++--- examples/location/places_list/places_list.qrc | 7 +++ examples/location/places_list/resources.qrc | 5 -- examples/location/places_map/marker.png | Bin 2341 -> 1051 bytes examples/location/places_map/places_map.pro | 2 +- examples/location/places_map/places_map.qml | 22 ++++---- examples/location/places_map/places_map.qrc | 6 +++ .../location/places_map/places_map_resource.qrc | 6 --- src/location/doc/images/places-list.png | Bin 28215 -> 18195 bytes src/location/doc/images/places-map.png | Bin 0 -> 167995 bytes src/location/doc/src/examples/places-map.qdoc | 2 +- src/location/doc/src/places.qdoc | 2 +- 15 files changed, 98 insertions(+), 34 deletions(-) create mode 100644 examples/location/places_list/Marker.qml create mode 100644 examples/location/places_list/marker.png create mode 100644 examples/location/places_list/places_list.qrc delete mode 100644 examples/location/places_list/resources.qrc create mode 100644 examples/location/places_map/places_map.qrc delete mode 100644 examples/location/places_map/places_map_resource.qrc create mode 100644 src/location/doc/images/places-map.png diff --git a/examples/location/places_list/Marker.qml b/examples/location/places_list/Marker.qml new file mode 100644 index 00000000..7b73cde9 --- /dev/null +++ b/examples/location/places_list/Marker.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + width: image.width + Image { + id: image + anchors.centerIn: parent + source: "marker.png" + Text{ + y: parent.height/10 + width: parent.width + color: "white" + font.bold: true + font.pixelSize: 14 + horizontalAlignment: Text.AlignHCenter + text: index + } + } +} diff --git a/examples/location/places_list/marker.png b/examples/location/places_list/marker.png new file mode 100644 index 00000000..d5c698d1 Binary files /dev/null and b/examples/location/places_list/marker.png differ diff --git a/examples/location/places_list/places_list.pro b/examples/location/places_list/places_list.pro index b120f4aa..82aa4337 100644 --- a/examples/location/places_list/places_list.pro +++ b/examples/location/places_list/places_list.pro @@ -5,7 +5,7 @@ QT += quick qml network positioning location SOURCES = main.cpp RESOURCES += \ - resources.qrc + places_list.qrc target.path = $$[QT_INSTALL_EXAMPLES]/location/places_list INSTALLS += target diff --git a/examples/location/places_list/places_list.qml b/examples/location/places_list/places_list.qml index a15914e9..791d0aaf 100644 --- a/examples/location/places_list/places_list.qml +++ b/examples/location/places_list/places_list.qml @@ -40,14 +40,14 @@ //! [Imports] import QtQuick 2.0 -import QtPositioning 5.2 -import QtLocation 5.3 +import QtPositioning 5.5 +import QtLocation 5.5 //! [Imports] Rectangle { width: 360 - height: 360 - property variant startCoordinate: QtPositioning.coordinate(-27.46778, 153.02778) + height: 640 + property variant startCoordinate: QtPositioning.coordinate( 59.9485, 10.7686) // The Qt Company in Oslo //! [Initialize Plugin] Plugin { @@ -79,12 +79,15 @@ Rectangle { anchors.fill: parent model: searchModel delegate: Component { - Column { - Text { text: title } - Text { text: place.location.address.text } + Row { + spacing: 5 + Marker { height: parent.height } + Column { + Text { text: title; font.bold: true } + Text { text: place.location.address.text } + } } } - spacing: 10 } //! [Places ListView] diff --git a/examples/location/places_list/places_list.qrc b/examples/location/places_list/places_list.qrc new file mode 100644 index 00000000..19a0ff59 --- /dev/null +++ b/examples/location/places_list/places_list.qrc @@ -0,0 +1,7 @@ + + + marker.png + places_list.qml + Marker.qml + + diff --git a/examples/location/places_list/resources.qrc b/examples/location/places_list/resources.qrc deleted file mode 100644 index 4cc332e2..00000000 --- a/examples/location/places_list/resources.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - places_list.qml - - diff --git a/examples/location/places_map/marker.png b/examples/location/places_map/marker.png index 86ec960e..d5c698d1 100644 Binary files a/examples/location/places_map/marker.png and b/examples/location/places_map/marker.png differ diff --git a/examples/location/places_map/places_map.pro b/examples/location/places_map/places_map.pro index 140ddf44..51d61bbc 100644 --- a/examples/location/places_map/places_map.pro +++ b/examples/location/places_map/places_map.pro @@ -5,7 +5,7 @@ QT += quick qml network positioning location SOURCES = main.cpp RESOURCES += \ - places_map_resource.qrc + places_map.qrc target.path = $$[QT_INSTALL_EXAMPLES]/location/places_map INSTALLS += target diff --git a/examples/location/places_map/places_map.qml b/examples/location/places_map/places_map.qml index d59ac642..7ff3706a 100644 --- a/examples/location/places_map/places_map.qml +++ b/examples/location/places_map/places_map.qml @@ -40,13 +40,13 @@ //! [Imports] import QtQuick 2.0 -import QtPositioning 5.2 -import QtLocation 5.3 +import QtPositioning 5.5 +import QtLocation 5.5 //! [Imports] Rectangle { width: 360 - height: 360 + height: 640 //! [Initialize Plugin] Plugin { @@ -62,7 +62,7 @@ Rectangle { //! [Current Location] PositionSource { id: positionSource - property variant lastSearchPosition: locationBrisbane + property variant lastSearchPosition: locationOslo active: true updateInterval: 120000 // 2 mins onPositionChanged: { @@ -80,15 +80,15 @@ Rectangle { //! [Current Location] //! [PlaceSearchModel] - property variant locationBrisbane: QtPositioning.coordinate(-27.47, 153.025) + property variant locationOslo: QtPositioning.coordinate( 59.93, 10.76) + PlaceSearchModel { id: searchModel plugin: myPlugin searchTerm: "Pizza" - //initially show Brisbane - searchArea: QtPositioning.circle(locationBrisbane) + searchArea: QtPositioning.circle(locationOslo) Component.onCompleted: update() } @@ -99,7 +99,7 @@ Rectangle { id: map anchors.fill: parent plugin: myPlugin; - center: locationBrisbane + center: locationOslo zoomLevel: 13 MapItemView { @@ -110,9 +110,9 @@ Rectangle { anchorPoint.x: image.width * 0.5 anchorPoint.y: image.height - sourceItem: Image { - id: image - source: "marker.png" + sourceItem: Column { + Image { id: image; source: "marker.png" } + Text { text: title; font.bold: true } } } } diff --git a/examples/location/places_map/places_map.qrc b/examples/location/places_map/places_map.qrc new file mode 100644 index 00000000..22395296 --- /dev/null +++ b/examples/location/places_map/places_map.qrc @@ -0,0 +1,6 @@ + + + marker.png + places_map.qml + + diff --git a/examples/location/places_map/places_map_resource.qrc b/examples/location/places_map/places_map_resource.qrc deleted file mode 100644 index 22395296..00000000 --- a/examples/location/places_map/places_map_resource.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - marker.png - places_map.qml - - diff --git a/src/location/doc/images/places-list.png b/src/location/doc/images/places-list.png index 02416e53..bf09a031 100644 Binary files a/src/location/doc/images/places-list.png and b/src/location/doc/images/places-list.png differ diff --git a/src/location/doc/images/places-map.png b/src/location/doc/images/places-map.png new file mode 100644 index 00000000..4982df23 Binary files /dev/null and b/src/location/doc/images/places-map.png differ diff --git a/src/location/doc/src/examples/places-map.qdoc b/src/location/doc/src/examples/places-map.qdoc index 7796c8ba..6e58bfb8 100644 --- a/src/location/doc/src/examples/places-map.qdoc +++ b/src/location/doc/src/examples/places-map.qdoc @@ -32,7 +32,7 @@ \brief The Places Map example demonstrates how to search for and display a list of places on a map using a MapItemView - \image places-map.jpg + \image places-map.png The example displays a map of the current location or, if no position is available, it uses Brisbane/Australia. Subsequently a search for places diff --git a/src/location/doc/src/places.qdoc b/src/location/doc/src/places.qdoc index 4de65220..291af614 100644 --- a/src/location/doc/src/places.qdoc +++ b/src/location/doc/src/places.qdoc @@ -155,7 +155,7 @@ \li \snippet places_map/places_map.qml Places MapItemView \li - \inlineimage places-map.jpg + \inlineimage places-map.png \endtable \note For simplicty's sake we have assumed that every search result is of -- cgit v1.2.1 From 3807b83c62b595727a3e5caea907616fe5899909 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 14 Jul 2015 11:10:55 +0200 Subject: Fix OSM parameters The documentation states the plugin uses "osm" as parameter name prefix. These cases where forgotten when this naming convention was introduced. Change-Id: I7a3735e04db7b55b8b3d4d6bf84002d63dbcfea9 Task-number: QTBUG-47188 Reviewed-by: Harald Meyer Reviewed-by: Michal Klocek Reviewed-by: Alex Blasche --- src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp | 2 +- src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp index 4ddc8a79..757b9577 100644 --- a/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qgeocodingmanagerengineosm.cpp @@ -75,7 +75,7 @@ QGeoCodingManagerEngineOsm::QGeoCodingManagerEngineOsm(const QVariantMap ¶me m_userAgent = "Qt Location based application"; if (parameters.contains(QStringLiteral("osm.geocoding.host"))) - m_urlPrefix = parameters.value(QStringLiteral("geocoding.host")).toString().toLatin1(); + m_urlPrefix = parameters.value(QStringLiteral("osm.geocoding.host")).toString().toLatin1(); else m_urlPrefix = QStringLiteral("http://nominatim.openstreetmap.org"); diff --git a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp index ab582434..df3351c2 100644 --- a/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qgeoroutingmanagerengineosm.cpp @@ -43,13 +43,13 @@ QGeoRoutingManagerEngineOsm::QGeoRoutingManagerEngineOsm(const QVariantMap ¶ QString *errorString) : QGeoRoutingManagerEngine(parameters), m_networkManager(new QNetworkAccessManager(this)) { - if (parameters.contains(QStringLiteral("useragent"))) - m_userAgent = parameters.value(QStringLiteral("useragent")).toString().toLatin1(); + if (parameters.contains(QStringLiteral("osm.useragent"))) + m_userAgent = parameters.value(QStringLiteral("osm.useragent")).toString().toLatin1(); else m_userAgent = "Qt Location based application"; - if (parameters.contains(QStringLiteral("routing.host"))) - m_urlPrefix = parameters.value(QStringLiteral("routing.host")).toString().toLatin1(); + if (parameters.contains(QStringLiteral("osm.routing.host"))) + m_urlPrefix = parameters.value(QStringLiteral("osm.routing.host")).toString().toLatin1(); else m_urlPrefix = QStringLiteral("http://router.project-osrm.org/viaroute"); -- cgit v1.2.1 From 5b66377db126b4a8a3d4bcf28b812d54b45b461a Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 14 Jul 2015 12:03:14 +0200 Subject: Add missing url parameter for OSM places search. Fixes a few minor grammar/spelling issues in related documentation too. Change-Id: I21c153596b02931c66a38f7068173c687cbe0ad9 Task-number: QTBUG-47188 Reviewed-by: Michal Klocek Reviewed-by: Alex Blasche --- src/location/doc/src/plugins/osm.qdoc | 15 +++++++++++---- src/plugins/geoservices/osm/qplacemanagerengineosm.cpp | 7 ++++++- src/plugins/geoservices/osm/qplacemanagerengineosm.h | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc index d5b23437..f6de9c20 100644 --- a/src/location/doc/src/plugins/osm.qdoc +++ b/src/location/doc/src/plugins/osm.qdoc @@ -72,13 +72,20 @@ a prefix. \row \li osm.routing.host \li Url string set when making network requests to the routing server. This parameter should be set to a - valid server url with the correct osrm api. If not specified the default \l {http://router.project-osrm.org/viaroute}{url} will be used. - \note The api documentation and sources are available at \l {http://project-osrm.org/}{Project OSRM}. + valid server url with the correct osrm API. If not specified the default \l {http://router.project-osrm.org/viaroute}{url} will be used. + \note The API documentation and sources are available at \l {http://project-osrm.org/}{Project OSRM}. \row \li osm.geocoding.host \li Url string set when making network requests to the geocoding server. This parameter should be set to a - valid server url with the correct osm api. If not specified the default \l {http://nominatim.openstreetmap.org/}{url} will be used. - \note The api documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. + valid server url with the correct osm API. If not specified the default \l {http://nominatim.openstreetmap.org/}{url} will be used. + \note The API documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. +\row + \li osm.places.host + \li Url string set when making network requests to the places server. + This parameter should be set to a valid server url with the correct osm API. + If not specified the default \l {http://nominatim.openstreetmap.org/search}{url} + will be used. + \note The API documentation is available at \l {https://wiki.openstreetmap.org/wiki/Nominatim}{Project OSM Nominatim}. \endtable \section1 Parameter Usage Example diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp index 2ae5bd7e..ed2c9ff0 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.cpp @@ -97,6 +97,11 @@ QPlaceManagerEngineOsm::QPlaceManagerEngineOsm(const QVariantMap ¶meters, else m_userAgent = "Qt Location based application"; + if (parameters.contains(QStringLiteral("osm.places.host"))) + m_urlPrefix = parameters.value(QStringLiteral("osm.places.host")).toString(); + else + m_urlPrefix = QStringLiteral("http://nominatim.openstreetmap.org/search"); + *error = QGeoServiceProvider::NoError; errorString->clear(); } @@ -175,7 +180,7 @@ QPlaceSearchReply *QPlaceManagerEngineOsm::search(const QPlaceSearchRequest &req queryItems.addQueryItem(QStringLiteral("addressdetails"), QStringLiteral("1")); - QUrl requestUrl(QStringLiteral("http://nominatim.openstreetmap.org/search?")); + QUrl requestUrl(m_urlPrefix); requestUrl.setQuery(queryItems); QNetworkReply *networkReply = m_networkManager->get(QNetworkRequest(requestUrl)); diff --git a/src/plugins/geoservices/osm/qplacemanagerengineosm.h b/src/plugins/geoservices/osm/qplacemanagerengineosm.h index 9a15b493..828d7bf1 100644 --- a/src/plugins/geoservices/osm/qplacemanagerengineosm.h +++ b/src/plugins/geoservices/osm/qplacemanagerengineosm.h @@ -75,6 +75,7 @@ private: QNetworkAccessManager *m_networkManager; QByteArray m_userAgent; + QString m_urlPrefix; QList m_locales; QNetworkReply *m_categoriesReply; -- cgit v1.2.1 From 30cc8de09c39717adbc2bf7a298e5bb9e0ad9893 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 21 Jul 2015 12:30:43 +0200 Subject: OSM supports up to zoom level 19 Change-Id: I803716afdd7ca9c2693c6236f5e741174d58a3f6 Task-number: QTBUG-47322 Reviewed-by: Michal Klocek Reviewed-by: Harald Meyer Reviewed-by: Alex Blasche --- src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp index d89de0b0..3671051d 100644 --- a/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp +++ b/src/plugins/geoservices/osm/qgeotiledmappingmanagerengineosm.cpp @@ -46,7 +46,7 @@ QGeoTiledMappingManagerEngineOsm::QGeoTiledMappingManagerEngineOsm(const QVarian { QGeoCameraCapabilities cameraCaps; cameraCaps.setMinimumZoomLevel(0.0); - cameraCaps.setMaximumZoomLevel(18.0); + cameraCaps.setMaximumZoomLevel(19.0); setCameraCapabilities(cameraCaps); setTileSize(QSize(256, 256)); -- cgit v1.2.1 From c1a116304c54ee595177be0c395cc4af252a9f96 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 24 Jul 2015 13:41:10 +0200 Subject: Make geoclue plugin compile on gcc4.5 Change-Id: Ic95affaf6952877b567b55a5ce6c385acd405736 Task-number: QTBUG-47427 Reviewed-by: Kai Koehne --- src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp index 53c2a903..fe5b048e 100644 --- a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp +++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp @@ -285,7 +285,7 @@ void QGeoPositionInfoSourceGeoclueMaster::setOptions() const QVariant v = i.value(); GValue *value = new GValue; - *value = { 0, { { 0 } } }; + memset(value, 0, sizeof(*value)); switch (v.userType()) { case QMetaType::QString: -- cgit v1.2.1 From c9aa79515380f59ff33d6f5fda45ea9da4ec7be0 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Fri, 26 Jun 2015 16:42:37 +1000 Subject: Fix issue where tiles are prefetched using both prefetch styles Before being made run-time selectable the only a single prefetch style was used. Restore the same behavior by adding a break to the switch statement. Change-Id: Id16a4b11709497df1511b2605c0a9b5837590b3a Reviewed-by: Alex Blasche Reviewed-by: Michal Klocek --- src/location/maps/qgeocameratiles.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp index 33c140ee..abce5c3e 100644 --- a/src/location/maps/qgeocameratiles.cpp +++ b/src/location/maps/qgeocameratiles.cpp @@ -152,6 +152,7 @@ QSet QGeoCameraTiles::prefetchTiles(PrefetchStle style) double neighbourScale = (1.0 + zoomFraction)/2.0; d_ptr->updateGeometry(PREFETCH_FRUSTUM_SCALE * neighbourScale); } + break; } case PrefetchTwoNeighbourLayers: { -- cgit v1.2.1 From d1c91515ef0ad4208c41a4052f92bfb817333aca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 7 Jul 2015 17:35:11 -0700 Subject: Add the GPLv3 license text LGPLv3 refers to it but does not include it in its body. Change-Id: Ib056b47dde3341ef9a52ffff13eed18cf3504738 Reviewed-by: Lars Knoll --- LICENSE.GPLv3 | 686 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE.LGPLv3 | 2 + 2 files changed, 688 insertions(+) create mode 100644 LICENSE.GPLv3 diff --git a/LICENSE.GPLv3 b/LICENSE.GPLv3 new file mode 100644 index 00000000..4e49b122 --- /dev/null +++ b/LICENSE.GPLv3 @@ -0,0 +1,686 @@ + GNU GENERAL PUBLIC LICENSE + + The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd. + Contact: http://www.qt.io/licensing/ + + You may use, distribute and copy the Qt GUI Toolkit under the terms of + GNU Lesser General Public License version 3. That license references + the General Public License version 3, that is displayed below. Other + portions of the Qt Toolkit may be licensed directly under this license. + +------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE.LGPLv3 b/LICENSE.LGPLv3 index 8fbb7439..4d67bac0 100644 --- a/LICENSE.LGPLv3 +++ b/LICENSE.LGPLv3 @@ -5,6 +5,8 @@ You may use, distribute and copy the Qt GUI Toolkit under the terms of GNU Lesser General Public License version 3, which is displayed below. + This license makes reference to the version 3 of the GNU General + Public License, which you can find in the LICENSE.GPLv3 file. ------------------------------------------------------------------------- -- cgit v1.2.1 From e9ccb51aabad92f0d4630f4a918c27db06a45b71 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Fri, 21 Aug 2015 11:34:15 +0200 Subject: Fix routing test for OSX OSX test machines seem to have trouble with correct timer invocations. This patch makes the failing code point less reliant on timeing issues. Change-Id: If70d3c763336a5993fc75ecb66db6fbcf20453a6 Reviewed-by: Ulf Hermann --- tests/auto/declarative_core/tst_routing.qml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/tests/auto/declarative_core/tst_routing.qml b/tests/auto/declarative_core/tst_routing.qml index fc936f32..96a4a10f 100644 --- a/tests/auto/declarative_core/tst_routing.qml +++ b/tests/auto/declarative_core/tst_routing.qml @@ -750,23 +750,20 @@ Item { // Autoupdate automaticRoutesSpy.clear(); filledRouteQuery.numberAlternativeRoutes = 1 // 'altroutes - 70' is the echoed errorcode - wait (300) - compare(automaticRoutesSpy.count, 1); + tryCompare (automaticRoutesSpy, "count", 1) // 5 sec compare(routeModelAutomatic.count, 1) // There should be a route already compare (routeModelAutomatic.get(0).path.length, 5) compare (routeModelAutomatic.get(0).path[0].latitude, filledRouteQuery.waypoints[0].latitude) // Remove a waypoint and check that autoupdate works filledRouteQuery.removeWaypoint(fcoordinate2) - wait(300) - compare(automaticRoutesSpy.count, 2); + tryCompare (automaticRoutesSpy, "count", 2) compare (routeModelAutomatic.get(0).path.length, 4) compare (routeModelAutomatic.get(0).path[0].latitude, fcoordinate1.latitude) // Add a waypoint and check that autoupdate works filledRouteQuery.addWaypoint(fcoordinate2); - wait(300); - compare(automaticRoutesSpy.count, 3); + tryCompare (automaticRoutesSpy, "count", 3) compare(routeModelAutomatic.count, 1); compare(routeModelAutomatic.get(0).path.length, 5); compare(routeModelAutomatic.get(0).path[0].latitude, filledRouteQuery.waypoints[0].latitude); @@ -779,15 +776,13 @@ Item { { latitude: 65, longitude: 66 }, { latitude: 67, longitude: 68 } ]; - wait(300) - compare(automaticRoutesSpy.count, 4); + tryCompare (automaticRoutesSpy, "count", 4) compare(routeModelAutomatic.get(0).path[0].latitude, fcoordinate1.latitude + 1) // new value should be echoed // Change query routeModelAutomatic.query = filledRouteQuery2 filledRouteQuery2.numberAlternativeRoutes = 3 - wait(300) - compare(automaticRoutesSpy.count, 5); + tryCompare (automaticRoutesSpy, "count", 5) compare (routeModelAutomatic.get(0).path.length, 3) // Verify that the old query is disconnected internally ie. does not trigger update @@ -798,8 +793,8 @@ Item { { latitude: 65, longitude: 66 }, { latitude: 67, longitude: 68 } ]; - wait(300) - compare(automaticRoutesSpy.count, 5); + wait(800) // wait to hope no further updates comes through + compare (automaticRoutesSpy.count, 5) compare(routeModelAutomatic.get(0).path.length, 3); } -- cgit v1.2.1 From 4f7c4056c8c614f8e38eb6b8fe5fbf4b6e2098ed Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 25 Aug 2015 13:59:18 +0200 Subject: Update QML types file for QtPositioning 5.6 The class implementing the animation has changed but the API offering is the same. Change-Id: I950fea89dc67b60123727d4848488f7fc24374cd Reviewed-by: Harald Meyer Reviewed-by: Kai Koehne --- src/imports/positioning/plugins.qmltypes | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/imports/positioning/plugins.qmltypes b/src/imports/positioning/plugins.qmltypes index 853c55cb..a47aa277 100644 --- a/src/imports/positioning/plugins.qmltypes +++ b/src/imports/positioning/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtPositioning 5.5' +// 'qmlplugindump -nonrelocatable QtPositioning 5.6' Module { dependencies: [] @@ -89,14 +89,6 @@ Module { Property { name: "postalCode"; type: "string" } Property { name: "isTextGenerated"; type: "bool"; isReadonly: true } } - Component { - name: "QDeclarativeGeoCoordinateAnimation" - prototype: "QQuickPropertyAnimation" - exports: ["QtPositioning/CoordinateAnimation 5.3"] - exportMetaObjectRevisions: [0] - Property { name: "from"; type: "QGeoCoordinate" } - Property { name: "to"; type: "QGeoCoordinate" } - } Component { name: "QDeclarativeGeoLocation" prototype: "QObject" @@ -114,7 +106,7 @@ Module { "QtPositioning/Position 5.0", "QtPositioning/Position 5.3", "QtPositioning/Position 5.4", - "QtPositioning/Position 5.5" + "QtPositioning/Position 5.6" ] exportMetaObjectRevisions: [0, 1, 2, 2] Property { name: "latitudeValid"; type: "bool"; isReadonly: true } @@ -250,6 +242,23 @@ Module { Method { name: "stop" } Method { name: "complete" } } + Component { + name: "QQuickGeoCoordinateAnimation" + prototype: "QQuickPropertyAnimation" + exports: ["QtPositioning/CoordinateAnimation 5.3"] + exportMetaObjectRevisions: [0] + Enum { + name: "Direction" + values: { + "Shortest": 0, + "West": 1, + "East": 2 + } + } + Property { name: "from"; type: "QGeoCoordinate" } + Property { name: "to"; type: "QGeoCoordinate" } + Property { name: "direction"; type: "Direction" } + } Component { name: "QQuickPropertyAnimation" prototype: "QQuickAbstractAnimation" -- cgit v1.2.1 From 865d8e7f40da40cb31df127223d0f32d2926a9a8 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 25 Aug 2015 14:21:50 +0200 Subject: Update qmltypes file for QtLocation 5.6 The MapGestureArea changed its implementation class but otherwise remained unchanged from an API perspective. Change-Id: Ia37e572dcdbea2765a1e9881981132be98770c20 Reviewed-by: Harald Meyer Reviewed-by: Kai Koehne --- src/imports/location/plugins.qmltypes | 140 +++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 60 deletions(-) diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes index 5b2a72ea..3871feaa 100644 --- a/src/imports/location/plugins.qmltypes +++ b/src/imports/location/plugins.qmltypes @@ -4,7 +4,7 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable QtLocation 5.5' +// 'qmlplugindump -nonrelocatable QtLocation 5.6' Module { dependencies: [] @@ -392,12 +392,7 @@ Module { prototype: "QQuickItem" exports: ["QtLocation/Map 5.0"] exportMetaObjectRevisions: [0] - Property { - name: "gesture" - type: "QDeclarativeGeoMapGestureArea" - isReadonly: true - isPointer: true - } + Property { name: "gesture"; type: "QQuickGeoMapGestureArea"; isReadonly: true; isPointer: true } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } Property { name: "minimumZoomLevel"; type: "double" } Property { name: "maximumZoomLevel"; type: "double" } @@ -439,11 +434,23 @@ Module { Parameter { name: "item"; type: "QDeclarativeGeoMapItemBase"; isPointer: true } } Method { name: "clearMapItems" } + Method { + name: "toCoordinate" + type: "QGeoCoordinate" + Parameter { name: "position"; type: "QPointF" } + Parameter { name: "clipToViewPort"; type: "bool" } + } Method { name: "toCoordinate" type: "QGeoCoordinate" Parameter { name: "position"; type: "QPointF" } } + Method { + name: "fromCoordinate" + type: "QPointF" + Parameter { name: "coordinate"; type: "QGeoCoordinate" } + Parameter { name: "clipToViewPort"; type: "bool" } + } Method { name: "fromCoordinate" type: "QPointF" @@ -466,57 +473,6 @@ Module { } Method { name: "prefetchData" } } - Component { - name: "QDeclarativeGeoMapGestureArea" - prototype: "QObject" - exports: ["QtLocation/MapGestureArea 5.0"] - isCreatable: false - exportMetaObjectRevisions: [0] - Enum { - name: "ActiveGesture" - values: { - "NoGesture": 0, - "ZoomGesture": 1, - "PanGesture": 2, - "FlickGesture": 4 - } - } - Enum { - name: "ActiveGestures" - values: { - "NoGesture": 0, - "ZoomGesture": 1, - "PanGesture": 2, - "FlickGesture": 4 - } - } - Property { name: "enabled"; type: "bool" } - Property { name: "pinchEnabled"; type: "bool" } - Property { name: "panEnabled"; type: "bool" } - Property { name: "isPinchActive"; type: "bool"; isReadonly: true } - Property { name: "isPanActive"; type: "bool"; isReadonly: true } - Property { name: "activeGestures"; type: "ActiveGestures" } - Property { name: "maximumZoomLevelChange"; type: "double" } - Property { name: "flickDeceleration"; type: "double" } - Signal { name: "panActiveChanged" } - Signal { name: "pinchActiveChanged" } - Signal { - name: "pinchStarted" - Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } - } - Signal { - name: "pinchUpdated" - Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } - } - Signal { - name: "pinchFinished" - Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } - } - Signal { name: "panStarted" } - Signal { name: "panFinished" } - Signal { name: "flickStarted" } - Signal { name: "flickFinished" } - } Component { name: "QDeclarativeGeoMapItemBase" defaultProperty: "data" @@ -620,7 +576,11 @@ Module { "CommunicationError": 2, "ParseError": 3, "UnsupportedOptionError": 4, - "UnknownError": 5 + "UnknownError": 5, + "NotSupportedError": 101, + "UnknownParameterError": 102, + "MissingRequiredParameterError": 103, + "ConnectionError": 104 } } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } @@ -1023,7 +983,11 @@ Module { "ParseError": 3, "UnsupportedOptionError": 4, "CombinationError": 5, - "UnknownError": 6 + "UnknownError": 6, + "NotSupportedError": 101, + "UnknownParameterError": 102, + "MissingRequiredParameterError": 103, + "ConnectionError": 104 } } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } @@ -1425,6 +1389,62 @@ Module { } Method { name: "keys"; type: "QStringList" } } + Component { + name: "QQuickGeoMapGestureArea" + defaultProperty: "data" + prototype: "QQuickItem" + exports: [ + "QtLocation/MapGestureArea 5.0", + "QtLocation/MapGestureArea 5.6" + ] + isCreatable: false + exportMetaObjectRevisions: [0, 1] + Enum { + name: "ActiveGesture" + values: { + "NoGesture": 0, + "ZoomGesture": 1, + "PanGesture": 2, + "FlickGesture": 4 + } + } + Enum { + name: "ActiveGestures" + values: { + "NoGesture": 0, + "ZoomGesture": 1, + "PanGesture": 2, + "FlickGesture": 4 + } + } + Property { name: "enabled"; type: "bool" } + Property { name: "pinchEnabled"; type: "bool" } + Property { name: "panEnabled"; type: "bool" } + Property { name: "isPinchActive"; type: "bool"; isReadonly: true } + Property { name: "isPanActive"; type: "bool"; isReadonly: true } + Property { name: "activeGestures"; type: "ActiveGestures" } + Property { name: "maximumZoomLevelChange"; type: "double" } + Property { name: "flickDeceleration"; type: "double" } + Property { name: "preventStealing"; revision: 1; type: "bool" } + Signal { name: "panActiveChanged" } + Signal { name: "pinchActiveChanged" } + Signal { + name: "pinchStarted" + Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } + } + Signal { + name: "pinchUpdated" + Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } + } + Signal { + name: "pinchFinished" + Parameter { name: "pinch"; type: "QDeclarativeGeoMapPinchEvent"; isPointer: true } + } + Signal { name: "panStarted" } + Signal { name: "panFinished" } + Signal { name: "flickStarted" } + Signal { name: "flickFinished" } + } Component { name: "QQuickItem" defaultProperty: "data" -- cgit v1.2.1 From aab858642228ef1796b1cee0f56f18a4e1ad9fd6 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Thu, 27 Aug 2015 13:28:00 +0200 Subject: Disable MapPinch test due to flakinesss Task-number: QTBUG-47970 Change-Id: I50c287f895a3c815a5055bb6fee0b663bd7f227d Reviewed-by: Simon Hausmann Reviewed-by: Aaron McCarthy --- tests/auto/declarative_ui/tst_map_pinch.qml | 581 --------------------- .../declarative_ui/tst_map_pinch.qml.QTBUG-47970 | 581 +++++++++++++++++++++ 2 files changed, 581 insertions(+), 581 deletions(-) delete mode 100644 tests/auto/declarative_ui/tst_map_pinch.qml create mode 100644 tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 diff --git a/tests/auto/declarative_ui/tst_map_pinch.qml b/tests/auto/declarative_ui/tst_map_pinch.qml deleted file mode 100644 index f4e57faa..00000000 --- a/tests/auto/declarative_ui/tst_map_pinch.qml +++ /dev/null @@ -1,581 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL21$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 -import QtTest 1.0 -import QtLocation 5.5 -import QtPositioning 5.5 -import QtLocation.Test 5.5 - -Item { - // General-purpose elements for the test: - id: page - width: 100 - height: 100 - Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true } - - property variant coordinate: QtPositioning.coordinate(10, 11) - - // From QtLocationTest plugin - PinchGenerator { - id: pinchGenerator - anchors.fill: parent - target: page - enabled: false - } - - MouseArea { - id: mouseAreaBottom - anchors.fill: parent - visible: false - } - - Map { - id: map - plugin: testPlugin - center: coordinate; - zoomLevel: 9; - anchors.fill: page - x:0; y:0 - property variant lastPinchEvent: null - property point startPinchPoint1: Qt.point(0,0) - property point startPinchPoint2: Qt.point(0,0) - property point endPinchPoint1: Qt.point(0,0) - property point endPinchPoint2: Qt.point(0,0) - property bool rejectPinch: false - gesture.onPinchStarted: { - map.lastPinchEvent = pinch; - map.startPinchPoint1= pinch.point1; - map.startPinchPoint2= pinch.point2; - if (rejectPinch) - pinch.accepted = false; - } - gesture.onPinchUpdated: map.lastPinchEvent = pinch; - - gesture.onPinchFinished: { - map.lastPinchEvent = pinch; - map.endPinchPoint1 = pinch.point1; - map.endPinchPoint2 = pinch.point2; - } - MouseArea { - id: mouseAreaTop - anchors.fill: parent - visible: false - } - } - - SignalSpy {id: centerSpy; target: map; signalName: 'centerChanged'} - SignalSpy {id: pinchStartedSpy; target: map.gesture; signalName: 'pinchStarted'} - SignalSpy {id: pinchUpdatedSpy; target: map.gesture; signalName: 'pinchUpdated'} - SignalSpy {id: pinchFinishedSpy; target: map.gesture; signalName: 'pinchFinished'} - SignalSpy {id: pinchMaximumZoomLevelChangeSpy; target: map.gesture; signalName: 'maximumZoomLevelChangeChanged'} - SignalSpy {id: gestureEnabledSpy; target: map.gesture; signalName: 'enabledChanged'} - SignalSpy {id: pinchActiveSpy; target: map.gesture; signalName: 'pinchActiveChanged'} - SignalSpy {id: pinchActiveGesturesSpy; target: map.gesture; signalName: 'activeGesturesChanged'} - SignalSpy {id: mapZoomLevelSpy; target: map; signalName: 'zoomLevelChanged'} - SignalSpy {id: mouseAreaTopSpy; target: mouseAreaTop; signalName: 'onPressed'} - SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'} - - TestCase { - when: windowShown - name: "MapPinch" - - function init() - { - map.gesture.activeGestures = MapGestureArea.ZoomGesture - map.gesture.enabled = true - map.rejectPinch = false - map.center = coordinate - map.minimumZoomLevel = 0 - map.maximumZoomLevel = 20 - mouseRelease(mouseAreaTop,0,0) //Fixme: mouse area state gets broken across the tests - mouseAreaBottom.visible = false - mouseAreaTop.visible = false - pinchGenerator.clear() - centerSpy.clear() - pinchStartedSpy.clear() - pinchUpdatedSpy.clear() - pinchFinishedSpy.clear() - pinchMaximumZoomLevelChangeSpy.clear() - gestureEnabledSpy.clear() - pinchActiveSpy.clear() - pinchActiveGesturesSpy.clear() - mapZoomLevelSpy.clear() - mouseAreaTopSpy.clear() - mouseAreaBottomSpy.clear() - } - - //see QDeclarativeGeoMapGestureArea::updatePinch() - function calculateZoom(startPinchPoint1,startPinchPoint2,endPinchPoint1,endPinchPoint2, - width,height, maximumZoomLevelChange, startZoomLevel) - { - var startDistance = Math.sqrt(Math.pow(startPinchPoint2.x - startPinchPoint1.x,2) + - + Math.pow(startPinchPoint2.y - startPinchPoint1.y,2)) - var endDistance = Math.sqrt(Math.pow(endPinchPoint2.x - endPinchPoint1.x,2) + - + Math.pow(endPinchPoint2.y - endPinchPoint1.y,2)) - return 2 * (endDistance - startDistance) * maximumZoomLevelChange / - (width + height) + startZoomLevel; - } - - function initTestCase() - { - //test default properties - compare(map.gesture.enabled, true) - map.gesture.enabled = false - compare(gestureEnabledSpy.count, 1) - compare(map.gesture.enabled, false) - map.gesture.enabled = false - compare(gestureEnabledSpy.count, 1) - compare(map.gesture.enabled, false) - map.gesture.enabled = true - compare(gestureEnabledSpy.count, 2) - compare(map.gesture.enabled, true) - compare(map.gesture.isPinchActive, false) - verify(map.gesture.activeGestures & MapGestureArea.ZoomGesture) - map.gesture.activeGestures = MapGestureArea.NoGesture - compare(map.gesture.activeGestures, MapGestureArea.NoGesture) - compare(pinchActiveGesturesSpy.count, 1) - map.gesture.activeGestures = MapGestureArea.NoGesture - compare(map.gesture.activeGestures, MapGestureArea.NoGesture) - compare(pinchActiveGesturesSpy.count, 1) - map.gesture.activeGestures = MapGestureArea.ZoomGesture | MapGestureArea.PanGesture - compare(map.gesture.activeGestures, MapGestureArea.ZoomGesture | MapGestureArea.PanGesture) - compare(pinchActiveGesturesSpy.count, 2) - map.gesture.activeGestures = MapGestureArea.PanGesture - compare(map.gesture.activeGestures, MapGestureArea.PanGesture) - compare(pinchActiveGesturesSpy.count, 3) - map.gesture.activeGestures = MapGestureArea.ZoomGesture - compare(map.gesture.activeGestures, MapGestureArea.ZoomGesture) - compare(pinchActiveGesturesSpy.count, 4) - compare(map.gesture.maximumZoomLevelChange, 4) - map.gesture.maximumZoomLevelChange = 8 - compare(pinchMaximumZoomLevelChangeSpy.count, 1) - compare (map.gesture.maximumZoomLevelChange, 8) - map.gesture.maximumZoomLevelChange = 8 - compare(pinchMaximumZoomLevelChangeSpy.count, 1) - compare (map.gesture.maximumZoomLevelChange, 8) - map.gesture.maximumZoomLevelChange = 11 // too big - map.gesture.maximumZoomLevelChange = 0.01 // too small - map.gesture.maximumZoomLevelChange = -1 // too small - compare(pinchMaximumZoomLevelChangeSpy.count, 1) - compare (map.gesture.maximumZoomLevelChange, 8) - map.gesture.maximumZoomLevelChange = 2 - compare(pinchMaximumZoomLevelChangeSpy.count, 2) - compare (map.gesture.maximumZoomLevelChange, 2) - } - - - function zoom_in() - { - var startZoomLevel = 9 - map.zoomLevel = startZoomLevel - mapZoomLevelSpy.clear() - map.gesture.maximumZoomLevelChange = 2 - - compare(map.gesture.isPinchActive, false) - pinchGenerator.pinch( - Qt.point(0,50), // point1From - Qt.point(50,50), // point1To - Qt.point(100,50), // point2From - Qt.point(50,50), // point2To - 40, // interval between touch events (swipe1), default 20ms - 40, // interval between touch events (swipe2), default 20ms - 10, // number of touchevents in point1from -> point1to, default 10 - 10); // number of touchevents in point2from -> point2to, default 10 - tryCompare(pinchStartedSpy, "count", 1); - // check the pinch event data for pinchStarted - compare(map.lastPinchEvent.center.x, 50) - compare(map.lastPinchEvent.center.y, 50) - compare(map.lastPinchEvent.angle, 0) - verify((map.lastPinchEvent.point1.x > pinchGenerator.startDragDistance()) - && (map.lastPinchEvent.point1.x < 25)) - compare(map.lastPinchEvent.point1.y, 50) - verify((map.lastPinchEvent.point2.x > 75) - && (map.lastPinchEvent.point2.x < 100 - pinchGenerator.startDragDistance())) - compare(map.lastPinchEvent.point2.y, 50) - compare(map.lastPinchEvent.accepted, true) - compare(map.lastPinchEvent.pointCount, 2) - tryCompare(pinchActiveSpy, "count", 2) // check that pinch is active - compare(map.gesture.isPinchActive, true) - wait(200) // five points, each 40ms - // check the pinch event data for pinchUpdated - compare(map.lastPinchEvent.center.x, 50) - compare(map.lastPinchEvent.center.y, 50) - compare(map.lastPinchEvent.angle, 0) - verify((map.lastPinchEvent.point1.x) > 25 && (map.lastPinchEvent.point1.x <= 50)) - compare(map.lastPinchEvent.point1.y, 50) - verify((map.lastPinchEvent.point2.x) >= 50 && (map.lastPinchEvent.point2.x < 85)) - compare(map.lastPinchEvent.point2.y, 50) - compare(map.lastPinchEvent.accepted, true) - compare(map.lastPinchEvent.pointCount, 2) - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.gesture.isPinchActive, false) - // check the pinch event data for pinchFinished - compare(map.lastPinchEvent.center.x, 50) - compare(map.lastPinchEvent.center.y, 50) - compare(map.lastPinchEvent.angle, 0) - verify((map.lastPinchEvent.point1.x) > 35 && (map.lastPinchEvent.point1.x <= 50)) - compare(map.lastPinchEvent.point1.y, 50) - verify((map.lastPinchEvent.point2.x) >= 50 && (map.lastPinchEvent.point2.x < 65)) - compare(map.lastPinchEvent.point2.y, 50) - compare(map.lastPinchEvent.accepted, true) - compare(map.lastPinchEvent.pointCount, 0) - - verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received - compare(pinchActiveSpy.count,3) - compare(map.gesture.isPinchActive, false) - compare(mapZoomLevelSpy.count, pinchUpdatedSpy.count) - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - } - - function test_zoom_in() - { - zoom_in() - } - - function test_zoom_in_with_top_filtering() - { - mouseAreaTop.visible = true - zoom_in() - tryCompare(mouseAreaTopSpy, "count", 1) - } - - function test_zoom_in_with_below_filtering() - { - mouseAreaBottom.visible=true - zoom_in() - tryCompare(mouseAreaBottomSpy, "count",0) - } - - function zoom_out() - { - var startZoomLevel = 7.8 - map.zoomLevel = startZoomLevel - map.gesture.maximumZoomLevelChange = 2 - compare (map.gesture.maximumZoomLevelChange, 2) - mapZoomLevelSpy.clear() - pinchGenerator.pinch(Qt.point(45,50), Qt.point(0,50), - Qt.point(55,50), Qt.point(100,50), - 40, 40, 10, 10); - tryCompare(pinchStartedSpy, "count", 1); - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.gesture.isPinchActive, false) - verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received - compare(mapZoomLevelSpy.count, pinchUpdatedSpy.count) - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - - compare(map.zoomLevel, endZoomLevel) - } - - function test_zoom_out() - { - zoom_out() - } - - function test_zoom_out_with_top_filtering() - { - mouseAreaTop.visible=true - zoom_out() - tryCompare(mouseAreaTopSpy, "count", 1) - } - - function test_zoom_out_with_below_filtering() - { - mouseAreaBottom.visible=true - zoom_out() - tryCompare(mouseAreaBottomSpy, "count",0) - } - - function test_zoom_in_and_back_out() - { - // direction change during same pinch - var startZoomLevel = 7.8 - map.gesture.maximumZoomLevelChange = 2 - map.zoomLevel = startZoomLevel - pinchGenerator.pinch(Qt.point(0,50), Qt.point(100,50), - Qt.point(100,50),Qt.point(0,50), - 40, 40, 10, 10); - tryCompare(pinchStartedSpy, "count", 1); - tryCompare(pinchFinishedSpy, "count", 1); - verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) // should remain the same - } - - function test_zoom_in_with_different_change_level() - { - var startZoomLevel = 8 - map.zoomLevel = startZoomLevel - map.gesture.maximumZoomLevelChange = 4 - compare (map.gesture.maximumZoomLevelChange, 4) - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), - Qt.point(100,50),Qt.point(50,50), - 40, 40, 10, 10); - tryCompare(pinchFinishedSpy, "count", 1); - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - } - - function test_zoom_out_with_different_change_level() - { - var startZoomLevel = 8 - map.gesture.maximumZoomLevelChange = 1 - map.zoomLevel = startZoomLevel - compare (map.gesture.maximumZoomLevelChange, 1) - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - tryCompare(pinchFinishedSpy, "count", 1); - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - } - - function test_zoom_in_below_minimum_zoom_level() - { - map.zoomLevel = 8 - map.gesture.maximumZoomLevelChange = 4 - map.minimumZoomLevel = 7 - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); - wait(250); - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.zoomLevel, 7) - } - - function test_zoom_out_above_maximum_zoom_level() - { - map.gesture.maximumZoomLevelChange = 4 - map.maximumZoomLevel = 8 - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50),Qt.point(50,50), Qt.point(100,50)); - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.zoomLevel, 8) - } - - function test_pinch_when_max_and_min_are_same() - { - map.maximumZoomLevel = 8 - map.minimumZoomLevel = 8 - compare(map.maximumZoomLevel, 8) - compare(map.minimumZoomLevel, 8) - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.zoomLevel, 8) - map.minimumZoomLevel = 1 - map.maximumZoomLevel = 20 - } - - function test_pinch_when_max_min_is_not_where_map_zoomLevel_currently_is() - { - map.gesture.maximumZoomLevelChange = 4 - map.minimumZoomLevel = 4 - map.maximumZoomLevel = 6 - // first when above the zoom range - map.zoomLevel = 5 - pinchGenerator.pinch(Qt.point(50,50),Qt.point(0,50),Qt.point(50,50),Qt.point(100,50)); // zoom out - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.zoomLevel, 6) - map.zoomLevel = 5 - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); // zoom in - tryCompare(pinchFinishedSpy, "count", 2); - compare(map.zoomLevel, 4) - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); // zoom in - tryCompare(pinchFinishedSpy, "count", 3); - compare(map.zoomLevel, 4) - map.minimumZoomLevel = 1 - map.maximumZoomLevel = 20 - } - - function test_pinch_while_pinch_area_is_disabled() - { - map.zoomLevel = 7.5 - map.gesture.enabled = false - map.gesture.maximumZoomLevelChange = 2 - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - wait(200); - compare(pinchActiveSpy.count, 0) - compare(map.gesture.isPinchActive, false) - compare(pinchStartedSpy.count, 0) - compare(pinchUpdatedSpy.count, 0); - compare(pinchFinishedSpy.count, 0); - compare(map.zoomLevel, 7.5) - pinchGenerator.stop() - } - - function test_pinch_disabling_during_pinching() - { - var startZoomLevel = 7.5 - map.zoomLevel = startZoomLevel - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - tryCompare(pinchStartedSpy, "count", 1); - // check that pinch is active. then disable the pinch. pinch area should still process - // as long as it is active - compare(pinchActiveSpy.count,2) - compare(map.gesture.isPinchActive, true) - map.gesture.enabled = false - tryCompare(pinchFinishedSpy, "count", 1) - var pinchupdates = pinchUpdatedSpy.count - verify(pinchupdates > 0) - compare(pinchActiveSpy.count,3) - compare(map.gesture.isPinchActive, false) - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - compare(map.zoomLevel, endZoomLevel) - } - - function test_check_no_active_gestures() - { - map.zoomLevel = 8.5 - map.gesture.activeGestures = MapGestureArea.NoGesture - - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - tryCompare(pinchStartedSpy, "count", 0); - wait(300); - compare(pinchUpdatedSpy.count, 0); - compare(pinchStartedSpy.count, 0); - compare(map.zoomLevel, 8.5) - pinchGenerator.stop() - } - - function test_changing_zoom_level_during_active_pinch_zoom() - { - var startZoomLevel = 8.5 - map.zoomLevel = startZoomLevel - map.gesture.maximumZoomLevelChange = 2 - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), - Qt.point(50,50), Qt.point(100,50), - 40, 40, 10, 10); - tryCompare(pinchStartedSpy, "count", 1); - tryCompare(pinchActiveSpy, "count", 2) - compare(map.gesture.isPinchActive, true) - map.zoomLevel = 3 // will get overridden by pinch - tryCompare(pinchFinishedSpy, "count", 1); - verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - } - - function test_zoom_below_and_above_plugin_support() - { - map.gesture.maximumZoomLevelChange = 4 - map.zoomLevel = map.minimumZoomLevel + 0.5 - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), - Qt.point(100,50),Qt.point(50,50), - 40, 40, 10, 10); - tryCompare(pinchFinishedSpy, "count", 1); - compare(map.zoomLevel, map.minimumZoomLevel) - map.zoomLevel = map.maximumZoomLevel - 0.5 - pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50),Qt.point(50,50), Qt.point(100,50)); - tryCompare(pinchFinishedSpy, "count", 2); - compare(map.zoomLevel, map.maximumZoomLevel) - } - - function test_check_pinch_accepted() - { - map.zoomLevel = 10 - map.rejectPinch = true - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), - Qt.point(100,50),Qt.point(50,50), - 40, 40, 10, 10); - wait(300) - compare(pinchUpdatedSpy.count, 0) - compare(pinchFinishedSpy.count, 0) - compare(map.gesture.isPinchActive, false) - compare(map.zoomLevel, 10) - var startZoomLevel = 10 - map.rejectPinch = false - wait(500) - pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50),40, 40, 10, 10); - tryCompare(pinchFinishedSpy, "count", 1) - var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, - map.endPinchPoint1, map.endPinchPoint2, - map.width,map.height, - map.gesture.maximumZoomLevelChange,startZoomLevel) - compare(map.zoomLevel, endZoomLevel) - compare(map.lastPinchEvent.accepted, true) - } - - function test_moving_center() - { - pinchGenerator.pinch(Qt.point(0, 50), Qt.point(50,100), Qt.point(50,0), Qt.point(100, 50)) - tryCompare(pinchStartedSpy, "count", 1) - compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.x + map.lastPinchEvent.point2.x) /2) - compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.y + map.lastPinchEvent.point2.y) /2) - tryCompare(pinchFinishedSpy, "count", 1) - compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.x + map.lastPinchEvent.point2.x) /2) - compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.y + map.lastPinchEvent.point2.y) /2) - // sanity check that we are not comparing wrong (points) with wrong (center) and calling it a success - verify((map.lastPinchEvent.center.x > 50) && (map.lastPinchEvent.center.x < 100)) - verify((map.lastPinchEvent.center.y > 50) && (map.lastPinchEvent.center.y < 100)) - } - - function test_angle_between_points() - { - // todo calculate the angle from points for comparison - pinchGenerator.pinch(Qt.point(0,0), Qt.point(0,100), Qt.point(100,100), Qt.point(100,0)) - tryCompare(pinchStartedSpy, "count", 1) - verify(map.lastPinchEvent.angle >= -45 && map.lastPinchEvent.angle < -20) - tryCompare(pinchFinishedSpy, "count", 1) - verify(map.lastPinchEvent.angle >= 20 && map.lastPinchEvent.angle <= 45) - } - } -} diff --git a/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 new file mode 100644 index 00000000..f4e57faa --- /dev/null +++ b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 @@ -0,0 +1,581 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** 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 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 +import QtTest 1.0 +import QtLocation 5.5 +import QtPositioning 5.5 +import QtLocation.Test 5.5 + +Item { + // General-purpose elements for the test: + id: page + width: 100 + height: 100 + Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true } + + property variant coordinate: QtPositioning.coordinate(10, 11) + + // From QtLocationTest plugin + PinchGenerator { + id: pinchGenerator + anchors.fill: parent + target: page + enabled: false + } + + MouseArea { + id: mouseAreaBottom + anchors.fill: parent + visible: false + } + + Map { + id: map + plugin: testPlugin + center: coordinate; + zoomLevel: 9; + anchors.fill: page + x:0; y:0 + property variant lastPinchEvent: null + property point startPinchPoint1: Qt.point(0,0) + property point startPinchPoint2: Qt.point(0,0) + property point endPinchPoint1: Qt.point(0,0) + property point endPinchPoint2: Qt.point(0,0) + property bool rejectPinch: false + gesture.onPinchStarted: { + map.lastPinchEvent = pinch; + map.startPinchPoint1= pinch.point1; + map.startPinchPoint2= pinch.point2; + if (rejectPinch) + pinch.accepted = false; + } + gesture.onPinchUpdated: map.lastPinchEvent = pinch; + + gesture.onPinchFinished: { + map.lastPinchEvent = pinch; + map.endPinchPoint1 = pinch.point1; + map.endPinchPoint2 = pinch.point2; + } + MouseArea { + id: mouseAreaTop + anchors.fill: parent + visible: false + } + } + + SignalSpy {id: centerSpy; target: map; signalName: 'centerChanged'} + SignalSpy {id: pinchStartedSpy; target: map.gesture; signalName: 'pinchStarted'} + SignalSpy {id: pinchUpdatedSpy; target: map.gesture; signalName: 'pinchUpdated'} + SignalSpy {id: pinchFinishedSpy; target: map.gesture; signalName: 'pinchFinished'} + SignalSpy {id: pinchMaximumZoomLevelChangeSpy; target: map.gesture; signalName: 'maximumZoomLevelChangeChanged'} + SignalSpy {id: gestureEnabledSpy; target: map.gesture; signalName: 'enabledChanged'} + SignalSpy {id: pinchActiveSpy; target: map.gesture; signalName: 'pinchActiveChanged'} + SignalSpy {id: pinchActiveGesturesSpy; target: map.gesture; signalName: 'activeGesturesChanged'} + SignalSpy {id: mapZoomLevelSpy; target: map; signalName: 'zoomLevelChanged'} + SignalSpy {id: mouseAreaTopSpy; target: mouseAreaTop; signalName: 'onPressed'} + SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'} + + TestCase { + when: windowShown + name: "MapPinch" + + function init() + { + map.gesture.activeGestures = MapGestureArea.ZoomGesture + map.gesture.enabled = true + map.rejectPinch = false + map.center = coordinate + map.minimumZoomLevel = 0 + map.maximumZoomLevel = 20 + mouseRelease(mouseAreaTop,0,0) //Fixme: mouse area state gets broken across the tests + mouseAreaBottom.visible = false + mouseAreaTop.visible = false + pinchGenerator.clear() + centerSpy.clear() + pinchStartedSpy.clear() + pinchUpdatedSpy.clear() + pinchFinishedSpy.clear() + pinchMaximumZoomLevelChangeSpy.clear() + gestureEnabledSpy.clear() + pinchActiveSpy.clear() + pinchActiveGesturesSpy.clear() + mapZoomLevelSpy.clear() + mouseAreaTopSpy.clear() + mouseAreaBottomSpy.clear() + } + + //see QDeclarativeGeoMapGestureArea::updatePinch() + function calculateZoom(startPinchPoint1,startPinchPoint2,endPinchPoint1,endPinchPoint2, + width,height, maximumZoomLevelChange, startZoomLevel) + { + var startDistance = Math.sqrt(Math.pow(startPinchPoint2.x - startPinchPoint1.x,2) + + + Math.pow(startPinchPoint2.y - startPinchPoint1.y,2)) + var endDistance = Math.sqrt(Math.pow(endPinchPoint2.x - endPinchPoint1.x,2) + + + Math.pow(endPinchPoint2.y - endPinchPoint1.y,2)) + return 2 * (endDistance - startDistance) * maximumZoomLevelChange / + (width + height) + startZoomLevel; + } + + function initTestCase() + { + //test default properties + compare(map.gesture.enabled, true) + map.gesture.enabled = false + compare(gestureEnabledSpy.count, 1) + compare(map.gesture.enabled, false) + map.gesture.enabled = false + compare(gestureEnabledSpy.count, 1) + compare(map.gesture.enabled, false) + map.gesture.enabled = true + compare(gestureEnabledSpy.count, 2) + compare(map.gesture.enabled, true) + compare(map.gesture.isPinchActive, false) + verify(map.gesture.activeGestures & MapGestureArea.ZoomGesture) + map.gesture.activeGestures = MapGestureArea.NoGesture + compare(map.gesture.activeGestures, MapGestureArea.NoGesture) + compare(pinchActiveGesturesSpy.count, 1) + map.gesture.activeGestures = MapGestureArea.NoGesture + compare(map.gesture.activeGestures, MapGestureArea.NoGesture) + compare(pinchActiveGesturesSpy.count, 1) + map.gesture.activeGestures = MapGestureArea.ZoomGesture | MapGestureArea.PanGesture + compare(map.gesture.activeGestures, MapGestureArea.ZoomGesture | MapGestureArea.PanGesture) + compare(pinchActiveGesturesSpy.count, 2) + map.gesture.activeGestures = MapGestureArea.PanGesture + compare(map.gesture.activeGestures, MapGestureArea.PanGesture) + compare(pinchActiveGesturesSpy.count, 3) + map.gesture.activeGestures = MapGestureArea.ZoomGesture + compare(map.gesture.activeGestures, MapGestureArea.ZoomGesture) + compare(pinchActiveGesturesSpy.count, 4) + compare(map.gesture.maximumZoomLevelChange, 4) + map.gesture.maximumZoomLevelChange = 8 + compare(pinchMaximumZoomLevelChangeSpy.count, 1) + compare (map.gesture.maximumZoomLevelChange, 8) + map.gesture.maximumZoomLevelChange = 8 + compare(pinchMaximumZoomLevelChangeSpy.count, 1) + compare (map.gesture.maximumZoomLevelChange, 8) + map.gesture.maximumZoomLevelChange = 11 // too big + map.gesture.maximumZoomLevelChange = 0.01 // too small + map.gesture.maximumZoomLevelChange = -1 // too small + compare(pinchMaximumZoomLevelChangeSpy.count, 1) + compare (map.gesture.maximumZoomLevelChange, 8) + map.gesture.maximumZoomLevelChange = 2 + compare(pinchMaximumZoomLevelChangeSpy.count, 2) + compare (map.gesture.maximumZoomLevelChange, 2) + } + + + function zoom_in() + { + var startZoomLevel = 9 + map.zoomLevel = startZoomLevel + mapZoomLevelSpy.clear() + map.gesture.maximumZoomLevelChange = 2 + + compare(map.gesture.isPinchActive, false) + pinchGenerator.pinch( + Qt.point(0,50), // point1From + Qt.point(50,50), // point1To + Qt.point(100,50), // point2From + Qt.point(50,50), // point2To + 40, // interval between touch events (swipe1), default 20ms + 40, // interval between touch events (swipe2), default 20ms + 10, // number of touchevents in point1from -> point1to, default 10 + 10); // number of touchevents in point2from -> point2to, default 10 + tryCompare(pinchStartedSpy, "count", 1); + // check the pinch event data for pinchStarted + compare(map.lastPinchEvent.center.x, 50) + compare(map.lastPinchEvent.center.y, 50) + compare(map.lastPinchEvent.angle, 0) + verify((map.lastPinchEvent.point1.x > pinchGenerator.startDragDistance()) + && (map.lastPinchEvent.point1.x < 25)) + compare(map.lastPinchEvent.point1.y, 50) + verify((map.lastPinchEvent.point2.x > 75) + && (map.lastPinchEvent.point2.x < 100 - pinchGenerator.startDragDistance())) + compare(map.lastPinchEvent.point2.y, 50) + compare(map.lastPinchEvent.accepted, true) + compare(map.lastPinchEvent.pointCount, 2) + tryCompare(pinchActiveSpy, "count", 2) // check that pinch is active + compare(map.gesture.isPinchActive, true) + wait(200) // five points, each 40ms + // check the pinch event data for pinchUpdated + compare(map.lastPinchEvent.center.x, 50) + compare(map.lastPinchEvent.center.y, 50) + compare(map.lastPinchEvent.angle, 0) + verify((map.lastPinchEvent.point1.x) > 25 && (map.lastPinchEvent.point1.x <= 50)) + compare(map.lastPinchEvent.point1.y, 50) + verify((map.lastPinchEvent.point2.x) >= 50 && (map.lastPinchEvent.point2.x < 85)) + compare(map.lastPinchEvent.point2.y, 50) + compare(map.lastPinchEvent.accepted, true) + compare(map.lastPinchEvent.pointCount, 2) + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.gesture.isPinchActive, false) + // check the pinch event data for pinchFinished + compare(map.lastPinchEvent.center.x, 50) + compare(map.lastPinchEvent.center.y, 50) + compare(map.lastPinchEvent.angle, 0) + verify((map.lastPinchEvent.point1.x) > 35 && (map.lastPinchEvent.point1.x <= 50)) + compare(map.lastPinchEvent.point1.y, 50) + verify((map.lastPinchEvent.point2.x) >= 50 && (map.lastPinchEvent.point2.x < 65)) + compare(map.lastPinchEvent.point2.y, 50) + compare(map.lastPinchEvent.accepted, true) + compare(map.lastPinchEvent.pointCount, 0) + + verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received + compare(pinchActiveSpy.count,3) + compare(map.gesture.isPinchActive, false) + compare(mapZoomLevelSpy.count, pinchUpdatedSpy.count) + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + } + + function test_zoom_in() + { + zoom_in() + } + + function test_zoom_in_with_top_filtering() + { + mouseAreaTop.visible = true + zoom_in() + tryCompare(mouseAreaTopSpy, "count", 1) + } + + function test_zoom_in_with_below_filtering() + { + mouseAreaBottom.visible=true + zoom_in() + tryCompare(mouseAreaBottomSpy, "count",0) + } + + function zoom_out() + { + var startZoomLevel = 7.8 + map.zoomLevel = startZoomLevel + map.gesture.maximumZoomLevelChange = 2 + compare (map.gesture.maximumZoomLevelChange, 2) + mapZoomLevelSpy.clear() + pinchGenerator.pinch(Qt.point(45,50), Qt.point(0,50), + Qt.point(55,50), Qt.point(100,50), + 40, 40, 10, 10); + tryCompare(pinchStartedSpy, "count", 1); + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.gesture.isPinchActive, false) + verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received + compare(mapZoomLevelSpy.count, pinchUpdatedSpy.count) + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + + compare(map.zoomLevel, endZoomLevel) + } + + function test_zoom_out() + { + zoom_out() + } + + function test_zoom_out_with_top_filtering() + { + mouseAreaTop.visible=true + zoom_out() + tryCompare(mouseAreaTopSpy, "count", 1) + } + + function test_zoom_out_with_below_filtering() + { + mouseAreaBottom.visible=true + zoom_out() + tryCompare(mouseAreaBottomSpy, "count",0) + } + + function test_zoom_in_and_back_out() + { + // direction change during same pinch + var startZoomLevel = 7.8 + map.gesture.maximumZoomLevelChange = 2 + map.zoomLevel = startZoomLevel + pinchGenerator.pinch(Qt.point(0,50), Qt.point(100,50), + Qt.point(100,50),Qt.point(0,50), + 40, 40, 10, 10); + tryCompare(pinchStartedSpy, "count", 1); + tryCompare(pinchFinishedSpy, "count", 1); + verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) // should remain the same + } + + function test_zoom_in_with_different_change_level() + { + var startZoomLevel = 8 + map.zoomLevel = startZoomLevel + map.gesture.maximumZoomLevelChange = 4 + compare (map.gesture.maximumZoomLevelChange, 4) + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), + Qt.point(100,50),Qt.point(50,50), + 40, 40, 10, 10); + tryCompare(pinchFinishedSpy, "count", 1); + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + } + + function test_zoom_out_with_different_change_level() + { + var startZoomLevel = 8 + map.gesture.maximumZoomLevelChange = 1 + map.zoomLevel = startZoomLevel + compare (map.gesture.maximumZoomLevelChange, 1) + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + tryCompare(pinchFinishedSpy, "count", 1); + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + } + + function test_zoom_in_below_minimum_zoom_level() + { + map.zoomLevel = 8 + map.gesture.maximumZoomLevelChange = 4 + map.minimumZoomLevel = 7 + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); + wait(250); + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.zoomLevel, 7) + } + + function test_zoom_out_above_maximum_zoom_level() + { + map.gesture.maximumZoomLevelChange = 4 + map.maximumZoomLevel = 8 + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50),Qt.point(50,50), Qt.point(100,50)); + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.zoomLevel, 8) + } + + function test_pinch_when_max_and_min_are_same() + { + map.maximumZoomLevel = 8 + map.minimumZoomLevel = 8 + compare(map.maximumZoomLevel, 8) + compare(map.minimumZoomLevel, 8) + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.zoomLevel, 8) + map.minimumZoomLevel = 1 + map.maximumZoomLevel = 20 + } + + function test_pinch_when_max_min_is_not_where_map_zoomLevel_currently_is() + { + map.gesture.maximumZoomLevelChange = 4 + map.minimumZoomLevel = 4 + map.maximumZoomLevel = 6 + // first when above the zoom range + map.zoomLevel = 5 + pinchGenerator.pinch(Qt.point(50,50),Qt.point(0,50),Qt.point(50,50),Qt.point(100,50)); // zoom out + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.zoomLevel, 6) + map.zoomLevel = 5 + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); // zoom in + tryCompare(pinchFinishedSpy, "count", 2); + compare(map.zoomLevel, 4) + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50)); // zoom in + tryCompare(pinchFinishedSpy, "count", 3); + compare(map.zoomLevel, 4) + map.minimumZoomLevel = 1 + map.maximumZoomLevel = 20 + } + + function test_pinch_while_pinch_area_is_disabled() + { + map.zoomLevel = 7.5 + map.gesture.enabled = false + map.gesture.maximumZoomLevelChange = 2 + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + wait(200); + compare(pinchActiveSpy.count, 0) + compare(map.gesture.isPinchActive, false) + compare(pinchStartedSpy.count, 0) + compare(pinchUpdatedSpy.count, 0); + compare(pinchFinishedSpy.count, 0); + compare(map.zoomLevel, 7.5) + pinchGenerator.stop() + } + + function test_pinch_disabling_during_pinching() + { + var startZoomLevel = 7.5 + map.zoomLevel = startZoomLevel + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + tryCompare(pinchStartedSpy, "count", 1); + // check that pinch is active. then disable the pinch. pinch area should still process + // as long as it is active + compare(pinchActiveSpy.count,2) + compare(map.gesture.isPinchActive, true) + map.gesture.enabled = false + tryCompare(pinchFinishedSpy, "count", 1) + var pinchupdates = pinchUpdatedSpy.count + verify(pinchupdates > 0) + compare(pinchActiveSpy.count,3) + compare(map.gesture.isPinchActive, false) + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + compare(map.zoomLevel, endZoomLevel) + } + + function test_check_no_active_gestures() + { + map.zoomLevel = 8.5 + map.gesture.activeGestures = MapGestureArea.NoGesture + + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + tryCompare(pinchStartedSpy, "count", 0); + wait(300); + compare(pinchUpdatedSpy.count, 0); + compare(pinchStartedSpy.count, 0); + compare(map.zoomLevel, 8.5) + pinchGenerator.stop() + } + + function test_changing_zoom_level_during_active_pinch_zoom() + { + var startZoomLevel = 8.5 + map.zoomLevel = startZoomLevel + map.gesture.maximumZoomLevelChange = 2 + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50), + Qt.point(50,50), Qt.point(100,50), + 40, 40, 10, 10); + tryCompare(pinchStartedSpy, "count", 1); + tryCompare(pinchActiveSpy, "count", 2) + compare(map.gesture.isPinchActive, true) + map.zoomLevel = 3 // will get overridden by pinch + tryCompare(pinchFinishedSpy, "count", 1); + verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + } + + function test_zoom_below_and_above_plugin_support() + { + map.gesture.maximumZoomLevelChange = 4 + map.zoomLevel = map.minimumZoomLevel + 0.5 + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), + Qt.point(100,50),Qt.point(50,50), + 40, 40, 10, 10); + tryCompare(pinchFinishedSpy, "count", 1); + compare(map.zoomLevel, map.minimumZoomLevel) + map.zoomLevel = map.maximumZoomLevel - 0.5 + pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50),Qt.point(50,50), Qt.point(100,50)); + tryCompare(pinchFinishedSpy, "count", 2); + compare(map.zoomLevel, map.maximumZoomLevel) + } + + function test_check_pinch_accepted() + { + map.zoomLevel = 10 + map.rejectPinch = true + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50), + Qt.point(100,50),Qt.point(50,50), + 40, 40, 10, 10); + wait(300) + compare(pinchUpdatedSpy.count, 0) + compare(pinchFinishedSpy.count, 0) + compare(map.gesture.isPinchActive, false) + compare(map.zoomLevel, 10) + var startZoomLevel = 10 + map.rejectPinch = false + wait(500) + pinchGenerator.pinch(Qt.point(0,50),Qt.point(50,50),Qt.point(100,50),Qt.point(50,50),40, 40, 10, 10); + tryCompare(pinchFinishedSpy, "count", 1) + var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2, + map.endPinchPoint1, map.endPinchPoint2, + map.width,map.height, + map.gesture.maximumZoomLevelChange,startZoomLevel) + compare(map.zoomLevel, endZoomLevel) + compare(map.lastPinchEvent.accepted, true) + } + + function test_moving_center() + { + pinchGenerator.pinch(Qt.point(0, 50), Qt.point(50,100), Qt.point(50,0), Qt.point(100, 50)) + tryCompare(pinchStartedSpy, "count", 1) + compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.x + map.lastPinchEvent.point2.x) /2) + compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.y + map.lastPinchEvent.point2.y) /2) + tryCompare(pinchFinishedSpy, "count", 1) + compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.x + map.lastPinchEvent.point2.x) /2) + compare(map.lastPinchEvent.center.x, (map.lastPinchEvent.point1.y + map.lastPinchEvent.point2.y) /2) + // sanity check that we are not comparing wrong (points) with wrong (center) and calling it a success + verify((map.lastPinchEvent.center.x > 50) && (map.lastPinchEvent.center.x < 100)) + verify((map.lastPinchEvent.center.y > 50) && (map.lastPinchEvent.center.y < 100)) + } + + function test_angle_between_points() + { + // todo calculate the angle from points for comparison + pinchGenerator.pinch(Qt.point(0,0), Qt.point(0,100), Qt.point(100,100), Qt.point(100,0)) + tryCompare(pinchStartedSpy, "count", 1) + verify(map.lastPinchEvent.angle >= -45 && map.lastPinchEvent.angle < -20) + tryCompare(pinchFinishedSpy, "count", 1) + verify(map.lastPinchEvent.angle >= 20 && map.lastPinchEvent.angle <= 45) + } + } +} -- cgit v1.2.1 From 88b52120c5225804677a275424ca1c46baf89dda Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Wed, 26 Aug 2015 16:27:56 +0200 Subject: Re-enable QML geocoding unit test They were disabled when trying to get qtlocation pass through the new CI. The failure reason were the delayed geocoding requests. The plugin employs a 200ms timeout before answering such requests. The unit test aligned its wait times along the same timeout values. Unfortunately this is not testable in the CI as those timeouts are not guaranteed. Task-number: QTBUG-47423 Change-Id: I1e3accaf1590f0c95282a62a8cc02a76de71b47c Reviewed-by: Harald Meyer Reviewed-by: Aaron McCarthy --- tests/auto/declarative_core/tst_geocoding.qml | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/auto/declarative_core/tst_geocoding.qml b/tests/auto/declarative_core/tst_geocoding.qml index 48dac691..577a9110 100644 --- a/tests/auto/declarative_core/tst_geocoding.qml +++ b/tests/auto/declarative_core/tst_geocoding.qml @@ -303,8 +303,6 @@ Item { TestCase { name: "GeocodeModelGeocoding" - /* - // see QTBUG-47423 function clear_slack_model() { slackModel.reset() locationsSlackSpy.clear() @@ -521,9 +519,8 @@ Item { compare (countSlackSpy.count, 0) compare (locationsSlackSpy.count, 0) compare (slackModel.count, 0) - wait (200) + tryCompare(countSlackSpy, "count", 1); //waits up to 5s compare (slackModel.count, 5) - compare (countSlackSpy.count, 1) compare (locationsSlackSpy.count, 1) // Frequent updates, previous requests are aborted slackModel.reset() @@ -545,9 +542,8 @@ Item { wait (100) compare(locationsSlackSpy.count, 0) compare(countSlackSpy.count, 0) - wait (200) + tryCompare(countSlackSpy, "count", 1); //waits up to 5s compare (locationsSlackSpy.count, 1) - compare(countSlackSpy.count, 1) compare(slackModel.count, 5) // limit } @@ -583,8 +579,7 @@ Item { compare (countSlackSpy.count, 0) compare (locationsSlackSpy.count, 0) compare (slackModel.count, 0) - wait (200) - compare (countSlackSpy.count, 1) + tryCompare(countSlackSpy, "count", 1); //waits up to 5s compare (locationsSlackSpy.count, 1) compare (slackModel.count, 7) // slackAddress1.county) // Frequent updates, previous requests are aborted @@ -607,9 +602,8 @@ Item { wait (100) compare(locationsSlackSpy.count, 0) compare(countSlackSpy.count, 0) - wait (200) + tryCompare(countSlackSpy, "count", 1); //waits up to 5s compare (locationsSlackSpy.count, 1) - compare(countSlackSpy.count, 1) compare(slackModel.count, 7) // slackAddress1.county } function test_reverse_geocode() { @@ -643,8 +637,8 @@ Item { compare (countSlackSpy.count, 0) compare (locationsSlackSpy.count, 0) compare (slackModel.count, 0) - wait (200) - compare (countSlackSpy.count, 1) + + tryCompare(countSlackSpy, "count", 1); //waits up to 5s compare (locationsSlackSpy.count, 1) compare (slackModel.count, 3) // slackCoordinate1.longitude // Frequent updates, previous requests are aborted @@ -667,11 +661,10 @@ Item { wait (100) compare(locationsSlackSpy.count, 0) compare(countSlackSpy.count, 0) - wait (200) - compare (locationsSlackSpy.count, 1) - compare(countSlackSpy.count, 1) + + tryCompare(countSlackSpy, "count", 1); //waits up to 5s + compare(locationsSlackSpy.count, 1) compare(slackModel.count, 3) // slackCoordinate1.longitude } - */ } } -- cgit v1.2.1 From f5932513e5d9a4627185996736ca2c66e6e103de Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 25 Aug 2015 16:28:28 +0200 Subject: Fix remaining QtLocation qdoc warnings /home/bb/dev/qt/qt56/qtlocation/src/imports/location/qquickgeomapgesturearea.cpp:145: warning: C++ class QDeclarativeGeoMapGestureArea not found: \instantiates QDeclarativeGeoMapGestureArea /home/bb/dev/qt/qt56/qtlocation/src/location/places/qplaceeditorial.cpp:99: warning: Cannot find 'QPlaceEditorial(...)' in '\fn' QPlaceEditorial::QPlaceEditorial(const QPlaceContent &other) [I cannot find any function of that name with the specified signature. Make sure that the signature is identical to the declaration, including 'const' qualifiers.] Change-Id: I10c2326364c8e8d29ddf641f42267302b05b9379 Reviewed-by: Aaron McCarthy --- src/imports/location/qquickgeomapgesturearea.cpp | 2 +- src/location/places/qplaceeditorial.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/location/qquickgeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp index 8c4eadda..b8f0167d 100644 --- a/src/imports/location/qquickgeomapgesturearea.cpp +++ b/src/imports/location/qquickgeomapgesturearea.cpp @@ -144,7 +144,7 @@ QT_BEGIN_NAMESPACE /*! \qmltype MapGestureArea - \instantiates QDeclarativeGeoMapGestureArea + \instantiates QQuickGeoMapGestureArea \inqmlmodule QtLocation diff --git a/src/location/places/qplaceeditorial.h b/src/location/places/qplaceeditorial.h index 4a7e790f..ecfe8db8 100644 --- a/src/location/places/qplaceeditorial.h +++ b/src/location/places/qplaceeditorial.h @@ -48,7 +48,7 @@ class Q_LOCATION_EXPORT QPlaceEditorial : public QPlaceContent public: QPlaceEditorial(); #ifdef Q_QDOC - QPlaceEditorial::QPlaceEditorial(const QPlaceContent &other) + QPlaceEditorial(const QPlaceContent &other); #else Q_DECLARE_CONTENT_COPY_CTOR(QPlaceEditorial) #endif -- cgit v1.2.1 From fd3ea87861b281a54c1888a0a044517cf86f9692 Mon Sep 17 00:00:00 2001 From: Alex Blasche Date: Tue, 25 Aug 2015 14:22:16 +0200 Subject: Update Error enums for GeoCode & Route model types 1.) Remove not required/duplicated enums 2.) Add docs for new enum values 3.) Sorted the enums by alphabet (except for NoErrror) 4.) Other minor spelling corrections 5.) Update and expand tests Change-Id: I83bf9e5e40f1237ead45320d020b315b39442946 Reviewed-by: Aaron McCarthy --- src/imports/location/plugins.qmltypes | 12 ++---- src/imports/location/qdeclarativegeocodemodel.cpp | 43 +++++++++++++++------- src/imports/location/qdeclarativegeocodemodel_p.h | 17 ++++----- src/imports/location/qdeclarativegeomap.cpp | 3 +- src/imports/location/qdeclarativegeoroutemodel.cpp | 41 +++++++++++++++------ src/imports/location/qdeclarativegeoroutemodel_p.h | 11 +++--- src/location/maps/qgeocodingmanager.cpp | 9 ----- tests/auto/declarative_core/tst_geocoding.qml | 27 +++++++------- tests/auto/declarative_core/tst_routing.qml | 25 +++++++------ 9 files changed, 105 insertions(+), 83 deletions(-) diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes index 3871feaa..105e8713 100644 --- a/src/imports/location/plugins.qmltypes +++ b/src/imports/location/plugins.qmltypes @@ -577,10 +577,8 @@ Module { "ParseError": 3, "UnsupportedOptionError": 4, "UnknownError": 5, - "NotSupportedError": 101, - "UnknownParameterError": 102, - "MissingRequiredParameterError": 103, - "ConnectionError": 104 + "UnknownParameterError": 100, + "MissingRequiredParameterError": 101 } } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } @@ -984,10 +982,8 @@ Module { "UnsupportedOptionError": 4, "CombinationError": 5, "UnknownError": 6, - "NotSupportedError": 101, - "UnknownParameterError": 102, - "MissingRequiredParameterError": 103, - "ConnectionError": 104 + "UnknownParameterError": 100, + "MissingRequiredParameterError": 101 } } Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true } diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp index d2599747..d8ff4e85 100644 --- a/src/imports/location/qdeclarativegeocodemodel.cpp +++ b/src/imports/location/qdeclarativegeocodemodel.cpp @@ -150,7 +150,7 @@ void QDeclarativeGeocodeModel::update() return; if (!plugin_) { - setError(NotSupportedError, tr("Cannot geocode, plugin not set.")); + setError(EngineNotSetError, tr("Cannot geocode, plugin not set.")); return; } @@ -160,7 +160,7 @@ void QDeclarativeGeocodeModel::update() QGeoCodingManager *geocodingManager = serviceProvider->geocodingManager(); if (!geocodingManager) { - setError(NotSupportedError, tr("Cannot geocode, geocode manager not set.")); + setError(EngineNotSetError, tr("Cannot geocode, geocode manager not set.")); return; } if (!coordinate_.isValid() && (!address_ || address_->address().isEmpty()) && @@ -292,13 +292,26 @@ void QDeclarativeGeocodeModel::pluginReady() QGeoCodingManager *geocodingManager = serviceProvider->geocodingManager(); if (serviceProvider->error() != QGeoServiceProvider::NoError) { - setError(GeocodeError(serviceProvider->error() + NotSupportedError - 1), - serviceProvider->errorString()); + QDeclarativeGeocodeModel::GeocodeError newError = UnknownError; + switch (serviceProvider->error()) { + case QGeoServiceProvider::NotSupportedError: + newError = EngineNotSetError; break; + case QGeoServiceProvider::UnknownParameterError: + newError = UnknownParameterError; break; + case QGeoServiceProvider::MissingRequiredParameterError: + newError = MissingRequiredParameterError; break; + case QGeoServiceProvider::ConnectionError: + newError = CommunicationError; break; + default: + break; + } + + setError(newError, serviceProvider->errorString()); return; } if (!geocodingManager) { - setError(NotSupportedError,tr("Plugin does not support (reverse) geocoding.")); + setError(EngineNotSetError,tr("Plugin does not support (reverse) geocoding.")); return; } @@ -432,13 +445,17 @@ void QDeclarativeGeocodeModel::setStatus(QDeclarativeGeocodeModel::Status status This read-only property holds the latest error value of the geocoding request. \list - \li GeocodeModel.NoError - No error has occurred - \li GeocodeModel.EngineNotSetError - The plugin/service provider used does not support (reverse) geocoding - \li GeocodeModel.CommunicationError - An error occurred while communicating with the service provider - \li GeocodeModel.ParseError - The response from the service provider was in an unrecognizable format - \li GeocodeModel.UnsupportedOptionError - The requested operation or one of the options for the operation are not supported by the service provider. - \li GeocodeModel.CombinationError - An error occurred while results where being combined from multiple sources - \li GeocodeModel.UnknownError - An error occurred which does not fit into any of the other categories + \li GeocodeModel.NoError - No error has occurred. + \li GeocodeModel.CombinationError - An error occurred while results where being combined from multiple sources. + \li GeocodeModel.CommunicationError - An error occurred while communicating with the service provider. + \li GeocodeModel.EngineNotSetError - The model's plugin property was not set or there is no geocoding manager associated with the plugin. + \li GeocodeModel.MissingRequiredParameterError - A required parameter was not specified. + \li GeocodeModel.ParseError - The response from the service provider was in an unrecognizable format. + \li GeocodeModel.UnknownError - An error occurred which does not fit into any of the other categories. + \li GeocodeModel.UnknownParameterError - The plugin did not recognize one of the parameters it was given. + \li GeocodeModel.UnsupportedOptionError - The requested operation is not supported by the geocoding provider. + This may happen when the loaded engine does not support a particular geocoding request + such as reverse geocoding. \endlist */ @@ -512,7 +529,7 @@ int QDeclarativeGeocodeModel::count() const QDeclarativeGeoLocation *QDeclarativeGeocodeModel::get(int index) { if (index < 0 || index >= declarativeLocations_.count()) { - setError(UnsupportedOptionError, QCoreApplication::translate(CONTEXT_NAME, INDEX_OUT_OF_RANGE).arg(index)); + qmlInfo(this) << QStringLiteral("Index '%1' out of range").arg(index); return 0; } return declarativeLocations_.at(index); diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h index 5d6b27a7..cb610bb0 100644 --- a/src/imports/location/qdeclarativegeocodemodel_p.h +++ b/src/imports/location/qdeclarativegeocodemodel_p.h @@ -82,18 +82,17 @@ public: enum GeocodeError { NoError = QGeoCodeReply::NoError, - EngineNotSetError = QGeoCodeReply::EngineNotSetError, - CommunicationError = QGeoCodeReply::CommunicationError, + EngineNotSetError = QGeoCodeReply::EngineNotSetError, //TODO Qt6 consider merge with NotSupportedError + CommunicationError = QGeoCodeReply::CommunicationError, //TODO Qt6 merge with Map's ConnectionError ParseError = QGeoCodeReply::ParseError, - UnsupportedOptionError = QGeoCodeReply::UnsupportedOptionError, + UnsupportedOptionError = QGeoCodeReply::UnsupportedOptionError, //TODO Qt6 consider rename UnsupportedOperationError CombinationError = QGeoCodeReply::CombinationError, UnknownError = QGeoCodeReply::UnknownError, - //here we leave gap for future model errors - //now geo service provider errors - NotSupportedError = 100 + QGeoServiceProvider::NotSupportedError, - UnknownParameterError = 100 + QGeoServiceProvider::UnknownParameterError, - MissingRequiredParameterError = 100 + QGeoServiceProvider::MissingRequiredParameterError, - ConnectionError = 100 + QGeoServiceProvider::ConnectionError + //we leave gap for future QGeoCodeReply errors + + //QGeoServiceProvider related errors start here + UnknownParameterError = 100, + MissingRequiredParameterError }; enum Roles { diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp index cf492977..87023708 100644 --- a/src/imports/location/qdeclarativegeomap.cpp +++ b/src/imports/location/qdeclarativegeomap.cpp @@ -283,6 +283,7 @@ void QDeclarativeGeoMap::pluginReady() } if (!m_mappingManager) { + //TODO Should really be EngineNotSetError (see QML GeoCodeModel) setError(QGeoServiceProvider::NotSupportedError, tr("Plugin does not support mapping.")); return; } @@ -917,7 +918,7 @@ QString QDeclarativeGeoMap::errorString() const \list \li Map.NoError - No error has occurred. - \li Map.NotSupportedError -The plugin does not support mapping functionality. + \li Map.NotSupportedError -The maps plugin property was not set or there is no mapping manager associated with the plugin. \li Map.UnknownParameterError -The plugin did not recognize one of the parameters it was given. \li Map.MissingRequiredParameterError - The plugin did not find one of the parameters it was expecting. \li Map.ConnectionError - The plugin could not connect to its backend service or database. diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp index 87023c15..0c64c23a 100644 --- a/src/imports/location/qdeclarativegeoroutemodel.cpp +++ b/src/imports/location/qdeclarativegeoroutemodel.cpp @@ -212,7 +212,7 @@ void QDeclarativeGeoRouteModel::abortRequest() QDeclarativeGeoRoute *QDeclarativeGeoRouteModel::get(int index) { if (index < 0 || index >= routes_.count()) { - setError(UnsupportedOptionError, QCoreApplication::translate(CONTEXT_NAME, INDEX_OUT_OF_RANGE).arg(index)); + qmlInfo(this) << QStringLiteral("Index '%1' out of range").arg(index); return 0; } return routes_.at(index); @@ -307,13 +307,26 @@ void QDeclarativeGeoRouteModel::pluginReady() QGeoRoutingManager *routingManager = serviceProvider->routingManager(); if (serviceProvider->error() != QGeoServiceProvider::NoError) { - setError(RouteError(serviceProvider->error() + NotSupportedError -1), - serviceProvider->errorString()); + QDeclarativeGeoRouteModel::RouteError newError = UnknownError; + switch (serviceProvider->error()) { + case QGeoServiceProvider::NotSupportedError: + newError = EngineNotSetError; break; + case QGeoServiceProvider::UnknownParameterError: + newError = UnknownParameterError; break; + case QGeoServiceProvider::MissingRequiredParameterError: + newError = MissingRequiredParameterError; break; + case QGeoServiceProvider::ConnectionError: + newError = CommunicationError; break; + default: + break; + } + + setError(newError, serviceProvider->errorString()); return; } if (!routingManager) { - setError(NotSupportedError, tr("Plugin does not support routing.")); + setError(EngineNotSetError, tr("Plugin does not support routing.")); return; } @@ -519,12 +532,16 @@ QString QDeclarativeGeoRouteModel::errorString() const This read-only property holds the latest error value of the routing request. \list - \li RouteModel.NoError - No error has occurred - \li RouteModel.EngineNotSetError - The plugin/service provider used does not support routing - \li RouteModel.CommunicationError - An error occurred while communicating with the service provider - \li RouteModel.ParseError - The response from the service provider was in an unrecognizable format - \li RouteModel.UnsupportedOptionError - The requested operation or one of the options for the operation are not supported by the service provider. - \li RouteModel.UnknownError - An error occurred which does not fit into any of the other categories + \li RouteModel.NoError - No error has occurred. + \li RouteModel.CommunicationError - An error occurred while communicating with the service provider. + \li RouteModel.EngineNotSetError - The model's plugin property was not set or there is no routing manager associated with the plugin. + \li RouteModel.MissingRequiredParameterError - A required parameter was not specified. + \li RouteModel.ParseError - The response from the service provider was in an unrecognizable format. + \li RouteModel.UnknownError - An error occurred which does not fit into any of the other categories. + \li RouteModel.UnknownParameterError - The plugin did not recognize one of the parameters it was given. + \li RouteModel.UnsupportedOptionError - The requested operation is not supported by the routing provider. + This may happen when the loaded engine does not support a particular + type of routing request. \endlist */ @@ -555,7 +572,7 @@ void QDeclarativeGeoRouteModel::update() return; if (!plugin_) { - setError(NotSupportedError, tr("Cannot route, plugin not set.")); + setError(EngineNotSetError, tr("Cannot route, plugin not set.")); return; } @@ -565,7 +582,7 @@ void QDeclarativeGeoRouteModel::update() QGeoRoutingManager *routingManager = serviceProvider->routingManager(); if (!routingManager) { - setError(NotSupportedError, tr("Cannot route, route manager not set.")); + setError(EngineNotSetError, tr("Cannot route, route manager not set.")); return; } if (!routeQuery_) { diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h index 363c3bc5..35cfe004 100644 --- a/src/imports/location/qdeclarativegeoroutemodel_p.h +++ b/src/imports/location/qdeclarativegeoroutemodel_p.h @@ -95,12 +95,11 @@ public: ParseError = QGeoRouteReply::ParseError, UnsupportedOptionError = QGeoRouteReply::UnsupportedOptionError, UnknownError = QGeoRouteReply::UnknownError, - //here we leave gap for future model errors - //now geo service provider errors - NotSupportedError = 100 + QGeoServiceProvider::NotSupportedError, - UnknownParameterError = 100 + QGeoServiceProvider::UnknownParameterError, - MissingRequiredParameterError = 100 + QGeoServiceProvider::MissingRequiredParameterError, - ConnectionError = 100 + QGeoServiceProvider::ConnectionError + //we leave gap for future QGeoRouteReply errors + + //QGeoServiceProvider related errors start here + UnknownParameterError = 100, + MissingRequiredParameterError }; explicit QDeclarativeGeoRouteModel(QObject *parent = 0); diff --git a/src/location/maps/qgeocodingmanager.cpp b/src/location/maps/qgeocodingmanager.cpp index a84686e3..284adde3 100644 --- a/src/location/maps/qgeocodingmanager.cpp +++ b/src/location/maps/qgeocodingmanager.cpp @@ -170,9 +170,6 @@ int QGeoCodingManager::managerVersion() const */ QGeoCodeReply *QGeoCodingManager::geocode(const QGeoAddress &address, const QGeoShape &bounds) { -// if (!d_ptr->engine) -// return new QGeoCodeReply(QGeoCodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); - return d_ptr->engine->geocode(address, bounds); } @@ -215,9 +212,6 @@ QGeoCodeReply *QGeoCodingManager::geocode(const QGeoAddress &address, const QGeo */ QGeoCodeReply *QGeoCodingManager::reverseGeocode(const QGeoCoordinate &coordinate, const QGeoShape &bounds) { -// if (!d_ptr->engine) -// return new QGeoCodeReply(QGeoCodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); - return d_ptr->engine->reverseGeocode(coordinate, bounds); } @@ -255,9 +249,6 @@ QGeoCodeReply *QGeoCodingManager::geocode(const QString &address, int offset, const QGeoShape &bounds) { -// if (!d_ptr->engine) -// return new QGeoCodeReply(QGeoCodeReply::EngineNotSetError, "The geocoding manager was not created with a valid engine.", this); - QGeoCodeReply *reply = d_ptr->engine->geocode(address, limit, offset, diff --git a/tests/auto/declarative_core/tst_geocoding.qml b/tests/auto/declarative_core/tst_geocoding.qml index 577a9110..984fde65 100644 --- a/tests/auto/declarative_core/tst_geocoding.qml +++ b/tests/auto/declarative_core/tst_geocoding.qml @@ -177,16 +177,24 @@ Item { compare(pluginSpy.count, 2) } // Test that model acts gracefully when plugin is not set or is invalid - // (does not support routing) + // (does not support geocoding) GeocodeModel {id: errorModel; plugin: errorPlugin} + GeocodeModel {id: errorModelNoPlugin} SignalSpy {id: countInvalidSpy; target: errorModel; signalName: "countChanged"} SignalSpy {id: errorSpy; target: errorModel; signalName: "errorChanged"} function test_error_plugin() { - compare(errorModel.error,GeocodeModel.NotSupportedError) + // test plugin not set + compare(errorModelNoPlugin.error,GeocodeModel.NoError) + errorModelNoPlugin.update() + compare(errorModelNoPlugin.error,GeocodeModel.EngineNotSetError) + console.log(errorModelNoPlugin.errorString) + + //plugin set but otherwise not offering anything + compare(errorModel.error,GeocodeModel.EngineNotSetError) compare(errorModel.errorString,"This error was expected. No worries !") errorSpy.clear() errorModel.update() - compare(errorModel.error,GeocodeModel.NotSupportedError) + compare(errorModel.error,GeocodeModel.EngineNotSetError) compare(errorModel.errorString,qsTr("Cannot geocode, geocode manager not set.")) compare(errorSpy.count, 1) errorSpy.clear() @@ -201,19 +209,12 @@ Item { compare(errorSpy.count, 0) errorSpy.clear() errorModel.update() - compare(errorModel.error,GeocodeModel.NotSupportedError) + compare(errorModel.error,GeocodeModel.EngineNotSetError) compare(errorModel.errorString,qsTr("Cannot geocode, geocode manager not set.")) compare(errorSpy.count, 1) errorSpy.clear() - errorModel.get(-1) - compare(errorModel.error,GeocodeModel.UnsupportedOptionError) - compare(errorModel.errorString,qsTr("Index '-1' out of range")) - compare(errorSpy.count, 1) - errorSpy.clear() - errorModel.get(1) - compare(errorModel.error,GeocodeModel.UnsupportedOptionError) - compare(errorModel.errorString,qsTr("Index '1' out of range")) - compare(errorSpy.count, 1) + var location = errorModel.get(-1) + compare(location, null) } } diff --git a/tests/auto/declarative_core/tst_routing.qml b/tests/auto/declarative_core/tst_routing.qml index 96a4a10f..f29c7dd3 100644 --- a/tests/auto/declarative_core/tst_routing.qml +++ b/tests/auto/declarative_core/tst_routing.qml @@ -446,14 +446,22 @@ Item { // Test that model acts gracefully when plugin is not set or is invalid // (does not support routing) RouteModel {id: errorModel; plugin: errorPlugin} + RouteModel {id: errorModelNoPlugin} SignalSpy {id: countInvalidSpy; target: errorModel; signalName: "countChanged"} SignalSpy {id: errorSpy; target: errorModel; signalName: "errorChanged"} function test_error_plugin() { - compare(errorModel.error,RouteModel.NotSupportedError) + // test plugin not set + compare(errorModelNoPlugin.error,RouteModel.NoError) + errorModelNoPlugin.update() + compare(errorModelNoPlugin.error,RouteModel.EngineNotSetError) + console.log(errorModelNoPlugin.errorString) + + //plugin set but otherwise not offering anything + compare(errorModel.error,RouteModel.EngineNotSetError) compare(errorModel.errorString,"This error was expected. No worries !") errorSpy.clear() errorModel.update() - compare(errorModel.error,RouteModel.NotSupportedError) + compare(errorModel.error,RouteModel.EngineNotSetError) compare(errorModel.errorString,qsTr("Cannot route, route manager not set.")) compare(errorSpy.count, 1) errorSpy.clear() @@ -468,19 +476,12 @@ Item { compare(errorSpy.count, 0) errorSpy.clear() errorModel.update() - compare(errorModel.error,RouteModel.NotSupportedError) + compare(errorModel.error,RouteModel.EngineNotSetError) compare(errorModel.errorString,qsTr("Cannot route, route manager not set.")) compare(errorSpy.count, 1) errorSpy.clear() - errorModel.get(-1) - compare(errorModel.error,RouteModel.UnsupportedOptionError) - compare(errorModel.errorString,qsTr("Index '-1' out of range")) - compare(errorSpy.count, 1) - errorSpy.clear() - errorModel.get(1) - compare(errorModel.error,RouteModel.UnsupportedOptionError) - compare(errorModel.errorString,qsTr("Index '1' out of range")) - compare(errorSpy.count, 1) + var data = errorModel.get(-1) + compare(data, null) } } -- cgit v1.2.1