summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf2
-rw-r--r--config.tests/geoclue-satellite/geoclue-satellite.pro6
-rw-r--r--config.tests/geoclue-satellite/main.cpp41
-rw-r--r--config.tests/geoclue/geoclue.pro6
-rw-r--r--config.tests/geoclue/main.cpp48
-rw-r--r--examples/location/mapviewer/forms/RouteAddress.qml2
-rw-r--r--examples/location/mapviewer/map/CircleItem.qml2
-rw-r--r--examples/location/mapviewer/map/ImageItem.qml2
-rw-r--r--examples/location/mapviewer/map/MapComponent.qml40
-rw-r--r--examples/location/mapviewer/map/Marker.qml2
-rw-r--r--examples/location/mapviewer/map/MiniMap.qml2
-rw-r--r--examples/location/mapviewer/map/PolygonItem.qml2
-rw-r--r--examples/location/mapviewer/map/PolylineItem.qml2
-rw-r--r--examples/location/mapviewer/map/RectangleItem.qml2
-rw-r--r--examples/location/mapviewer/mapviewer.qml2
-rw-r--r--examples/location/mapviewer/menus/MainMenu.qml2
-rw-r--r--examples/location/places/forms/SearchOptions.qml2
-rw-r--r--examples/location/places/items/MainMenu.qml2
-rw-r--r--examples/location/places/items/MapComponent.qml7
-rw-r--r--examples/location/places/places.qml2
-rw-r--r--examples/location/places/views/CategoryDelegate.qml2
-rw-r--r--examples/location/places/views/CategoryView.qml2
-rw-r--r--examples/location/places/views/EditorialDelegate.qml2
-rw-r--r--examples/location/places/views/EditorialPage.qml2
-rw-r--r--examples/location/places/views/EditorialView.qml2
-rw-r--r--examples/location/places/views/ImageView.qml2
-rw-r--r--examples/location/places/views/ReviewDelegate.qml2
-rw-r--r--examples/location/places/views/ReviewPage.qml2
-rw-r--r--examples/location/places/views/ReviewView.qml2
-rw-r--r--examples/location/places/views/SearchResultDelegate.qml2
-rw-r--r--examples/location/places/views/SearchResultView.qml2
-rw-r--r--examples/location/places_list/places_list.qml2
-rw-r--r--examples/location/places_map/places_map.qml2
-rw-r--r--examples/location/planespotter/Plane.qml2
-rw-r--r--examples/location/planespotter/planespotter.qml2
-rw-r--r--examples/positioning/geoflickr/flickrmobile/GeoTab.qml9
-rw-r--r--examples/positioning/satelliteinfo/main.cpp4
-rw-r--r--qtlocation.pro2
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativecategory.cpp2
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativecategory_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativecontactdetail_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeperiod_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplace_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceattribute_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceicon_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeplaceuser_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativeratings_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativereviewmodel_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesupplier_p.h11
-rw-r--r--src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h11
-rw-r--r--src/imports/location/error_messages.cpp8
-rw-r--r--src/imports/location/error_messages.h11
-rw-r--r--src/imports/location/location.cpp15
-rw-r--r--src/imports/location/location.pro13
-rw-r--r--src/imports/location/locationvaluetypehelper_p.h11
-rw-r--r--src/imports/location/mapitemviewdelegateincubator.cpp53
-rw-r--r--src/imports/location/mapitemviewdelegateincubator.h60
-rw-r--r--src/imports/location/plugins.qmltypes136
-rw-r--r--src/imports/location/qdeclarativecirclemapitem_p.h11
-rw-r--r--src/imports/location/qdeclarativegeocodemodel.cpp78
-rw-r--r--src/imports/location/qdeclarativegeocodemodel_p.h32
-rw-r--r--src/imports/location/qdeclarativegeomaneuver_p.h11
-rw-r--r--src/imports/location/qdeclarativegeomap.cpp62
-rw-r--r--src/imports/location/qdeclarativegeomap_p.h26
-rw-r--r--src/imports/location/qdeclarativegeomapcopyrightsnotice_p.h11
-rw-r--r--src/imports/location/qdeclarativegeomapitembase_p.h11
-rw-r--r--src/imports/location/qdeclarativegeomapitemview.cpp223
-rw-r--r--src/imports/location/qdeclarativegeomapitemview_p.h56
-rw-r--r--src/imports/location/qdeclarativegeomapquickitem_p.h11
-rw-r--r--src/imports/location/qdeclarativegeomaptype_p.h11
-rw-r--r--src/imports/location/qdeclarativegeoroute_p.h11
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel.cpp96
-rw-r--r--src/imports/location/qdeclarativegeoroutemodel_p.h26
-rw-r--r--src/imports/location/qdeclarativegeoroutesegment_p.h11
-rw-r--r--src/imports/location/qdeclarativegeoserviceprovider_p.h11
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem.cpp15
-rw-r--r--src/imports/location/qdeclarativepolygonmapitem_p.h11
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem.cpp16
-rw-r--r--src/imports/location/qdeclarativepolylinemapitem_p.h11
-rw-r--r--src/imports/location/qdeclarativerectanglemapitem_p.h11
-rw-r--r--src/imports/location/qdeclarativeroutemapitem_p.h11
-rw-r--r--src/imports/location/qgeomapitemgeometry_p.h11
-rw-r--r--src/imports/location/qquickgeomapgesturearea.cpp (renamed from src/imports/location/qdeclarativegeomapgesturearea.cpp)666
-rw-r--r--src/imports/location/qquickgeomapgesturearea_p.h (renamed from src/imports/location/qdeclarativegeomapgesturearea_p.h)178
-rw-r--r--src/imports/positioning/plugins.qmltypes29
-rw-r--r--src/imports/positioning/positioning.cpp8
-rw-r--r--src/imports/positioning/positioning.pro5
-rw-r--r--src/imports/positioning/qdeclarativegeocoordinateanimation.cpp96
-rw-r--r--src/imports/positioning/qdeclarativeposition_p.h11
-rw-r--r--src/imports/positioning/qdeclarativepositionsource_p.h11
-rw-r--r--src/imports/positioning/qquickgeocoordinateanimation.cpp291
-rw-r--r--src/imports/positioning/qquickgeocoordinateanimation_p.h (renamed from src/plugins/position/blackberry/bb/ppsobject.h)85
-rw-r--r--src/imports/positioning/qquickgeocoordinateanimation_p_p.h (renamed from src/imports/positioning/qdeclarativegeocoordinateanimation_p.h)43
-rw-r--r--src/location/doc/qtlocation.qdocconf2
-rw-r--r--src/location/doc/snippets/declarative/maps.qml2
-rw-r--r--[-rwxr-xr-x]src/location/doc/snippets/declarative/nmealog.txt0
-rw-r--r--src/location/doc/snippets/declarative/places.qml2
-rw-r--r--src/location/doc/snippets/declarative/routing.qml2
-rw-r--r--src/location/doc/src/plugins/nokia.qdoc4
-rw-r--r--src/location/doc/src/plugins/osm.qdoc8
-rw-r--r--src/location/doc/src/qml-maps.qdoc3
-rw-r--r--src/location/doc/src/qtlocation.qdoc5
-rw-r--r--src/location/maps/maps.pri6
-rw-r--r--src/location/maps/qabstractgeotilecache.cpp147
-rw-r--r--src/location/maps/qabstractgeotilecache_p.h124
-rw-r--r--src/location/maps/qgeocameracapabilities.cpp2
-rw-r--r--src/location/maps/qgeocameratiles.cpp6
-rw-r--r--src/location/maps/qgeocameratiles_p.h4
-rw-r--r--src/location/maps/qgeocodereply.cpp2
-rw-r--r--src/location/maps/qgeocodingmanager.cpp11
-rw-r--r--src/location/maps/qgeocodingmanagerengine.cpp2
-rw-r--r--src/location/maps/qgeofiletilecache.cpp (renamed from src/location/maps/qgeotilecache.cpp)97
-rw-r--r--src/location/maps/qgeofiletilecache_p.h (renamed from src/location/maps/qgeotilecache_p.h)69
-rw-r--r--src/location/maps/qgeomaneuver.cpp2
-rw-r--r--src/location/maps/qgeomap.cpp14
-rw-r--r--src/location/maps/qgeomap_p.h2
-rw-r--r--src/location/maps/qgeomap_p_p.h1
-rw-r--r--src/location/maps/qgeomappingmanager.cpp2
-rw-r--r--src/location/maps/qgeomappingmanagerengine.cpp2
-rw-r--r--src/location/maps/qgeomappingmanagerengine_p.h2
-rw-r--r--src/location/maps/qgeomapscene.cpp18
-rw-r--r--src/location/maps/qgeomapscene_p.h1
-rw-r--r--src/location/maps/qgeoroute.cpp2
-rw-r--r--src/location/maps/qgeoroutereply.cpp2
-rw-r--r--src/location/maps/qgeorouterequest.cpp2
-rw-r--r--src/location/maps/qgeoroutesegment.cpp2
-rw-r--r--src/location/maps/qgeoroutingmanager.cpp2
-rw-r--r--src/location/maps/qgeoroutingmanagerengine.cpp2
-rw-r--r--src/location/maps/qgeoserviceprovider.cpp2
-rw-r--r--src/location/maps/qgeoserviceproviderfactory.cpp2
-rw-r--r--src/location/maps/qgeotiledmap.cpp70
-rw-r--r--src/location/maps/qgeotiledmap_p.h11
-rw-r--r--src/location/maps/qgeotiledmap_p_p.h10
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine.cpp56
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine_p.h25
-rw-r--r--src/location/maps/qgeotiledmappingmanagerengine_p_p.h6
-rw-r--r--src/location/maps/qgeotiledmapreply.cpp2
-rw-r--r--src/location/maps/qgeotilefetcher_p_p.h1
-rw-r--r--src/location/maps/qgeotilerequestmanager.cpp8
-rw-r--r--src/location/maps/qgeotilerequestmanager_p.h1
-rw-r--r--src/location/places/qplace.cpp2
-rw-r--r--src/location/places/qplaceattribute.cpp2
-rw-r--r--src/location/places/qplacecategory.cpp2
-rw-r--r--src/location/places/qplacecategory_p.h11
-rw-r--r--src/location/places/qplacecontent.cpp2
-rw-r--r--src/location/places/qplacecontentreply.cpp2
-rw-r--r--src/location/places/qplacecontentrequest.cpp2
-rw-r--r--src/location/places/qplacecontentrequest_p.h11
-rw-r--r--src/location/places/qplacedetailsreply.cpp2
-rw-r--r--src/location/places/qplaceeditorial.cpp2
-rw-r--r--src/location/places/qplaceeditorial.h2
-rw-r--r--src/location/places/qplaceeditorial_p.h11
-rw-r--r--src/location/places/qplaceicon.cpp2
-rw-r--r--src/location/places/qplaceidreply.cpp2
-rw-r--r--src/location/places/qplaceimage.cpp2
-rw-r--r--src/location/places/qplaceimage_p.h11
-rw-r--r--src/location/places/qplacemanager.cpp2
-rw-r--r--src/location/places/qplacemanagerengine.cpp2
-rw-r--r--src/location/places/qplacematchreply.cpp2
-rw-r--r--src/location/places/qplacematchrequest.cpp2
-rw-r--r--src/location/places/qplaceproposedsearchresult_p.h11
-rw-r--r--src/location/places/qplaceratings.cpp2
-rw-r--r--src/location/places/qplaceratings_p.h11
-rw-r--r--src/location/places/qplacereply.cpp2
-rw-r--r--src/location/places/qplaceresult.cpp2
-rw-r--r--src/location/places/qplaceresult_p.h11
-rw-r--r--src/location/places/qplacereview.cpp2
-rw-r--r--src/location/places/qplacereview_p.h11
-rw-r--r--src/location/places/qplacesearchreply.cpp2
-rw-r--r--src/location/places/qplacesearchrequest.cpp2
-rw-r--r--src/location/places/qplacesearchresult.cpp2
-rw-r--r--src/location/places/qplacesearchresult_p.h11
-rw-r--r--src/location/places/qplacesearchsuggestionreply.cpp2
-rw-r--r--src/location/places/qplacesupplier.cpp2
-rw-r--r--src/location/places/qplacesupplier_p.h11
-rw-r--r--src/location/places/qplaceuser.cpp2
-rw-r--r--src/location/places/qplaceuser_p.h11
-rw-r--r--src/location/places/unsupportedreplies_p.h11
-rw-r--r--src/location/qlocation.cpp2
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp9
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmap_nokia.h1
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp20
-rw-r--r--src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.h2
-rw-r--r--src/plugins/geoservices/osm/qgeomapreplyosm.cpp6
-rw-r--r--src/plugins/geoservices/osm/qgeotilefetcherosm.cpp5
-rw-r--r--src/plugins/position/android/src/plugin.json3
-rw-r--r--src/plugins/position/android/src/qgeopositioninfosource_android_p.h11
-rw-r--r--src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h11
-rw-r--r--src/plugins/position/blackberry/bb/ppsattribute.cpp302
-rw-r--r--src/plugins/position/blackberry/bb/ppsattribute_p.h72
-rw-r--r--src/plugins/position/blackberry/bb/ppsobject.cpp735
-rw-r--r--src/plugins/position/blackberry/bb/safeassign.h49
-rw-r--r--src/plugins/position/blackberry/blackberry.pro26
-rw-r--r--src/plugins/position/blackberry/locationmanagerutil_bb.cpp156
-rw-r--r--src/plugins/position/blackberry/locationmanagerutil_bb.h67
-rw-r--r--src/plugins/position/blackberry/plugin.json8
-rw-r--r--src/plugins/position/blackberry/qgeopositioninfosource_bb.cpp1268
-rw-r--r--src/plugins/position/blackberry/qgeopositioninfosource_bb.h137
-rw-r--r--src/plugins/position/blackberry/qgeopositioninfosource_bb_p.h118
-rw-r--r--src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.cpp62
-rw-r--r--src/plugins/position/blackberry/qgeosatelliteinfosource_bb.cpp613
-rw-r--r--src/plugins/position/blackberry/qgeosatelliteinfosource_bb_p.h97
-rw-r--r--src/plugins/position/corelocation/plugin.json3
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl.mm4
-rw-r--r--src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h11
-rw-r--r--src/plugins/position/geoclue/geoclue.pro37
-rw-r--r--src/plugins/position/geoclue/geocluetypes.cpp99
-rw-r--r--src/plugins/position/geoclue/geocluetypes.h (renamed from src/plugins/position/blackberry/qgeosatelliteinfosource_bb.h)80
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.Master.xml10
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.MasterClient.xml41
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.Position.xml25
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.Satellite.xml33
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.Velocity.xml20
-rw-r--r--src/plugins/position/geoclue/org.freedesktop.Geoclue.xml24
-rw-r--r--src/plugins/position/geoclue/plugin-satellite.json7
-rw-r--r--src/plugins/position/geoclue/plugin.json5
-rw-r--r--src/plugins/position/geoclue/qgeocluemaster.cpp125
-rw-r--r--src/plugins/position/geoclue/qgeocluemaster.h40
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp433
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.h (renamed from src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h)87
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp20
-rw-r--r--src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h23
-rw-r--r--src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp257
-rw-r--r--src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h37
-rw-r--r--src/plugins/position/gypsy/plugin.json3
-rw-r--r--src/plugins/position/position.pro6
-rw-r--r--src/plugins/position/positionpoll/plugin.json3
-rw-r--r--src/plugins/position/serialnmea/plugin.json9
-rw-r--r--src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.cpp123
-rw-r--r--src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.h (renamed from src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.h)15
-rw-r--r--src/plugins/position/serialnmea/serialnmea.pro15
-rw-r--r--src/plugins/position/simulator/plugin.json3
-rw-r--r--src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h11
-rw-r--r--src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h11
-rw-r--r--src/plugins/position/simulator/qlocationconnection_simulator_p.h11
-rw-r--r--src/plugins/position/winrt/plugin.json3
-rw-r--r--src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h11
-rw-r--r--src/positioning/doc/qtpositioning.qdocconf2
-rw-r--r--src/positioning/doc/src/qtpositioning.qdoc10
-rw-r--r--src/positioning/qdeclarativegeoaddress_p.h11
-rw-r--r--src/positioning/qdeclarativegeolocation_p.h11
-rw-r--r--src/positioning/qgeocoordinate.cpp30
-rw-r--r--src/positioning/qgeocoordinate.h3
-rw-r--r--src/positioning/qgeocoordinate_p.h15
-rw-r--r--src/positioning/qgeolocation_p.h11
-rw-r--r--src/positioning/qgeopositioninfosource.cpp6
-rw-r--r--src/positioning/qgeopositioninfosource_p.h11
-rw-r--r--src/positioning/qgeoprojection.cpp15
-rw-r--r--src/positioning/qgeoprojection_p.h4
-rw-r--r--src/positioning/qgeosatelliteinfosource.cpp6
-rw-r--r--sync.profile1
-rw-r--r--tests/applications/declarative_map/Dialog.qml171
-rw-r--r--tests/applications/declarative_map/TitleBar.qml76
-rw-r--r--tests/applications/declarative_map/blinky.gifbin3783 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/common/Button.qml96
-rw-r--r--tests/applications/declarative_map/common/Menu.qml149
-rw-r--r--tests/applications/declarative_map/common/Slider.qml109
-rw-r--r--tests/applications/declarative_map/common/TitleBar.qml86
-rw-r--r--tests/applications/declarative_map/map3d.pro19
-rw-r--r--tests/applications/declarative_map/map3d.qml1073
-rw-r--r--tests/applications/declarative_map/map3d.qrc25
-rw-r--r--tests/applications/declarative_map/map3d_mousetest.qml1049
-rw-r--r--tests/applications/declarative_map/qmlmap3d.cpp76
-rw-r--r--tests/applications/declarative_map/quit.pngbin2369 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/button.pngbin2550 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/button.sci5
-rw-r--r--tests/applications/declarative_map/resources/button_hovered.pngbin2572 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/button_pressed.pngbin2969 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/menuItem.pngbin1436 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/menuItem.sci5
-rw-r--r--tests/applications/declarative_map/resources/menuItem_hovered.pngbin1380 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/menuItem_pressed.pngbin1389 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/quit.pngbin2369 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/quit_hovered.pngbin2224 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/quit_pressed.pngbin2448 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/titlebar.pngbin1436 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/resources/titlebar.sci5
-rw-r--r--tests/applications/declarative_map/titlebar.pngbin1436 -> 0 bytes
-rw-r--r--tests/applications/declarative_map/titlebar.sci5
-rw-r--r--tests/applications/positioning_backend/main.cpp8
-rw-r--r--tests/auto/declarative_core/declarative_core.pro2
-rw-r--r--tests/auto/declarative_core/main.cpp5
-rw-r--r--tests/auto/declarative_core/tst_coordinate.qml189
-rw-r--r--tests/auto/declarative_core/tst_geocoding.qml (renamed from tests/auto/declarative_ui/tst_map_geocoding.qml)110
-rw-r--r--tests/auto/declarative_core/tst_routing.qml (renamed from tests/auto/declarative_core/tst_map_routing.qml)86
-rw-r--r--tests/auto/declarative_ui/declarative_ui.pro2
-rw-r--r--tests/auto/declarative_ui/main.cpp5
-rw-r--r--tests/auto/declarative_ui/tst_map.qml48
-rw-r--r--tests/auto/declarative_ui/tst_map_coordinateanimation.qml7
-rw-r--r--tests/auto/declarative_ui/tst_map_error.qml194
-rw-r--r--tests/auto/declarative_ui/tst_map_flick.qml307
-rw-r--r--tests/auto/declarative_ui/tst_map_item.qml7
-rw-r--r--tests/auto/declarative_ui/tst_map_item_details.qml7
-rw-r--r--tests/auto/declarative_ui/tst_map_item_fit_viewport.qml8
-rw-r--r--tests/auto/declarative_ui/tst_map_itemview.qml105
-rw-r--r--tests/auto/declarative_ui/tst_map_keepgrab.qml161
-rw-r--r--tests/auto/declarative_ui/tst_map_maptype.qml2
-rw-r--r--tests/auto/declarative_ui/tst_map_mouse.qml9
-rw-r--r--tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970 (renamed from tests/auto/declarative_ui/tst_map_pinch_and_flick.qml)483
-rw-r--r--tests/auto/geotestplugin/qgeocodingmanagerengine_test.h2
-rw-r--r--tests/auto/positionplugin/plugin.json3
-rw-r--r--tests/auto/positionplugintest/positionplugintest.pro2
-rw-r--r--tests/auto/positionplugintest/tst_positionplugin.cpp5
-rw-r--r--tests/auto/qgeoareamonitor/qgeoareamonitor.pro2
-rw-r--r--tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp5
-rw-r--r--tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp6
-rw-r--r--tests/auto/qgeocodingmanager/qgeocodingmanager.pro2
-rw-r--r--tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp5
-rw-r--r--tests/auto/qgeomapscene/tst_qgeomapscene.cpp8
-rw-r--r--tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro2
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp5
-rw-r--r--tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro2
-rw-r--r--tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp5
-rw-r--r--tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro3
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp117
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h8
-rw-r--r--tests/auto/qgeoserviceprovider/qgeoserviceprovider.pro2
-rw-r--r--tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp5
-rw-r--r--tests/auto/qmlinterface/data/TestPlace.qml2
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro2
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp5
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro2
-rw-r--r--tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp5
-rw-r--r--tests/auto/qplacemanager/qplacemanager.pro2
-rw-r--r--tests/auto/qplacemanager/tst_qplacemanager.cpp5
-rw-r--r--tests/auto/qplacemanager_unsupported/qplacemanager_unsupported.pro2
-rw-r--r--tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp5
-rw-r--r--tests/plugins/declarativetestplugin/declarativetestplugin.pro4
-rw-r--r--tests/plugins/declarativetestplugin/locationtest.cpp14
-rw-r--r--tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp7
-rw-r--r--tests/plugins/declarativetestplugin/qmldir2
334 files changed, 5174 insertions, 9150 deletions
diff --git a/.qmake.conf b/.qmake.conf
index fd7c2fa9..a9b6a329 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,4 +1,4 @@
load(qt_build_config)
CONFIG += qt_example_installs
-MODULE_VERSION = 5.5.1
+MODULE_VERSION = 5.6.0
diff --git a/config.tests/geoclue-satellite/geoclue-satellite.pro b/config.tests/geoclue-satellite/geoclue-satellite.pro
deleted file mode 100644
index 1ebc2e84..00000000
--- a/config.tests/geoclue-satellite/geoclue-satellite.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = app
-unix {
- CONFIG += link_pkgconfig
- PKGCONFIG += geoclue
-}
-SOURCES += main.cpp
diff --git a/config.tests/geoclue-satellite/main.cpp b/config.tests/geoclue-satellite/main.cpp
deleted file mode 100644
index 60bd30a0..00000000
--- a/config.tests/geoclue-satellite/main.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd, author: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module 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$
-**
-****************************************************************************/
-
-#include <geoclue/geoclue-satellite.h>
-
-int main()
-{
- GeoclueSatellite satellite;
-
- return 0;
-}
diff --git a/config.tests/geoclue/geoclue.pro b/config.tests/geoclue/geoclue.pro
deleted file mode 100644
index 1ebc2e84..00000000
--- a/config.tests/geoclue/geoclue.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = app
-unix {
- CONFIG += link_pkgconfig
- PKGCONFIG += geoclue
-}
-SOURCES += main.cpp
diff --git a/config.tests/geoclue/main.cpp b/config.tests/geoclue/main.cpp
deleted file mode 100644
index 08271c41..00000000
--- a/config.tests/geoclue/main.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Jolla Ltd.
-** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtLocation module 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$
-**
-****************************************************************************/
-
-#include <geoclue/geoclue-position.h>
-#include <geoclue/geoclue-velocity.h>
-
-int main()
-{
- GType type = geoclue_position_get_type();
- GeocluePosition position;
-
- type = geoclue_velocity_get_type();
- GeoclueVelocity velocity;
-
- return 0;
-}
diff --git a/examples/location/mapviewer/forms/RouteAddress.qml b/examples/location/mapviewer/forms/RouteAddress.qml
index 09bc80bb..248396d9 100644
--- a/examples/location/mapviewer/forms/RouteAddress.qml
+++ b/examples/location/mapviewer/forms/RouteAddress.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtPositioning 5.5
RouteAddressForm {
diff --git a/examples/location/mapviewer/map/CircleItem.qml b/examples/location/mapviewer/map/CircleItem.qml
index 3f663149..3b32ba51 100644
--- a/examples/location/mapviewer/map/CircleItem.qml
+++ b/examples/location/mapviewer/map/CircleItem.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
//TODO: remove/refactor me when items are integrated
diff --git a/examples/location/mapviewer/map/ImageItem.qml b/examples/location/mapviewer/map/ImageItem.qml
index 27456ed9..3bf4dfe2 100644
--- a/examples/location/mapviewer/map/ImageItem.qml
+++ b/examples/location/mapviewer/map/ImageItem.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
import QtQuick 2.5;
-import QtLocation 5.5
+import QtLocation 5.6
MapQuickItem { //to be used inside MapComponent only
id: imageItem
diff --git a/examples/location/mapviewer/map/MapComponent.qml b/examples/location/mapviewer/map/MapComponent.qml
index 0cb84fdf..ece4798b 100644
--- a/examples/location/mapviewer/map/MapComponent.qml
+++ b/examples/location/mapviewer/map/MapComponent.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
import QtQuick.Controls 1.4
-import QtLocation 5.5
+import QtLocation 5.6
import QtPositioning 5.5
import "../helper.js" as Helper
@@ -302,9 +302,25 @@ Map {
Keys.onPressed: {
if (event.key === Qt.Key_Plus) {
- map.zoomLevel++
+ map.zoomLevel++;
} else if (event.key === Qt.Key_Minus) {
- map.zoomLevel--
+ map.zoomLevel--;
+ } else if (event.key === Qt.Key_Left || event.key === Qt.Key_Right ||
+ event.key === Qt.Key_Up || event.key === Qt.Key_Down) {
+ var dx = 0;
+ var dy = 0;
+
+ switch (event.key) {
+
+ case Qt.Key_Left: dx = map.width / 4; break;
+ case Qt.Key_Right: dx = -map.width / 4; break;
+ case Qt.Key_Up: dy = map.height / 4; break;
+ case Qt.Key_Down: dy = -map.height / 4; break;
+
+ }
+
+ var mapCenterPoint = Qt.point(map.width / 2.0 - dx, map.height / 2.0 - dy);
+ map.center = map.toCoordinate(mapCenterPoint);
}
}
@@ -594,14 +610,22 @@ Map {
}
onDoubleClicked: {
- map.center = map.toCoordinate(Qt.point(mouse.x, mouse.y))
+ var mouseGeoPos = map.toCoordinate(Qt.point(mouse.x, mouse.y));
+ var preZoomPoint = map.fromCoordinate(mouseGeoPos, false);
if (mouse.button === Qt.LeftButton) {
- map.zoomLevel++
+ map.zoomLevel++;
} else if (mouse.button === Qt.RightButton) {
- map.zoomLevel--
+ map.zoomLevel--;
}
- lastX = -1
- lastY = -1
+ var postZoomPoint = map.fromCoordinate(mouseGeoPos, false);
+ var dx = postZoomPoint.x - preZoomPoint.x;
+ var dy = postZoomPoint.y - preZoomPoint.y;
+
+ var mapCenterPoint = Qt.point(map.width / 2.0 + dx, map.height / 2.0 + dy);
+ map.center = map.toCoordinate(mapCenterPoint);
+
+ lastX = -1;
+ lastY = -1;
}
onPressAndHold:{
diff --git a/examples/location/mapviewer/map/Marker.qml b/examples/location/mapviewer/map/Marker.qml
index a8851a4c..3c0ed170 100644
--- a/examples/location/mapviewer/map/Marker.qml
+++ b/examples/location/mapviewer/map/Marker.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5;
-import QtLocation 5.5
+import QtLocation 5.6
//! [mqi-top]
MapQuickItem {
diff --git a/examples/location/mapviewer/map/MiniMap.qml b/examples/location/mapviewer/map/MiniMap.qml
index 29a6a880..3ab9a572 100644
--- a/examples/location/mapviewer/map/MiniMap.qml
+++ b/examples/location/mapviewer/map/MiniMap.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
Rectangle{
id: miniMapRect
diff --git a/examples/location/mapviewer/map/PolygonItem.qml b/examples/location/mapviewer/map/PolygonItem.qml
index b28ff22c..cab4e6c0 100644
--- a/examples/location/mapviewer/map/PolygonItem.qml
+++ b/examples/location/mapviewer/map/PolygonItem.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
//TODO: remove me when items are integrated
diff --git a/examples/location/mapviewer/map/PolylineItem.qml b/examples/location/mapviewer/map/PolylineItem.qml
index 4861e5af..c27d8b7a 100644
--- a/examples/location/mapviewer/map/PolylineItem.qml
+++ b/examples/location/mapviewer/map/PolylineItem.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
//TODO: remove/refactor me when items are integrated
diff --git a/examples/location/mapviewer/map/RectangleItem.qml b/examples/location/mapviewer/map/RectangleItem.qml
index 57b0a483..8369c903 100644
--- a/examples/location/mapviewer/map/RectangleItem.qml
+++ b/examples/location/mapviewer/map/RectangleItem.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
MapRectangle {
id: mapRectangle
diff --git a/examples/location/mapviewer/mapviewer.qml b/examples/location/mapviewer/mapviewer.qml
index adcd3fe8..bcc2c919 100644
--- a/examples/location/mapviewer/mapviewer.qml
+++ b/examples/location/mapviewer/mapviewer.qml
@@ -40,7 +40,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
-import QtLocation 5.5
+import QtLocation 5.6
import QtPositioning 5.5
import "map"
import "menus"
diff --git a/examples/location/mapviewer/menus/MainMenu.qml b/examples/location/mapviewer/menus/MainMenu.qml
index 2d402bd0..3dc3e9fb 100644
--- a/examples/location/mapviewer/menus/MainMenu.qml
+++ b/examples/location/mapviewer/menus/MainMenu.qml
@@ -40,7 +40,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
-import QtLocation 5.5
+import QtLocation 5.6
MenuBar {
property variant providerMenu: providerMenu
diff --git a/examples/location/places/forms/SearchOptions.qml b/examples/location/places/forms/SearchOptions.qml
index 80309f0a..44115398 100644
--- a/examples/location/places/forms/SearchOptions.qml
+++ b/examples/location/places/forms/SearchOptions.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtPositioning 5.5
SearchOptionsForm {
diff --git a/examples/location/places/items/MainMenu.qml b/examples/location/places/items/MainMenu.qml
index 1437d3c3..9785c183 100644
--- a/examples/location/places/items/MainMenu.qml
+++ b/examples/location/places/items/MainMenu.qml
@@ -40,7 +40,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
-import QtLocation 5.5
+import QtLocation 5.6
MenuBar {
property variant providerMenu: providerMenu
diff --git a/examples/location/places/items/MapComponent.qml b/examples/location/places/items/MapComponent.qml
index ccf1415d..0be555db 100644
--- a/examples/location/places/items/MapComponent.qml
+++ b/examples/location/places/items/MapComponent.qml
@@ -41,7 +41,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
import "../helper.js" as Helper
Map {
@@ -211,9 +211,4 @@ Map {
map.zoomLevel = value
}
}
-
- MouseArea {
- //workaround for QTBUG-46388
- anchors.fill: parent
- }
}
diff --git a/examples/location/places/places.qml b/examples/location/places/places.qml
index 5598fdc7..0141fbb7 100644
--- a/examples/location/places/places.qml
+++ b/examples/location/places/places.qml
@@ -42,7 +42,7 @@ import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
import "items"
ApplicationWindow {
diff --git a/examples/location/places/views/CategoryDelegate.qml b/examples/location/places/views/CategoryDelegate.qml
index 75f7060e..d4562d46 100644
--- a/examples/location/places/views/CategoryDelegate.qml
+++ b/examples/location/places/views/CategoryDelegate.qml
@@ -40,7 +40,7 @@
import QtQuick 2.5
import QtQuick.Controls 1.4
-import QtLocation 5.5
+import QtLocation 5.6
Item {
id: root
diff --git a/examples/location/places/views/CategoryView.qml b/examples/location/places/views/CategoryView.qml
index b17f3e79..3cb83c73 100644
--- a/examples/location/places/views/CategoryView.qml
+++ b/examples/location/places/views/CategoryView.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQml.Models 2.1
diff --git a/examples/location/places/views/EditorialDelegate.qml b/examples/location/places/views/EditorialDelegate.qml
index 7d55e02b..82e544a1 100644
--- a/examples/location/places/views/EditorialDelegate.qml
+++ b/examples/location/places/views/EditorialDelegate.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
Item {
diff --git a/examples/location/places/views/EditorialPage.qml b/examples/location/places/views/EditorialPage.qml
index 42864ef3..caf0b7af 100644
--- a/examples/location/places/views/EditorialPage.qml
+++ b/examples/location/places/views/EditorialPage.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
diff --git a/examples/location/places/views/EditorialView.qml b/examples/location/places/views/EditorialView.qml
index e7b580ef..05d45239 100644
--- a/examples/location/places/views/EditorialView.qml
+++ b/examples/location/places/views/EditorialView.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
//! [PlaceEditorialModel view]
ListView {
diff --git a/examples/location/places/views/ImageView.qml b/examples/location/places/views/ImageView.qml
index a82a9d1d..a4495dab 100644
--- a/examples/location/places/views/ImageView.qml
+++ b/examples/location/places/views/ImageView.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
Item {
diff --git a/examples/location/places/views/ReviewDelegate.qml b/examples/location/places/views/ReviewDelegate.qml
index 97991254..7f2ba64f 100644
--- a/examples/location/places/views/ReviewDelegate.qml
+++ b/examples/location/places/views/ReviewDelegate.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
Item {
diff --git a/examples/location/places/views/ReviewPage.qml b/examples/location/places/views/ReviewPage.qml
index 2fdf3523..d3ccf73b 100644
--- a/examples/location/places/views/ReviewPage.qml
+++ b/examples/location/places/views/ReviewPage.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
diff --git a/examples/location/places/views/ReviewView.qml b/examples/location/places/views/ReviewView.qml
index 095f0947..eb8727b4 100644
--- a/examples/location/places/views/ReviewView.qml
+++ b/examples/location/places/views/ReviewView.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
//! [ReviewModel delegate]
ListView {
diff --git a/examples/location/places/views/SearchResultDelegate.qml b/examples/location/places/views/SearchResultDelegate.qml
index 5d6cb45c..a4ef9af9 100644
--- a/examples/location/places/views/SearchResultDelegate.qml
+++ b/examples/location/places/views/SearchResultDelegate.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import "../helper.js" as Helper
diff --git a/examples/location/places/views/SearchResultView.qml b/examples/location/places/views/SearchResultView.qml
index c5151f30..1c2ee17c 100644
--- a/examples/location/places/views/SearchResultView.qml
+++ b/examples/location/places/views/SearchResultView.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.5
-import QtLocation 5.5
+import QtLocation 5.6
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
diff --git a/examples/location/places_list/places_list.qml b/examples/location/places_list/places_list.qml
index 791d0aaf..cb5633ab 100644
--- a/examples/location/places_list/places_list.qml
+++ b/examples/location/places_list/places_list.qml
@@ -41,7 +41,7 @@
//! [Imports]
import QtQuick 2.0
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
//! [Imports]
Rectangle {
diff --git a/examples/location/places_map/places_map.qml b/examples/location/places_map/places_map.qml
index 7ff3706a..e7d20e7b 100644
--- a/examples/location/places_map/places_map.qml
+++ b/examples/location/places_map/places_map.qml
@@ -41,7 +41,7 @@
//! [Imports]
import QtQuick 2.0
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
//! [Imports]
Rectangle {
diff --git a/examples/location/planespotter/Plane.qml b/examples/location/planespotter/Plane.qml
index 8037f153..eec5a237 100644
--- a/examples/location/planespotter/Plane.qml
+++ b/examples/location/planespotter/Plane.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.4
-import QtLocation 5.5
+import QtLocation 5.6
//! [PlaneMapQuick1]
// Plane.qml
diff --git a/examples/location/planespotter/planespotter.qml b/examples/location/planespotter/planespotter.qml
index 91d9e056..624a015e 100644
--- a/examples/location/planespotter/planespotter.qml
+++ b/examples/location/planespotter/planespotter.qml
@@ -41,7 +41,7 @@
import QtQuick 2.4
import QtQuick.Window 2.2
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
Window {
width: 700
diff --git a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml
index 1226120d..4505319f 100644
--- a/examples/positioning/geoflickr/flickrmobile/GeoTab.qml
+++ b/examples/positioning/geoflickr/flickrmobile/GeoTab.qml
@@ -94,6 +94,15 @@ Rectangle {
id: positionSource
onPositionChanged: { planet.source = "images/sun.png"; }
+ onSourceErrorChanged: {
+ if (sourceError == PositionSource.NoError)
+ return
+
+ console.log("Source error: " + sourceError)
+ activityText.fadeOut = true
+ stop()
+ }
+
onUpdateTimeout: {
activityText.fadeOut = true
}
diff --git a/examples/positioning/satelliteinfo/main.cpp b/examples/positioning/satelliteinfo/main.cpp
index 9d417953..8d94d01c 100644
--- a/examples/positioning/satelliteinfo/main.cpp
+++ b/examples/positioning/satelliteinfo/main.cpp
@@ -54,11 +54,7 @@ int main(int argc, char *argv[])
view.setResizeMode(QQuickView::SizeRootObjectToView);
QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
-#if defined(Q_OS_QNX)
- view.showFullScreen();
-#else
view.show();
-#endif
return app.exec();
}
diff --git a/qtlocation.pro b/qtlocation.pro
index d3a1ba65..3104465f 100644
--- a/qtlocation.pro
+++ b/qtlocation.pro
@@ -1,6 +1,4 @@
load(configure)
-qtCompileTest(geoclue)
-qtCompileTest(geoclue-satellite)
qtCompileTest(gypsy)
load(qt_parts)
diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp
index 0edf09d9..ae496c1b 100644
--- a/src/imports/location/declarativeplaces/qdeclarativecategory.cpp
+++ b/src/imports/location/declarativeplaces/qdeclarativecategory.cpp
@@ -155,7 +155,7 @@ void QDeclarativeCategory::pluginReady()
/*!
\qmlproperty QPlaceCategory Category::category
- \target Category::category
+ \keyword Category::category
For details on how to use this property to interface between C++ and QML see
"\l {Category - QPlaceCategory} {Interfaces between C++ and QML Code}".
diff --git a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h
index ac8747e3..63b255b4 100644
--- a/src/imports/location/declarativeplaces/qdeclarativecategory_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativecategory_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVECATEGORY_P_H
#define QDECLARATIVECATEGORY_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtQml/qqml.h>
#include <QtQml/QQmlParserStatus>
#include <QObject>
diff --git a/src/imports/location/declarativeplaces/qdeclarativecontactdetail_p.h b/src/imports/location/declarativeplaces/qdeclarativecontactdetail_p.h
index db0a094d..9d404def 100644
--- a/src/imports/location/declarativeplaces/qdeclarativecontactdetail_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativecontactdetail_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVECONTACTDETAIL_P_H
#define QDECLARATIVECONTACTDETAIL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtLocation/QPlaceContactDetail>
#include <QtQml/QQmlPropertyMap>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeperiod_p.h b/src/imports/location/declarativeplaces/qdeclarativeperiod_p.h
index 56994eff..3ded0109 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeperiod_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeperiod_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPERIOD_P_H
#define QDECLARATIVEPERIOD_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qplaceperiod.h>
#include <QtQml/qqml.h>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
index 1488bb20..78557091 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplace_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPLACE_P_H
#define QDECLARATIVEPLACE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtQml/QQmlListProperty>
#include <QtQml/QQmlParserStatus>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute_p.h
index 451edfe2..f1c873c3 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplaceattribute_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceattribute_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPLACEATTRIBUTE_P_H
#define QDECLARATIVEPLACEATTRIBUTE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QObject>
#include <QtQml/qqml.h>
#include <QString>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceicon_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceicon_p.h
index cf588b77..23acb36e 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplaceicon_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceicon_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPLACEICON_P_H
#define QDECLARATIVEPLACEICON_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeoserviceprovider_p.h"
#include <qplaceicon.h>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
index 51d46597..8f8f3f4e 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceimagemodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPLACEIMAGEMODEL_P_H
#define QDECLARATIVEPLACEIMAGEMODEL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativeplacecontentmodel.h"
QT_BEGIN_NAMESPACE
diff --git a/src/imports/location/declarativeplaces/qdeclarativeplaceuser_p.h b/src/imports/location/declarativeplaces/qdeclarativeplaceuser_p.h
index ea9a3638..6c6ececf 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeplaceuser_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeplaceuser_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPLACEUSER_P_H
#define QDECLARATIVEPLACEUSER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtQml/qqml.h>
#include <QtLocation/QPlaceUser>
diff --git a/src/imports/location/declarativeplaces/qdeclarativeratings_p.h b/src/imports/location/declarativeplaces/qdeclarativeratings_p.h
index 596eed69..7583e703 100644
--- a/src/imports/location/declarativeplaces/qdeclarativeratings_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativeratings_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVERATINGS_P_H
#define QDECLARATIVERATINGS_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qplaceratings.h>
#include <QtQml/qqml.h>
diff --git a/src/imports/location/declarativeplaces/qdeclarativereviewmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativereviewmodel_p.h
index 343f9f7e..06bf7aa8 100644
--- a/src/imports/location/declarativeplaces/qdeclarativereviewmodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativereviewmodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEREVIEWMODEL_P_H
#define QDECLARATIVEREVIEWMODEL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativeplacecontentmodel.h"
QT_BEGIN_NAMESPACE
diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
index fb63d72c..73bf16d3 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativesearchresultmodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVESEARCHRESULTMODEL_P_H
#define QDECLARATIVESEARCHRESULTMODEL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativesearchmodelbase.h"
#include "qdeclarativecategory_p.h"
#include "qdeclarativeplace_p.h"
diff --git a/src/imports/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
index c8d30a51..49e09980 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativesearchsuggestionmodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVESEARCHSUGGESTIONMODEL_P_H
#define QDECLARATIVESEARCHSUGGESTIONMODEL_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativesearchmodelbase.h"
#include <QtCore/QStringList>
diff --git a/src/imports/location/declarativeplaces/qdeclarativesupplier_p.h b/src/imports/location/declarativeplaces/qdeclarativesupplier_p.h
index 68e7680f..35b1dbda 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesupplier_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativesupplier_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVESUPPLIER_P_H
#define QDECLARATIVESUPPLIER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QObject>
#include <QtCore/QUrl>
#include <QtQml/qqml.h>
diff --git a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
index 6026a79b..98167892 100644
--- a/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
+++ b/src/imports/location/declarativeplaces/qdeclarativesupportedcategoriesmodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVESUPPORTEDCATEGORIESMODEL_H
#define QDECLARATIVESUPPORTEDCATEGORIESMODEL_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qdeclarativegeoserviceprovider_p.h>
#include <QObject>
diff --git a/src/imports/location/error_messages.cpp b/src/imports/location/error_messages.cpp
index 3eb5ce0c..a2557f79 100644
--- a/src/imports/location/error_messages.cpp
+++ b/src/imports/location/error_messages.cpp
@@ -46,11 +46,7 @@ const char PLUGIN_ERROR[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin Error (%1
const char PLUGIN_PROVIDER_ERROR[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin Error (%1): Could not instantiate provider");
const char PLUGIN_NOT_VALID[] = QT_TRANSLATE_NOOP("QtLocationQML", "Plugin is not valid");
const char CATEGORIES_NOT_INITIALIZED[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to initialize categories");
-const char UNABLE_TO_MAKE_REQUEST[]= QT_TRANSLATE_NOOP("QtLocationQML", "Unable to create request");
-
-//often used but only visible to developer -> no translation required
-const char ROUTE_PLUGIN_NOT_SET[] = "Cannot route, plugin not set.";
-const char ROUTE_MGR_NOT_SET[] = "Cannot route, route manager not set.";
-const char COORD_NOT_BELONG_TO[] = "Coordinate does not belong to %1";
+const char UNABLE_TO_MAKE_REQUEST[] = QT_TRANSLATE_NOOP("QtLocationQML", "Unable to create request");
+const char INDEX_OUT_OF_RANGE[] = QT_TRANSLATE_NOOP("QtLocationQML", "Index '%1' out of range");
QT_END_NAMESPACE
diff --git a/src/imports/location/error_messages.h b/src/imports/location/error_messages.h
index a2e4bf49..81c43b34 100644
--- a/src/imports/location/error_messages.h
+++ b/src/imports/location/error_messages.h
@@ -33,27 +33,22 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef ERROR_MESSAGES_H
#define ERROR_MESSAGES_H
-#include <QString>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
extern const char CONTEXT_NAME[];
-
extern const char PLUGIN_PROPERTY_NOT_SET[];
extern const char PLUGIN_ERROR[];
extern const char PLUGIN_PROVIDER_ERROR[];
extern const char PLUGIN_NOT_VALID[];
-
extern const char CATEGORIES_NOT_INITIALIZED[];
-
-extern const char ROUTE_PLUGIN_NOT_SET[];
-extern const char ROUTE_MGR_NOT_SET[];
-
-extern const char COORD_NOT_BELONG_TO[];
extern const char UNABLE_TO_MAKE_REQUEST[];
+extern const char INDEX_OUT_OF_RANGE[];
QT_END_NAMESPACE
diff --git a/src/imports/location/location.cpp b/src/imports/location/location.cpp
index b78ada1a..c19a4065 100644
--- a/src/imports/location/location.cpp
+++ b/src/imports/location/location.cpp
@@ -98,7 +98,7 @@ public:
qmlRegisterType<QDeclarativeGeoMap >(uri, major, minor, "Map");
qmlRegisterUncreatableType<QDeclarativeGeoMapItemBase >(uri, major, minor, "GeoMapItemBase",
- QStringLiteral("HeoMapItemBase is not intended instantiable by developer."));
+ QStringLiteral("GeoMapItemBase is not intended instantiable by developer."));
qmlRegisterType<QDeclarativeGeoMapQuickItem >(uri, major, minor, "MapQuickItem");
qmlRegisterType<QDeclarativeGeoMapItemView >(uri, major, minor, "MapItemView");
@@ -110,8 +110,8 @@ public:
qmlRegisterType<QDeclarativeGeoManeuver >(uri, major, minor, "RouteManeuver");
qmlRegisterUncreatableType<QDeclarativeGeoMapPinchEvent >(uri, major, minor, "MapPinchEvent",
QStringLiteral("(Map)PinchEvent is not intended instantiable by developer."));
- qmlRegisterUncreatableType<QDeclarativeGeoMapGestureArea>(uri, major, minor, "MapGestureArea",
- QStringLiteral("(Map)HestureArea is not intended instantiable by developer."));
+ qmlRegisterUncreatableType<QQuickGeoMapGestureArea>(uri, major, minor, "MapGestureArea",
+ QStringLiteral("(Map)GestureArea is not intended instantiable by developer."));
qmlRegisterUncreatableType<QDeclarativeGeoMapType >(uri, major, minor, "MapType",
QStringLiteral("MapType is not intended instantiable by developer."));
qmlRegisterType<QDeclarativeCategory >(uri, major, minor, "Category");
@@ -147,9 +147,16 @@ public:
// Register the 5.5 types
// Implicitly registers 5.3 & 5.4
+
minor = 5;
+ //TODO: this is broken QTBUG-40043
qmlRegisterUncreatableType<QDeclarativeGeoMapType, 1>(uri, major, minor, "MapType",
- QStringLiteral("MapType is not intended instantiable by developer."));
+ QStringLiteral("MapType is not intended instantiable by developer."));
+ minor = 6;
+ //TODO: this is broken QTBUG-40043
+ qmlRegisterUncreatableType<QQuickGeoMapGestureArea, 1>(uri, major, minor, "MapGestureArea",
+ QStringLiteral("(Map)GestureArea is not intended instantiable by developer."));
+
//registrations below are version independent
qRegisterMetaType<QPlaceCategory>();
diff --git a/src/imports/location/location.pro b/src/imports/location/location.pro
index 53ef61a6..7441fab3 100644
--- a/src/imports/location/location.pro
+++ b/src/imports/location/location.pro
@@ -3,6 +3,7 @@ QT += quick-private network positioning-private location-private qml-private cor
INCLUDEPATH += ../../location
INCLUDEPATH += ../../location/maps
INCLUDEPATH += ../../positioning
+INCLUDEPATH += ../positioning
INCLUDEPATH *= $$PWD
HEADERS += \
@@ -24,9 +25,11 @@ HEADERS += \
qdeclarativeroutemapitem_p.h \
qgeomapitemgeometry_p.h \
qdeclarativegeomapcopyrightsnotice_p.h \
- qdeclarativegeomapgesturearea_p.h \
error_messages.h \
- locationvaluetypehelper_p.h
+ locationvaluetypehelper_p.h\
+ qquickgeomapgesturearea_p.h\
+ ../positioning/qquickgeocoordinateanimation_p.h \
+ mapitemviewdelegateincubator.h
SOURCES += \
location.cpp \
@@ -48,9 +51,11 @@ SOURCES += \
qdeclarativeroutemapitem.cpp \
qgeomapitemgeometry.cpp \
qdeclarativegeomapcopyrightsnotice.cpp \
- qdeclarativegeomapgesturearea.cpp \
error_messages.cpp \
- locationvaluetypehelper.cpp
+ locationvaluetypehelper.cpp \
+ qquickgeomapgesturearea.cpp \
+ ../positioning/qquickgeocoordinateanimation.cpp \
+ mapitemviewdelegateincubator.cpp
include(declarativeplaces/declarativeplaces.pri)
diff --git a/src/imports/location/locationvaluetypehelper_p.h b/src/imports/location/locationvaluetypehelper_p.h
index 648dae34..50038e88 100644
--- a/src/imports/location/locationvaluetypehelper_p.h
+++ b/src/imports/location/locationvaluetypehelper_p.h
@@ -37,6 +37,17 @@
#ifndef LOCATION_VALUE_TYPE_HELPER
#define LOCATION_VALUE_TYPE_HELPER
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QJSValue>
#include <QGeoCoordinate>
#include <QGeoRectangle>
diff --git a/src/imports/location/mapitemviewdelegateincubator.cpp b/src/imports/location/mapitemviewdelegateincubator.cpp
new file mode 100644
index 00000000..98f0d460
--- /dev/null
+++ b/src/imports/location/mapitemviewdelegateincubator.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Jolla Ltd, author: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mapitemviewdelegateincubator.h"
+#include "qdeclarativegeomapitemview_p.h"
+
+QT_BEGIN_NAMESPACE
+
+MapItemViewDelegateIncubator::MapItemViewDelegateIncubator(QDeclarativeGeoMapItemView *view)
+: m_view(view)
+{
+}
+
+void MapItemViewDelegateIncubator::statusChanged(QQmlIncubator::Status status)
+{
+ m_view->incubatorStatusChanged(this, status);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/location/mapitemviewdelegateincubator.h b/src/imports/location/mapitemviewdelegateincubator.h
new file mode 100644
index 00000000..aa82a6bf
--- /dev/null
+++ b/src/imports/location/mapitemviewdelegateincubator.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Jolla Ltd, author: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef MAPITEMVIEWDELEGATEINCUBATOR_H
+#define MAPITEMVIEWDELEGATEINCUBATOR_H
+
+#include <QtQml/QQmlIncubator>
+
+QT_BEGIN_NAMESPACE
+
+class QDeclarativeGeoMapItemView;
+
+class MapItemViewDelegateIncubator : public QQmlIncubator
+{
+public:
+ MapItemViewDelegateIncubator(QDeclarativeGeoMapItemView *view);
+
+protected:
+ void statusChanged(Status status) Q_DECL_OVERRIDE;
+
+private:
+ QDeclarativeGeoMapItemView *m_view;
+};
+
+QT_END_NAMESPACE
+
+#endif // MAPITEMVIEWDELEGATEINCUBATOR_H
diff --git a/src/imports/location/plugins.qmltypes b/src/imports/location/plugins.qmltypes
index 5b2a72ea..105e8713 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" }
@@ -443,6 +438,18 @@ Module {
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"
@@ -467,57 +474,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"
prototype: "QQuickItem"
@@ -620,7 +576,9 @@ Module {
"CommunicationError": 2,
"ParseError": 3,
"UnsupportedOptionError": 4,
- "UnknownError": 5
+ "UnknownError": 5,
+ "UnknownParameterError": 100,
+ "MissingRequiredParameterError": 101
}
}
Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true }
@@ -1023,7 +981,9 @@ Module {
"ParseError": 3,
"UnsupportedOptionError": 4,
"CombinationError": 5,
- "UnknownError": 6
+ "UnknownError": 6,
+ "UnknownParameterError": 100,
+ "MissingRequiredParameterError": 101
}
}
Property { name: "plugin"; type: "QDeclarativeGeoServiceProvider"; isPointer: true }
@@ -1426,6 +1386,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"
prototype: "QObject"
diff --git a/src/imports/location/qdeclarativecirclemapitem_p.h b/src/imports/location/qdeclarativecirclemapitem_p.h
index 9fb98c9a..fb786e08 100644
--- a/src/imports/location/qdeclarativecirclemapitem_p.h
+++ b/src/imports/location/qdeclarativecirclemapitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVECIRCLEMAPITEM_H
#define QDECLARATIVECIRCLEMAPITEM_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomapitembase_p.h"
#include "qdeclarativepolylinemapitem_p.h"
#include "qdeclarativepolygonmapitem_p.h"
diff --git a/src/imports/location/qdeclarativegeocodemodel.cpp b/src/imports/location/qdeclarativegeocodemodel.cpp
index 4c043d49..d8ff4e85 100644
--- a/src/imports/location/qdeclarativegeocodemodel.cpp
+++ b/src/imports/location/qdeclarativegeocodemodel.cpp
@@ -150,7 +150,7 @@ void QDeclarativeGeocodeModel::update()
return;
if (!plugin_) {
- qmlInfo(this) << QStringLiteral("Cannot geocode, plugin not set.");
+ setError(EngineNotSetError, tr("Cannot geocode, plugin not set."));
return;
}
@@ -160,17 +160,16 @@ void QDeclarativeGeocodeModel::update()
QGeoCodingManager *geocodingManager = serviceProvider->geocodingManager();
if (!geocodingManager) {
- qmlInfo(this) << QStringLiteral("Cannot geocode, geocode manager not set.");
+ setError(EngineNotSetError, tr("Cannot geocode, geocode manager not set."));
return;
}
if (!coordinate_.isValid() && (!address_ || address_->address().isEmpty()) &&
(searchString_.isEmpty())) {
- qmlInfo(this) << QStringLiteral("Cannot geocode, valid query not set.");
+ setError(ParseError, tr("Cannot geocode, valid query not set."));
return;
}
abortRequest(); // abort possible previous requests
- setErrorString(""); // clear previous error string
- setError(NoError);
+ setError(NoError, QString());
if (coordinate_.isValid()) {
setStatus(QDeclarativeGeocodeModel::Loading);
@@ -291,11 +290,31 @@ void QDeclarativeGeocodeModel::pluginReady()
{
QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
QGeoCodingManager *geocodingManager = serviceProvider->geocodingManager();
- if (!geocodingManager || serviceProvider->error() != QGeoServiceProvider::NoError) {
- qmlInfo(this) << QStringLiteral("Error: Plugin does not support (reverse) geocoding.\nError message:")
- << serviceProvider->errorString();
+
+ if (serviceProvider->error() != QGeoServiceProvider::NoError) {
+ 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(EngineNotSetError,tr("Plugin does not support (reverse) geocoding."));
return;
}
+
connect(geocodingManager, SIGNAL(finished(QGeoCodeReply*)),
this, SLOT(geocodeFinished(QGeoCodeReply*)));
connect(geocodingManager, SIGNAL(error(QGeoCodeReply*,QGeoCodeReply::Error,QString)),
@@ -362,8 +381,7 @@ void QDeclarativeGeocodeModel::geocodeFinished(QGeoCodeReply *reply)
return;
int oldCount = declarativeLocations_.count();
setLocations(reply->locations());
- setErrorString("");
- setError(NoError);
+ setError(NoError, QString());
setStatus(QDeclarativeGeocodeModel::Ready);
reply->deleteLater();
reply_ = 0;
@@ -389,8 +407,7 @@ void QDeclarativeGeocodeModel::geocodeError(QGeoCodeReply *reply,
emit locationsChanged();
emit countChanged();
}
- setErrorString(errorString);
- setError(static_cast<QDeclarativeGeocodeModel::GeocodeError>(error));
+ setError(static_cast<QDeclarativeGeocodeModel::GeocodeError>(error), errorString);
setStatus(QDeclarativeGeocodeModel::Error);
reply->deleteLater();
reply_ = 0;
@@ -428,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
*/
@@ -443,11 +464,12 @@ QDeclarativeGeocodeModel::GeocodeError QDeclarativeGeocodeModel::error() const
return error_;
}
-void QDeclarativeGeocodeModel::setError(GeocodeError error)
+void QDeclarativeGeocodeModel::setError(GeocodeError error, const QString &errorString)
{
- if (error_ == error)
+ if (error_ == error && errorString_ == errorString)
return;
error_ = error;
+ errorString_ = errorString;
emit errorChanged();
}
@@ -466,14 +488,6 @@ QString QDeclarativeGeocodeModel::errorString() const
return errorString_;
}
-void QDeclarativeGeocodeModel::setErrorString(const QString &error)
-{
- if (errorString_ == error)
- return;
- errorString_ = error;
- emit errorStringChanged();
-}
-
/*!
\internal
*/
@@ -592,8 +606,7 @@ void QDeclarativeGeocodeModel::reset()
endResetModel();
abortRequest();
- setErrorString(QString());
- setError(NoError);
+ setError(NoError, QString());
setStatus(QDeclarativeGeocodeModel::Null);
}
@@ -606,8 +619,7 @@ void QDeclarativeGeocodeModel::reset()
void QDeclarativeGeocodeModel::cancel()
{
abortRequest();
- setErrorString(QString());
- setError(NoError);
+ setError(NoError, QString());
setStatus(declarativeLocations_.isEmpty() ? Null : Ready);
}
diff --git a/src/imports/location/qdeclarativegeocodemodel_p.h b/src/imports/location/qdeclarativegeocodemodel_p.h
index 2844ee48..2fbe9937 100644
--- a/src/imports/location/qdeclarativegeocodemodel_p.h
+++ b/src/imports/location/qdeclarativegeocodemodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOCODEMODEL_H
#define QDECLARATIVEGEOCODEMODEL_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeoserviceprovider_p.h"
#include <qgeocodereply.h>
@@ -63,7 +74,7 @@ class QDeclarativeGeocodeModel : public QAbstractListModel, public QQmlParserSta
Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
+ Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged)
Q_PROPERTY(int offset READ offset WRITE setOffset NOTIFY offsetChanged)
@@ -82,12 +93,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
+ UnknownError = QGeoCodeReply::UnknownError,
+ //we leave gap for future QGeoCodeReply errors
+
+ //QGeoServiceProvider related errors start here
+ UnknownParameterError = 100,
+ MissingRequiredParameterError
};
enum Roles {
@@ -136,8 +152,7 @@ Q_SIGNALS:
void countChanged();
void pluginChanged();
void statusChanged();
- void errorStringChanged();
- void errorChanged();
+ void errorChanged(); //emitted also for errorString notification
void locationsChanged();
void autoUpdateChanged();
void boundsChanged();
@@ -159,8 +174,7 @@ protected Q_SLOTS:
protected:
QGeoCodingManager *searchManager();
void setStatus(Status status);
- void setErrorString(const QString &error);
- void setError(GeocodeError error);
+ void setError(GeocodeError error, const QString &errorString);
bool autoUpdate_;
bool complete_;
diff --git a/src/imports/location/qdeclarativegeomaneuver_p.h b/src/imports/location/qdeclarativegeomaneuver_p.h
index 5f2facad..b189d83f 100644
--- a/src/imports/location/qdeclarativegeomaneuver_p.h
+++ b/src/imports/location/qdeclarativegeomaneuver_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOMANEUVER_H
#define QDECLARATIVEGEOMANEUVER_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <qgeomaneuver.h>
#include <QtPositioning/QGeoCoordinate>
diff --git a/src/imports/location/qdeclarativegeomap.cpp b/src/imports/location/qdeclarativegeomap.cpp
index 53c40a6e..e290487e 100644
--- a/src/imports/location/qdeclarativegeomap.cpp
+++ b/src/imports/location/qdeclarativegeomap.cpp
@@ -175,7 +175,7 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
m_mappingManager(0),
m_center(51.5073,-0.1277), //London city center
m_activeMapType(0),
- m_gestureArea(0),
+ m_gestureArea(new QQuickGeoMapGestureArea(this)),
m_map(0),
m_error(QGeoServiceProvider::NoError),
m_zoomLevel(8.0),
@@ -190,8 +190,6 @@ QDeclarativeGeoMap::QDeclarativeGeoMap(QQuickItem *parent)
connect(this, SIGNAL(childrenChanged()), this, SLOT(onMapChildrenChanged()), Qt::QueuedConnection);
- // Create internal flickable and pinch area.
- m_gestureArea = new QDeclarativeGeoMapGestureArea(this, this);
m_activeMapType = new QDeclarativeGeoMapType(QGeoMapType(QGeoMapType::NoMap,
tr("No Map"),
tr("No Map"), false, false, 0), this);
@@ -279,11 +277,14 @@ void QDeclarativeGeoMap::pluginReady()
m_serviceProvider = m_plugin->sharedGeoServiceProvider();
m_mappingManager = m_serviceProvider->mappingManager();
- setError(m_serviceProvider->error(), m_serviceProvider->errorString());
+ if (m_serviceProvider->error() != QGeoServiceProvider::NoError) {
+ setError(m_serviceProvider->error(), m_serviceProvider->errorString());
+ return;
+ }
- if (!m_mappingManager || m_serviceProvider->error() != QGeoServiceProvider::NoError) {
- qmlInfo(this) << QStringLiteral("Error: Plugin does not support mapping.\nError message:")
- << m_serviceProvider->errorString();
+ if (!m_mappingManager) {
+ //TODO Should really be EngineNotSetError (see QML GeoCodeModel)
+ setError(QGeoServiceProvider::NotSupportedError, tr("Plugin does not support mapping."));
return;
}
@@ -368,7 +369,7 @@ void QDeclarativeGeoMap::touchUngrabEvent()
further details.
*/
-QDeclarativeGeoMapGestureArea *QDeclarativeGeoMap::gesture()
+QQuickGeoMapGestureArea *QDeclarativeGeoMap::gesture()
{
return m_gestureArea;
}
@@ -538,16 +539,6 @@ void QDeclarativeGeoMap::mappingManagerInitialized()
/*!
\internal
*/
-void QDeclarativeGeoMap::updateMapDisplay(const QRectF &target)
-{
- Q_UNUSED(target);
- QQuickItem::update();
-}
-
-
-/*!
- \internal
-*/
QDeclarativeGeoServiceProvider *QDeclarativeGeoMap::plugin() const
{
return m_plugin;
@@ -713,7 +704,7 @@ QGeoCoordinate QDeclarativeGeoMap::center() const
This property does not provide any change notifications.
- \since 5.5
+ \since 5.6
*/
void QDeclarativeGeoMap::setVisibleRegion(const QGeoShape &shape)
{
@@ -737,8 +728,8 @@ void QDeclarativeGeoMap::setVisibleRegion(const QGeoShape &shape)
QGeoShape QDeclarativeGeoMap::visibleRegion() const
{
- if (!width() || !height())
- return QGeoShape();
+ if (!m_map || !width() || !height())
+ return m_region;
QGeoCoordinate tl = m_map->itemPositionToCoordinate(QDoubleVector2D(0, 0));
QGeoCoordinate br = m_map->itemPositionToCoordinate(QDoubleVector2D(width(), height()));
@@ -748,6 +739,8 @@ QGeoShape QDeclarativeGeoMap::visibleRegion() const
void QDeclarativeGeoMap::fitViewportToGeoShape()
{
+ if (!m_map) return;
+
double bboxWidth;
double bboxHeight;
QGeoCoordinate centerCoordinate;
@@ -827,31 +820,33 @@ QQmlListProperty<QDeclarativeGeoMapType> QDeclarativeGeoMap::supportedMapTypes()
}
/*!
- \qmlmethod coordinate QtLocation::Map::toCoordinate(QPointF position)
+ \qmlmethod coordinate QtLocation::Map::toCoordinate(QPointF position, bool clipToViewPort)
Returns the coordinate which corresponds to the \a position relative to the map item.
- Returns an invalid coordinate if \a position is not within the current viewport.
+ If \a cliptoViewPort is \c true, or not supplied then returns an invalid coordinate if
+ \a position is not within the current viewport.
*/
-QGeoCoordinate QDeclarativeGeoMap::toCoordinate(const QPointF &position) const
+QGeoCoordinate QDeclarativeGeoMap::toCoordinate(const QPointF &position, bool clipToViewPort) const
{
if (m_map)
- return m_map->itemPositionToCoordinate(QDoubleVector2D(position));
+ return m_map->itemPositionToCoordinate(QDoubleVector2D(position), clipToViewPort);
else
return QGeoCoordinate();
}
/*!
- \qmlmethod point QtLocation::Map::fromCoordinate(coordinate coordinate)
+ \qmlmethod point QtLocation::Map::fromCoordinate(coordinate coordinate, bool clipToViewPort)
Returns the position relative to the map item which corresponds to the \a coordinate.
- Returns an invalid QPointF if \a coordinate is not within the current viewport.
+ If \a cliptoViewPort is \c true, or not supplied then returns an invalid QPointF if
+ \a coordinate is not within the current viewport.
*/
-QPointF QDeclarativeGeoMap::fromCoordinate(const QGeoCoordinate &coordinate) const
+QPointF QDeclarativeGeoMap::fromCoordinate(const QGeoCoordinate &coordinate, bool clipToViewPort) const
{
if (m_map)
- return m_map->coordinateToItemPosition(coordinate).toPointF();
+ return m_map->coordinateToItemPosition(coordinate, clipToViewPort).toPointF();
else
return QPointF(qQNaN(), qQNaN());
}
@@ -923,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.
@@ -948,9 +943,10 @@ void QDeclarativeGeoMap::touchEvent(QTouchEvent *event)
event->type() == QEvent::TouchCancel) {
ungrabTouchPoints();
}
+ } else {
+ //ignore event so sythesized event is generated;
+ QQuickItem::touchEvent(event);
}
- //this will always ignore event so sythesized event is generated;
- QQuickItem::touchEvent(event);
}
/*!
@@ -1144,6 +1140,8 @@ QDeclarativeGeoMapType * QDeclarativeGeoMap::activeMapType() const
*/
void QDeclarativeGeoMap::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
+ m_gestureArea->setSize(newGeometry.size());
+
if (!m_mappingManagerInitialized)
return;
diff --git a/src/imports/location/qdeclarativegeomap_p.h b/src/imports/location/qdeclarativegeomap_p.h
index 93f9426b..8ee58556 100644
--- a/src/imports/location/qdeclarativegeomap_p.h
+++ b/src/imports/location/qdeclarativegeomap_p.h
@@ -37,9 +37,20 @@
#ifndef QDECLARATIVEGEOMAP_H
#define QDECLARATIVEGEOMAP_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qgeoserviceprovider.h"
#include "qdeclarativegeomapitemview_p.h"
-#include "qdeclarativegeomapgesturearea_p.h"
+#include "qquickgeomapgesturearea_p.h"
#include "qgeocameradata_p.h"
#include <QtQuick/QQuickItem>
#include <QtCore/QPointer>
@@ -56,7 +67,7 @@ class QDeclarativeGeoMap : public QQuickItem
{
Q_OBJECT
Q_ENUMS(QGeoServiceProvider::Error)
- Q_PROPERTY(QDeclarativeGeoMapGestureArea *gesture READ gesture CONSTANT)
+ Q_PROPERTY(QQuickGeoMapGestureArea *gesture READ gesture CONSTANT)
Q_PROPERTY(QDeclarativeGeoServiceProvider *plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
Q_PROPERTY(qreal minimumZoomLevel READ minimumZoomLevel WRITE setMinimumZoomLevel NOTIFY minimumZoomLevelChanged)
Q_PROPERTY(qreal maximumZoomLevel READ maximumZoomLevel WRITE setMaximumZoomLevel NOTIFY maximumZoomLevelChanged)
@@ -103,14 +114,14 @@ public:
Q_INVOKABLE void clearMapItems();
QList<QObject *> mapItems();
- Q_INVOKABLE QGeoCoordinate toCoordinate(const QPointF &position) const;
- Q_INVOKABLE QPointF fromCoordinate(const QGeoCoordinate &coordinate) const;
+ Q_INVOKABLE QGeoCoordinate toCoordinate(const QPointF &position, bool clipToViewPort = true) const;
+ Q_INVOKABLE QPointF fromCoordinate(const QGeoCoordinate &coordinate, bool clipToViewPort = true) const;
#if QT_DEPRECATED_SINCE(5,5)
QT_DEPRECATED Q_INVOKABLE QPointF toScreenPosition(const QGeoCoordinate &coordinate) const;
#endif
- QDeclarativeGeoMapGestureArea *gesture();
+ QQuickGeoMapGestureArea *gesture();
Q_INVOKABLE void fitViewportToGeoShape(const QVariant &shape);
Q_INVOKABLE void fitViewportToMapItems();
@@ -152,7 +163,6 @@ protected:
void setError(QGeoServiceProvider::Error error, const QString &errorString);
private Q_SLOTS:
- void updateMapDisplay(const QRectF &target);
void mappingManagerInitialized();
void mapZoomLevelChanged(qreal zoom);
void pluginReady();
@@ -173,7 +183,7 @@ private:
QDeclarativeGeoMapType *m_activeMapType;
QList<QDeclarativeGeoMapType *> m_supportedMapTypes;
QList<QDeclarativeGeoMapItemView *> m_mapViews;
- QDeclarativeGeoMapGestureArea *m_gestureArea;
+ QQuickGeoMapGestureArea *m_gestureArea;
QGeoMap *m_map;
QPointer<QDeclarativeGeoMapCopyrightNotice> m_copyrights;
QList<QPointer<QDeclarativeGeoMapItemBase> > m_mapItems;
@@ -188,7 +198,7 @@ private:
friend class QDeclarativeGeoMapItem;
friend class QDeclarativeGeoMapItemView;
- friend class QDeclarativeGeoMapGestureArea;
+ friend class QQuickGeoMapGestureArea;
Q_DISABLE_COPY(QDeclarativeGeoMap)
};
diff --git a/src/imports/location/qdeclarativegeomapcopyrightsnotice_p.h b/src/imports/location/qdeclarativegeomapcopyrightsnotice_p.h
index 78a0ce30..6ab40111 100644
--- a/src/imports/location/qdeclarativegeomapcopyrightsnotice_p.h
+++ b/src/imports/location/qdeclarativegeomapcopyrightsnotice_p.h
@@ -38,6 +38,17 @@
#ifndef QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_H
#define QDECLARATIVEGEOMAPCOPYRIGHTSNOTICE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtGui/QImage>
#include <QtQuick/QQuickPaintedItem>
diff --git a/src/imports/location/qdeclarativegeomapitembase_p.h b/src/imports/location/qdeclarativegeomapitembase_p.h
index 2ca22821..d4ad34c5 100644
--- a/src/imports/location/qdeclarativegeomapitembase_p.h
+++ b/src/imports/location/qdeclarativegeomapitembase_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOMAPITEMBASE_H
#define QDECLARATIVEGEOMAPITEMBASE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtQuick/QQuickItem>
#include "qdeclarativegeomap_p.h"
diff --git a/src/imports/location/qdeclarativegeomapitemview.cpp b/src/imports/location/qdeclarativegeomapitemview.cpp
index 0ad69dcf..eff03b17 100644
--- a/src/imports/location/qdeclarativegeomapitemview.cpp
+++ b/src/imports/location/qdeclarativegeomapitemview.cpp
@@ -1,5 +1,7 @@
/****************************************************************************
**
+** Copyright (C) 2015 Jolla Ltd.
+** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
@@ -37,9 +39,11 @@
#include "qdeclarativegeomapitemview_p.h"
#include "qdeclarativegeomap_p.h"
#include "qdeclarativegeomapitembase_p.h"
+#include "mapitemviewdelegateincubator.h"
#include <QtCore/QAbstractItemModel>
#include <QtQml/QQmlContext>
+#include <QtQml/QQmlIncubator>
#include <QtQml/private/qqmlopenmetaobject_p.h>
QT_BEGIN_NAMESPACE
@@ -71,13 +75,15 @@ QT_BEGIN_NAMESPACE
QDeclarativeGeoMapItemView::QDeclarativeGeoMapItemView(QQuickItem *parent)
: QObject(parent), componentCompleted_(false), delegate_(0),
- itemModel_(0), map_(0), fitViewport_(false)
+ itemModel_(0), map_(0), fitViewport_(false), m_metaObjectType(0)
{
}
QDeclarativeGeoMapItemView::~QDeclarativeGeoMapItemView()
{
removeInstantiatedItems();
+ if (m_metaObjectType)
+ m_metaObjectType->release();
}
/*!
@@ -88,6 +94,49 @@ void QDeclarativeGeoMapItemView::componentComplete()
componentCompleted_ = true;
}
+void QDeclarativeGeoMapItemView::incubatorStatusChanged(MapItemViewDelegateIncubator *incubator,
+ QQmlIncubator::Status status)
+{
+ if (status == QQmlIncubator::Loading)
+ return;
+
+ for (int i = 0; i < m_itemData.length(); ++i) {
+ ItemData *itemData = m_itemData.at(i);
+ if (itemData->incubator != incubator)
+ continue;
+
+ switch (status) {
+ case QQmlIncubator::Ready:
+ itemData->item = qobject_cast<QDeclarativeGeoMapItemBase *>(incubator->object());
+ if (!itemData->item) {
+ qWarning() << "QDeclarativeGeoMapItemView map item delegate is of unsupported type.";
+ delete incubator->object();
+ } else {
+ map_->addMapItem(itemData->item);
+ if (fitViewport_)
+ fitViewport();
+ }
+ delete itemData->incubator;
+ itemData->incubator = 0;
+ break;
+ case QQmlIncubator::Null:
+ // Should never get here
+ delete itemData->incubator;
+ itemData->incubator = 0;
+ break;
+ case QQmlIncubator::Error:
+ qWarning() << "QDeclarativeGeoMapItemView map item creation failed.";
+ delete itemData->incubator;
+ itemData->incubator = 0;
+ break;
+ default:
+ ;
+ }
+
+ break;
+ }
+}
+
/*!
\qmlproperty model QtLocation::MapItemView::model
@@ -111,6 +160,14 @@ void QDeclarativeGeoMapItemView::setModel(const QVariant &model)
this, SLOT(itemModelRowsRemoved(QModelIndex,int,int)));
disconnect(itemModel_, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(itemModelRowsInserted(QModelIndex,int,int)));
+ disconnect(itemModel_, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(itemModelRowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ disconnect(itemModel_, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ this, SLOT(itemModelDataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ removeInstantiatedItems();
+ m_metaObjectType->release();
+ m_metaObjectType = 0;
itemModel_ = 0;
}
@@ -122,9 +179,18 @@ void QDeclarativeGeoMapItemView::setModel(const QVariant &model)
this, SLOT(itemModelRowsRemoved(QModelIndex,int,int)));
connect(itemModel_, SIGNAL(rowsInserted(QModelIndex,int,int)),
this, SLOT(itemModelRowsInserted(QModelIndex,int,int)));
+ connect(itemModel_, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
+ this, SLOT(itemModelRowsMoved(QModelIndex,int,int,QModelIndex,int)));
+ connect(itemModel_, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ this, SLOT(itemModelDataChanged(QModelIndex,QModelIndex,QVector<int>)));
+
+ m_metaObjectType = new QQmlOpenMetaObjectType(&QObject::staticMetaObject, 0);
+ foreach (const QByteArray &name, itemModel_->roleNames())
+ m_metaObjectType->createProperty(name);
+
+ instantiateAllItems();
}
- repopulate();
emit modelChanged();
}
@@ -146,15 +212,11 @@ void QDeclarativeGeoMapItemView::itemModelRowsInserted(const QModelIndex &index,
if (!componentCompleted_ || !map_ || !delegate_ || !itemModel_)
return;
- QDeclarativeGeoMapItemBase *mapItem;
for (int i = start; i <= end; ++i) {
- mapItem = createItemFromItemModel(i);
- if (!mapItem) {
- break;
- }
- mapItemList_.append(mapItem);
- map_->addMapItem(mapItem);
+ const QModelIndex insertedIndex = itemModel_->index(i, 0, index);
+ createItemForIndex(insertedIndex);
}
+
if (fitViewport_)
fitViewport();
}
@@ -170,17 +232,56 @@ void QDeclarativeGeoMapItemView::itemModelRowsRemoved(const QModelIndex &index,
return;
for (int i = end; i >= start; --i) {
- QDeclarativeGeoMapItemBase *mapItem = mapItemList_.takeAt(i);
- Q_ASSERT(mapItem);
- if (!mapItem) // bad
+ ItemData *itemData = m_itemData.takeAt(i);
+ if (!itemData)
break;
- map_->removeMapItem(mapItem);
- mapItem->deleteLater();
+
+ map_->removeMapItem(itemData->item);
+ delete itemData;
}
+
if (fitViewport_)
fitViewport();
}
+void QDeclarativeGeoMapItemView::itemModelRowsMoved(const QModelIndex &parent, int start, int end,
+ const QModelIndex &destination, int row)
+{
+ Q_UNUSED(parent)
+ Q_UNUSED(start)
+ Q_UNUSED(end)
+ Q_UNUSED(destination)
+ Q_UNUSED(row)
+
+ qWarning() << "QDeclarativeGeoMapItemView does not support models that move rows.";
+}
+
+void QDeclarativeGeoMapItemView::itemModelDataChanged(const QModelIndex &topLeft,
+ const QModelIndex &bottomRight,
+ const QVector<int> &roles)
+{
+ Q_UNUSED(roles)
+
+ for (int i = topLeft.row(); i <= bottomRight.row(); ++i) {
+ const QModelIndex index = itemModel_->index(i, 0);
+ ItemData *itemData = m_itemData.at(i);
+
+ QHashIterator<int, QByteArray> iterator(itemModel_->roleNames());
+ while (iterator.hasNext()) {
+ iterator.next();
+
+ QVariant modelData = itemModel_->data(index, iterator.key());
+ if (!modelData.isValid())
+ continue;
+
+ itemData->context->setContextProperty(QString::fromLatin1(iterator.value().constData()),
+ modelData);
+
+ itemData->modelDataMeta->setValue(iterator.value(), modelData);
+ }
+ }
+}
+
/*!
\qmlproperty Component QtLocation::MapItemView::delegate
@@ -254,87 +355,87 @@ void QDeclarativeGeoMapItemView::removeInstantiatedItems()
{
if (!map_)
return;
- foreach (QDeclarativeGeoMapItemBase *mapItem, mapItemList_) {
- mapItem->deleteLater();
- map_->removeMapItem(mapItem);
+
+ foreach (ItemData *itemData, m_itemData) {
+ map_->removeMapItem(itemData->item);
+ delete itemData;
}
- mapItemList_.clear();
+ m_itemData.clear();
}
/*!
\internal
- Removes and repopulates all items.
+
+ Instantiates all items.
*/
-void QDeclarativeGeoMapItemView::repopulate()
+void QDeclarativeGeoMapItemView::instantiateAllItems()
{
- // Free any earlier instances
- removeInstantiatedItems();
-
if (!componentCompleted_ || !map_ || !delegate_ || !itemModel_)
return;
- // Iterate model data and instantiate delegates.
for (int i = 0; i < itemModel_->rowCount(); ++i) {
- QDeclarativeGeoMapItemBase *mapItem = createItemFromItemModel(i);
- Q_ASSERT(mapItem);
- if (!mapItem) // bad
- break;
- mapItemList_.append(mapItem);
- map_->addMapItem(mapItem);
+ const QModelIndex index = itemModel_->index(i, 0);
+ createItemForIndex(index);
}
+
if (fitViewport_)
fitViewport();
}
/*!
\internal
+ Removes and repopulates all items.
+*/
+void QDeclarativeGeoMapItemView::repopulate()
+{
+ removeInstantiatedItems();
+ instantiateAllItems();
+}
+
+/*!
+ \internal
*/
-QDeclarativeGeoMapItemBase *QDeclarativeGeoMapItemView::createItemFromItemModel(int modelRow)
+void QDeclarativeGeoMapItemView::createItemForIndex(const QModelIndex &index)
{
- if (!delegate_ || !itemModel_)
- return 0;
+ // Expected to be already tested by caller.
+ Q_ASSERT(delegate_);
+ Q_ASSERT(itemModel_);
- QModelIndex index = itemModel_->index(modelRow, 0); // column 0
- if (!index.isValid()) {
- qWarning() << "QDeclarativeGeoMapItemView Index is not valid: " << modelRow;
- return 0;
- }
+ ItemData *itemData = new ItemData;
- QObject *model = new QObject(this);
- QQmlOpenMetaObject *modelMetaObject = new QQmlOpenMetaObject(model);
+ itemData->modelData = new QObject;
+ itemData->modelDataMeta = new QQmlOpenMetaObject(itemData->modelData, m_metaObjectType, false);
+ itemData->context = new QQmlContext(qmlContext(this));
QHashIterator<int, QByteArray> iterator(itemModel_->roleNames());
- QQmlContext *itemContext = new QQmlContext(qmlContext(this));
while (iterator.hasNext()) {
iterator.next();
+
QVariant modelData = itemModel_->data(index, iterator.key());
if (!modelData.isValid())
continue;
- itemContext->setContextProperty(QString::fromLatin1(iterator.value().constData()),
- modelData);
+ itemData->context->setContextProperty(QString::fromLatin1(iterator.value().constData()),
+ modelData);
- modelMetaObject->setValue(iterator.value(), modelData);
+ itemData->modelDataMeta->setValue(iterator.value(), modelData);
}
- itemContext->setContextProperty(QStringLiteral("model"), model);
- itemContext->setContextProperty(QStringLiteral("index"), modelRow);
- QObject *obj = delegate_->create(itemContext);
+ itemData->context->setContextProperty(QLatin1String("model"), itemData->modelData);
+ itemData->context->setContextProperty(QLatin1String("index"), index.row());
- if (!obj) {
- qWarning() << "QDeclarativeGeoMapItemView map item creation failed.";
- delete itemContext;
- return 0;
- }
- QDeclarativeGeoMapItemBase *declMapObj = qobject_cast<QDeclarativeGeoMapItemBase *>(obj);
- if (!declMapObj) {
- qWarning() << "QDeclarativeGeoMapItemView map item delegate is of unsupported type.";
- delete itemContext;
- return 0;
- }
- itemContext->setParent(declMapObj);
- model->setParent(declMapObj);
- return declMapObj;
+ itemData->incubator = new MapItemViewDelegateIncubator(this);
+ delegate_->create(*itemData->incubator, itemData->context);
+
+ m_itemData.insert(index.row(), itemData);
+}
+
+QDeclarativeGeoMapItemView::ItemData::~ItemData()
+{
+ delete incubator;
+ delete item;
+ delete context;
+ delete modelData;
}
#include "moc_qdeclarativegeomapitemview_p.cpp"
diff --git a/src/imports/location/qdeclarativegeomapitemview_p.h b/src/imports/location/qdeclarativegeomapitemview_p.h
index b39a47f0..004e3fb9 100644
--- a/src/imports/location/qdeclarativegeomapitemview_p.h
+++ b/src/imports/location/qdeclarativegeomapitemview_p.h
@@ -1,5 +1,7 @@
/****************************************************************************
**
+** Copyright (C) 2015 Jolla Ltd.
+** Contact: Aaron McCarthy <aaron.mccarthy@jollamobile.com>
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
@@ -37,8 +39,20 @@
#ifndef QDECLARATIVEGEOMAPITEMVIEW_H
#define QDECLARATIVEGEOMAPITEMVIEW_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QModelIndex>
#include <QtQml/QQmlParserStatus>
+#include <QtQml/QQmlIncubator>
#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -48,6 +62,9 @@ class QQmlComponent;
class QQuickItem;
class QDeclarativeGeoMap;
class QDeclarativeGeoMapItemBase;
+class QQmlOpenMetaObject;
+class QQmlOpenMetaObjectType;
+class MapItemViewDelegateIncubator;
class QDeclarativeGeoMapItemView : public QObject, public QQmlParserStatus
{
@@ -75,6 +92,7 @@ public:
void setMap(QDeclarativeGeoMap *);
void repopulate();
void removeInstantiatedItems();
+ void instantiateAllItems();
qreal zValue();
void setZValue(qreal zValue);
@@ -88,25 +106,53 @@ Q_SIGNALS:
void delegateChanged();
void autoFitViewportChanged();
-private:
- QDeclarativeGeoMapItemBase *createItemFromItemModel(int modelRow);
-
- void fitViewport();
+protected:
+ void incubatorStatusChanged(MapItemViewDelegateIncubator *incubator,
+ QQmlIncubator::Status status);
private Q_SLOTS:
void itemModelReset();
void itemModelRowsInserted(const QModelIndex &index, int start, int end);
void itemModelRowsRemoved(const QModelIndex &index, int start, int end);
+ void itemModelRowsMoved(const QModelIndex &parent, int start, int end,
+ const QModelIndex &destination, int row);
+ void itemModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
+ const QVector<int> &roles);
private:
+ struct ItemData {
+ ItemData()
+ : incubator(0), item(0), context(0), modelData(0), modelDataMeta(0)
+ {
+ }
+
+ ~ItemData();
+
+ MapItemViewDelegateIncubator *incubator;
+ QDeclarativeGeoMapItemBase *item;
+ QQmlContext *context;
+ QObject *modelData;
+ QQmlOpenMetaObject *modelDataMeta;
+ };
+
+ void createItemForIndex(const QModelIndex &index);
+ void fitViewport();
+
bool componentCompleted_;
QQmlComponent *delegate_;
QAbstractItemModel *itemModel_;
QDeclarativeGeoMap *map_;
- QList<QDeclarativeGeoMapItemBase *> mapItemList_;
+ QVector<ItemData *> m_itemData;
bool fitViewport_;
+
+ QQmlOpenMetaObjectType *m_metaObjectType;
+
+ friend class QTypeInfo<ItemData>;
+ friend class MapItemViewDelegateIncubator;
};
+Q_DECLARE_TYPEINFO(QDeclarativeGeoMapItemView::ItemData, Q_MOVABLE_TYPE);
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QDeclarativeGeoMapItemView)
diff --git a/src/imports/location/qdeclarativegeomapquickitem_p.h b/src/imports/location/qdeclarativegeomapquickitem_p.h
index 2be5457c..af9f6ec6 100644
--- a/src/imports/location/qdeclarativegeomapquickitem_p.h
+++ b/src/imports/location/qdeclarativegeomapquickitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOMAPQUICKITEM_H
#define QDECLARATIVEGEOMAPQUICKITEM_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtQuick/QQuickItem>
#include <QtQuick/QSGNode>
diff --git a/src/imports/location/qdeclarativegeomaptype_p.h b/src/imports/location/qdeclarativegeomaptype_p.h
index 903b6aac..980c594a 100644
--- a/src/imports/location/qdeclarativegeomaptype_p.h
+++ b/src/imports/location/qdeclarativegeomaptype_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOMAPTYPE_H
#define QDECLARATIVEGEOMAPTYPE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtQml/qqml.h>
#include <QtLocation/private/qgeomaptype_p.h>
diff --git a/src/imports/location/qdeclarativegeoroute_p.h b/src/imports/location/qdeclarativegeoroute_p.h
index 42fa6789..9bb46087 100644
--- a/src/imports/location/qdeclarativegeoroute_p.h
+++ b/src/imports/location/qdeclarativegeoroute_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOROUTE_H
#define QDECLARATIVEGEOROUTE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeoroutesegment_p.h"
#include <QtCore/QObject>
diff --git a/src/imports/location/qdeclarativegeoroutemodel.cpp b/src/imports/location/qdeclarativegeoroutemodel.cpp
index b59e6b8e..0c64c23a 100644
--- a/src/imports/location/qdeclarativegeoroutemodel.cpp
+++ b/src/imports/location/qdeclarativegeoroutemodel.cpp
@@ -169,8 +169,7 @@ void QDeclarativeGeoRouteModel::reset()
}
abortRequest();
- setErrorString(QString());
- setError(NoError);
+ setError(NoError, QString());
setStatus(QDeclarativeGeoRouteModel::Null);
}
@@ -183,8 +182,7 @@ void QDeclarativeGeoRouteModel::reset()
void QDeclarativeGeoRouteModel::cancel()
{
abortRequest();
- setErrorString(QString());
- setError(NoError);
+ setError(NoError, QString());
setStatus(routes_.isEmpty() ? Null : Ready);
}
@@ -214,8 +212,7 @@ void QDeclarativeGeoRouteModel::abortRequest()
QDeclarativeGeoRoute *QDeclarativeGeoRouteModel::get(int index)
{
if (index < 0 || index >= routes_.count()) {
- qmlInfo(this) << QStringLiteral("Error, invalid index for get():")
- << index;
+ qmlInfo(this) << QStringLiteral("Index '%1' out of range").arg(index);
return 0;
}
return routes_.at(index);
@@ -308,11 +305,31 @@ void QDeclarativeGeoRouteModel::pluginReady()
{
QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
QGeoRoutingManager *routingManager = serviceProvider->routingManager();
- if (!routingManager || serviceProvider->error() != QGeoServiceProvider::NoError) {
- qmlInfo(this) << QStringLiteral("Error: Plugin does not support routing.\nError message:")
- << serviceProvider->errorString();
+
+ if (serviceProvider->error() != QGeoServiceProvider::NoError) {
+ 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(EngineNotSetError, tr("Plugin does not support routing."));
return;
}
+
connect(routingManager, SIGNAL(finished(QGeoRouteReply*)),
this, SLOT(routingFinished(QGeoRouteReply*)));
connect(routingManager, SIGNAL(error(QGeoRouteReply*,QGeoRouteReply::Error,QString)),
@@ -420,20 +437,16 @@ bool QDeclarativeGeoRouteModel::autoUpdate() const
*/
void QDeclarativeGeoRouteModel::setMeasurementSystem(QLocale::MeasurementSystem ms)
{
- if (!plugin_) {
- qmlInfo(this) << ROUTE_PLUGIN_NOT_SET;
+ if (!plugin_)
return;
- }
QGeoServiceProvider *serviceProvider = plugin_->sharedGeoServiceProvider();
if (!serviceProvider)
return;
QGeoRoutingManager *routingManager = serviceProvider->routingManager();
- if (!routingManager) {
- qmlInfo(this) << ROUTE_MGR_NOT_SET;
+ if (!routingManager)
return;
- }
if (routingManager->measurementSystem() == ms)
return;
@@ -457,7 +470,6 @@ QLocale::MeasurementSystem QDeclarativeGeoRouteModel::measurementSystem() const
QGeoRoutingManager *routingManager = serviceProvider->routingManager();
if (!routingManager) {
- qmlInfo(this) << ROUTE_MGR_NOT_SET;
if (plugin_->locales().isEmpty())
return QLocale().measurementSystem();
@@ -500,20 +512,6 @@ QDeclarativeGeoRouteModel::Status QDeclarativeGeoRouteModel::status() const
}
/*!
- \internal
-*/
-void QDeclarativeGeoRouteModel::setErrorString(const QString &error)
-{
- if (errorString_ == error)
- return;
-
- errorString_ = error;
-
- if (complete_)
- emit errorStringChanged();
-}
-
-/*!
\qmlproperty string QtLocation::RouteModel::errorString
This read-only property holds the textual presentation of the latest routing error.
@@ -534,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
*/
@@ -548,11 +550,12 @@ QDeclarativeGeoRouteModel::RouteError QDeclarativeGeoRouteModel::error() const
return error_;
}
-void QDeclarativeGeoRouteModel::setError(RouteError error)
+void QDeclarativeGeoRouteModel::setError(RouteError error, const QString& errorString)
{
- if (error_ == error)
+ if (error_ == error && errorString_ == errorString)
return;
error_ = error;
+ errorString_ = errorString;
emit errorChanged();
}
@@ -569,7 +572,7 @@ void QDeclarativeGeoRouteModel::update()
return;
if (!plugin_) {
- qmlInfo(this) << ROUTE_PLUGIN_NOT_SET;
+ setError(EngineNotSetError, tr("Cannot route, plugin not set."));
return;
}
@@ -579,22 +582,21 @@ void QDeclarativeGeoRouteModel::update()
QGeoRoutingManager *routingManager = serviceProvider->routingManager();
if (!routingManager) {
- qmlInfo(this) << ROUTE_MGR_NOT_SET;
+ setError(EngineNotSetError, tr("Cannot route, route manager not set."));
return;
}
if (!routeQuery_) {
- qmlInfo(this) << QStringLiteral("Cannot route, valid query not set.");
+ setError(ParseError,"Cannot route, valid query not set.");
return;
}
abortRequest(); // Clear previus requests
QGeoRouteRequest request = routeQuery_->routeRequest();
if (request.waypoints().count() < 2) {
- qmlInfo(this) << QStringLiteral("Not enough waypoints for routing.");
+ setError(ParseError,tr("Not enough waypoints for routing."));
return;
}
- setErrorString(""); // clear previous error string
- setError(NoError);
+ setError(NoError, QString());
reply_ = routingManager->calculateRoute(request);
setStatus(QDeclarativeGeoRouteModel::Loading);
@@ -627,8 +629,7 @@ void QDeclarativeGeoRouteModel::routingFinished(QGeoRouteReply *reply)
}
endResetModel();
- setErrorString("");
- setError(NoError);
+ setError(NoError, QString());
setStatus(QDeclarativeGeoRouteModel::Ready);
reply->deleteLater();
@@ -649,8 +650,7 @@ void QDeclarativeGeoRouteModel::routingError(QGeoRouteReply *reply,
{
if (reply != reply_)
return;
- setErrorString(errorString);
- setError(static_cast<QDeclarativeGeoRouteModel::RouteError>(error));
+ setError(static_cast<QDeclarativeGeoRouteModel::RouteError>(error), errorString);
setStatus(QDeclarativeGeoRouteModel::Error);
reply->deleteLater();
reply_ = 0;
diff --git a/src/imports/location/qdeclarativegeoroutemodel_p.h b/src/imports/location/qdeclarativegeoroutemodel_p.h
index c820aa52..66769ea7 100644
--- a/src/imports/location/qdeclarativegeoroutemodel_p.h
+++ b/src/imports/location/qdeclarativegeoroutemodel_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOROUTEMODEL_H
#define QDECLARATIVEGEOROUTEMODEL_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeoserviceprovider_p.h"
#include <QtPositioning/QGeoCoordinate>
@@ -70,7 +81,7 @@ class QDeclarativeGeoRouteModel : public QAbstractListModel, public QQmlParserSt
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(bool autoUpdate READ autoUpdate WRITE setAutoUpdate NOTIFY autoUpdateChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
+ Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
Q_PROPERTY(RouteError error READ error NOTIFY errorChanged)
Q_PROPERTY(QLocale::MeasurementSystem measurementSystem READ measurementSystem WRITE setMeasurementSystem NOTIFY measurementSystemChanged)
@@ -94,7 +105,12 @@ public:
CommunicationError = QGeoRouteReply::CommunicationError,
ParseError = QGeoRouteReply::ParseError,
UnsupportedOptionError = QGeoRouteReply::UnsupportedOptionError,
- UnknownError = QGeoRouteReply::UnknownError
+ UnknownError = QGeoRouteReply::UnknownError,
+ //we leave gap for future QGeoRouteReply errors
+
+ //QGeoServiceProvider related errors start here
+ UnknownParameterError = 100,
+ MissingRequiredParameterError
};
explicit QDeclarativeGeoRouteModel(QObject *parent = 0);
@@ -136,8 +152,7 @@ Q_SIGNALS:
void queryChanged();
void autoUpdateChanged();
void statusChanged();
- void errorStringChanged();
- void errorChanged();
+ void errorChanged(); //emitted also for errorString notification
void routesChanged();
void measurementSystemChanged();
@@ -154,8 +169,7 @@ private Q_SLOTS:
private:
void setStatus(Status status);
- void setErrorString(const QString &error);
- void setError(RouteError error);
+ void setError(RouteError error, const QString &errorString);
void abortRequest();
bool complete_;
diff --git a/src/imports/location/qdeclarativegeoroutesegment_p.h b/src/imports/location/qdeclarativegeoroutesegment_p.h
index b02e8f2b..e6cf5aa5 100644
--- a/src/imports/location/qdeclarativegeoroutesegment_p.h
+++ b/src/imports/location/qdeclarativegeoroutesegment_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEGEOROUTESEGMENT_H
#define QDECLARATIVEGEOROUTESEGMENT_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomaneuver_p.h"
#include <QtCore/QObject>
diff --git a/src/imports/location/qdeclarativegeoserviceprovider_p.h b/src/imports/location/qdeclarativegeoserviceprovider_p.h
index 56529aa6..f7a2ee83 100644
--- a/src/imports/location/qdeclarativegeoserviceprovider_p.h
+++ b/src/imports/location/qdeclarativegeoserviceprovider_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEQGEOSERVICEPROVIDER_H
#define QDECLARATIVEQGEOSERVICEPROVIDER_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
diff --git a/src/imports/location/qdeclarativepolygonmapitem.cpp b/src/imports/location/qdeclarativepolygonmapitem.cpp
index 5b94d009..9a71614f 100644
--- a/src/imports/location/qdeclarativepolygonmapitem.cpp
+++ b/src/imports/location/qdeclarativepolygonmapitem.cpp
@@ -448,26 +448,19 @@ void QDeclarativePolygonMapItem::addCoordinate(const QGeoCoordinate &coordinate)
/*!
\qmlmethod void MapPolygon::removeCoordinate(coordinate)
- Removes a coordinate from the path. If there are multiple instances of the
+ Removes \a coordinate from the path. If there are multiple instances of the
same coordinate, the one added last is removed.
- \sa addCoordinate, path
+ If \a coordinate is not in the path this method does nothing.
+ \sa addCoordinate, path
*/
-
void QDeclarativePolygonMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
int index = path_.lastIndexOf(coordinate);
-
- if (index == -1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem");
+ if (index == -1)
return;
- }
- if (path_.count() < index + 1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolygonMapItem");
- return;
- }
path_.removeAt(index);
geometry_.markSourceDirty();
diff --git a/src/imports/location/qdeclarativepolygonmapitem_p.h b/src/imports/location/qdeclarativepolygonmapitem_p.h
index 38249354..86a9ec4c 100644
--- a/src/imports/location/qdeclarativepolygonmapitem_p.h
+++ b/src/imports/location/qdeclarativepolygonmapitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPOLYGONMAPITEM
#define QDECLARATIVEPOLYGONMAPITEM
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomapitembase_p.h"
#include "qdeclarativepolylinemapitem_p.h"
#include "qgeomapitemgeometry_p.h"
diff --git a/src/imports/location/qdeclarativepolylinemapitem.cpp b/src/imports/location/qdeclarativepolylinemapitem.cpp
index f39c6f53..9201701c 100644
--- a/src/imports/location/qdeclarativepolylinemapitem.cpp
+++ b/src/imports/location/qdeclarativepolylinemapitem.cpp
@@ -570,25 +570,19 @@ void QDeclarativePolylineMapItem::addCoordinate(const QGeoCoordinate &coordinate
/*!
\qmlmethod void MapPolyline::removeCoordinate(coordinate)
- Removes a coordinate from the path. If there are multiple instances of the
+ Removes \a coordinate from the path. If there are multiple instances of the
same coordinate, the one added last is removed.
+ If \a coordinate is not in the path this method does nothing.
+
\sa addCoordinate, path
*/
-
void QDeclarativePolylineMapItem::removeCoordinate(const QGeoCoordinate &coordinate)
{
int index = path_.lastIndexOf(coordinate);
-
- if (index == -1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem");
+ if (index == -1)
return;
- }
- if (path_.count() < index + 1) {
- qmlInfo(this) << COORD_NOT_BELONG_TO << QStringLiteral("PolylineMapItem");
- return;
- }
path_.removeAt(index);
geometry_.markSourceDirty();
@@ -732,7 +726,7 @@ QSGNode *QDeclarativePolylineMapItem::updateMapItemPaintNode(QSGNode *oldNode, U
}
//TODO: update only material
- if (geometry_.isScreenDirty() || dirtyMaterial_) {
+ if (geometry_.isScreenDirty() || dirtyMaterial_ || !oldNode) {
node->update(line_.color(), &geometry_);
geometry_.setPreserveGeometry(false);
geometry_.markClean();
diff --git a/src/imports/location/qdeclarativepolylinemapitem_p.h b/src/imports/location/qdeclarativepolylinemapitem_p.h
index 8822f49d..6eeeb11f 100644
--- a/src/imports/location/qdeclarativepolylinemapitem_p.h
+++ b/src/imports/location/qdeclarativepolylinemapitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEPOLYLINEMAPITEM
#define QDECLARATIVEPOLYLINEMAPITEM
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomapitembase_p.h"
#include "qgeomapitemgeometry_p.h"
diff --git a/src/imports/location/qdeclarativerectanglemapitem_p.h b/src/imports/location/qdeclarativerectanglemapitem_p.h
index 6046c190..d4c319ab 100644
--- a/src/imports/location/qdeclarativerectanglemapitem_p.h
+++ b/src/imports/location/qdeclarativerectanglemapitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVERECTANGLEMAPITEM_H_
#define QDECLARATIVERECTANGLEMAPITEM_H_
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomapitembase_p.h"
#include "qgeomapitemgeometry_p.h"
#include "qdeclarativepolylinemapitem_p.h"
diff --git a/src/imports/location/qdeclarativeroutemapitem_p.h b/src/imports/location/qdeclarativeroutemapitem_p.h
index 5ba9f071..9bb3a443 100644
--- a/src/imports/location/qdeclarativeroutemapitem_p.h
+++ b/src/imports/location/qdeclarativeroutemapitem_p.h
@@ -37,6 +37,17 @@
#ifndef QDECLARATIVEROUTEMAPITEM_H_
#define QDECLARATIVEROUTEMAPITEM_H_
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativegeomapitembase_p.h"
#include "qdeclarativegeomap_p.h"
#include "qdeclarativepolylinemapitem_p.h"
diff --git a/src/imports/location/qgeomapitemgeometry_p.h b/src/imports/location/qgeomapitemgeometry_p.h
index eac90042..36b670f9 100644
--- a/src/imports/location/qgeomapitemgeometry_p.h
+++ b/src/imports/location/qgeomapitemgeometry_p.h
@@ -37,6 +37,17 @@
#ifndef QGEOMAPITEMGEOMETRY_H
#define QGEOMAPITEMGEOMETRY_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QPainterPath>
#include <QPointF>
#include <QRectF>
diff --git a/src/imports/location/qdeclarativegeomapgesturearea.cpp b/src/imports/location/qquickgeomapgesturearea.cpp
index 68178e6d..baa9e702 100644
--- a/src/imports/location/qdeclarativegeomapgesturearea.cpp
+++ b/src/imports/location/qquickgeomapgesturearea.cpp
@@ -34,7 +34,7 @@
**
****************************************************************************/
-#include "qdeclarativegeomapgesturearea_p.h"
+#include "qquickgeomapgesturearea_p.h"
#include "qdeclarativegeomap_p.h"
#include "qgeomapcontroller_p.h"
#include "error_messages.h"
@@ -144,7 +144,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype MapGestureArea
- \instantiates QDeclarativeGeoMapGestureArea
+ \instantiates QQuickGeoMapGestureArea
\inqmlmodule QtLocation
@@ -331,104 +331,126 @@ QT_BEGIN_NAMESPACE
The corresponding handler is \c onFlickFinished.
*/
-static void registerQGeoCoordinateInterpolator()
+QQuickGeoMapGestureArea::QQuickGeoMapGestureArea(QDeclarativeGeoMap *map)
+ : QQuickItem(map),
+ m_map(0),
+ m_declarativeMap(map),
+ m_enabled(true),
+ m_activeGestures(ZoomGesture | PanGesture | FlickGesture),
+ m_preventStealing(false)
{
- // required by QPropertyAnimation
- qRegisterAnimationInterpolator<QGeoCoordinate>(geoCoordinateInterpolator);
+ m_flick.m_enabled = true,
+ m_flick.m_maxVelocity = QML_MAP_FLICK_DEFAULTMAXVELOCITY;
+ m_flick.m_deceleration = QML_MAP_FLICK_DEFAULTDECELERATION;
+ m_flick.m_animation = 0;
+ m_touchPointState = touchPoints0;
+ m_pinchState = pinchInactive;
+ m_flickState = flickInactive;
}
-Q_CONSTRUCTOR_FUNCTION(registerQGeoCoordinateInterpolator)
-static void unregisterQGeoCoordinateInterpolator()
+/*!
+ \internal
+*/
+void QQuickGeoMapGestureArea::setMap(QGeoMap *map)
{
- qRegisterAnimationInterpolator<QGeoCoordinate>(
- (QVariant (*)(const QGeoCoordinate &, const QGeoCoordinate &, qreal))0);
-}
-Q_DESTRUCTOR_FUNCTION(unregisterQGeoCoordinateInterpolator)
+ if (m_map || !map)
+ return;
-QDeclarativeGeoMapGestureArea::QDeclarativeGeoMapGestureArea(QDeclarativeGeoMap *map, QObject *parent)
- : QObject(parent),
- declarativeMap_(map),
- enabled_(true),
- activeGestures_(ZoomGesture | PanGesture | FlickGesture)
-{
- map_ = 0;
- pan_.enabled_ = true,
- pan_.maxVelocity_ = QML_MAP_FLICK_DEFAULTMAXVELOCITY;
- pan_.deceleration_ = QML_MAP_FLICK_DEFAULTDECELERATION;
- pan_.animation_ = 0;
- touchPointState_ = touchPoints0;
- pinchState_ = pinchInactive;
- panState_ = panInactive;
+ m_map = map;
+ m_flick.m_animation = new QQuickGeoCoordinateAnimation(this);
+ m_flick.m_animation->setTargetObject(m_map->mapController());
+ m_flick.m_animation->setProperty(QStringLiteral("center"));
+ m_flick.m_animation->setEasing(QEasingCurve(QEasingCurve::OutQuad));
+ connect(m_flick.m_animation, &QQuickAbstractAnimation::stopped, this, &QQuickGeoMapGestureArea::handleFlickAnimationStopped);
}
/*!
- \internal
+ \qmlproperty bool QtQuick::MapGestureArea::preventStealing
+ This property holds whether the mouse events may be stolen from this
+ MapGestureArea.
+
+ If a Map is placed within an item that filters child mouse
+ and touch events, such as Flickable, the mouse and touch events
+ may be stolen from the MapGestureArea if a gesture is recognized
+ by the parent item, e.g. a flick gesture. If preventStealing is
+ set to true, no item will steal the mouse and touch events.
+
+ Note that setting preventStealing to true once an item has started
+ stealing events will have no effect until the next press event.
+
+ By default this property is false.
*/
-void QDeclarativeGeoMapGestureArea::setMap(QGeoMap *map)
+
+bool QQuickGeoMapGestureArea::preventStealing() const
{
- if (map_ || !map)
- return;
- map_ = map;
- pan_.animation_ = new QPropertyAnimation(map_->mapController(), "center", this);
- pan_.animation_->setEasingCurve(QEasingCurve(QEasingCurve::OutQuad));
- connect(pan_.animation_, SIGNAL(finished()), this, SLOT(endFlick()));
+ return m_preventStealing;
+}
+
+void QQuickGeoMapGestureArea::setPreventStealing(bool prevent)
+{
+ if (prevent != m_preventStealing) {
+ m_preventStealing = prevent;
+ m_declarativeMap->setKeepMouseGrab(m_preventStealing && m_enabled);
+ m_declarativeMap->setKeepTouchGrab(m_preventStealing && m_enabled);
+ emit preventStealingChanged();
+ }
}
-QDeclarativeGeoMapGestureArea::~QDeclarativeGeoMapGestureArea()
+QQuickGeoMapGestureArea::~QQuickGeoMapGestureArea()
{
}
/*!
\internal
*/
-QDeclarativeGeoMapGestureArea::ActiveGestures QDeclarativeGeoMapGestureArea::activeGestures() const
+QQuickGeoMapGestureArea::ActiveGestures QQuickGeoMapGestureArea::activeGestures() const
{
- return activeGestures_;
+ return m_activeGestures;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setActiveGestures(ActiveGestures activeGestures)
+void QQuickGeoMapGestureArea::setActiveGestures(ActiveGestures activeGestures)
{
- if (activeGestures == activeGestures_)
+ if (activeGestures == m_activeGestures)
return;
- activeGestures_ = activeGestures;
+ m_activeGestures = activeGestures;
emit activeGesturesChanged();
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::isPinchActive() const
+bool QQuickGeoMapGestureArea::isPinchActive() const
{
- return pinchState_ == pinchActive;
+ return m_pinchState == pinchActive;
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::isPanActive() const
+bool QQuickGeoMapGestureArea::isPanActive() const
{
- return panState_ == panActive || panState_ == panFlick;
+ return m_flickState == panActive || m_flickState == flickActive;
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::enabled() const
+bool QQuickGeoMapGestureArea::enabled() const
{
- return enabled_;
+ return m_enabled;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setEnabled(bool enabled)
+void QQuickGeoMapGestureArea::setEnabled(bool enabled)
{
- if (enabled == enabled_)
+ if (enabled == m_enabled)
return;
- enabled_ = enabled;
+ m_enabled = enabled;
emit enabledChanged();
}
@@ -436,38 +458,38 @@ void QDeclarativeGeoMapGestureArea::setEnabled(bool enabled)
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::pinchEnabled() const
+bool QQuickGeoMapGestureArea::pinchEnabled() const
{
- return pinch_.enabled;
+ return m_pinch.m_enabled;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setPinchEnabled(bool enabled)
+void QQuickGeoMapGestureArea::setPinchEnabled(bool enabled)
{
- if (enabled == pinch_.enabled)
+ if (enabled == m_pinch.m_enabled)
return;
- pinch_.enabled = enabled;
+ m_pinch.m_enabled = enabled;
emit pinchEnabledChanged();
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::panEnabled() const
+bool QQuickGeoMapGestureArea::panEnabled() const
{
- return pan_.enabled_;
+ return m_flick.m_enabled;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setPanEnabled(bool enabled)
+void QQuickGeoMapGestureArea::setPanEnabled(bool enabled)
{
- if (enabled == pan_.enabled_)
+ if (enabled == m_flick.m_enabled)
return;
- pan_.enabled_ = enabled;
+ m_flick.m_enabled = enabled;
emit panEnabledChanged();
// unlike the pinch, the pan existing functionality is to stop immediately
@@ -481,18 +503,18 @@ void QDeclarativeGeoMapGestureArea::setPanEnabled(bool enabled)
The caller is responsible to only send values that are valid
for the map plugin. Negative values are ignored.
*/
-void QDeclarativeGeoMapGestureArea::setMinimumZoomLevel(qreal min)
+void QQuickGeoMapGestureArea::setMinimumZoomLevel(qreal min)
{
if (min >= 0)
- pinch_.zoom.minimum = min;
+ m_pinch.m_zoom.m_minimum = min;
}
/*!
\internal
*/
-qreal QDeclarativeGeoMapGestureArea::minimumZoomLevel() const
+qreal QQuickGeoMapGestureArea::minimumZoomLevel() const
{
- return pinch_.zoom.minimum;
+ return m_pinch.m_zoom.m_minimum;
}
/*!
@@ -501,59 +523,59 @@ qreal QDeclarativeGeoMapGestureArea::minimumZoomLevel() const
The caller is responsible to only send values that are valid
for the map plugin. Negative values are ignored.
*/
-void QDeclarativeGeoMapGestureArea::setMaximumZoomLevel(qreal max)
+void QQuickGeoMapGestureArea::setMaximumZoomLevel(qreal max)
{
if (max >= 0)
- pinch_.zoom.maximum = max;
+ m_pinch.m_zoom.m_maximum = max;
}
/*!
\internal
*/
-qreal QDeclarativeGeoMapGestureArea::maximumZoomLevel() const
+qreal QQuickGeoMapGestureArea::maximumZoomLevel() const
{
- return pinch_.zoom.maximum;
+ return m_pinch.m_zoom.m_maximum;
}
/*!
\internal
*/
-qreal QDeclarativeGeoMapGestureArea::maximumZoomLevelChange() const
+qreal QQuickGeoMapGestureArea::maximumZoomLevelChange() const
{
- return pinch_.zoom.maximumChange;
+ return m_pinch.m_zoom.maximumChange;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setMaximumZoomLevelChange(qreal maxChange)
+void QQuickGeoMapGestureArea::setMaximumZoomLevelChange(qreal maxChange)
{
- if (maxChange == pinch_.zoom.maximumChange || maxChange < 0.1 || maxChange > 10.0)
+ if (maxChange == m_pinch.m_zoom.maximumChange || maxChange < 0.1 || maxChange > 10.0)
return;
- pinch_.zoom.maximumChange = maxChange;
+ m_pinch.m_zoom.maximumChange = maxChange;
emit maximumZoomLevelChangeChanged();
}
/*!
\internal
*/
-qreal QDeclarativeGeoMapGestureArea::flickDeceleration() const
+qreal QQuickGeoMapGestureArea::flickDeceleration() const
{
- return pan_.deceleration_;
+ return m_flick.m_deceleration;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::setFlickDeceleration(qreal deceleration)
+void QQuickGeoMapGestureArea::setFlickDeceleration(qreal deceleration)
{
if (deceleration < QML_MAP_FLICK_MINIMUMDECELERATION)
deceleration = QML_MAP_FLICK_MINIMUMDECELERATION;
else if (deceleration > QML_MAP_FLICK_MAXIMUMDECELERATION)
deceleration = QML_MAP_FLICK_MAXIMUMDECELERATION;
- if (deceleration == pan_.deceleration_)
+ if (deceleration == m_flick.m_deceleration)
return;
- pan_.deceleration_ = deceleration;
+ m_flick.m_deceleration = deceleration;
emit flickDecelerationChanged();
}
@@ -576,7 +598,7 @@ QTouchEvent::TouchPoint* createTouchPointFromMouseEvent(QMouseEvent *event, Qt::
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleMousePressEvent(QMouseEvent *event)
+void QQuickGeoMapGestureArea::handleMousePressEvent(QMouseEvent *event)
{
m_mousePoint.reset(createTouchPointFromMouseEvent(event, Qt::TouchPointPressed));
if (m_touchPoints.isEmpty()) update();
@@ -586,7 +608,7 @@ void QDeclarativeGeoMapGestureArea::handleMousePressEvent(QMouseEvent *event)
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleMouseMoveEvent(QMouseEvent *event)
+void QQuickGeoMapGestureArea::handleMouseMoveEvent(QMouseEvent *event)
{
m_mousePoint.reset(createTouchPointFromMouseEvent(event, Qt::TouchPointMoved));
if (m_touchPoints.isEmpty()) update();
@@ -596,83 +618,117 @@ void QDeclarativeGeoMapGestureArea::handleMouseMoveEvent(QMouseEvent *event)
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleMouseReleaseEvent(QMouseEvent *event)
+void QQuickGeoMapGestureArea::handleMouseReleaseEvent(QMouseEvent *event)
{
- m_mousePoint.reset(createTouchPointFromMouseEvent(event, Qt::TouchPointReleased));
- if (m_touchPoints.isEmpty()) update();
+ if (!m_mousePoint.isNull()) {
+ //this looks super ugly , however is required in case we do not get synthesized MouseReleaseEvent
+ //and we reset the point already in handleTouchUngrabEvent
+ m_mousePoint.reset(createTouchPointFromMouseEvent(event, Qt::TouchPointReleased));
+ if (m_touchPoints.isEmpty()) update();
+ }
event->accept();
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleMouseUngrabEvent()
+void QQuickGeoMapGestureArea::handleMouseUngrabEvent()
{
- m_mousePoint.reset();
- update();
+
+ if (m_touchPoints.isEmpty() && !m_mousePoint.isNull()) {
+ m_mousePoint.reset();
+ update();
+ } else {
+ m_mousePoint.reset();
+ }
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleTouchUngrabEvent()
+void QQuickGeoMapGestureArea::handleTouchUngrabEvent()
{
- m_touchPoints.clear();
- update();
+ m_touchPoints.clear();
+ //this is needed since in some cases mouse release is not delivered
+ //(second touch point brakes mouse synthesized events)
+ m_mousePoint.reset();
+ update();
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::handleTouchEvent(QTouchEvent *event)
+void QQuickGeoMapGestureArea::handleTouchEvent(QTouchEvent *event)
{
m_touchPoints.clear();
for (int i = 0; i < event->touchPoints().count(); ++i)
m_touchPoints << event->touchPoints().at(i);
+ if (event->touchPoints().count() >= 2)
+ event->accept();
+ else
+ event->ignore();
update();
}
-void QDeclarativeGeoMapGestureArea::handleWheelEvent(QWheelEvent *event)
+void QQuickGeoMapGestureArea::handleWheelEvent(QWheelEvent *event)
{
- declarativeMap_->setZoomLevel(qBound(minimumZoomLevel(), declarativeMap_->zoomLevel() + event->angleDelta().y() * qreal(0.001), maximumZoomLevel()));
+ if (!m_map)
+ return;
+
+ QGeoCoordinate wheelGeoPos = m_map->itemPositionToCoordinate(QDoubleVector2D(event->posF()), false);
+ QPointF preZoomPoint = m_map->coordinateToItemPosition(wheelGeoPos, false).toPointF();
+
+ m_declarativeMap->setZoomLevel(qBound(minimumZoomLevel(), m_declarativeMap->zoomLevel() + event->angleDelta().y() * qreal(0.001), maximumZoomLevel()));
+
+ QPointF postZoomPoint = m_map->coordinateToItemPosition(wheelGeoPos, false).toPointF();
+
+ if (preZoomPoint != postZoomPoint)
+ {
+ qreal dx = postZoomPoint.x() - preZoomPoint.x();
+ qreal dy = postZoomPoint.y() - preZoomPoint.y();
+ QPointF mapCenterPoint(m_map->width() / 2.0 + dx, m_map->height() / 2.0 + dy);
+
+ QGeoCoordinate mapCenterCoordinate = m_map->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
+ m_map->mapController()->setCenter(mapCenterCoordinate);
+ }
event->accept();
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::clearTouchData()
+void QQuickGeoMapGestureArea::clearTouchData()
{
- velocityX_ = 0;
- velocityY_ = 0;
- sceneCenter_.setX(0);
- sceneCenter_.setY(0);
- touchCenterCoord_.setLongitude(0);
- touchCenterCoord_.setLatitude(0);
- startCoord_.setLongitude(0);
- startCoord_.setLatitude(0);
+ m_velocityX = 0;
+ m_velocityY = 0;
+ m_sceneCenter.setX(0);
+ m_sceneCenter.setY(0);
+ m_touchCenterCoord.setLongitude(0);
+ m_touchCenterCoord.setLatitude(0);
+ m_startCoord.setLongitude(0);
+ m_startCoord.setLatitude(0);
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::updateVelocityList(const QPointF &pos)
+void QQuickGeoMapGestureArea::updateVelocityList(const QPointF &pos)
{
// Take velocity samples every sufficient period of time, used later to determine the flick
// duration and speed (when mouse is released).
- qreal elapsed = qreal(lastPosTime_.elapsed());
+ qreal elapsed = qreal(m_lastPosTime.elapsed());
if (elapsed >= QML_MAP_FLICK_VELOCITY_SAMPLE_PERIOD) {
elapsed /= 1000.;
- int dyFromLastPos = pos.y() - lastPos_.y();
- int dxFromLastPos = pos.x() - lastPos_.x();
- lastPos_ = pos;
- lastPosTime_.restart();
+ int dyFromLastPos = pos.y() - m_lastPos.y();
+ int dxFromLastPos = pos.x() - m_lastPos.x();
+ m_lastPos = pos;
+ m_lastPosTime.restart();
qreal velX = qreal(dxFromLastPos) / elapsed;
qreal velY = qreal(dyFromLastPos) / elapsed;
- velocityX_ = qBound<qreal>(-pan_.maxVelocity_, velX, pan_.maxVelocity_);
- velocityY_ = qBound<qreal>(-pan_.maxVelocity_, velY, pan_.maxVelocity_);
+ m_velocityX = qBound<qreal>(-m_flick.m_maxVelocity, velX, m_flick.m_maxVelocity);
+ m_velocityY = qBound<qreal>(-m_flick.m_maxVelocity, velY, m_flick.m_maxVelocity);
}
}
@@ -680,7 +736,7 @@ void QDeclarativeGeoMapGestureArea::updateVelocityList(const QPointF &pos)
\internal
*/
-bool QDeclarativeGeoMapGestureArea::isActive() const
+bool QQuickGeoMapGestureArea::isActive() const
{
return isPanActive() || isPinchActive();
}
@@ -689,9 +745,11 @@ bool QDeclarativeGeoMapGestureArea::isActive() const
\internal
*/
// simplify the gestures by using a state-machine format (easy to move to a future state machine)
-void QDeclarativeGeoMapGestureArea::update()
+void QQuickGeoMapGestureArea::update()
{
- if (!map_) return;
+ if (!m_map)
+ return;
+
// First state machine is for the number of touch points
//combine touch with mouse event
@@ -703,57 +761,57 @@ void QDeclarativeGeoMapGestureArea::update()
touchPointStateMachine();
// Parallel state machine for pinch
- if (isPinchActive() || (enabled_ && pinch_.enabled && (activeGestures_ & (ZoomGesture))))
+ if (isPinchActive() || (m_enabled && m_pinch.m_enabled && (m_activeGestures & (ZoomGesture))))
pinchStateMachine();
// Parallel state machine for pan (since you can pan at the same time as pinching)
// The stopPan function ensures that pan stops immediately when disabled,
// but the line below allows pan continue its current gesture if you disable
// the whole gesture (enabled_ flag), this keeps the enabled_ consistent with the pinch
- if (isPanActive() || (enabled_ && pan_.enabled_ && (activeGestures_ & (PanGesture | FlickGesture))))
+ if (isPanActive() || (m_enabled && m_flick.m_enabled && (m_activeGestures & (PanGesture | FlickGesture))))
panStateMachine();
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::touchPointStateMachine()
+void QQuickGeoMapGestureArea::touchPointStateMachine()
{
// Transitions:
- switch (touchPointState_) {
+ switch (m_touchPointState) {
case touchPoints0:
if (m_allPoints.count() == 1) {
clearTouchData();
startOneTouchPoint();
- touchPointState_ = touchPoints1;
+ m_touchPointState = touchPoints1;
} else if (m_allPoints.count() >= 2) {
clearTouchData();
startTwoTouchPoints();
- touchPointState_ = touchPoints2;
+ m_touchPointState = touchPoints2;
}
break;
case touchPoints1:
if (m_allPoints.count() == 0) {
- touchPointState_ = touchPoints0;
+ m_touchPointState = touchPoints0;
} else if (m_allPoints.count() == 2) {
- touchCenterCoord_ = map_->itemPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
+ m_touchCenterCoord = m_map->itemPositionToCoordinate(QDoubleVector2D(m_sceneCenter), false);
startTwoTouchPoints();
- touchPointState_ = touchPoints2;
+ m_touchPointState = touchPoints2;
}
break;
case touchPoints2:
if (m_allPoints.count() == 0) {
- touchPointState_ = touchPoints0;
+ m_touchPointState = touchPoints0;
} else if (m_allPoints.count() == 1) {
- touchCenterCoord_ = map_->itemPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
+ m_touchCenterCoord = m_map->itemPositionToCoordinate(QDoubleVector2D(m_sceneCenter), false);
startOneTouchPoint();
- touchPointState_ = touchPoints1;
+ m_touchPointState = touchPoints1;
}
break;
};
// Update
- switch (touchPointState_) {
+ switch (m_touchPointState) {
case touchPoints0:
break; // do nothing if no touch points down
case touchPoints1:
@@ -768,108 +826,114 @@ void QDeclarativeGeoMapGestureArea::touchPointStateMachine()
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::startOneTouchPoint()
+void QQuickGeoMapGestureArea::startOneTouchPoint()
{
- sceneStartPoint1_ = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- lastPos_ = sceneStartPoint1_;
- lastPosTime_.start();
- QGeoCoordinate startCoord = map_->itemPositionToCoordinate(QDoubleVector2D(sceneStartPoint1_), false);
+ m_sceneStartPoint1 = mapFromScene(m_allPoints.at(0).scenePos());
+ m_lastPos = m_sceneStartPoint1;
+ m_lastPosTime.start();
+ QGeoCoordinate startCoord = m_map->itemPositionToCoordinate(QDoubleVector2D(m_sceneStartPoint1), false);
// ensures a smooth transition for panning
- startCoord_.setLongitude(startCoord_.longitude() + startCoord.longitude() -
- touchCenterCoord_.longitude());
- startCoord_.setLatitude(startCoord_.latitude() + startCoord.latitude() -
- touchCenterCoord_.latitude());
+ m_startCoord.setLongitude(m_startCoord.longitude() + startCoord.longitude() -
+ m_touchCenterCoord.longitude());
+ m_startCoord.setLatitude(m_startCoord.latitude() + startCoord.latitude() -
+ m_touchCenterCoord.latitude());
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::updateOneTouchPoint()
+void QQuickGeoMapGestureArea::updateOneTouchPoint()
{
- sceneCenter_ = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- updateVelocityList(sceneCenter_);
+ m_sceneCenter = mapFromScene(m_allPoints.at(0).scenePos());
+ updateVelocityList(m_sceneCenter);
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::startTwoTouchPoints()
+void QQuickGeoMapGestureArea::startTwoTouchPoints()
{
- sceneStartPoint1_ = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- sceneStartPoint2_ = declarativeMap_->mapFromScene(m_allPoints.at(1).scenePos());
- QPointF startPos = (sceneStartPoint1_ + sceneStartPoint2_) * 0.5;
- lastPos_ = startPos;
- lastPosTime_.start();
- QGeoCoordinate startCoord = map_->itemPositionToCoordinate(QDoubleVector2D(startPos), false);
- startCoord_.setLongitude(startCoord_.longitude() + startCoord.longitude() -
- touchCenterCoord_.longitude());
- startCoord_.setLatitude(startCoord_.latitude() + startCoord.latitude() -
- touchCenterCoord_.latitude());
+ m_sceneStartPoint1 = mapFromScene(m_allPoints.at(0).scenePos());
+ m_sceneStartPoint2 = mapFromScene(m_allPoints.at(1).scenePos());
+ QPointF startPos = (m_sceneStartPoint1 + m_sceneStartPoint2) * 0.5;
+ m_lastPos = startPos;
+ m_lastPosTime.start();
+ QGeoCoordinate startCoord = m_map->itemPositionToCoordinate(QDoubleVector2D(startPos), false);
+ m_startCoord.setLongitude(m_startCoord.longitude() + startCoord.longitude() -
+ m_touchCenterCoord.longitude());
+ m_startCoord.setLatitude(m_startCoord.latitude() + startCoord.latitude() -
+ m_touchCenterCoord.latitude());
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::updateTwoTouchPoints()
+void QQuickGeoMapGestureArea::updateTwoTouchPoints()
{
- QPointF p1 = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- QPointF p2 = declarativeMap_->mapFromScene(m_allPoints.at(1).scenePos());
+ QPointF p1 = mapFromScene(m_allPoints.at(0).scenePos());
+ QPointF p2 = mapFromScene(m_allPoints.at(1).scenePos());
qreal dx = p1.x() - p2.x();
qreal dy = p1.y() - p2.y();
- distanceBetweenTouchPoints_ = sqrt(dx * dx + dy * dy);
- sceneCenter_ = (p1 + p2) / 2;
- updateVelocityList(sceneCenter_);
+ m_distanceBetweenTouchPoints = sqrt(dx * dx + dy * dy);
+ m_sceneCenter = (p1 + p2) / 2;
+ updateVelocityList(m_sceneCenter);
- twoTouchAngle_ = QLineF(p1, p2).angle();
- if (twoTouchAngle_ > 180)
- twoTouchAngle_ -= 360;
+ m_twoTouchAngle = QLineF(p1, p2).angle();
+ if (m_twoTouchAngle > 180)
+ m_twoTouchAngle -= 360;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::pinchStateMachine()
+void QQuickGeoMapGestureArea::pinchStateMachine()
{
- PinchState lastState = pinchState_;
+ PinchState lastState = m_pinchState;
// Transitions:
- switch (pinchState_) {
+ switch (m_pinchState) {
case pinchInactive:
if (m_allPoints.count() >= 2) {
if (canStartPinch()) {
+ m_declarativeMap->setKeepMouseGrab(true);
+ m_declarativeMap->setKeepTouchGrab(true);
startPinch();
- pinchState_ = pinchActive;
+ m_pinchState = pinchActive;
} else {
- pinchState_ = pinchInactiveTwoPoints;
+ m_pinchState = pinchInactiveTwoPoints;
}
}
break;
case pinchInactiveTwoPoints:
if (m_allPoints.count() <= 1) {
- pinchState_ = pinchInactive;
+ m_pinchState = pinchInactive;
} else {
if (canStartPinch()) {
+ m_declarativeMap->setKeepMouseGrab(true);
+ m_declarativeMap->setKeepTouchGrab(true);
startPinch();
- pinchState_ = pinchActive;
+ m_pinchState = pinchActive;
}
}
break;
case pinchActive:
if (m_allPoints.count() <= 1) {
+ m_pinchState = pinchInactive;
+ m_declarativeMap->setKeepMouseGrab(m_preventStealing);
+ m_declarativeMap->setKeepTouchGrab(m_preventStealing);
endPinch();
- pinchState_ = pinchInactive;
}
break;
}
// This line implements an exclusive state machine, where the transitions and updates don't
// happen on the same frame
- if (pinchState_ != lastState) {
+ if (m_pinchState != lastState) {
emit pinchActiveChanged();
return;
}
// Update
- switch (pinchState_) {
+ switch (m_pinchState) {
case pinchInactive:
case pinchInactiveTwoPoints:
break; // do nothing
@@ -882,25 +946,25 @@ void QDeclarativeGeoMapGestureArea::pinchStateMachine()
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::canStartPinch()
+bool QQuickGeoMapGestureArea::canStartPinch()
{
const int startDragDistance = qApp->styleHints()->startDragDistance();
if (m_allPoints.count() >= 2) {
- QPointF p1 = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- QPointF p2 = declarativeMap_->mapFromScene(m_allPoints.at(1).scenePos());
- if (qAbs(p1.x()-sceneStartPoint1_.x()) > startDragDistance
- || qAbs(p1.y()-sceneStartPoint1_.y()) > startDragDistance
- || qAbs(p2.x()-sceneStartPoint2_.x()) > startDragDistance
- || qAbs(p2.y()-sceneStartPoint2_.y()) > startDragDistance) {
- pinch_.event.setCenter(declarativeMap_->mapFromScene(sceneCenter_));
- pinch_.event.setAngle(twoTouchAngle_);
- pinch_.event.setPoint1(p1);
- pinch_.event.setPoint2(p2);
- pinch_.event.setPointCount(m_allPoints.count());
- pinch_.event.setAccepted(true);
- emit pinchStarted(&pinch_.event);
- return pinch_.event.accepted();
+ QPointF p1 = mapFromScene(m_allPoints.at(0).scenePos());
+ QPointF p2 = mapFromScene(m_allPoints.at(1).scenePos());
+ if (qAbs(p1.x()-m_sceneStartPoint1.x()) > startDragDistance
+ || qAbs(p1.y()-m_sceneStartPoint1.y()) > startDragDistance
+ || qAbs(p2.x()-m_sceneStartPoint2.x()) > startDragDistance
+ || qAbs(p2.y()-m_sceneStartPoint2.y()) > startDragDistance) {
+ m_pinch.m_event.setCenter(mapFromScene(m_sceneCenter));
+ m_pinch.m_event.setAngle(m_twoTouchAngle);
+ m_pinch.m_event.setPoint1(p1);
+ m_pinch.m_event.setPoint2(p2);
+ m_pinch.m_event.setPointCount(m_allPoints.count());
+ m_pinch.m_event.setAccepted(true);
+ emit pinchStarted(&m_pinch.m_event);
+ return m_pinch.m_event.accepted();
}
}
return false;
@@ -909,125 +973,128 @@ bool QDeclarativeGeoMapGestureArea::canStartPinch()
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::startPinch()
+void QQuickGeoMapGestureArea::startPinch()
{
- pinch_.startDist = distanceBetweenTouchPoints_;
- pinch_.zoom.previous = declarativeMap_->zoomLevel();
- pinch_.lastAngle = twoTouchAngle_;
+ m_pinch.m_startDist = m_distanceBetweenTouchPoints;
+ m_pinch.m_zoom.m_previous = m_declarativeMap->zoomLevel();
+ m_pinch.m_lastAngle = m_twoTouchAngle;
- pinch_.lastPoint1 = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- pinch_.lastPoint2 = declarativeMap_->mapFromScene(m_allPoints.at(1).scenePos());
+ m_pinch.m_lastPoint1 = mapFromScene(m_allPoints.at(0).scenePos());
+ m_pinch.m_lastPoint2 = mapFromScene(m_allPoints.at(1).scenePos());
- pinch_.zoom.start = declarativeMap_->zoomLevel();
+ m_pinch.m_zoom.m_start = m_declarativeMap->zoomLevel();
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::updatePinch()
+void QQuickGeoMapGestureArea::updatePinch()
{
// Calculate the new zoom level if we have distance ( >= 2 touchpoints), otherwise stick with old.
- qreal newZoomLevel = pinch_.zoom.previous;
- if (distanceBetweenTouchPoints_) {
+ qreal newZoomLevel = m_pinch.m_zoom.m_previous;
+ if (m_distanceBetweenTouchPoints) {
newZoomLevel =
// How much further/closer the current touchpoints are (in pixels) compared to pinch start
- ((distanceBetweenTouchPoints_ - pinch_.startDist) *
+ ((m_distanceBetweenTouchPoints - m_pinch.m_startDist) *
// How much one pixel corresponds in units of zoomlevel (and multiply by above delta)
- (pinch_.zoom.maximumChange / ((declarativeMap_->width() + declarativeMap_->height()) / 2))) +
+ (m_pinch.m_zoom.maximumChange / ((width() + height()) / 2))) +
// Add to starting zoom level. Sign of (dist-pinchstartdist) takes care of zoom in / out
- pinch_.zoom.start;
+ m_pinch.m_zoom.m_start;
}
- qreal da = pinch_.lastAngle - twoTouchAngle_;
+ qreal da = m_pinch.m_lastAngle - m_twoTouchAngle;
if (da > 180)
da -= 360;
else if (da < -180)
da += 360;
- pinch_.event.setCenter(declarativeMap_->mapFromScene(sceneCenter_));
- pinch_.event.setAngle(twoTouchAngle_);
+ m_pinch.m_event.setCenter(mapFromScene(m_sceneCenter));
+ m_pinch.m_event.setAngle(m_twoTouchAngle);
- pinch_.lastPoint1 = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- pinch_.lastPoint2 = declarativeMap_->mapFromScene(m_allPoints.at(1).scenePos());
- pinch_.event.setPoint1(pinch_.lastPoint1);
- pinch_.event.setPoint2(pinch_.lastPoint2);
- pinch_.event.setPointCount(m_allPoints.count());
- pinch_.event.setAccepted(true);
+ m_pinch.m_lastPoint1 = mapFromScene(m_allPoints.at(0).scenePos());
+ m_pinch.m_lastPoint2 = mapFromScene(m_allPoints.at(1).scenePos());
+ m_pinch.m_event.setPoint1(m_pinch.m_lastPoint1);
+ m_pinch.m_event.setPoint2(m_pinch.m_lastPoint2);
+ m_pinch.m_event.setPointCount(m_allPoints.count());
+ m_pinch.m_event.setAccepted(true);
- pinch_.lastAngle = twoTouchAngle_;
- emit pinchUpdated(&pinch_.event);
+ m_pinch.m_lastAngle = m_twoTouchAngle;
+ emit pinchUpdated(&m_pinch.m_event);
- if (activeGestures_ & ZoomGesture) {
+ if (m_activeGestures & ZoomGesture) {
// Take maximum and minimumzoomlevel into account
- qreal perPinchMinimumZoomLevel = qMax(pinch_.zoom.start - pinch_.zoom.maximumChange, pinch_.zoom.minimum);
- qreal perPinchMaximumZoomLevel = qMin(pinch_.zoom.start + pinch_.zoom.maximumChange, pinch_.zoom.maximum);
+ qreal perPinchMinimumZoomLevel = qMax(m_pinch.m_zoom.m_start - m_pinch.m_zoom.maximumChange, m_pinch.m_zoom.m_minimum);
+ qreal perPinchMaximumZoomLevel = qMin(m_pinch.m_zoom.m_start + m_pinch.m_zoom.maximumChange, m_pinch.m_zoom.m_maximum);
newZoomLevel = qMin(qMax(perPinchMinimumZoomLevel, newZoomLevel), perPinchMaximumZoomLevel);
- declarativeMap_->setZoomLevel(newZoomLevel);
- pinch_.zoom.previous = newZoomLevel;
+ m_declarativeMap->setZoomLevel(newZoomLevel);
+ m_pinch.m_zoom.m_previous = newZoomLevel;
}
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::endPinch()
+void QQuickGeoMapGestureArea::endPinch()
{
- QPointF p1 = declarativeMap_->mapFromScene(pinch_.lastPoint1);
- QPointF p2 = declarativeMap_->mapFromScene(pinch_.lastPoint2);
- pinch_.event.setCenter((p1 + p2) / 2);
- pinch_.event.setAngle(pinch_.lastAngle);
- pinch_.event.setPoint1(p1);
- pinch_.event.setPoint2(p2);
- pinch_.event.setAccepted(true);
- pinch_.event.setPointCount(0);
- emit pinchFinished(&pinch_.event);
- pinch_.startDist = 0;
+ QPointF p1 = mapFromScene(m_pinch.m_lastPoint1);
+ QPointF p2 = mapFromScene(m_pinch.m_lastPoint2);
+ m_pinch.m_event.setCenter((p1 + p2) / 2);
+ m_pinch.m_event.setAngle(m_pinch.m_lastAngle);
+ m_pinch.m_event.setPoint1(p1);
+ m_pinch.m_event.setPoint2(p2);
+ m_pinch.m_event.setAccepted(true);
+ m_pinch.m_event.setPointCount(0);
+ emit pinchFinished(&m_pinch.m_event);
+ m_pinch.m_startDist = 0;
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::panStateMachine()
+void QQuickGeoMapGestureArea::panStateMachine()
{
- PanState lastState = panState_;
+ FlickState lastState = m_flickState;
// Transitions
- switch (panState_) {
- case panInactive:
+ switch (m_flickState) {
+ case flickInactive:
if (canStartPan()) {
// Update startCoord_ to ensure smooth start for panning when going over startDragDistance
- QGeoCoordinate newStartCoord = map_->itemPositionToCoordinate(QDoubleVector2D(sceneCenter_), false);
- startCoord_.setLongitude(newStartCoord.longitude());
- startCoord_.setLatitude(newStartCoord.latitude());
- panState_ = panActive;
+ QGeoCoordinate newStartCoord = m_map->itemPositionToCoordinate(QDoubleVector2D(m_sceneCenter), false);
+ m_startCoord.setLongitude(newStartCoord.longitude());
+ m_startCoord.setLatitude(newStartCoord.latitude());
+ m_declarativeMap->setKeepMouseGrab(true);
+ m_flickState = panActive;
}
break;
case panActive:
if (m_allPoints.count() == 0) {
- panState_ = panFlick;
+ m_flickState = flickActive;
if (!tryStartFlick())
{
- panState_ = panInactive;
+ m_flickState = flickInactive;
// mark as inactive for use by camera
- if (pinchState_ == pinchInactive) {
+ if (m_pinchState == pinchInactive) {
+ m_declarativeMap->setKeepMouseGrab(m_preventStealing);
emit panFinished();
- map_->prefetchData();
+ m_map->prefetchData();
}
}
}
break;
- case panFlick:
+ case flickActive:
if (m_allPoints.count() > 0) { // re touched before movement ended
endFlick();
- panState_ = panActive;
+ m_declarativeMap->setKeepMouseGrab(true);
+ m_flickState = panActive;
}
break;
}
- if (panState_ != lastState)
+ if (m_flickState != lastState)
emit panActiveChanged();
// Update
- switch (panState_) {
- case panInactive: // do nothing
+ switch (m_flickState) {
+ case flickInactive: // do nothing
break;
case panActive:
updatePan();
@@ -1035,24 +1102,24 @@ void QDeclarativeGeoMapGestureArea::panStateMachine()
if (lastState != panActive)
emit panStarted();
break;
- case panFlick:
+ case flickActive:
break;
}
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::canStartPan()
+bool QQuickGeoMapGestureArea::canStartPan()
{
- if (m_allPoints.count() == 0 || (activeGestures_ & PanGesture) == 0)
+ if (m_allPoints.count() == 0 || (m_activeGestures & PanGesture) == 0)
return false;
// Check if thresholds for normal panning are met.
// (normal panning vs flicking: flicking will start from mouse release event).
const int startDragDistance = qApp->styleHints()->startDragDistance() * 2;
- QPointF p1 = declarativeMap_->mapFromScene(m_allPoints.at(0).scenePos());
- int dyFromPress = int(p1.y() - sceneStartPoint1_.y());
- int dxFromPress = int(p1.x() - sceneStartPoint1_.x());
+ QPointF p1 = mapFromScene(m_allPoints.at(0).scenePos());
+ int dyFromPress = int(p1.y() - m_sceneStartPoint1.y());
+ int dxFromPress = int(p1.x() - m_sceneStartPoint1.x());
if ((qAbs(dyFromPress) >= startDragDistance || qAbs(dxFromPress) >= startDragDistance))
return true;
return false;
@@ -1061,48 +1128,48 @@ bool QDeclarativeGeoMapGestureArea::canStartPan()
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::updatePan()
+void QQuickGeoMapGestureArea::updatePan()
{
- QPointF startPoint = map_->coordinateToItemPosition(startCoord_, false).toPointF();
- int dx = static_cast<int>(sceneCenter_.x() - startPoint.x());
- int dy = static_cast<int>(sceneCenter_.y() - startPoint.y());
+ QPointF startPoint = m_map->coordinateToItemPosition(m_startCoord, false).toPointF();
+ int dx = static_cast<int>(m_sceneCenter.x() - startPoint.x());
+ int dy = static_cast<int>(m_sceneCenter.y() - startPoint.y());
QPointF mapCenterPoint;
- mapCenterPoint.setY(map_->height() / 2.0 - dy);
- mapCenterPoint.setX(map_->width() / 2.0 - dx);
- QGeoCoordinate animationStartCoordinate = map_->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
- map_->mapController()->setCenter(animationStartCoordinate);
+ mapCenterPoint.setY(m_map->height() / 2.0 - dy);
+ mapCenterPoint.setX(m_map->width() / 2.0 - dx);
+ QGeoCoordinate animationStartCoordinate = m_map->itemPositionToCoordinate(QDoubleVector2D(mapCenterPoint), false);
+ m_map->mapController()->setCenter(animationStartCoordinate);
}
/*!
\internal
*/
-bool QDeclarativeGeoMapGestureArea::tryStartFlick()
+bool QQuickGeoMapGestureArea::tryStartFlick()
{
- if ((activeGestures_ & FlickGesture) == 0)
+ if ((m_activeGestures & FlickGesture) == 0)
return false;
// if we drag then pause before release we should not cause a flick.
qreal velocityX = 0.0;
qreal velocityY = 0.0;
- if (lastPosTime_.elapsed() < QML_MAP_FLICK_VELOCITY_SAMPLE_PERIOD) {
- velocityY = velocityY_;
- velocityX = velocityX_;
+ if (m_lastPosTime.elapsed() < QML_MAP_FLICK_VELOCITY_SAMPLE_PERIOD) {
+ velocityY = m_velocityY;
+ velocityX = m_velocityX;
}
int flickTimeY = 0;
int flickTimeX = 0;
int flickPixelsX = 0;
int flickPixelsY = 0;
- if (qAbs(velocityY) > MinimumFlickVelocity && qAbs(sceneCenter_.y() - sceneStartPoint1_.y()) > FlickThreshold) {
+ if (qAbs(velocityY) > MinimumFlickVelocity && qAbs(m_sceneCenter.y() - m_sceneStartPoint1.y()) > FlickThreshold) {
// calculate Y flick animation values
- qreal acceleration = pan_.deceleration_;
- if ((velocityY > 0.0f) == (pan_.deceleration_ > 0.0f))
+ qreal acceleration = m_flick.m_deceleration;
+ if ((velocityY > 0.0f) == (m_flick.m_deceleration > 0.0f))
acceleration = acceleration * -1.0f;
flickTimeY = static_cast<int>(-1000 * velocityY / acceleration);
flickPixelsY = (flickTimeY * velocityY) / (1000.0 * 2);
}
- if (qAbs(velocityX) > MinimumFlickVelocity && qAbs(sceneCenter_.x() - sceneStartPoint1_.x()) > FlickThreshold) {
+ if (qAbs(velocityX) > MinimumFlickVelocity && qAbs(m_sceneCenter.x() - m_sceneStartPoint1.x()) > FlickThreshold) {
// calculate X flick animation values
- qreal acceleration = pan_.deceleration_;
- if ((velocityX > 0.0f) == (pan_.deceleration_ > 0.0f))
+ qreal acceleration = m_flick.m_deceleration;
+ if ((velocityX > 0.0f) == (m_flick.m_deceleration > 0.0f))
acceleration = acceleration * -1.0f;
flickTimeX = static_cast<int>(-1000 * velocityX / acceleration);
flickPixelsX = (flickTimeX * velocityX) / (1000.0 * 2);
@@ -1118,57 +1185,82 @@ bool QDeclarativeGeoMapGestureArea::tryStartFlick()
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::startFlick(int dx, int dy, int timeMs)
+void QQuickGeoMapGestureArea::startFlick(int dx, int dy, int timeMs)
{
if (timeMs < 0)
return;
- QGeoCoordinate animationStartCoordinate = map_->mapController()->center();
-
- if (pan_.animation_->state() == QPropertyAnimation::Running)
- pan_.animation_->stop();
- QGeoCoordinate animationEndCoordinate = map_->mapController()->center();
- pan_.animation_->setDuration(timeMs);
- animationEndCoordinate.setLongitude(animationStartCoordinate.longitude() - (dx / pow(2.0, map_->mapController()->zoom())));
- animationEndCoordinate.setLatitude(animationStartCoordinate.latitude() + (dy / pow(2.0, map_->mapController()->zoom())));
- pan_.animation_->setStartValue(QVariant::fromValue(animationStartCoordinate));
- pan_.animation_->setEndValue(QVariant::fromValue(animationEndCoordinate));
- pan_.animation_->start();
+ QGeoCoordinate animationStartCoordinate = m_map->mapController()->center();
+
+ if (m_flick.m_animation->isRunning())
+ m_flick.m_animation->stop();
+ QGeoCoordinate animationEndCoordinate = m_map->mapController()->center();
+ m_flick.m_animation->setDuration(timeMs);
+
+ double zoom = pow(2.0, m_map->mapController()->zoom());
+ double longitude = animationStartCoordinate.longitude() - (dx / zoom);
+ double latitude = animationStartCoordinate.latitude() + (dy / zoom);
+
+ if (dx > 0)
+ m_flick.m_animation->setDirection(QQuickGeoCoordinateAnimation::East);
+ else
+ m_flick.m_animation->setDirection(QQuickGeoCoordinateAnimation::West);
+
+ //keep animation in correct bounds
+ if (latitude > 85.05113)
+ latitude = 85.05113;
+ else if (latitude < -85.05113)
+ latitude = -85.05113;
+
+ animationEndCoordinate.setLongitude(longitude);
+ animationEndCoordinate.setLatitude(latitude);
+
+ m_flick.m_animation->setFrom(animationStartCoordinate);
+ m_flick.m_animation->setTo(animationEndCoordinate);
+ m_flick.m_animation->start();
emit flickStarted();
}
-void QDeclarativeGeoMapGestureArea::stopPan()
+void QQuickGeoMapGestureArea::stopPan()
{
- velocityX_ = 0;
- velocityY_ = 0;
- if (panState_ == panFlick) {
+ m_velocityX = 0;
+ m_velocityY = 0;
+ if (m_flickState == flickActive) {
endFlick();
- } else if (panState_ == panActive) {
- panState_ = panInactive;
+ } else if (m_flickState == panActive) {
+ m_flickState = flickInactive;
+ m_declarativeMap->setKeepMouseGrab(m_preventStealing);
emit panFinished();
emit panActiveChanged();
- map_->prefetchData();
+ m_map->prefetchData();
}
}
/*!
\internal
*/
-void QDeclarativeGeoMapGestureArea::endFlick()
+void QQuickGeoMapGestureArea::endFlick()
+{
+ if (m_flick.m_animation->isRunning())
+ m_flick.m_animation->stop();
+ else
+ handleFlickAnimationStopped();
+}
+
+void QQuickGeoMapGestureArea::handleFlickAnimationStopped()
{
+ m_declarativeMap->setKeepMouseGrab(m_preventStealing);
emit panFinished();
- if (pan_.animation_->state() == QPropertyAnimation::Running)
- pan_.animation_->stop();
emit flickFinished();
- panState_ = panInactive;
+ m_flickState = flickInactive;
emit panActiveChanged();
- map_->prefetchData();
+ m_map->prefetchData();
}
-#include "moc_qdeclarativegeomapgesturearea_p.cpp"
+#include "moc_qquickgeomapgesturearea_p.cpp"
QT_END_NAMESPACE
diff --git a/src/imports/location/qdeclarativegeomapgesturearea_p.h b/src/imports/location/qquickgeomapgesturearea_p.h
index d968cab6..43bb2ce5 100644
--- a/src/imports/location/qdeclarativegeomapgesturearea_p.h
+++ b/src/imports/location/qquickgeomapgesturearea_p.h
@@ -34,16 +34,27 @@
**
****************************************************************************/
-#ifndef QDECLARATIVEGEOMAPGESTUREAREA_P_H
-#define QDECLARATIVEGEOMAPGESTUREAREA_P_H
-
-#include <QtQml/qqml.h>
+#ifndef QQUICKGEOMAPGESTUREAREA_P_H
+#define QQUICKGEOMAPGESTUREAREA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/QQuickItem>
#include <QTouchEvent>
-#include <QObject>
#include <QDebug>
#include <QElapsedTimer>
#include "qgeocoordinate.h"
#include "qgeomap_p.h"
+#include "qquickgeocoordinateanimation_p.h"
QT_BEGIN_NAMESPACE
@@ -52,8 +63,6 @@ class QDeclarativeGeoMap;
class QTouchEvent;
class QWheelEvent;
class QGeoMap;
-class QPropertyAnimation;
-class QQuickItem;
class QDeclarativeGeoMapPinchEvent : public QObject
{
@@ -70,41 +79,38 @@ public:
QDeclarativeGeoMapPinchEvent(const QPointF &center, qreal angle,
const QPointF &point1, const QPointF &point2,
int pointCount = 0, bool accepted = true)
- : QObject(), center_(center), angle_(angle),
- point1_(point1), point2_(point2),
- pointCount_(pointCount), accepted_(accepted) {}
+ : QObject(), m_center(center), m_angle(angle),
+ m_point1(point1), m_point2(point2),
+ m_pointCount(pointCount), m_accepted(accepted) {}
QDeclarativeGeoMapPinchEvent()
: QObject(),
- angle_(0.0),
- pointCount_(0),
- accepted_(true) {}
-
- QPointF center() const { return center_; }
- void setCenter(const QPointF &center) { center_ = center; }
- qreal angle() const { return angle_; }
- void setAngle(qreal angle) { angle_ = angle; }
- QPointF point1() const { return point1_; }
- void setPoint1(const QPointF &p) { point1_ = p; }
- QPointF point2() const { return point2_; }
- void setPoint2(const QPointF &p) { point2_ = p; }
- int pointCount() const { return pointCount_; }
- void setPointCount(int count) { pointCount_ = count; }
- bool accepted() const { return accepted_; }
- void setAccepted(bool a) { accepted_ = a; }
+ m_angle(0.0),
+ m_pointCount(0),
+ m_accepted(true) {}
+
+ QPointF center() const { return m_center; }
+ void setCenter(const QPointF &center) { m_center = center; }
+ qreal angle() const { return m_angle; }
+ void setAngle(qreal angle) { m_angle = angle; }
+ QPointF point1() const { return m_point1; }
+ void setPoint1(const QPointF &p) { m_point1 = p; }
+ QPointF point2() const { return m_point2; }
+ void setPoint2(const QPointF &p) { m_point2 = p; }
+ int pointCount() const { return m_pointCount; }
+ void setPointCount(int count) { m_pointCount = count; }
+ bool accepted() const { return m_accepted; }
+ void setAccepted(bool a) { m_accepted = a; }
private:
- QPointF center_;
- qreal angle_;
- QPointF point1_;
- QPointF point2_;
- int pointCount_;
- bool accepted_;
+ QPointF m_center;
+ qreal m_angle;
+ QPointF m_point1;
+ QPointF m_point2;
+ int m_pointCount;
+ bool m_accepted;
};
-// tbd: should we have a 'active' / 'moving' boolean attribute when pinch is active?
-
-// class QDeclarativeGeoMapGestureArea: public QObject // supporting pinching, panning, flicking
-class QDeclarativeGeoMapGestureArea: public QObject
+class QQuickGeoMapGestureArea: public QQuickItem
{
Q_OBJECT
Q_ENUMS(ActiveGesture)
@@ -118,9 +124,10 @@ class QDeclarativeGeoMapGestureArea: public QObject
Q_PROPERTY(ActiveGestures activeGestures READ activeGestures WRITE setActiveGestures NOTIFY activeGesturesChanged)
Q_PROPERTY(qreal maximumZoomLevelChange READ maximumZoomLevelChange WRITE setMaximumZoomLevelChange NOTIFY maximumZoomLevelChangeChanged)
Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged)
+ Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1)
public:
- QDeclarativeGeoMapGestureArea(QDeclarativeGeoMap *map, QObject *parent = 0);
- ~QDeclarativeGeoMapGestureArea();
+ QQuickGeoMapGestureArea(QDeclarativeGeoMap *map);
+ ~QQuickGeoMapGestureArea();
enum ActiveGesture {
NoGesture = 0x0000,
@@ -168,6 +175,9 @@ public:
void setMap(QGeoMap *map);
+ bool preventStealing() const;
+ void setPreventStealing(bool prevent);
+
Q_SIGNALS:
void panActiveChanged();
void pinchActiveChanged();
@@ -187,7 +197,7 @@ Q_SIGNALS:
void panFinished();
void flickStarted();
void flickFinished();
-
+ void preventStealingChanged();
private:
void update();
@@ -212,8 +222,10 @@ private:
void updatePan();
bool tryStartFlick();
void startFlick(int dx, int dy, int timeMs = 0);
-private Q_SLOTS:
void endFlick();
+private Q_SLOTS:
+ void handleFlickAnimationStopped();
+
private:
void stopPan();
@@ -221,60 +233,62 @@ private:
void updateVelocityList(const QPointF &pos);
private:
- QGeoMap *map_;
- QDeclarativeGeoMap *declarativeMap_;
- bool enabled_;
+ QGeoMap *m_map;
+ QDeclarativeGeoMap *m_declarativeMap;
+ bool m_enabled;
struct Pinch
{
- Pinch() : enabled(true), startDist(0), lastAngle(0.0) {}
+ Pinch() : m_enabled(true), m_startDist(0), m_lastAngle(0.0) {}
- QDeclarativeGeoMapPinchEvent event;
- bool enabled;
+ QDeclarativeGeoMapPinchEvent m_event;
+ bool m_enabled;
struct Zoom
{
- Zoom() : minimum(-1.0), maximum(-1.0), start(0.0), previous(0.0),
+ Zoom() : m_minimum(-1.0), m_maximum(-1.0), m_start(0.0), m_previous(0.0),
maximumChange(4.0) {}
- qreal minimum;
- qreal maximum;
- qreal start;
- qreal previous;
+ qreal m_minimum;
+ qreal m_maximum;
+ qreal m_start;
+ qreal m_previous;
qreal maximumChange;
- } zoom;
+ } m_zoom;
- QPointF lastPoint1;
- QPointF lastPoint2;
- qreal startDist;
- qreal lastAngle;
- } pinch_;
+ QPointF m_lastPoint1;
+ QPointF m_lastPoint2;
+ qreal m_startDist;
+ qreal m_lastAngle;
+ } m_pinch;
- ActiveGestures activeGestures_;
+ ActiveGestures m_activeGestures;
struct Pan
{
- qreal maxVelocity_;
- qreal deceleration_;
- QPropertyAnimation *animation_;
- bool enabled_;
- } pan_;
+ qreal m_maxVelocity;
+ qreal m_deceleration;
+ QQuickGeoCoordinateAnimation *m_animation;
+ bool m_enabled;
+ } m_flick;
+
// these are calculated regardless of gesture or number of touch points
- qreal velocityX_;
- qreal velocityY_;
- QElapsedTimer lastPosTime_;
- QPointF lastPos_;
+ qreal m_velocityX;
+ qreal m_velocityY;
+ QElapsedTimer m_lastPosTime;
+ QPointF m_lastPos;
QList<QTouchEvent::TouchPoint> m_allPoints;
QList<QTouchEvent::TouchPoint> m_touchPoints;
QScopedPointer<QTouchEvent::TouchPoint> m_mousePoint;
- QPointF sceneStartPoint1_;
+ QPointF m_sceneStartPoint1;
// only set when two points in contact
- QPointF sceneStartPoint2_;
- QGeoCoordinate startCoord_;
- QGeoCoordinate touchCenterCoord_;
- qreal twoTouchAngle_;
- qreal distanceBetweenTouchPoints_;
- QPointF sceneCenter_;
+ QPointF m_sceneStartPoint2;
+ QGeoCoordinate m_startCoord;
+ QGeoCoordinate m_touchCenterCoord;
+ qreal m_twoTouchAngle;
+ qreal m_distanceBetweenTouchPoints;
+ QPointF m_sceneCenter;
+ bool m_preventStealing;
// prototype state machine...
enum TouchPointState
@@ -282,24 +296,24 @@ private:
touchPoints0,
touchPoints1,
touchPoints2
- } touchPointState_;
+ } m_touchPointState;
enum PinchState
{
pinchInactive,
pinchInactiveTwoPoints,
pinchActive
- } pinchState_;
+ } m_pinchState;
- enum PanState
+ enum FlickState
{
- panInactive,
+ flickInactive,
panActive,
- panFlick
- } panState_;
+ flickActive
+ } m_flickState;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeGeoMapGestureArea)
+QML_DECLARE_TYPE(QQuickGeoMapGestureArea)
-#endif // QDECLARATIVEGEOMAPGESTUREAREA_P_H
+#endif // QQUICKGEOMAPGESTUREAREA_P_H
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: []
@@ -90,14 +90,6 @@ Module {
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"
exports: ["QtPositioning/Location 5.0"]
@@ -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 }
@@ -251,6 +243,23 @@ Module {
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"
Property { name: "duration"; type: "int" }
diff --git a/src/imports/positioning/positioning.cpp b/src/imports/positioning/positioning.cpp
index ce68cb46..c9a64a47 100644
--- a/src/imports/positioning/positioning.cpp
+++ b/src/imports/positioning/positioning.cpp
@@ -39,7 +39,7 @@
#include "qdeclarativepositionsource_p.h"
#include "qdeclarativeposition_p.h"
-#include "qdeclarativegeocoordinateanimation_p.h"
+#include "qquickgeocoordinateanimation_p.h"
#include "locationsingleton.h"
#include <QtCore/QVariantAnimation>
@@ -517,7 +517,7 @@ public:
qRegisterMetaType<QGeoShape>();
QMetaType::registerEqualsComparator<QGeoShape>();
- qRegisterAnimationInterpolator<QGeoCoordinate>(geoCoordinateInterpolator);
+ qRegisterAnimationInterpolator<QGeoCoordinate>(q_coordinateInterpolator);
// Register the 5.0 types
// 5.0 is silent and not advertised
@@ -531,7 +531,7 @@ public:
// Register the 5.3 types
// Introduction of 5.3 version; existing 5.0 exports become automatically available under 5.3
minor = 3;
- qmlRegisterType<QDeclarativeGeoCoordinateAnimation >(uri, major, minor, "CoordinateAnimation");
+ qmlRegisterType<QQuickGeoCoordinateAnimation >(uri, major, minor, "CoordinateAnimation");
qmlRegisterType<QDeclarativePosition, 1 >(uri, major, minor, "Position");
// Register the 5.4 types
@@ -539,7 +539,7 @@ public:
minor = 4;
qmlRegisterType<QDeclarativePosition, 2>(uri, major, minor, "Position");
- minor = 5;
+ minor = 6;
qmlRegisterType<QDeclarativePosition, 2>(uri, major, minor, "Position");
} else {
qDebug() << "Unsupported URI given to load positioning QML plugin: " << QLatin1String(uri);
diff --git a/src/imports/positioning/positioning.pro b/src/imports/positioning/positioning.pro
index 7e49ec8e..119c3dea 100644
--- a/src/imports/positioning/positioning.pro
+++ b/src/imports/positioning/positioning.pro
@@ -5,13 +5,14 @@ INCLUDEPATH *= $$PWD
HEADERS += qdeclarativeposition_p.h \
qdeclarativepositionsource_p.h \
locationsingleton.h \
- qdeclarativegeocoordinateanimation_p.h
+ qquickgeocoordinateanimation_p.h \
+ qquickgeocoordinateanimation_p_p.h
SOURCES += qdeclarativeposition.cpp \
positioning.cpp \
qdeclarativepositionsource.cpp \
locationsingleton.cpp \
- qdeclarativegeocoordinateanimation.cpp
+ qquickgeocoordinateanimation.cpp
load(qml_plugin)
diff --git a/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp b/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp
deleted file mode 100644
index 8bb677ad..00000000
--- a/src/imports/positioning/qdeclarativegeocoordinateanimation.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include "qdeclarativegeocoordinateanimation_p.h"
-#include <QtQuick/private/qquickanimation_p_p.h>
-#include <QtPositioning/private/qdoublevector2d_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CoordinateAnimation
- \instantiates QDeclarativeGeoCoordinateAnimation
- \inherits PropertyAnimation
- \inqmlmodule QtPositioning
- \since 5.3
-
- \brief A PropertyAnimation for geo coordinate properties.
-
- A specialized \l{PropertyAnimation} that defines an animation
- between two geo coordinates.
-*/
-
-QDeclarativeGeoCoordinateAnimation::QDeclarativeGeoCoordinateAnimation(QObject *parent)
- : QQuickPropertyAnimation(parent)
-{
- Q_D(QQuickPropertyAnimation);
- d->interpolatorType = qMetaTypeId<QGeoCoordinate>();
- d->defaultToInterpolatorType = true;
- d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
-}
-
-QDeclarativeGeoCoordinateAnimation::~QDeclarativeGeoCoordinateAnimation()
-{
-}
-
-/*!
- \qmlproperty coordinate CoordinateAnimation::from
- This property holds the coordinate where the animation should begin.
-*/
-QGeoCoordinate QDeclarativeGeoCoordinateAnimation::from() const
-{
- Q_D(const QQuickPropertyAnimation);
- return d->from.value<QGeoCoordinate>();
-}
-
-void QDeclarativeGeoCoordinateAnimation::setFrom(const QGeoCoordinate &f)
-{
- QQuickPropertyAnimation::setFrom(QVariant::fromValue(f));
-}
-
-/*!
- \qmlproperty coordinate CoordinateAnimation::to
- This property holds the coordinate where the animation should end.
-*/
-QGeoCoordinate QDeclarativeGeoCoordinateAnimation::to() const
-{
- Q_D(const QQuickPropertyAnimation);
- return d->to.value<QGeoCoordinate>();
-}
-
-void QDeclarativeGeoCoordinateAnimation::setTo(const QGeoCoordinate &t)
-{
- QQuickPropertyAnimation::setTo(QVariant::fromValue(t));
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/positioning/qdeclarativeposition_p.h b/src/imports/positioning/qdeclarativeposition_p.h
index 67253abe..78f78464 100644
--- a/src/imports/positioning/qdeclarativeposition_p.h
+++ b/src/imports/positioning/qdeclarativeposition_p.h
@@ -36,6 +36,17 @@
#ifndef QDECLARATIVEPOSITION_H
#define QDECLARATIVEPOSITION_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtCore/QDateTime>
#include <QtQml/qqml.h>
diff --git a/src/imports/positioning/qdeclarativepositionsource_p.h b/src/imports/positioning/qdeclarativepositionsource_p.h
index 376014e4..b4530aff 100644
--- a/src/imports/positioning/qdeclarativepositionsource_p.h
+++ b/src/imports/positioning/qdeclarativepositionsource_p.h
@@ -34,6 +34,17 @@
#ifndef QDECLARATIVEPOSITIONSOURCE_H
#define QDECLARATIVEPOSITIONSOURCE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qdeclarativeposition_p.h"
#include <QtCore/QObject>
diff --git a/src/imports/positioning/qquickgeocoordinateanimation.cpp b/src/imports/positioning/qquickgeocoordinateanimation.cpp
new file mode 100644
index 00000000..11f9542e
--- /dev/null
+++ b/src/imports/positioning/qquickgeocoordinateanimation.cpp
@@ -0,0 +1,291 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtPositioning module 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$
+**
+****************************************************************************/
+
+#include "qquickgeocoordinateanimation_p.h"
+#include "qquickgeocoordinateanimation_p_p.h"
+#include <QtQuick/private/qquickanimation_p_p.h>
+#include <QtPositioning/private/qdoublevector2d_p.h>
+#include <QtPositioning/private/qgeoprojection_p.h>
+#include <QtPositioning/private/qgeocoordinate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CoordinateAnimation
+ \instantiates QQuickGeoCoordinateAnimation
+ \inherits PropertyAnimation
+ \inqmlmodule QtPositioning
+ \since 5.3
+
+ \brief A PropertyAnimation for geo coordinate properties.
+
+ A specialized \l{PropertyAnimation} that defines an animation
+ between two \l{coordinate}{coordinates}.
+
+ By default, a \l{latitude} of the \l{coordinate} is animated in the direction of shortest
+ (geodesic) distance between those coordinates. Since CoordinateAnimation uses Mercator
+ map projection, the \l{latitude} animation is always between -90 and 90 degrees.
+ The \l{longitude} animation path is not limited and can go over 180 degrees
+ in both west and east directions.
+
+ The \l{direction} property can be set to specify the direction in which the \l{longitude}
+ animation should occur.
+
+ \sa {Animation and Transitions in Qt Quick}
+*/
+
+QVariant q_coordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ if (from == to) {
+ if (progress < 0.5) {
+ return QVariant::fromValue(from);
+ } else {
+ return QVariant::fromValue(to);
+ }
+ }
+
+ QGeoCoordinate result = QGeoProjection::coordinateInterpolation(from, to, progress);
+
+ return QVariant::fromValue(result);
+}
+
+QVariant q_coordinateShortestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ const QGeoMercatorCoordinatePrivate* fromMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
+ const QGeoMercatorCoordinatePrivate* toMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
+
+ double toX = toMercator->m_mercatorX;
+ double toY = toMercator->m_mercatorY;
+ double fromX = fromMercator->m_mercatorX;
+ double fromY = fromMercator->m_mercatorY;
+ double x;
+ if (0.5 < qAbs(toX - fromX)) {
+ // handle dateline crossing
+ double ex = toX;
+ double sx = fromX;
+ if (ex < sx)
+ sx -= 1.0;
+ else if (sx < ex)
+ ex -= 1.0;
+
+ x = fromX + (toX - fromX) * progress;
+
+ if (x < 0.0)
+ x += 1.0;
+
+ } else {
+ x = fromX + (toX - fromX) * progress;
+ }
+
+ double y = fromY + (toY - fromY) * progress;
+
+ QGeoCoordinate result = QGeoProjection::mercatorToCoord(QDoubleVector2D(x, y));
+ result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
+ return QVariant::fromValue(result);
+}
+
+QVariant q_coordinateWestInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ const QGeoMercatorCoordinatePrivate* fromMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
+ const QGeoMercatorCoordinatePrivate* toMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
+
+ double toX = toMercator->m_mercatorX;
+ double toY = toMercator->m_mercatorY;
+ double fromX = fromMercator->m_mercatorX;
+ double fromY = fromMercator->m_mercatorY;
+ double diff = toX - fromX;
+
+ while (diff < 0.0) {
+ toX += 1.0;
+ diff += 1.0;
+ }
+
+ double x = fromX + (toX - fromX) * progress;
+ double y = fromY + (toY - fromY) * progress;
+
+ while (x > 1.0)
+ x -= 1.0;
+
+ QGeoCoordinate result = QGeoProjection::mercatorToCoord(QDoubleVector2D(x, y));
+ result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
+
+ return QVariant::fromValue(result);
+}
+
+QVariant q_coordinateEastInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
+{
+ const QGeoMercatorCoordinatePrivate* fromMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&from));
+ const QGeoMercatorCoordinatePrivate* toMercator =
+ static_cast<const QGeoMercatorCoordinatePrivate*>(QGeoCoordinatePrivate::get(&to));
+
+ double toX = toMercator->m_mercatorX;
+ double toY = toMercator->m_mercatorY;
+ double fromX = fromMercator->m_mercatorX;
+ double fromY = fromMercator->m_mercatorY;
+ double diff = toX - fromX;
+
+ while (diff > 0.0) {
+ toX -= 1.0;
+ diff -= 1.0;
+ }
+
+ double x = fromX + (toX - fromX) * progress;
+ double y = fromY + (toY - fromY) * progress;
+
+ while (x < 0.0)
+ x += 1.0;
+
+ QGeoCoordinate result = QGeoProjection::mercatorToCoord(QDoubleVector2D(x, y));
+ result.setAltitude(from.altitude() + (to.altitude() - from.altitude()) * progress);
+
+ return QVariant::fromValue(result);
+}
+
+QQuickGeoCoordinateAnimation::QQuickGeoCoordinateAnimation(QObject *parent)
+ : QQuickPropertyAnimation(*(new QQuickGeoCoordinateAnimationPrivate), parent)
+
+{
+ Q_D(QQuickGeoCoordinateAnimation);
+ d->interpolatorType = qMetaTypeId<QGeoCoordinate>();
+ d->defaultToInterpolatorType = true;
+ d->interpolator = QVariantAnimationPrivate::getInterpolator(d->interpolatorType);
+}
+
+QQuickGeoCoordinateAnimation::~QQuickGeoCoordinateAnimation()
+{
+}
+
+/*!
+ \qmlproperty coordinate CoordinateAnimation::from
+ This property holds the coordinate where the animation should begin.
+*/
+QGeoCoordinate QQuickGeoCoordinateAnimation::from() const
+{
+ Q_D(const QQuickGeoCoordinateAnimation);
+ return d->from.value<QGeoCoordinate>();
+}
+
+void QQuickGeoCoordinateAnimation::setFrom(const QGeoCoordinate &f)
+{
+ QGeoMercatorCoordinatePrivate *mercator = new QGeoMercatorCoordinatePrivate();
+ QDoubleVector2D fromVector = QGeoProjection::coordToMercator(f);
+ mercator->lat = f.latitude();
+ mercator->lng = f.longitude();
+ mercator->alt = f.altitude();
+ mercator->m_mercatorX = fromVector.x();
+ mercator->m_mercatorY = fromVector.y();
+ QGeoCoordinate from(*mercator);
+ QQuickPropertyAnimation::setFrom(QVariant::fromValue(from));
+}
+
+/*!
+ \qmlproperty coordinate CoordinateAnimation::to
+ This property holds the coordinate where the animation should end.
+*/
+QGeoCoordinate QQuickGeoCoordinateAnimation::to() const
+{
+ Q_D(const QQuickGeoCoordinateAnimation);
+ return d->to.value<QGeoCoordinate>();
+}
+
+void QQuickGeoCoordinateAnimation::setTo(const QGeoCoordinate &t)
+{
+ QGeoMercatorCoordinatePrivate *mercator = new QGeoMercatorCoordinatePrivate();
+ QDoubleVector2D toVector = QGeoProjection::coordToMercator(t);
+ mercator->lat = t.latitude();
+ mercator->lng = t.longitude();
+ mercator->alt = t.altitude();
+ mercator->m_mercatorX = toVector.x();
+ mercator->m_mercatorY = toVector.y();
+ QGeoCoordinate to(*mercator);
+ QQuickPropertyAnimation::setTo(QVariant::fromValue(to));
+}
+
+/*!
+ \qmlproperty enumeration CoordinateAnimation::direction
+ This property holds the direction of the \l{longitude} animation of the \l{coordinate}.
+
+ Possible values are:
+
+ \list
+ \li CoordinateAnimation.Shortest (default) - the longitude animation goes in the direction
+ that produces the shortest animation path.
+ \li CoordinateAnimation.West - the longitude animation always goes into western direction
+ and may cross the date line.
+ \li CoordinateAnimation.East - the longitude animation always goes into eastern direction
+ and may cross the date line.
+ \endlist
+ \since 5.5
+*/
+
+
+QQuickGeoCoordinateAnimation::Direction QQuickGeoCoordinateAnimation::direction() const
+{
+ Q_D(const QQuickGeoCoordinateAnimation);
+ return d->m_direction;
+}
+
+void QQuickGeoCoordinateAnimation::setDirection(QQuickGeoCoordinateAnimation::Direction direction)
+{
+ Q_D( QQuickGeoCoordinateAnimation);
+ if (d->m_direction == direction)
+ return;
+
+ d->m_direction = direction;
+ switch (direction) {
+ case West:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&q_coordinateWestInterpolator);
+ break;
+ case East:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&q_coordinateEastInterpolator);
+ break;
+ case Shortest:
+ default:
+ d->interpolator = reinterpret_cast<QVariantAnimation::Interpolator>(&q_coordinateShortestInterpolator);
+ break;
+ }
+ emit directionChanged();
+
+}
+
+QQuickGeoCoordinateAnimationPrivate::QQuickGeoCoordinateAnimationPrivate():
+ m_direction(QQuickGeoCoordinateAnimation::Shortest)
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/position/blackberry/bb/ppsobject.h b/src/imports/positioning/qquickgeocoordinateanimation_p.h
index 9f290448..526aa456 100644
--- a/src/plugins/position/blackberry/bb/ppsobject.h
+++ b/src/imports/positioning/qquickgeocoordinateanimation_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtPositioning module of the Qt Toolkit.
@@ -31,60 +31,63 @@
**
****************************************************************************/
-#ifndef BB_CORE_PPSOBJECT_HPP
-#define BB_CORE_PPSOBJECT_HPP
+#ifndef QQUICKGEOCOORDINATEANIMATION_P_H
+#define QQUICKGEOCOORDINATEANIMATION_P_H
-#include <bb/Global>
-#include <bb/PpsAttribute>
-#include <bb/PpsOpenMode>
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
-#include <QMap>
-#include <QObject>
-#include <QVariantMap>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtPositioning/qgeocoordinate.h>
-namespace bb
-{
-class PpsObjectPrivate;
+QT_BEGIN_NAMESPACE
+
+class QQuickGeoCoordinateAnimationPrivate;
-class BB_CORE_EXPORT PpsObject : public QObject
+class QQuickGeoCoordinateAnimation : public QQuickPropertyAnimation
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QQuickGeoCoordinateAnimation)
+ Q_PROPERTY(QGeoCoordinate from READ from WRITE setFrom)
+ Q_PROPERTY(QGeoCoordinate to READ to WRITE setTo)
+ Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged)
public:
- explicit PpsObject(const QString &path, QObject *parent = 0);
- virtual ~PpsObject();
+ enum Direction {
+ Shortest,
+ West,
+ East
+ };
+ Q_ENUM(Direction)
- int error() const;
- QString errorString() const;
+ QQuickGeoCoordinateAnimation(QObject *parent=0);
+ ~QQuickGeoCoordinateAnimation();
- bool isReadyReadEnabled() const;
- bool isBlocking() const;
- bool setBlocking(bool enable);
- bool isOpen() const;
- bool open(PpsOpenMode::Types mode = PpsOpenMode::PublishSubscribe);
- bool close();
- QByteArray read(bool * ok = 0);
- bool write(const QByteArray &byteArray);
- bool remove();
+ QGeoCoordinate from() const;
+ void setFrom(const QGeoCoordinate &);
- static QVariantMap decode( const QByteArray &rawData, bool * ok = 0 );
- static QMap<QString, PpsAttribute> decodeWithFlags( const QByteArray &rawData, bool * ok = 0 );
- static QByteArray encode( const QVariantMap &ppsData, bool * ok = 0 );
+ QGeoCoordinate to() const;
+ void setTo(const QGeoCoordinate &);
-public Q_SLOTS:
- void setReadyReadEnabled(bool enable);
+ Direction direction() const;
+ void setDirection(Direction direction);
Q_SIGNALS:
- void readyRead();
-
-private:
-//!@cond PRIVATE
- QScopedPointer<PpsObjectPrivate> d_ptr;
- Q_DECLARE_PRIVATE(PpsObject)
- Q_DISABLE_COPY(PpsObject)
-//!@endcond PRIVATE
+ void directionChanged();
};
-} // namespace bb
+QVariant q_coordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress);
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickGeoCoordinateAnimation)
-#endif // BB_CORE_PPSOBJECT_HPP
+#endif // QQUICKCOORDINATEANIMATION_P_H
diff --git a/src/imports/positioning/qdeclarativegeocoordinateanimation_p.h b/src/imports/positioning/qquickgeocoordinateanimation_p_p.h
index 2aafc8f6..daa59b73 100644
--- a/src/imports/positioning/qdeclarativegeocoordinateanimation_p.h
+++ b/src/imports/positioning/qquickgeocoordinateanimation_p_p.h
@@ -31,34 +31,33 @@
**
****************************************************************************/
-#ifndef QDECLARATIVEGEOCOORDINATEANIMATION_P_H
-#define QDECLARATIVEGEOCOORDINATEANIMATION_P_H
-
-#include <QtQuick/private/qquickanimation_p.h>
-#include <QtPositioning/qgeocoordinate.h>
+#ifndef QQUICKGEOCOORDINATEANIMATION_P_P_H
+#define QQUICKGEOCOORDINATEANIMATION_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickgeocoordinateanimation_p.h"
+#include <QtQuick/private/qquickanimation_p_p.h>
QT_BEGIN_NAMESPACE
-class QDeclarativeGeoCoordinateAnimation : public QQuickPropertyAnimation
+class QQuickGeoCoordinateAnimationPrivate : public QQuickPropertyAnimationPrivate
{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QQuickPropertyAnimation)
- Q_PROPERTY(QGeoCoordinate from READ from WRITE setFrom)
- Q_PROPERTY(QGeoCoordinate to READ to WRITE setTo)
-
+ Q_DECLARE_PUBLIC(QQuickGeoCoordinateAnimation)
public:
- QDeclarativeGeoCoordinateAnimation(QObject *parent=0);
- ~QDeclarativeGeoCoordinateAnimation();
-
- QGeoCoordinate from() const;
- void setFrom(const QGeoCoordinate &);
-
- QGeoCoordinate to() const;
- void setTo(const QGeoCoordinate &);
+ QQuickGeoCoordinateAnimationPrivate();
+ QQuickGeoCoordinateAnimation::Direction m_direction;
};
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QDeclarativeGeoCoordinateAnimation)
-
-#endif // QDECLARATIVEGEOCOORDINATEANIMATION_P_H
+#endif // QQUICKGEOCOORDINATEANIMATION_P_P_H
diff --git a/src/location/doc/qtlocation.qdocconf b/src/location/doc/qtlocation.qdocconf
index 695860a0..abe48974 100644
--- a/src/location/doc/qtlocation.qdocconf
+++ b/src/location/doc/qtlocation.qdocconf
@@ -41,7 +41,7 @@ sourcedirs += .. \
../../imports/location \
../../plugins/geoservices/nokia
-examplesinstallpath = location
+examplesinstallpath = qtlocation/location
exampledirs += ../../../examples/location \
snippets/
diff --git a/src/location/doc/snippets/declarative/maps.qml b/src/location/doc/snippets/declarative/maps.qml
index 59e92c45..3378ee06 100644
--- a/src/location/doc/snippets/declarative/maps.qml
+++ b/src/location/doc/snippets/declarative/maps.qml
@@ -43,7 +43,7 @@ import QtQuick 2.0
//! [QtQuick import]
//! [QtLocation import]
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
//! [QtLocation import]
Item {
diff --git a/src/location/doc/snippets/declarative/nmealog.txt b/src/location/doc/snippets/declarative/nmealog.txt
index 8c8286dd..8c8286dd 100755..100644
--- a/src/location/doc/snippets/declarative/nmealog.txt
+++ b/src/location/doc/snippets/declarative/nmealog.txt
diff --git a/src/location/doc/snippets/declarative/places.qml b/src/location/doc/snippets/declarative/places.qml
index a0081bd9..7dab804c 100644
--- a/src/location/doc/snippets/declarative/places.qml
+++ b/src/location/doc/snippets/declarative/places.qml
@@ -42,7 +42,7 @@
import QtQuick 2.0
//! [QtQuick import]
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
Item {
width: 400; height: 400;
diff --git a/src/location/doc/snippets/declarative/routing.qml b/src/location/doc/snippets/declarative/routing.qml
index 75d18c5b..643722bf 100644
--- a/src/location/doc/snippets/declarative/routing.qml
+++ b/src/location/doc/snippets/declarative/routing.qml
@@ -42,7 +42,7 @@
import QtQuick 2.3
//! [QtQuick import]
import QtPositioning 5.5
-import QtLocation 5.5
+import QtLocation 5.6
Item {
width: 1000
diff --git a/src/location/doc/src/plugins/nokia.qdoc b/src/location/doc/src/plugins/nokia.qdoc
index f1a6828a..1ed5e6e1 100644
--- a/src/location/doc/src/plugins/nokia.qdoc
+++ b/src/location/doc/src/plugins/nokia.qdoc
@@ -92,7 +92,9 @@ a prefix.
\li here.mapping.cache.directory
\li Absolute path to map tile cache directory used as network disk cache.
- Default place for the cache is "QtLocation" directory in \l {QStandardPaths::writableLocation()} {QStandardPaths::writableLocation}(\l{QStandardPaths::GenericCacheLocation}).
+ The default place for the cache is \c{QtLocation/here} directory in \l {QStandardPaths::writableLocation()} {QStandardPaths::writableLocation}(\l{QStandardPaths::GenericCacheLocation}).
+ On systems that have no concept of a shared cache, the application-specific \l{QStandardPaths::CacheLocation} is used instead.
+
\row
\li here.mapping.cache.disk.size
\li Map tile disk cache size in bytes. Default size of the cache is 20MB.
diff --git a/src/location/doc/src/plugins/osm.qdoc b/src/location/doc/src/plugins/osm.qdoc
index f6de9c20..1c924fd3 100644
--- a/src/location/doc/src/plugins/osm.qdoc
+++ b/src/location/doc/src/plugins/osm.qdoc
@@ -106,4 +106,12 @@ Plugin {
PluginParameter { name: "osm.geocoding.host"; value: "http://geocoding.server.address" }
}
\endcode
+
+\section1 Other Plugin-specific Information
+
+\section2 Tile cache
+
+The tiles are cached in a \c{QtLocation/osm} directory in \l {QStandardPaths::writableLocation()}{QStandardPaths::writableLocation}
+(\l{QStandardPaths::GenericCacheLocation}). On systems that have no concept of a shared cache, the application-specific
+\l{QStandardPaths::CacheLocation} is used instead.
*/
diff --git a/src/location/doc/src/qml-maps.qdoc b/src/location/doc/src/qml-maps.qdoc
index ebae9582..9b6232f5 100644
--- a/src/location/doc/src/qml-maps.qdoc
+++ b/src/location/doc/src/qml-maps.qdoc
@@ -48,8 +48,7 @@ Map item you can center the map, zoom, pinch and make the item flickable.
The places to be added to the map are
\l {Maps and Navigation (QML)#Putting Objects on a Map (Map Overlay Objects)}{MapItems}. The item's
position is defined by a \l {coordinate}{coordinate} which includes latitude,
-longitude and altitude. The item is then displayed automatically after it is added to the Map.
-\l {Maps and Navigation (QML)#Putting Objects on a Map (Map Overlay Objects)}{MapItems} or \l Map.
+longitude and altitude. The item is then displayed automatically after it is added to the \l Map.
\section2 Position on map
diff --git a/src/location/doc/src/qtlocation.qdoc b/src/location/doc/src/qtlocation.qdoc
index 11d0d2f7..7979bbe5 100644
--- a/src/location/doc/src/qtlocation.qdoc
+++ b/src/location/doc/src/qtlocation.qdoc
@@ -68,9 +68,6 @@ applications.
The Qt Location API helps you create viable mapping solutions using the data
available from some of the popular location services.
-The release of this API with Qt 5.5 is a Technology Preview. This implies a
-soft API freeze for Qt Location.
-
\section1 Overview
The Qt Location API enables you to:
@@ -88,7 +85,7 @@ To load the Qt Location module, add the following statement to your .qml files
\code
import QtPositioning 5.5
- import QtLocation 5.5
+ import QtLocation 5.6
\endcode
The QtLocation QML module depends on the QtPositioning QML module.
diff --git a/src/location/maps/maps.pri b/src/location/maps/maps.pri
index 43e0f747..93af4f4d 100644
--- a/src/location/maps/maps.pri
+++ b/src/location/maps/maps.pri
@@ -49,7 +49,8 @@ PRIVATE_HEADERS += \
maps/qgeoroutingmanagerengine_p.h \
maps/qgeoroutingmanager_p.h \
maps/qgeoserviceprovider_p.h \
- maps/qgeotilecache_p.h \
+ maps/qabstractgeotilecache_p.h \
+ maps/qgeofiletilecache_p.h \
maps/qgeotiledmapreply_p.h \
maps/qgeotiledmapreply_p_p.h \
maps/qgeotilespec_p.h \
@@ -81,7 +82,8 @@ SOURCES += \
maps/qgeoroutingmanagerengine.cpp \
maps/qgeoserviceprovider.cpp \
maps/qgeoserviceproviderfactory.cpp \
- maps/qgeotilecache.cpp \
+ maps/qabstractgeotilecache.cpp \
+ maps/qgeofiletilecache.cpp \
maps/qgeotiledmapreply.cpp \
maps/qgeotilespec.cpp \
maps/qgeotiledmap.cpp
diff --git a/src/location/maps/qabstractgeotilecache.cpp b/src/location/maps/qabstractgeotilecache.cpp
new file mode 100644
index 00000000..739123db
--- /dev/null
+++ b/src/location/maps/qabstractgeotilecache.cpp
@@ -0,0 +1,147 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "qabstractgeotilecache_p.h"
+
+#include "qgeotilespec_p.h"
+
+#include "qgeomappingmanager_p.h"
+
+#include <QDir>
+#include <QStandardPaths>
+#include <QMetaType>
+#include <QPixmap>
+#include <QDebug>
+
+Q_DECLARE_METATYPE(QList<QGeoTileSpec>)
+Q_DECLARE_METATYPE(QSet<QGeoTileSpec>)
+
+QT_BEGIN_NAMESPACE
+
+QGeoTileTexture::QGeoTileTexture()
+ : textureBound(false) {}
+
+QGeoTileTexture::~QGeoTileTexture()
+{
+}
+
+QAbstractGeoTileCache::QAbstractGeoTileCache(QObject *parent)
+ : QObject(parent)
+{
+ qRegisterMetaType<QGeoTileSpec>();
+ qRegisterMetaType<QList<QGeoTileSpec> >();
+ qRegisterMetaType<QSet<QGeoTileSpec> >();
+}
+
+QAbstractGeoTileCache::~QAbstractGeoTileCache()
+{
+}
+
+void QAbstractGeoTileCache::printStats()
+{
+}
+
+void QAbstractGeoTileCache::handleError(const QGeoTileSpec &, const QString &error)
+{
+ qWarning() << "tile request error " << error;
+}
+
+void QAbstractGeoTileCache::setMaxDiskUsage(int diskUsage)
+{
+ Q_UNUSED(diskUsage);
+}
+
+int QAbstractGeoTileCache::maxDiskUsage() const
+{
+ return 0;
+}
+
+int QAbstractGeoTileCache::diskUsage() const
+{
+ return 0;
+}
+
+void QAbstractGeoTileCache::setMaxMemoryUsage(int memoryUsage)
+{
+ Q_UNUSED(memoryUsage);
+}
+
+int QAbstractGeoTileCache::maxMemoryUsage() const
+{
+ return 0;
+}
+
+int QAbstractGeoTileCache::memoryUsage() const
+{
+ return 0;
+}
+
+QString QAbstractGeoTileCache::baseCacheDirectory()
+{
+ QString dir;
+
+ // Try the shared cache first and use a specific directory. (e.g. ~/.cache/QtLocation)
+ // If this is not supported by the platform, use the application-specific cache
+ // location. (e.g. ~/.cache/<app_name>/QtLocation)
+ dir = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
+
+ if (!dir.isEmpty()) {
+ // The shared cache may not be writable when application isolation is enforced.
+ static bool writable = false;
+ static bool writableChecked = false;
+ if (!writableChecked) {
+ writableChecked = true;
+ QDir::root().mkpath(dir);
+ QFile writeTestFile(QDir(dir).filePath(QStringLiteral("qt_cache_check")));
+ writable = writeTestFile.open(QIODevice::WriteOnly);
+ if (writable)
+ writeTestFile.remove();
+ }
+ if (!writable)
+ dir = QString();
+ }
+
+ if (dir.isEmpty())
+ dir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
+
+ if (!dir.endsWith(QLatin1Char('/')))
+ dir += QLatin1Char('/');
+
+ dir += QLatin1String("QtLocation/");
+
+ return dir;
+}
+
+QT_END_NAMESPACE
diff --git a/src/location/maps/qabstractgeotilecache_p.h b/src/location/maps/qabstractgeotilecache_p.h
new file mode 100644
index 00000000..e368066f
--- /dev/null
+++ b/src/location/maps/qabstractgeotilecache_p.h
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtLocation module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QABSTRACTGEOTILECACHE_P_H
+#define QABSTRACTGEOTILECACHE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLocation/qlocationglobal.h>
+
+#include <QObject>
+#include <QCache>
+#include "qcache3q_p.h"
+#include <QSet>
+#include <QMutex>
+#include <QTimer>
+
+#include "qgeotilespec_p.h"
+#include "qgeotiledmappingmanagerengine_p.h"
+
+#include <QImage>
+
+QT_BEGIN_NAMESPACE
+
+class QGeoMappingManager;
+
+class QGeoTile;
+class QAbstractGeoTileCache;
+
+class QThread;
+
+/* This is also used in the mapgeometry */
+class Q_LOCATION_EXPORT QGeoTileTexture
+{
+public:
+
+ QGeoTileTexture();
+ ~QGeoTileTexture();
+
+ QGeoTileSpec spec;
+ QImage image;
+ bool textureBound;
+};
+
+class Q_LOCATION_EXPORT QAbstractGeoTileCache : public QObject
+{
+ Q_OBJECT
+public:
+ virtual ~QAbstractGeoTileCache();
+
+ virtual void setMaxDiskUsage(int diskUsage);
+ virtual int maxDiskUsage() const;
+ virtual int diskUsage() const;
+
+ virtual void setMaxMemoryUsage(int memoryUsage);
+ virtual int maxMemoryUsage() const;
+ virtual int memoryUsage() const;
+
+ virtual void setMinTextureUsage(int textureUsage) = 0;
+ virtual void setExtraTextureUsage(int textureUsage) = 0;
+ virtual int maxTextureUsage() const = 0;
+ virtual int minTextureUsage() const = 0;
+ virtual int textureUsage() const = 0;
+
+ virtual QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec) = 0;
+
+ virtual void insert(const QGeoTileSpec &spec,
+ const QByteArray &bytes,
+ const QString &format,
+ QGeoTiledMappingManagerEngine::CacheAreas areas = QGeoTiledMappingManagerEngine::AllCaches) = 0;
+ virtual void handleError(const QGeoTileSpec &spec, const QString &errorString);
+
+ static QString baseCacheDirectory();
+
+protected:
+ QAbstractGeoTileCache(QObject *parent = 0);
+
+ virtual void printStats() = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QABSTRACTGEOTILECACHE_P_H
diff --git a/src/location/maps/qgeocameracapabilities.cpp b/src/location/maps/qgeocameracapabilities.cpp
index 41f71b97..7b4a014a 100644
--- a/src/location/maps/qgeocameracapabilities.cpp
+++ b/src/location/maps/qgeocameracapabilities.cpp
@@ -107,7 +107,7 @@ QGeoCameraCapabilitiesPrivate &QGeoCameraCapabilitiesPrivate::operator = (const
\class QGeoCameraCapabilities
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\internal
\brief The QGeoCameraCapabilities class describes the limitations on camera settings imposed by a mapping plugin.
diff --git a/src/location/maps/qgeocameratiles.cpp b/src/location/maps/qgeocameratiles.cpp
index abce5c3e..d2783a5b 100644
--- a/src/location/maps/qgeocameratiles.cpp
+++ b/src/location/maps/qgeocameratiles.cpp
@@ -179,7 +179,7 @@ QSet<QGeoTileSpec> QGeoCameraTiles::prefetchTiles(PrefetchStle style)
return d_ptr->m_tiles;
}
-void QGeoCameraTiles::setCamera(const QGeoCameraData &camera)
+void QGeoCameraTiles::setCameraData(const QGeoCameraData &camera)
{
if (d_ptr->m_camera == camera)
return;
@@ -217,7 +217,7 @@ void QGeoCameraTiles::setMapType(const QGeoMapType &mapType)
d_ptr->m_mapType = mapType;
}
-void QGeoCameraTiles::setMapVersion(const int mapVersion)
+void QGeoCameraTiles::setMapVersion(int mapVersion)
{
if (d_ptr->m_mapVersion == mapVersion)
return;
@@ -249,7 +249,7 @@ void QGeoCameraTiles::setMaximumZoomLevel(int maxZoom)
d_ptr->m_maxZoom = maxZoom;
}
-QSet<QGeoTileSpec> QGeoCameraTiles::visibleTiles()
+const QSet<QGeoTileSpec>& QGeoCameraTiles::visibleTiles()
{
if (d_ptr->m_dirtyGeometry) {
d_ptr->m_tiles.clear();
diff --git a/src/location/maps/qgeocameratiles_p.h b/src/location/maps/qgeocameratiles_p.h
index e3260283..e133f8e6 100644
--- a/src/location/maps/qgeocameratiles_p.h
+++ b/src/location/maps/qgeocameratiles_p.h
@@ -65,7 +65,7 @@ public:
enum PrefetchStle { PrefetchNeighbourLayer, PrefetchTwoNeighbourLayers};
- void setCamera(const QGeoCameraData &camera);
+ void setCameraData(const QGeoCameraData &camera);
void setScreenSize(const QSize &size);
void setTileSize(int tileSize);
void setMaximumZoomLevel(int maxZoom);
@@ -76,7 +76,7 @@ public:
void setMapType(const QGeoMapType &mapType);
void setMapVersion(int mapVersion);
- QSet<QGeoTileSpec> visibleTiles();
+ const QSet<QGeoTileSpec>& visibleTiles();
QSet<QGeoTileSpec> prefetchTiles(PrefetchStle style);
protected:
diff --git a/src/location/maps/qgeocodereply.cpp b/src/location/maps/qgeocodereply.cpp
index 7ed18b17..47018217 100644
--- a/src/location/maps/qgeocodereply.cpp
+++ b/src/location/maps/qgeocodereply.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
\class QGeoCodeReply
\inmodule QtLocation
\ingroup QtLocation-geocoding
- \since 5.5
+ \since 5.6
\brief The QGeoCodeReply class manages an operation started by an
instance of QGeoCodingManager.
diff --git a/src/location/maps/qgeocodingmanager.cpp b/src/location/maps/qgeocodingmanager.cpp
index a84686e3..70c5de82 100644
--- a/src/location/maps/qgeocodingmanager.cpp
+++ b/src/location/maps/qgeocodingmanager.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\class QGeoCodingManager
\inmodule QtLocation
\ingroup QtLocation-geocoding
- \since 5.5
+ \since 5.6
\brief The QGeoCodingManager class provides support for geocoding
operations.
@@ -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/src/location/maps/qgeocodingmanagerengine.cpp b/src/location/maps/qgeocodingmanagerengine.cpp
index 97d0f75d..b163d173 100644
--- a/src/location/maps/qgeocodingmanagerengine.cpp
+++ b/src/location/maps/qgeocodingmanagerengine.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\class QGeoCodingManagerEngine
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\brief The QGeoCodingManagerEngine class provides an interface and
convenience methods to implementers of QGeoServiceProvider plugins who want
diff --git a/src/location/maps/qgeotilecache.cpp b/src/location/maps/qgeofiletilecache.cpp
index aa76735f..4efe9696 100644
--- a/src/location/maps/qgeotilecache.cpp
+++ b/src/location/maps/qgeofiletilecache.cpp
@@ -33,7 +33,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qgeotilecache_p.h"
+#include "qgeofiletilecache_p.h"
#include "qgeotilespec_p.h"
@@ -60,14 +60,11 @@ public:
}
QGeoTileSpec spec;
- QGeoTileCache *cache;
+ QGeoFileTileCache *cache;
QByteArray bytes;
QString format;
};
-QGeoTileTexture::QGeoTileTexture()
- : textureBound(false) {}
-
void QCache3QTileEvictionPolicy::aboutToBeRemoved(const QGeoTileSpec &key, QSharedPointer<QGeoCachedTileDisk> obj)
{
Q_UNUSED(key);
@@ -88,26 +85,14 @@ QGeoCachedTileDisk::~QGeoCachedTileDisk()
cache->evictFromDiskCache(this);
}
-QGeoTileTexture::~QGeoTileTexture()
-{
-}
-
-QGeoTileCache::QGeoTileCache(const QString &directory, QObject *parent)
- : QObject(parent), directory_(directory),
+QGeoFileTileCache::QGeoFileTileCache(const QString &directory, QObject *parent)
+ : QAbstractGeoTileCache(parent), directory_(directory),
minTextureUsage_(0), extraTextureUsage_(0)
{
- qRegisterMetaType<QGeoTileSpec>();
- qRegisterMetaType<QList<QGeoTileSpec> >();
- qRegisterMetaType<QSet<QGeoTileSpec> >();
-
- // We keep default values here so that they are in one place
- // rather than in each individual plugin (the plugins can
- // of course override them)
-
- const QString basePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
- + QLatin1String("/QtLocation");
+ const QString basePath = baseCacheDirectory();
// delete old tiles from QtLocation 5.4 or prior
+ // Newer version use plugin-specific subdirectories so those are not affected.
// TODO Remove cache cleanup in Qt 6
QDir baseDir(basePath);
if (baseDir.exists()) {
@@ -118,8 +103,7 @@ QGeoTileCache::QGeoTileCache(const QString &directory, QObject *parent)
if (directory_.isEmpty()) {
directory_ = basePath;
- qWarning() << "Plugin uses uninitialized directory for QGeoTileCache"
- " which will was deleted during startup";
+ qWarning() << "Plugin uses uninitialized QGeoFileTileCache directory which was deleted during startup";
}
QDir::root().mkpath(directory_);
@@ -132,7 +116,7 @@ QGeoTileCache::QGeoTileCache(const QString &directory, QObject *parent)
loadTiles();
}
-void QGeoTileCache::loadTiles()
+void QGeoFileTileCache::loadTiles()
{
QStringList formats;
formats << QLatin1String("*.*");
@@ -186,7 +170,7 @@ void QGeoTileCache::loadTiles()
}
}
-QGeoTileCache::~QGeoTileCache()
+QGeoFileTileCache::~QGeoFileTileCache()
{
// write disk cache queues to disk
QDir dir(directory_);
@@ -212,72 +196,72 @@ QGeoTileCache::~QGeoTileCache()
}
}
-void QGeoTileCache::printStats()
+void QGeoFileTileCache::printStats()
{
textureCache_.printStats();
memoryCache_.printStats();
diskCache_.printStats();
}
-void QGeoTileCache::setMaxDiskUsage(int diskUsage)
+void QGeoFileTileCache::setMaxDiskUsage(int diskUsage)
{
diskCache_.setMaxCost(diskUsage);
}
-int QGeoTileCache::maxDiskUsage() const
+int QGeoFileTileCache::maxDiskUsage() const
{
return diskCache_.maxCost();
}
-int QGeoTileCache::diskUsage() const
+int QGeoFileTileCache::diskUsage() const
{
return diskCache_.totalCost();
}
-void QGeoTileCache::setMaxMemoryUsage(int memoryUsage)
+void QGeoFileTileCache::setMaxMemoryUsage(int memoryUsage)
{
memoryCache_.setMaxCost(memoryUsage);
}
-int QGeoTileCache::maxMemoryUsage() const
+int QGeoFileTileCache::maxMemoryUsage() const
{
return memoryCache_.maxCost();
}
-int QGeoTileCache::memoryUsage() const
+int QGeoFileTileCache::memoryUsage() const
{
return memoryCache_.totalCost();
}
-void QGeoTileCache::setExtraTextureUsage(int textureUsage)
+void QGeoFileTileCache::setExtraTextureUsage(int textureUsage)
{
extraTextureUsage_ = textureUsage;
textureCache_.setMaxCost(minTextureUsage_ + extraTextureUsage_);
}
-void QGeoTileCache::setMinTextureUsage(int textureUsage)
+void QGeoFileTileCache::setMinTextureUsage(int textureUsage)
{
minTextureUsage_ = textureUsage;
textureCache_.setMaxCost(minTextureUsage_ + extraTextureUsage_);
}
-int QGeoTileCache::maxTextureUsage() const
+int QGeoFileTileCache::maxTextureUsage() const
{
return textureCache_.maxCost();
}
-int QGeoTileCache::minTextureUsage() const
+int QGeoFileTileCache::minTextureUsage() const
{
return minTextureUsage_;
}
-int QGeoTileCache::textureUsage() const
+int QGeoFileTileCache::textureUsage() const
{
return textureCache_.totalCost();
}
-QSharedPointer<QGeoTileTexture> QGeoTileCache::get(const QGeoTileSpec &spec)
+QSharedPointer<QGeoTileTexture> QGeoFileTileCache::get(const QGeoTileSpec &spec)
{
QSharedPointer<QGeoTileTexture> tt = textureCache_.object(spec);
if (tt)
@@ -297,19 +281,19 @@ QSharedPointer<QGeoTileTexture> QGeoTileCache::get(const QGeoTileSpec &spec)
QSharedPointer<QGeoCachedTileDisk> td = diskCache_.object(spec);
if (td) {
- QStringList parts = td->filename.split('.');
+ const QString format = QFileInfo(td->filename).suffix();
QFile file(td->filename);
file.open(QIODevice::ReadOnly);
QByteArray bytes = file.readAll();
file.close();
QPixmap pixmap;
- if (!pixmap.loadFromData(bytes, (parts.size() == 2 ? parts.at(1).toLocal8Bit().constData() : 0))) {
+ if (!pixmap.loadFromData(bytes)) {
handleError(spec, QLatin1String("Problem with tile image"));
return QSharedPointer<QGeoTileTexture>(0);
}
- addToMemoryCache(spec, bytes, (parts.size() == 2 ? parts.at(1) : QLatin1String("")));
+ addToMemoryCache(spec, bytes, format);
QSharedPointer<QGeoTileTexture> tt = addToTextureCache(td->spec, pixmap);
if (tt)
return tt;
@@ -318,12 +302,7 @@ QSharedPointer<QGeoTileTexture> QGeoTileCache::get(const QGeoTileSpec &spec)
return QSharedPointer<QGeoTileTexture>();
}
-QString QGeoTileCache::directory() const
-{
- return directory_;
-}
-
-void QGeoTileCache::insert(const QGeoTileSpec &spec,
+void QGeoFileTileCache::insert(const QGeoTileSpec &spec,
const QByteArray &bytes,
const QString &format,
QGeoTiledMappingManagerEngine::CacheAreas areas)
@@ -347,16 +326,16 @@ void QGeoTileCache::insert(const QGeoTileSpec &spec,
* and act as a poison */
}
-void QGeoTileCache::evictFromDiskCache(QGeoCachedTileDisk *td)
+void QGeoFileTileCache::evictFromDiskCache(QGeoCachedTileDisk *td)
{
QFile::remove(td->filename);
}
-void QGeoTileCache::evictFromMemoryCache(QGeoCachedTileMemory * /* tm */)
+void QGeoFileTileCache::evictFromMemoryCache(QGeoCachedTileMemory * /* tm */)
{
}
-QSharedPointer<QGeoCachedTileDisk> QGeoTileCache::addToDiskCache(const QGeoTileSpec &spec, const QString &filename)
+QSharedPointer<QGeoCachedTileDisk> QGeoFileTileCache::addToDiskCache(const QGeoTileSpec &spec, const QString &filename)
{
QSharedPointer<QGeoCachedTileDisk> td(new QGeoCachedTileDisk);
td->spec = spec;
@@ -369,7 +348,7 @@ QSharedPointer<QGeoCachedTileDisk> QGeoTileCache::addToDiskCache(const QGeoTileS
return td;
}
-QSharedPointer<QGeoCachedTileMemory> QGeoTileCache::addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format)
+QSharedPointer<QGeoCachedTileMemory> QGeoFileTileCache::addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format)
{
QSharedPointer<QGeoCachedTileMemory> tm(new QGeoCachedTileMemory);
tm->spec = spec;
@@ -383,7 +362,7 @@ QSharedPointer<QGeoCachedTileMemory> QGeoTileCache::addToMemoryCache(const QGeoT
return tm;
}
-QSharedPointer<QGeoTileTexture> QGeoTileCache::addToTextureCache(const QGeoTileSpec &spec, const QPixmap &pixmap)
+QSharedPointer<QGeoTileTexture> QGeoFileTileCache::addToTextureCache(const QGeoTileSpec &spec, const QPixmap &pixmap)
{
QSharedPointer<QGeoTileTexture> tt(new QGeoTileTexture);
tt->spec = spec;
@@ -395,12 +374,7 @@ QSharedPointer<QGeoTileTexture> QGeoTileCache::addToTextureCache(const QGeoTileS
return tt;
}
-void QGeoTileCache::handleError(const QGeoTileSpec &, const QString &error)
-{
- qWarning() << "tile request error " << error;
-}
-
-QString QGeoTileCache::tileSpecToFilename(const QGeoTileSpec &spec, const QString &format, const QString &directory)
+QString QGeoFileTileCache::tileSpecToFilename(const QGeoTileSpec &spec, const QString &format, const QString &directory)
{
QString filename = spec.plugin();
filename += QLatin1String("-");
@@ -426,7 +400,7 @@ QString QGeoTileCache::tileSpecToFilename(const QGeoTileSpec &spec, const QStrin
return dir.filePath(filename);
}
-QGeoTileSpec QGeoTileCache::filenameToTileSpec(const QString &filename)
+QGeoTileSpec QGeoFileTileCache::filenameToTileSpec(const QString &filename)
{
QGeoTileSpec emptySpec;
@@ -465,4 +439,9 @@ QGeoTileSpec QGeoTileCache::filenameToTileSpec(const QString &filename)
numbers.at(4));
}
+QString QGeoFileTileCache::directory() const
+{
+ return directory_;
+}
+
QT_END_NAMESPACE
diff --git a/src/location/maps/qgeotilecache_p.h b/src/location/maps/qgeofiletilecache_p.h
index 9cf31db0..6bd1ad2b 100644
--- a/src/location/maps/qgeotilecache_p.h
+++ b/src/location/maps/qgeofiletilecache_p.h
@@ -33,8 +33,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef QGEOTILECACHE_P_H
-#define QGEOTILECACHE_P_H
+#ifndef QGEOFILETILECACHE_P_H
+#define QGEOFILETILECACHE_P_H
//
// W A R N I N G
@@ -58,6 +58,7 @@
#include "qgeotilespec_p.h"
#include "qgeotiledmappingmanagerengine_p.h"
+#include "qabstractgeotilecache_p.h"
#include <QImage>
@@ -67,12 +68,12 @@ class QGeoMappingManager;
class QGeoTile;
class QGeoCachedTileMemory;
-class QGeoTileCache;
+class QGeoFileTileCache;
class QPixmap;
class QThread;
-/* This would be internal to qgeotilecache.cpp except that the eviction
+/* This would be internal to qgeofiletilecache.cpp except that the eviction
* policy can't be defined without it being concrete here */
class QGeoCachedTileDisk
{
@@ -82,20 +83,7 @@ public:
QGeoTileSpec spec;
QString filename;
QString format;
- QGeoTileCache *cache;
-};
-
-/* This is also used in the mapgeometry */
-class Q_LOCATION_EXPORT QGeoTileTexture
-{
-public:
-
- QGeoTileTexture();
- ~QGeoTileTexture();
-
- QGeoTileSpec spec;
- QImage image;
- bool textureBound;
+ QGeoFileTileCache *cache;
};
/* Custom eviction policy for the disk cache, to avoid deleting all the files
@@ -107,29 +95,28 @@ protected:
void aboutToBeEvicted(const QGeoTileSpec &key, QSharedPointer<QGeoCachedTileDisk> obj);
};
-class Q_LOCATION_EXPORT QGeoTileCache : public QObject
+class Q_LOCATION_EXPORT QGeoFileTileCache : public QAbstractGeoTileCache
{
Q_OBJECT
public:
- QGeoTileCache(const QString &directory = QString(), QObject *parent = 0);
- ~QGeoTileCache();
+ QGeoFileTileCache(const QString &directory = QString(), QObject *parent = 0);
+ ~QGeoFileTileCache();
- void setMaxDiskUsage(int diskUsage);
- int maxDiskUsage() const;
- int diskUsage() const;
+ void setMaxDiskUsage(int diskUsage) Q_DECL_OVERRIDE;
+ int maxDiskUsage() const Q_DECL_OVERRIDE;
+ int diskUsage() const Q_DECL_OVERRIDE;
- void setMaxMemoryUsage(int memoryUsage);
- int maxMemoryUsage() const;
- int memoryUsage() const;
+ void setMaxMemoryUsage(int memoryUsage) Q_DECL_OVERRIDE;
+ int maxMemoryUsage() const Q_DECL_OVERRIDE;
+ int memoryUsage() const Q_DECL_OVERRIDE;
- void setMinTextureUsage(int textureUsage);
- void setExtraTextureUsage(int textureUsage);
- int maxTextureUsage() const;
- int minTextureUsage() const;
- int textureUsage() const;
+ void setMinTextureUsage(int textureUsage) Q_DECL_OVERRIDE;
+ void setExtraTextureUsage(int textureUsage) Q_DECL_OVERRIDE;
+ int maxTextureUsage() const Q_DECL_OVERRIDE;
+ int minTextureUsage() const Q_DECL_OVERRIDE;
+ int textureUsage() const Q_DECL_OVERRIDE;
- QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec);
- QString directory() const;
+ QSharedPointer<QGeoTileTexture> get(const QGeoTileSpec &spec) Q_DECL_OVERRIDE;
// can be called without a specific tileCache pointer
static void evictFromDiskCache(QGeoCachedTileDisk *td);
@@ -138,15 +125,14 @@ public:
void insert(const QGeoTileSpec &spec,
const QByteArray &bytes,
const QString &format,
- QGeoTiledMappingManagerEngine::CacheAreas areas = QGeoTiledMappingManagerEngine::AllCaches);
- void handleError(const QGeoTileSpec &spec, const QString &errorString);
-
-public Q_SLOTS:
- void printStats();
+ QGeoTiledMappingManagerEngine::CacheAreas areas = QGeoTiledMappingManagerEngine::AllCaches) Q_DECL_OVERRIDE;
private:
+ void printStats() Q_DECL_OVERRIDE;
void loadTiles();
+ QString directory() const;
+
QSharedPointer<QGeoCachedTileDisk> addToDiskCache(const QGeoTileSpec &spec, const QString &filename);
QSharedPointer<QGeoCachedTileMemory> addToMemoryCache(const QGeoTileSpec &spec, const QByteArray &bytes, const QString &format);
QSharedPointer<QGeoTileTexture> addToTextureCache(const QGeoTileSpec &spec, const QPixmap &pixmap);
@@ -154,15 +140,16 @@ private:
static QString tileSpecToFilename(const QGeoTileSpec &spec, const QString &format, const QString &directory);
static QGeoTileSpec filenameToTileSpec(const QString &filename);
- QString directory_;
QCache3Q<QGeoTileSpec, QGeoCachedTileDisk, QCache3QTileEvictionPolicy > diskCache_;
QCache3Q<QGeoTileSpec, QGeoCachedTileMemory > memoryCache_;
QCache3Q<QGeoTileSpec, QGeoTileTexture > textureCache_;
+ QString directory_;
+
int minTextureUsage_;
int extraTextureUsage_;
};
QT_END_NAMESPACE
-#endif // QGEOTILECACHE_P_H
+#endif // QGEOFILETILECACHE_P_H
diff --git a/src/location/maps/qgeomaneuver.cpp b/src/location/maps/qgeomaneuver.cpp
index 679390ed..f38cb293 100644
--- a/src/location/maps/qgeomaneuver.cpp
+++ b/src/location/maps/qgeomaneuver.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
\class QGeoManeuver
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoManeuver class represents the information relevant to the
point at which two QGeoRouteSegments meet.
diff --git a/src/location/maps/qgeomap.cpp b/src/location/maps/qgeomap.cpp
index f6f8d5e2..edc64839 100644
--- a/src/location/maps/qgeomap.cpp
+++ b/src/location/maps/qgeomap.cpp
@@ -118,12 +118,6 @@ const QGeoMapType QGeoMap::activeMapType() const
return d->m_activeMapType;
}
-QString QGeoMap::pluginString()
-{
- Q_D(const QGeoMap);
- return d->m_pluginString;
-}
-
QGeoCameraCapabilities QGeoMap::cameraCapabilities()
{
Q_D(const QGeoMap);
@@ -133,11 +127,6 @@ QGeoCameraCapabilities QGeoMap::cameraCapabilities()
return QGeoCameraCapabilities();
}
-int QGeoMap::mapVersion()
-{
- return -1;
-}
-
void QGeoMap::prefetchData()
{
@@ -152,9 +141,6 @@ QGeoMapPrivate::QGeoMapPrivate(QGeoMappingManagerEngine *engine)
m_controller(0),
m_activeMapType(QGeoMapType())
{
- if (!m_engine.isNull()) {
- m_pluginString = m_engine->managerName() + QLatin1Char('_') + QString::number(m_engine->managerVersion());
- }
}
QGeoMapPrivate::~QGeoMapPrivate()
diff --git a/src/location/maps/qgeomap_p.h b/src/location/maps/qgeomap_p.h
index 9e4d5a0d..58a020dc 100644
--- a/src/location/maps/qgeomap_p.h
+++ b/src/location/maps/qgeomap_p.h
@@ -83,10 +83,8 @@ public:
virtual QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos, bool clipToViewport = true) const = 0;
virtual QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const = 0;
- virtual int mapVersion();
virtual void prefetchData();
- QString pluginString();
QGeoCameraCapabilities cameraCapabilities();
protected:
diff --git a/src/location/maps/qgeomap_p_p.h b/src/location/maps/qgeomap_p_p.h
index e7a23060..3b996ecc 100644
--- a/src/location/maps/qgeomap_p_p.h
+++ b/src/location/maps/qgeomap_p_p.h
@@ -78,7 +78,6 @@ protected:
int m_height;
double m_aspectRatio;
QPointer<QGeoMappingManagerEngine> m_engine;
- QString m_pluginString;
QGeoMapController *m_controller;
QGeoCameraData m_cameraData;
QGeoMapType m_activeMapType;
diff --git a/src/location/maps/qgeomappingmanager.cpp b/src/location/maps/qgeomappingmanager.cpp
index d009bbdd..681e68a7 100644
--- a/src/location/maps/qgeomappingmanager.cpp
+++ b/src/location/maps/qgeomappingmanager.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\class QGeoMappingManager
\inmodule QtLocation
\ingroup QtLocation-maps
- \since 5.5
+ \since 5.6
\internal
\brief The QGeoMappingManager class provides support for displaying
diff --git a/src/location/maps/qgeomappingmanagerengine.cpp b/src/location/maps/qgeomappingmanagerengine.cpp
index 9129e69b..70b1e836 100644
--- a/src/location/maps/qgeomappingmanagerengine.cpp
+++ b/src/location/maps/qgeomappingmanagerengine.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\class QGeoMappingManagerEngine
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\internal
\brief Provides support functionality for map display with QGeoServiceProvider.
diff --git a/src/location/maps/qgeomappingmanagerengine_p.h b/src/location/maps/qgeomappingmanagerengine_p.h
index b9565d87..7e866d89 100644
--- a/src/location/maps/qgeomappingmanagerengine_p.h
+++ b/src/location/maps/qgeomappingmanagerengine_p.h
@@ -81,8 +81,6 @@ public:
virtual ~QGeoMappingManagerEngine();
virtual QGeoMap *createMap() = 0;
- virtual void registerMap(QGeoMap *map) = 0;
- virtual void deregisterMap(QGeoMap *map) = 0;
QVariantMap parameters() const;
diff --git a/src/location/maps/qgeomapscene.cpp b/src/location/maps/qgeomapscene.cpp
index a448937b..4a457005 100644
--- a/src/location/maps/qgeomapscene.cpp
+++ b/src/location/maps/qgeomapscene.cpp
@@ -36,7 +36,7 @@
****************************************************************************/
#include "qgeomapscene_p.h"
#include "qgeocameradata_p.h"
-#include "qgeotilecache_p.h"
+#include "qabstractgeotilecache_p.h"
#include "qgeotilespec_p.h"
#include <QtPositioning/private/qdoublevector3d_p.h>
#include <QtCore/private/qobject_p.h>
@@ -156,6 +156,12 @@ void QGeoMapScene::setVisibleTiles(const QSet<QGeoTileSpec> &tiles)
d->setVisibleTiles(tiles);
}
+const QSet<QGeoTileSpec> &QGeoMapScene::visibleTiles() const
+{
+ Q_D(const QGeoMapScene);
+ return d->m_visibleTiles;
+}
+
void QGeoMapScene::addTile(const QGeoTileSpec &spec, QSharedPointer<QGeoTileTexture> texture)
{
Q_D(QGeoMapScene);
@@ -325,14 +331,8 @@ void QGeoMapScenePrivate::addTile(const QGeoTileSpec &spec, QSharedPointer<QGeoT
m_textures.insert(spec, texture);
}
-// return true if new tiles introduced in [tiles]
void QGeoMapScenePrivate::setVisibleTiles(const QSet<QGeoTileSpec> &tiles)
{
- Q_Q(QGeoMapScene);
-
- // detect if new tiles introduced
- bool newTilesIntroduced = !m_visibleTiles.contains(tiles);
-
// work out the tile bounds for the new scene
setTileBounds(tiles);
@@ -344,8 +344,6 @@ void QGeoMapScenePrivate::setVisibleTiles(const QSet<QGeoTileSpec> &tiles)
removeTiles(toRemove);
m_visibleTiles = tiles;
- if (newTilesIntroduced)
- emit q->newTilesVisible(m_visibleTiles);
}
void QGeoMapScenePrivate::removeTiles(const QSet<QGeoTileSpec> &oldTiles)
@@ -584,7 +582,7 @@ public:
~QGeoMapRootNode()
{
- qDeleteAll(textures.values());
+ qDeleteAll(textures);
}
void setClipRect(const QRect &rect)
diff --git a/src/location/maps/qgeomapscene_p.h b/src/location/maps/qgeomapscene_p.h
index a4a9e4e4..34d4a11f 100644
--- a/src/location/maps/qgeomapscene_p.h
+++ b/src/location/maps/qgeomapscene_p.h
@@ -73,6 +73,7 @@ public:
void setCameraData(const QGeoCameraData &cameraData);
void setVisibleTiles(const QSet<QGeoTileSpec> &tiles);
+ const QSet<QGeoTileSpec> &visibleTiles() const;
void setUseVerticalLock(bool lock);
diff --git a/src/location/maps/qgeoroute.cpp b/src/location/maps/qgeoroute.cpp
index 2406ee86..52fa4a5e 100644
--- a/src/location/maps/qgeoroute.cpp
+++ b/src/location/maps/qgeoroute.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRoute
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoRoute class represents a route between two points.
diff --git a/src/location/maps/qgeoroutereply.cpp b/src/location/maps/qgeoroutereply.cpp
index 99b4f2f3..ab869d3c 100644
--- a/src/location/maps/qgeoroutereply.cpp
+++ b/src/location/maps/qgeoroutereply.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRouteReply
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoRouteReply class manages an operation started by an instance
of QGeoRoutingManager.
diff --git a/src/location/maps/qgeorouterequest.cpp b/src/location/maps/qgeorouterequest.cpp
index e01cbe46..369606ea 100644
--- a/src/location/maps/qgeorouterequest.cpp
+++ b/src/location/maps/qgeorouterequest.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRouteRequest
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoRouteRequest class represents the parameters and restrictions
which define a request for routing information.
diff --git a/src/location/maps/qgeoroutesegment.cpp b/src/location/maps/qgeoroutesegment.cpp
index bee136eb..45c2cc69 100644
--- a/src/location/maps/qgeoroutesegment.cpp
+++ b/src/location/maps/qgeoroutesegment.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRouteSegment
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoRouteSegment class represents a segment of a route.
diff --git a/src/location/maps/qgeoroutingmanager.cpp b/src/location/maps/qgeoroutingmanager.cpp
index 18e6fa04..8eca6719 100644
--- a/src/location/maps/qgeoroutingmanager.cpp
+++ b/src/location/maps/qgeoroutingmanager.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRoutingManager
\inmodule QtLocation
\ingroup QtLocation-routing
- \since 5.5
+ \since 5.6
\brief The QGeoRoutingManager class provides support for geographic routing
operations.
diff --git a/src/location/maps/qgeoroutingmanagerengine.cpp b/src/location/maps/qgeoroutingmanagerengine.cpp
index e59f89b2..9c552682 100644
--- a/src/location/maps/qgeoroutingmanagerengine.cpp
+++ b/src/location/maps/qgeoroutingmanagerengine.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
\class QGeoRoutingManagerEngine
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\brief The QGeoRoutingManagerEngine class provides an interface and
convenience methods to implementers of QGeoServiceProvider plugins who want
diff --git a/src/location/maps/qgeoserviceprovider.cpp b/src/location/maps/qgeoserviceprovider.cpp
index 4056662c..b1b9cb86 100644
--- a/src/location/maps/qgeoserviceprovider.cpp
+++ b/src/location/maps/qgeoserviceprovider.cpp
@@ -75,7 +75,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
\class QGeoServiceProvider
\inmodule QtLocation
\ingroup QtLocation-common
- \since 5.5
+ \since 5.6
\brief The QGeoServiceProvider class aggregates access to services which provide
geographical information.
diff --git a/src/location/maps/qgeoserviceproviderfactory.cpp b/src/location/maps/qgeoserviceproviderfactory.cpp
index 4a1a46fd..7efc8a9f 100644
--- a/src/location/maps/qgeoserviceproviderfactory.cpp
+++ b/src/location/maps/qgeoserviceproviderfactory.cpp
@@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE
\class QGeoServiceProviderFactory
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\brief The QGeoServiceProviderFactory class is a factory class used as the
plugin interface for services related to geographical information.
diff --git a/src/location/maps/qgeotiledmap.cpp b/src/location/maps/qgeotiledmap.cpp
index 60e27d8e..d561c011 100644
--- a/src/location/maps/qgeotiledmap.cpp
+++ b/src/location/maps/qgeotiledmap.cpp
@@ -37,7 +37,7 @@
#include "qgeotiledmap_p_p.h"
#include "qgeotiledmappingmanagerengine_p.h"
-#include "qgeotilecache_p.h"
+#include "qabstractgeotilecache_p.h"
#include "qgeotilespec_p.h"
#include "qgeocameratiles_p.h"
@@ -56,15 +56,8 @@ QGeoTiledMap::QGeoTiledMap(QGeoTiledMappingManagerEngine *engine, QObject *paren
d->m_tileRequests = new QGeoTileRequestManager(this, engine);
- QObject::connect(d->m_mapScene,
- SIGNAL(newTilesVisible(QSet<QGeoTileSpec>)),
- this,
- SLOT(evaluateCopyrights(QSet<QGeoTileSpec>)));
- QObject::connect(engine,
- SIGNAL(mapVersionChanged()),
- this,
- SLOT(updateMapVersion()));
- QMetaObject::invokeMethod(this, "updateMapVersion", Qt::QueuedConnection);
+ QObject::connect(engine,&QGeoTiledMappingManagerEngine::tileVersionChanged,
+ this,&QGeoTiledMap::handleTileVersionChanged);
}
QGeoTiledMap::~QGeoTiledMap()
@@ -72,6 +65,12 @@ QGeoTiledMap::~QGeoTiledMap()
Q_D(QGeoTiledMap);
delete d->m_tileRequests;
d->m_tileRequests = 0;
+
+ if (!d->m_engine.isNull()) {
+ QGeoTiledMappingManagerEngine *engine = qobject_cast<QGeoTiledMappingManagerEngine*>(d->m_engine);
+ Q_ASSERT(engine);
+ engine->releaseMap(this);
+ }
}
QGeoTileRequestManager *QGeoTiledMap::requestManager()
@@ -86,7 +85,7 @@ void QGeoTiledMap::updateTile(const QGeoTileSpec &spec)
d->updateTile(spec);
}
-QGeoTileCache *QGeoTiledMap::tileCache()
+QAbstractGeoTileCache *QGeoTiledMap::tileCache()
{
Q_D(QGeoTiledMap);
return d->m_cache;
@@ -104,10 +103,14 @@ void QGeoTiledMap::prefetchData()
d->prefetchTiles();
}
-void QGeoTiledMap::updateMapVersion()
+void QGeoTiledMap::handleTileVersionChanged()
{
Q_D(QGeoTiledMap);
- d->changeMapVersion(mapVersion());
+ if (!d->m_engine.isNull()) {
+ QGeoTiledMappingManagerEngine* engine = qobject_cast<QGeoTiledMappingManagerEngine*>(d->m_engine);
+ Q_ASSERT(engine);
+ d->changeTileVersion(engine->tileVersion());
+ }
}
void QGeoTiledMap::evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles)
@@ -154,8 +157,7 @@ QGeoTiledMapPrivate::QGeoTiledMapPrivate(QGeoTiledMappingManagerEngine *engine)
{
m_cameraTiles->setMaximumZoomLevel(static_cast<int>(std::ceil(engine->cameraCapabilities().maximumZoomLevel())));
m_cameraTiles->setTileSize(engine->tileSize().width());
- m_cameraTiles->setPluginString(m_pluginString);
-
+ m_cameraTiles->setPluginString(engine->managerName() + QLatin1Char('_') + QString::number(engine->managerVersion()));
m_mapScene->setTileSize(engine->tileSize().width());
}
@@ -202,23 +204,32 @@ void QGeoTiledMapPrivate::changeCameraData(const QGeoCameraData &oldCameraData)
cam.setZoomLevel(izl);
}
- m_cameraTiles->setCamera(cam);
-
+ m_cameraTiles->setCameraData(cam);
m_mapScene->setCameraData(cam);
- m_mapScene->setVisibleTiles(m_cameraTiles->visibleTiles());
+ updateScene();
+}
- if (m_tileRequests) {
- // don't request tiles that are already built and textured
- QList<QSharedPointer<QGeoTileTexture> > cachedTiles =
- m_tileRequests->requestTiles(m_cameraTiles->visibleTiles() - m_mapScene->texturedTiles());
+void QGeoTiledMapPrivate::updateScene()
+{
+ Q_Q(QGeoTiledMap);
+ // detect if new tiles introduced
+ const QSet<QGeoTileSpec>& tiles = m_cameraTiles->visibleTiles();
+ bool newTilesIntroduced = !m_mapScene->visibleTiles().contains(tiles);
+ m_mapScene->setVisibleTiles(tiles);
- foreach (const QSharedPointer<QGeoTileTexture> &tex, cachedTiles) {
- m_mapScene->addTile(tex->spec, tex);
- }
+ if (newTilesIntroduced)
+ q->evaluateCopyrights(tiles);
- if (!cachedTiles.isEmpty())
- q->update();
+ // don't request tiles that are already built and textured
+ QList<QSharedPointer<QGeoTileTexture> > cachedTiles =
+ m_tileRequests->requestTiles(m_cameraTiles->visibleTiles() - m_mapScene->texturedTiles());
+
+ foreach (const QSharedPointer<QGeoTileTexture> &tex, cachedTiles) {
+ m_mapScene->addTile(tex->spec, tex);
}
+
+ if (!cachedTiles.isEmpty())
+ q->update();
}
void QGeoTiledMapPrivate::changeActiveMapType(const QGeoMapType mapType)
@@ -226,9 +237,10 @@ void QGeoTiledMapPrivate::changeActiveMapType(const QGeoMapType mapType)
m_cameraTiles->setMapType(mapType);
}
-void QGeoTiledMapPrivate::changeMapVersion(int mapVersion)
+void QGeoTiledMapPrivate::changeTileVersion(int version)
{
- m_cameraTiles->setMapVersion(mapVersion);
+ m_cameraTiles->setMapVersion(version);
+ updateScene();
}
void QGeoTiledMapPrivate::mapResized(int width, int height)
diff --git a/src/location/maps/qgeotiledmap_p.h b/src/location/maps/qgeotiledmap_p.h
index 2dbf1754..111056d2 100644
--- a/src/location/maps/qgeotiledmap_p.h
+++ b/src/location/maps/qgeotiledmap_p.h
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QGeoTileSpec;
class QGeoTileTexture;
-class QGeoTileCache;
+class QAbstractGeoTileCache;
class QGeoTiledMapPrivate;
class QGeoTiledMappingManagerEngine;
class QGeoTileRequestManager;
@@ -79,7 +79,7 @@ public:
QGeoTiledMap(QGeoTiledMappingManagerEngine *engine, QObject *parent);
virtual ~QGeoTiledMap();
- QGeoTileCache *tileCache();
+ QAbstractGeoTileCache *tileCache();
QGeoTileRequestManager *requestManager();
void updateTile(const QGeoTileSpec &spec);
@@ -87,13 +87,12 @@ public:
QDoubleVector2D coordinateToItemPosition(const QGeoCoordinate &coordinate, bool clipToViewport = true) const Q_DECL_OVERRIDE;
void prefetchData() Q_DECL_OVERRIDE;
-
protected:
QSGNode *updateSceneGraph(QSGNode *, QQuickWindow *window) Q_DECL_OVERRIDE;
-
-protected Q_SLOTS:
virtual void evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles);
- void updateMapVersion();
+
+private Q_SLOTS:
+ void handleTileVersionChanged();
private:
Q_DISABLE_COPY(QGeoTiledMap)
diff --git a/src/location/maps/qgeotiledmap_p_p.h b/src/location/maps/qgeotiledmap_p_p.h
index bd4b4c05..2e93a006 100644
--- a/src/location/maps/qgeotiledmap_p_p.h
+++ b/src/location/maps/qgeotiledmap_p_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QGeoCameraTiles;
class QGeoMapScene;
-class QGeoTileCache;
+class QAbstractGeoTileCache;
class QGeoTiledMappingManagerEngine;
class QGeoTiledMap;
class QGeoTileRequestManager;
@@ -74,8 +74,6 @@ public:
~QGeoTiledMapPrivate();
QSGNode *updateSceneGraph(QSGNode *node, QQuickWindow *window);
-
- void changeMapVersion(int mapVersion);
void resized(int width, int height);
QGeoCoordinate itemPositionToCoordinate(const QDoubleVector2D &pos) const;
@@ -88,9 +86,13 @@ protected:
void mapResized(int width, int height) Q_DECL_OVERRIDE;
void changeCameraData(const QGeoCameraData &oldCameraData) Q_DECL_OVERRIDE;
void changeActiveMapType(const QGeoMapType mapType) Q_DECL_OVERRIDE;
+ void changeTileVersion(int version);
+
+private:
+ void updateScene();
private:
- QGeoTileCache *m_cache;
+ QAbstractGeoTileCache *m_cache;
QGeoCameraTiles *m_cameraTiles;
QGeoMapScene *m_mapScene;
QGeoTileRequestManager *m_tileRequests;
diff --git a/src/location/maps/qgeotiledmappingmanagerengine.cpp b/src/location/maps/qgeotiledmappingmanagerengine.cpp
index 96758854..4e777ab2 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine.cpp
+++ b/src/location/maps/qgeotiledmappingmanagerengine.cpp
@@ -41,7 +41,7 @@
#include "qgeotiledmap_p.h"
#include "qgeotilerequestmanager_p.h"
-#include "qgeotilecache_p.h"
+#include "qgeofiletilecache_p.h"
#include "qgeotilespec_p.h"
#include <QTimer>
@@ -99,24 +99,8 @@ QGeoMap *QGeoTiledMappingManagerEngine::createMap()
return NULL;
}
-void QGeoTiledMappingManagerEngine::registerMap(QGeoMap *m)
+void QGeoTiledMappingManagerEngine::releaseMap(QGeoTiledMap *map)
{
- QGeoTiledMap* map = qobject_cast<QGeoTiledMap*>(m);
- if (!map) {
- qWarning() << "QGeoTiledMappingManagerEngine can only register QGeoTiledMap";
- return;
- }
- d_ptr->tileMaps_.insert(map);
-}
-
-void QGeoTiledMappingManagerEngine::deregisterMap(QGeoMap *m)
-{
- QGeoTiledMap* map = qobject_cast<QGeoTiledMap*>(m);
- if (!map) {
- qWarning() << "QGeoTiledMappingManagerEngine can only deregister QGeoTiledMap";
- return;
- }
- d_ptr->tileMaps_.remove(map);
d_ptr->mapHash_.remove(map);
QHash<QGeoTileSpec, QSet<QGeoTiledMap *> > newTileHash = d_ptr->tileHash_;
@@ -217,7 +201,6 @@ void QGeoTiledMappingManagerEngine::engineTileFinished(const QGeoTileSpec &spec,
}
d->tileHash_.remove(spec);
-
tileCache()->insert(spec, bytes, format, d->cacheHint_);
map = maps.constBegin();
@@ -259,12 +242,27 @@ void QGeoTiledMappingManagerEngine::setTileSize(const QSize &tileSize)
d->tileSize_ = tileSize;
}
+void QGeoTiledMappingManagerEngine::setTileVersion(int version)
+{
+ Q_D(QGeoTiledMappingManagerEngine);
+ if (d->m_tileVersion != version) {
+ d->m_tileVersion = version;
+ emit tileVersionChanged();
+ }
+}
+
QSize QGeoTiledMappingManagerEngine::tileSize() const
{
Q_D(const QGeoTiledMappingManagerEngine);
return d->tileSize_;
}
+int QGeoTiledMappingManagerEngine::tileVersion() const
+{
+ Q_D(const QGeoTiledMappingManagerEngine);
+ return d->m_tileVersion;
+}
+
QGeoTiledMappingManagerEngine::CacheAreas QGeoTiledMappingManagerEngine::cacheHint() const
{
Q_D(const QGeoTiledMappingManagerEngine);
@@ -277,24 +275,21 @@ void QGeoTiledMappingManagerEngine::setCacheHint(QGeoTiledMappingManagerEngine::
d->cacheHint_ = cacheHint;
}
-QGeoTileCache *QGeoTiledMappingManagerEngine::createTileCacheWithDir(const QString &cacheDirectory)
+void QGeoTiledMappingManagerEngine::setTileCache(QAbstractGeoTileCache *cache)
{
Q_D(QGeoTiledMappingManagerEngine);
Q_ASSERT_X(!d->tileCache_, Q_FUNC_INFO, "This should be called only once");
- d->tileCache_ = new QGeoTileCache(cacheDirectory);
- return d->tileCache_;
+ d->tileCache_ = cache;
}
-QGeoTileCache *QGeoTiledMappingManagerEngine::tileCache()
+QAbstractGeoTileCache *QGeoTiledMappingManagerEngine::tileCache()
{
Q_D(QGeoTiledMappingManagerEngine);
if (!d->tileCache_) {
QString cacheDirectory;
- if (!managerName().isEmpty()) {
- cacheDirectory = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
- + QLatin1String("/QtLocation/") + managerName();
- }
- d->tileCache_ = new QGeoTileCache(cacheDirectory);
+ if (!managerName().isEmpty())
+ cacheDirectory = QAbstractGeoTileCache::baseCacheDirectory() + managerName();
+ d->tileCache_ = new QGeoFileTileCache(cacheDirectory);
}
return d->tileCache_;
}
@@ -308,7 +303,10 @@ QSharedPointer<QGeoTileTexture> QGeoTiledMappingManagerEngine::getTileTexture(co
*******************************************************************************/
QGeoTiledMappingManagerEnginePrivate::QGeoTiledMappingManagerEnginePrivate()
-: cacheHint_(QGeoTiledMappingManagerEngine::AllCaches), tileCache_(0), fetcher_(0)
+: m_tileVersion(-1),
+ cacheHint_(QGeoTiledMappingManagerEngine::AllCaches),
+ tileCache_(0),
+ fetcher_(0)
{
}
diff --git a/src/location/maps/qgeotiledmappingmanagerengine_p.h b/src/location/maps/qgeotiledmappingmanagerengine_p.h
index 6cc4caea..86c5b63c 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine_p.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine_p.h
@@ -37,6 +37,17 @@
#ifndef QGEOTILEDMAPPINGMANAGERENGINE_H
#define QGEOTILEDMAPPINGMANAGERENGINE_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QObject>
#include <QSize>
#include <QPair>
@@ -53,7 +64,7 @@ class QGeoTileTexture;
class QGeoTileSpec;
class QGeoTiledMap;
-class QGeoTileCache;
+class QAbstractGeoTileCache;
class Q_LOCATION_EXPORT QGeoTiledMappingManagerEngine : public QGeoMappingManagerEngine
{
@@ -73,16 +84,16 @@ public:
QGeoTileFetcher *tileFetcher();
QGeoMap *createMap() Q_DECL_OVERRIDE;
- void registerMap(QGeoMap *map) Q_DECL_OVERRIDE;
- void deregisterMap(QGeoMap *map) Q_DECL_OVERRIDE;
+ void releaseMap(QGeoTiledMap *map);
QSize tileSize() const;
+ int tileVersion() const;
void updateTileRequests(QGeoTiledMap *map,
const QSet<QGeoTileSpec> &tilesAdded,
const QSet<QGeoTileSpec> &tilesRemoved);
- QGeoTileCache *tileCache(); // TODO: check this is still used
+ QAbstractGeoTileCache *tileCache();
QSharedPointer<QGeoTileTexture> getTileTexture(const QGeoTileSpec &spec);
@@ -94,14 +105,14 @@ private Q_SLOTS:
Q_SIGNALS:
void tileError(const QGeoTileSpec &spec, const QString &errorString);
- void mapVersionChanged();
+ void tileVersionChanged();
protected:
void setTileFetcher(QGeoTileFetcher *fetcher);
void setTileSize(const QSize &tileSize);
+ void setTileVersion(int version);
void setCacheHint(QGeoTiledMappingManagerEngine::CacheAreas cacheHint);
-
- QGeoTileCache *createTileCacheWithDir(const QString &cacheDirectory);
+ void setTileCache(QAbstractGeoTileCache *cache);
private:
QGeoTiledMappingManagerEnginePrivate *d_ptr;
diff --git a/src/location/maps/qgeotiledmappingmanagerengine_p_p.h b/src/location/maps/qgeotiledmappingmanagerengine_p_p.h
index 77e84e85..86ad0f08 100644
--- a/src/location/maps/qgeotiledmappingmanagerengine_p_p.h
+++ b/src/location/maps/qgeotiledmappingmanagerengine_p_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
class QGeoTiledMap;
-class QGeoTileCache;
+class QAbstractGeoTileCache;
class QGeoTileSpec;
class QGeoTileFetcher;
@@ -68,11 +68,11 @@ public:
~QGeoTiledMappingManagerEnginePrivate();
QSize tileSize_;
- QSet<QGeoTiledMap *> tileMaps_;
+ int m_tileVersion;
QHash<QGeoTiledMap *, QSet<QGeoTileSpec> > mapHash_;
QHash<QGeoTileSpec, QSet<QGeoTiledMap *> > tileHash_;
QGeoTiledMappingManagerEngine::CacheAreas cacheHint_;
- QGeoTileCache *tileCache_;
+ QAbstractGeoTileCache *tileCache_;
QGeoTileFetcher *fetcher_;
private:
diff --git a/src/location/maps/qgeotiledmapreply.cpp b/src/location/maps/qgeotiledmapreply.cpp
index abbebc4b..f2dfd9eb 100644
--- a/src/location/maps/qgeotiledmapreply.cpp
+++ b/src/location/maps/qgeotiledmapreply.cpp
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
\class QGeoTiledMapReply
\inmodule QtLocation
\ingroup QtLocation-impl
- \since 5.5
+ \since 5.6
\internal
\brief The QGeoTiledMapReply class manages a tile fetch operation started
diff --git a/src/location/maps/qgeotilefetcher_p_p.h b/src/location/maps/qgeotilefetcher_p_p.h
index ce2a5481..acd7288e 100644
--- a/src/location/maps/qgeotilefetcher_p_p.h
+++ b/src/location/maps/qgeotilefetcher_p_p.h
@@ -62,7 +62,6 @@ QT_BEGIN_NAMESPACE
class QGeoTileSpec;
class QGeoTiledMapReply;
-class QGeoTileCache;
class QGeoTiledMappingManagerEngine;
class QGeoTileFetcherPrivate
diff --git a/src/location/maps/qgeotilerequestmanager.cpp b/src/location/maps/qgeotilerequestmanager.cpp
index d689d618..1409856a 100644
--- a/src/location/maps/qgeotilerequestmanager.cpp
+++ b/src/location/maps/qgeotilerequestmanager.cpp
@@ -37,7 +37,7 @@
#include "qgeotilespec_p.h"
#include "qgeotiledmap_p.h"
#include "qgeotiledmappingmanagerengine_p.h"
-#include "qgeotilecache_p.h"
+#include "qabstractgeotilecache_p.h"
#include <QtCore/QPointer>
QT_BEGIN_NAMESPACE
@@ -66,14 +66,12 @@ public:
QGeoTileRequestManager::QGeoTileRequestManager(QGeoTiledMap *map, QGeoTiledMappingManagerEngine *engine)
: d_ptr(new QGeoTileRequestManagerPrivate(map, engine))
{
- if (!d_ptr->m_engine.isNull())
- d_ptr->m_engine->registerMap(d_ptr->m_map);
+
}
QGeoTileRequestManager::~QGeoTileRequestManager()
{
- if (!d_ptr->m_engine.isNull())
- d_ptr->m_engine->deregisterMap(d_ptr->m_map);
+
}
QList<QSharedPointer<QGeoTileTexture> > QGeoTileRequestManager::requestTiles(const QSet<QGeoTileSpec> &tiles)
diff --git a/src/location/maps/qgeotilerequestmanager_p.h b/src/location/maps/qgeotilerequestmanager_p.h
index 8ae7360a..66d2251e 100644
--- a/src/location/maps/qgeotilerequestmanager_p.h
+++ b/src/location/maps/qgeotilerequestmanager_p.h
@@ -54,7 +54,6 @@ QT_BEGIN_NAMESPACE
class QGeoTiledMap;
class QGeoTiledMappingManagerEngine;
class QGeoTileSpec;
-class QGeoTileCache;
class QGeoTileTexture;
class QGeoTileRequestManagerPrivate;
diff --git a/src/location/places/qplace.cpp b/src/location/places/qplace.cpp
index c3e99eab..82f9f641 100644
--- a/src/location/places/qplace.cpp
+++ b/src/location/places/qplace.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlace class represents a set of data about a place.
diff --git a/src/location/places/qplaceattribute.cpp b/src/location/places/qplaceattribute.cpp
index e2546f3c..e7812a78 100644
--- a/src/location/places/qplaceattribute.cpp
+++ b/src/location/places/qplaceattribute.cpp
@@ -69,7 +69,7 @@ bool QPlaceAttributePrivate::isEmpty() const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceAttribute class represents generic attribute information about a place.
diff --git a/src/location/places/qplacecategory.cpp b/src/location/places/qplacecategory.cpp
index 408eacca..5629631a 100644
--- a/src/location/places/qplacecategory.cpp
+++ b/src/location/places/qplacecategory.cpp
@@ -78,7 +78,7 @@ bool QPlaceCategoryPrivate::isEmpty() const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceCategory class represents a category that a \l QPlace can be associated with.
diff --git a/src/location/places/qplacecategory_p.h b/src/location/places/qplacecategory_p.h
index c12c9d5e..07fec3c3 100644
--- a/src/location/places/qplacecategory_p.h
+++ b/src/location/places/qplacecategory_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACECATEGORY_P_H
#define QPLACECATEGORY_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QSharedData>
#include <QtCore/QString>
#include <QtLocation/QLocation>
diff --git a/src/location/places/qplacecontent.cpp b/src/location/places/qplacecontent.cpp
index 88f0e898..a3334c6a 100644
--- a/src/location/places/qplacecontent.cpp
+++ b/src/location/places/qplacecontent.cpp
@@ -68,7 +68,7 @@ bool QPlaceContentPrivate::compare(const QPlaceContentPrivate *other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceContent class serves as the base class for rich content types.
diff --git a/src/location/places/qplacecontentreply.cpp b/src/location/places/qplacecontentreply.cpp
index df02d094..f6030198 100644
--- a/src/location/places/qplacecontentreply.cpp
+++ b/src/location/places/qplacecontentreply.cpp
@@ -61,7 +61,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceContentReply class manages a content retrieval operation started by an
instance of QPlaceManager.
diff --git a/src/location/places/qplacecontentrequest.cpp b/src/location/places/qplacecontentrequest.cpp
index 8ab14774..5a211ae9 100644
--- a/src/location/places/qplacecontentrequest.cpp
+++ b/src/location/places/qplacecontentrequest.cpp
@@ -72,7 +72,7 @@ void QPlaceContentRequestPrivate::clear()
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-requests
- \since 5.5
+ \since 5.6
\brief The QPlaceContentRequest class represents the parameters of a content request.
diff --git a/src/location/places/qplacecontentrequest_p.h b/src/location/places/qplacecontentrequest_p.h
index d82c1101..d9ba3700 100644
--- a/src/location/places/qplacecontentrequest_p.h
+++ b/src/location/places/qplacecontentrequest_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACECONTENTREQUEST_P_H
#define QPLACECONTENTREQUEST_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QSharedData>
#include <QtCore/QVariant>
#include <QtLocation/QPlaceContent>
diff --git a/src/location/places/qplacedetailsreply.cpp b/src/location/places/qplacedetailsreply.cpp
index 11ad191f..84ea9f84 100644
--- a/src/location/places/qplacedetailsreply.cpp
+++ b/src/location/places/qplacedetailsreply.cpp
@@ -55,7 +55,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceDetailsReply class manages a place details fetch operation started by an
instance of QPlaceManager.
diff --git a/src/location/places/qplaceeditorial.cpp b/src/location/places/qplaceeditorial.cpp
index 6018770f..bd1cb647 100644
--- a/src/location/places/qplaceeditorial.cpp
+++ b/src/location/places/qplaceeditorial.cpp
@@ -68,7 +68,7 @@ bool QPlaceEditorialPrivate::compare(const QPlaceContentPrivate *other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceEditorial class represents a publisher's article describing a place.
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
diff --git a/src/location/places/qplaceeditorial_p.h b/src/location/places/qplaceeditorial_p.h
index 9d74b0d5..f502db73 100644
--- a/src/location/places/qplaceeditorial_p.h
+++ b/src/location/places/qplaceeditorial_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACEDESCRIPTION_P_H
#define QPLACEDESCRIPTION_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QUrl>
#include <QtLocation/QPlaceSupplier>
diff --git a/src/location/places/qplaceicon.cpp b/src/location/places/qplaceicon.cpp
index 914c079e..c3a2b851 100644
--- a/src/location/places/qplaceicon.cpp
+++ b/src/location/places/qplaceicon.cpp
@@ -79,7 +79,7 @@ bool QPlaceIconPrivate::operator == (const QPlaceIconPrivate &other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceIcon class represents an icon.
diff --git a/src/location/places/qplaceidreply.cpp b/src/location/places/qplaceidreply.cpp
index d2f54c82..7fb8bbe8 100644
--- a/src/location/places/qplaceidreply.cpp
+++ b/src/location/places/qplaceidreply.cpp
@@ -57,7 +57,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceIdReply class manages operations which return an identifier such as
saving and removal operations of places and categories.
diff --git a/src/location/places/qplaceimage.cpp b/src/location/places/qplaceimage.cpp
index 7143d290..f3dda154 100644
--- a/src/location/places/qplaceimage.cpp
+++ b/src/location/places/qplaceimage.cpp
@@ -67,7 +67,7 @@ bool QPlaceImagePrivate::compare(const QPlaceContentPrivate *other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceImage class represents a reference to an image.
diff --git a/src/location/places/qplaceimage_p.h b/src/location/places/qplaceimage_p.h
index b8a4d0f7..4030b08d 100644
--- a/src/location/places/qplaceimage_p.h
+++ b/src/location/places/qplaceimage_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACEIMAGE_P_H
#define QPLACEIMAGE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QSharedData>
#include <QtCore/QUrl>
diff --git a/src/location/places/qplacemanager.cpp b/src/location/places/qplacemanager.cpp
index 8ed1afc3..e78489f7 100644
--- a/src/location/places/qplacemanager.cpp
+++ b/src/location/places/qplacemanager.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-manager
- \since 5.5
+ \since 5.6
\brief The QPlaceManager class provides the interface which allows clients to access
places stored in a particular backend.
diff --git a/src/location/places/qplacemanagerengine.cpp b/src/location/places/qplacemanagerengine.cpp
index 65c4933e..c1b5f237 100644
--- a/src/location/places/qplacemanagerengine.cpp
+++ b/src/location/places/qplacemanagerengine.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\ingroup QtLocation-impl
\ingroup QtLocation-places
\ingroup QtLocation-places-manager
- \since 5.5
+ \since 5.6
\brief The QPlaceManagerEngine class provides an interface for
implementers of QGeoServiceProvider plugins who want to provide access to place
diff --git a/src/location/places/qplacematchreply.cpp b/src/location/places/qplacematchreply.cpp
index dc4a79bc..9794b3f3 100644
--- a/src/location/places/qplacematchreply.cpp
+++ b/src/location/places/qplacematchreply.cpp
@@ -56,7 +56,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceMatchReply class manages a place matching operation started by an
instance of QPlaceManager.
diff --git a/src/location/places/qplacematchrequest.cpp b/src/location/places/qplacematchrequest.cpp
index 7c5fb749..89343dc6 100644
--- a/src/location/places/qplacematchrequest.cpp
+++ b/src/location/places/qplacematchrequest.cpp
@@ -101,7 +101,7 @@ void QPlaceMatchRequestPrivate::clear()
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-requests
- \since 5.5
+ \since 5.6
\brief The QPlaceMatchRequest class is used to find places from one manager that match those from another. It represents
a set of request parameters.
diff --git a/src/location/places/qplaceproposedsearchresult_p.h b/src/location/places/qplaceproposedsearchresult_p.h
index 90cbbe10..46f95106 100644
--- a/src/location/places/qplaceproposedsearchresult_p.h
+++ b/src/location/places/qplaceproposedsearchresult_p.h
@@ -37,6 +37,17 @@
#ifndef QPROPOSEDSEARCHRESULT_P_H
#define QPROPOSEDSEARCHRESULT_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qplacesearchresult_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/location/places/qplaceratings.cpp b/src/location/places/qplaceratings.cpp
index db5dd3ac..391db376 100644
--- a/src/location/places/qplaceratings.cpp
+++ b/src/location/places/qplaceratings.cpp
@@ -68,7 +68,7 @@ bool QPlaceRatingsPrivate::isEmpty() const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceRatings class holds rating information about a place.
diff --git a/src/location/places/qplaceratings_p.h b/src/location/places/qplaceratings_p.h
index 4a3d8731..21d441a2 100644
--- a/src/location/places/qplaceratings_p.h
+++ b/src/location/places/qplaceratings_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACERATINGS_P_H
#define QPLACERATINGS_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QSharedData>
QT_BEGIN_NAMESPACE
diff --git a/src/location/places/qplacereply.cpp b/src/location/places/qplacereply.cpp
index 758d6fea..0590871d 100644
--- a/src/location/places/qplacereply.cpp
+++ b/src/location/places/qplacereply.cpp
@@ -44,7 +44,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceReply class manages an operation started by an instance of QPlaceManager and
serves as a base class for more specialized replies.
diff --git a/src/location/places/qplaceresult.cpp b/src/location/places/qplaceresult.cpp
index 8ed5fed6..fe89eff7 100644
--- a/src/location/places/qplaceresult.cpp
+++ b/src/location/places/qplaceresult.cpp
@@ -70,7 +70,7 @@ bool QPlaceResultPrivate::compare(const QPlaceSearchResultPrivate *other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceResult class represents a search result containing a place.
diff --git a/src/location/places/qplaceresult_p.h b/src/location/places/qplaceresult_p.h
index d3d2f6c2..0e0bf8cd 100644
--- a/src/location/places/qplaceresult_p.h
+++ b/src/location/places/qplaceresult_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACERESULT_P_H
#define QPLACERESULT_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qplacesearchresult_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/location/places/qplacereview.cpp b/src/location/places/qplacereview.cpp
index afc31c49..ca79b076 100644
--- a/src/location/places/qplacereview.cpp
+++ b/src/location/places/qplacereview.cpp
@@ -76,7 +76,7 @@ bool QPlaceReviewPrivate::compare(const QPlaceContentPrivate *other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceReview class represents a review of a place.
diff --git a/src/location/places/qplacereview_p.h b/src/location/places/qplacereview_p.h
index 19fa8fa6..345aa192 100644
--- a/src/location/places/qplacereview_p.h
+++ b/src/location/places/qplacereview_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACEREVIEW_P_H
#define QPLACEREVIEW_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QUrl>
#include <QtCore/QDateTime>
diff --git a/src/location/places/qplacesearchreply.cpp b/src/location/places/qplacesearchreply.cpp
index a29e49f7..06eef4e5 100644
--- a/src/location/places/qplacesearchreply.cpp
+++ b/src/location/places/qplacesearchreply.cpp
@@ -56,7 +56,7 @@ public:
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceSearchReply class manages a place search operation started by an
instance of QPlaceManager.
diff --git a/src/location/places/qplacesearchrequest.cpp b/src/location/places/qplacesearchrequest.cpp
index 2fddbe9a..c2d993e3 100644
--- a/src/location/places/qplacesearchrequest.cpp
+++ b/src/location/places/qplacesearchrequest.cpp
@@ -136,7 +136,7 @@ void QPlaceSearchRequestPrivate::clear()
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-requests
- \since 5.5
+ \since 5.6
\brief The QPlaceSearchRequest class represents the set of parameters for a search request.
diff --git a/src/location/places/qplacesearchresult.cpp b/src/location/places/qplacesearchresult.cpp
index f0ed5f5b..d8ddc50a 100644
--- a/src/location/places/qplacesearchresult.cpp
+++ b/src/location/places/qplacesearchresult.cpp
@@ -67,7 +67,7 @@ bool QPlaceSearchResultPrivate::compare(const QPlaceSearchResultPrivate *other)
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceSearchResult class is the base class for search results.
diff --git a/src/location/places/qplacesearchresult_p.h b/src/location/places/qplacesearchresult_p.h
index 6960c129..e7c1aaf5 100644
--- a/src/location/places/qplacesearchresult_p.h
+++ b/src/location/places/qplacesearchresult_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACESEARCHRESULT_P_H
#define QPLACESEARCHRESULT_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qplacesearchresult.h"
#include "qplacesearchrequest.h"
diff --git a/src/location/places/qplacesearchsuggestionreply.cpp b/src/location/places/qplacesearchsuggestionreply.cpp
index 09ed9390..9bfc5f0a 100644
--- a/src/location/places/qplacesearchsuggestionreply.cpp
+++ b/src/location/places/qplacesearchsuggestionreply.cpp
@@ -55,7 +55,7 @@ QT_USE_NAMESPACE
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-replies
- \since 5.5
+ \since 5.6
\brief The QPlaceSearchSuggestionReply class manages a search suggestion operation started by an
instance of QPlaceManager.
diff --git a/src/location/places/qplacesupplier.cpp b/src/location/places/qplacesupplier.cpp
index fb8b6b6e..aa9e1220 100644
--- a/src/location/places/qplacesupplier.cpp
+++ b/src/location/places/qplacesupplier.cpp
@@ -80,7 +80,7 @@ bool QPlaceSupplierPrivate::isEmpty() const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceSupplier class represents a supplier of a place or content associated
with a place.
diff --git a/src/location/places/qplacesupplier_p.h b/src/location/places/qplacesupplier_p.h
index 072c0fe3..ab09349d 100644
--- a/src/location/places/qplacesupplier_p.h
+++ b/src/location/places/qplacesupplier_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACESUPPLIER_P_H
#define QPLACESUPPLIER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QString>
#include <QSharedData>
#include <QUrl>
diff --git a/src/location/places/qplaceuser.cpp b/src/location/places/qplaceuser.cpp
index fd176525..fbfba621 100644
--- a/src/location/places/qplaceuser.cpp
+++ b/src/location/places/qplaceuser.cpp
@@ -63,7 +63,7 @@ bool QPlaceUserPrivate::operator==(const QPlaceUserPrivate &other) const
\inmodule QtLocation
\ingroup QtLocation-places
\ingroup QtLocation-places-data
- \since 5.5
+ \since 5.6
\brief The QPlaceUser class represents an individual user.
*/
diff --git a/src/location/places/qplaceuser_p.h b/src/location/places/qplaceuser_p.h
index 334683b6..f49110b5 100644
--- a/src/location/places/qplaceuser_p.h
+++ b/src/location/places/qplaceuser_p.h
@@ -37,6 +37,17 @@
#ifndef QPLACEUSER_P_H
#define QPLACEUSER_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QSharedData>
#include <QString>
diff --git a/src/location/places/unsupportedreplies_p.h b/src/location/places/unsupportedreplies_p.h
index 7b0bef1a..b23a3b34 100644
--- a/src/location/places/unsupportedreplies_p.h
+++ b/src/location/places/unsupportedreplies_p.h
@@ -37,6 +37,17 @@
#ifndef UNSUPPORTEDREPLIES_P_H
#define UNSUPPORTEDREPLIES_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qplacedetailsreply.h"
#include "qplacecontentreply.h"
#include "qplacesearchreply.h"
diff --git a/src/location/qlocation.cpp b/src/location/qlocation.cpp
index e9f8cf37..2afed10b 100644
--- a/src/location/qlocation.cpp
+++ b/src/location/qlocation.cpp
@@ -43,7 +43,7 @@ namespace QLocation {
/*!
\namespace QLocation
\inmodule QtLocation
- \target QLocation Namespace
+ \keyword QLocation Namespace
\brief The QLocation namespace contains miscellaneous identifiers used throughout the
QtLocation module.
diff --git a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
index bf58ad34..98777d09 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.cpp
@@ -110,13 +110,4 @@ void QGeoTiledMapNokia::evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTile
emit copyrightsChanged(m_copyrightsSlab);
}
-int QGeoTiledMapNokia::mapVersion()
-{
- if (!m_engine.isNull())
- return m_engine->mapVersion();
- else
- return QGeoTiledMap::mapVersion();
-
-}
-
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
index d0253343..9651cc80 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
+++ b/src/plugins/geoservices/nokia/qgeotiledmap_nokia.h
@@ -54,7 +54,6 @@ public:
QString getViewCopyright();
void evaluateCopyrights(const QSet<QGeoTileSpec> &visibleTiles);
- int mapVersion();
private:
QImage m_logo;
diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
index 02e6f12c..0713ba10 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
+++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.cpp
@@ -39,7 +39,7 @@
#include "qgeotiledmap_nokia.h"
#include "qgeotilefetcher_nokia.h"
#include "qgeotilespec_p.h"
-#include "qgeotilecache_p.h"
+#include "qgeofiletilecache_p.h"
#include <QDebug>
#include <QDir>
@@ -101,16 +101,15 @@ QGeoTiledMappingManagerEngineNokia::QGeoTiledMappingManagerEngineNokia(
// TODO: do this in a plugin-neutral way so that other tiled map plugins
// don't need this boilerplate or hardcode plugin name
- QString cacheDir;
if (parameters.contains(QStringLiteral("here.mapping.cache.directory"))) {
- cacheDir = parameters.value(QStringLiteral("here.mapping.cache.directory")).toString();
+ m_cacheDirectory = parameters.value(QStringLiteral("here.mapping.cache.directory")).toString();
} else {
// managerName() is not yet set, we have to hardcode the plugin name below
- cacheDir = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)
- + QLatin1String("/QtLocation/here");
+ m_cacheDirectory = QAbstractGeoTileCache::baseCacheDirectory() + QLatin1String("here");
}
- QGeoTileCache *tileCache = createTileCacheWithDir(cacheDir);
+ QAbstractGeoTileCache *tileCache = new QGeoFileTileCache(m_cacheDirectory);
+ setTileCache(tileCache);
if (parameters.contains(QStringLiteral("here.mapping.cache.disk.size"))) {
bool ok = false;
@@ -258,14 +257,13 @@ void QGeoTiledMappingManagerEngineNokia::updateVersion(const QJsonObject &newVer
m_mapVersion.setVersion(m_mapVersion.version() + 1);
saveMapVersion();
-
- emit mapVersionChanged();
+ setTileVersion(m_mapVersion.version());
}
}
void QGeoTiledMappingManagerEngineNokia::saveMapVersion()
{
- QDir saveDir(tileCache()->directory());
+ QDir saveDir(m_cacheDirectory);
QFile saveFile(saveDir.filePath(QStringLiteral("here_version")));
if (!saveFile.open(QIODevice::WriteOnly)) {
@@ -279,8 +277,7 @@ void QGeoTiledMappingManagerEngineNokia::saveMapVersion()
void QGeoTiledMappingManagerEngineNokia::loadMapVersion()
{
-
- QDir saveDir(tileCache()->directory());
+ QDir saveDir(m_cacheDirectory);
QFile loadFile(saveDir.filePath(QStringLiteral("here_version")));
if (!loadFile.open(QIODevice::ReadOnly)) {
@@ -297,6 +294,7 @@ void QGeoTiledMappingManagerEngineNokia::loadMapVersion()
m_mapVersion.setVersion(object[QStringLiteral("version")].toInt());
m_mapVersion.setVersionData(object[QStringLiteral("data")].toObject());
+ setTileVersion(m_mapVersion.version());
}
QString QGeoTiledMappingManagerEngineNokia::evaluateCopyrightsText(const QGeoMapType mapType,
diff --git a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.h b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.h
index acaf61d7..16483120 100644
--- a/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.h
+++ b/src/plugins/geoservices/nokia/qgeotiledmappingmanagerengine_nokia.h
@@ -101,6 +101,8 @@ private:
QHash<QString, QList<CopyrightDesc> > m_copyrights;
QHash<int, QString> m_mapSchemes;
QGeoMapVersion m_mapVersion;
+
+ QString m_cacheDirectory;
};
QT_END_NAMESPACE
diff --git a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp
index b540683b..d020716e 100644
--- a/src/plugins/geoservices/osm/qgeomapreplyosm.cpp
+++ b/src/plugins/geoservices/osm/qgeomapreplyosm.cpp
@@ -75,7 +75,11 @@ void QGeoMapReplyOsm::networkReplyFinished()
QByteArray a = m_reply->readAll();
setMapImageData(a);
- setMapImageFormat("png");
+ int mapId = tileSpec().mapId();
+ if (mapId == 1 || mapId == 2)
+ setMapImageFormat(QStringLiteral("jpg"));
+ else
+ setMapImageFormat(QStringLiteral("png"));
setFinished(true);
diff --git a/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp b/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp
index 95a4355e..9d2a83fa 100644
--- a/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp
+++ b/src/plugins/geoservices/osm/qgeotilefetcherosm.cpp
@@ -62,13 +62,16 @@ QGeoTiledMapReply *QGeoTileFetcherOsm::getTileImage(const QGeoTileSpec &spec)
request.setRawHeader("User-Agent", m_userAgent);
QString urlPrefix;
+ QString suffix = QStringLiteral(".png");
switch (spec.mapId()) {
case 1:
urlPrefix = QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/map/");
+ suffix = QStringLiteral(".jpg");
break;
case 2:
urlPrefix = QStringLiteral("http://otile1.mqcdn.com/tiles/1.0.0/sat/");
+ suffix = QStringLiteral(".jpg");
break;
case 3:
urlPrefix = QStringLiteral("http://a.tile.thunderforest.com/cycle/");
@@ -94,7 +97,7 @@ QGeoTiledMapReply *QGeoTileFetcherOsm::getTileImage(const QGeoTileSpec &spec)
request.setUrl(QUrl(urlPrefix + QString::number(spec.zoom()) + QLatin1Char('/') +
QString::number(spec.x()) + QLatin1Char('/') +
- QString::number(spec.y()) + QStringLiteral(".png")));
+ QString::number(spec.y()) + suffix));
QNetworkReply *reply = m_networkManager->get(request);
diff --git a/src/plugins/position/android/src/plugin.json b/src/plugins/position/android/src/plugin.json
index b84fafea..4fd87892 100644
--- a/src/plugins/position/android/src/plugin.json
+++ b/src/plugins/position/android/src/plugin.json
@@ -4,5 +4,6 @@
"Position": true,
"Satellite": true,
"Monitor": false,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": false
}
diff --git a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h b/src/plugins/position/android/src/qgeopositioninfosource_android_p.h
index 0980a0ce..cdff1e13 100644
--- a/src/plugins/position/android/src/qgeopositioninfosource_android_p.h
+++ b/src/plugins/position/android/src/qgeopositioninfosource_android_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOPOSITIONINFOSOURCE_ANDROID_P_H
#define QGEOPOSITIONINFOSOURCE_ANDROID_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QGeoPositionInfoSource>
#include <QTimer>
diff --git a/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h b/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h
index 0bc8f5dd..06cc25b9 100644
--- a/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h
+++ b/src/plugins/position/android/src/qgeosatelliteinfosource_android_p.h
@@ -35,6 +35,17 @@
#ifndef QGEOSATELLITEINFOSOURCEANDROID_H
#define QGEOSATELLITEINFOSOURCEANDROID_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QGeoSatelliteInfoSource>
#include <QTimer>
diff --git a/src/plugins/position/blackberry/bb/ppsattribute.cpp b/src/plugins/position/blackberry/bb/ppsattribute.cpp
deleted file mode 100644
index 4e8bb6c8..00000000
--- a/src/plugins/position/blackberry/bb/ppsattribute.cpp
+++ /dev/null
@@ -1,302 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include <bb/PpsAttribute>
-#include "ppsattribute_p.h"
-
-#include <QDebug>
-#include <QVariant>
-
-Q_DECLARE_METATYPE(QList<bb::PpsAttribute>)
-typedef QMap<QString, bb::PpsAttribute> PpsAttributeMap;
-Q_DECLARE_METATYPE(PpsAttributeMap)
-
-namespace bb
-{
-
-///////////////////////////
-//
-// PpsAttributePrivate
-//
-///////////////////////////
-
-PpsAttributePrivate::PpsAttributePrivate():
- _type(PpsAttribute::None)
-{
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( int value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Number;
- attribute.d->_data = value;
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( long long value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Number;
- attribute.d->_data = value;
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( double value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Number;
- attribute.d->_data = value;
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( bool value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Bool;
- attribute.d->_data = value;
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( const QString &value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::String;
- attribute.d->_data = value;
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( const QList<PpsAttribute> &value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Array;
- attribute.d->_data = QVariant::fromValue(value);
- attribute.d->_flags = flags;
- return attribute;
-}
-
-/*static*/ PpsAttribute PpsAttributePrivate::ppsAttribute( const QMap<QString, PpsAttribute> &value, PpsAttributeFlag::Types flags )
-{
- PpsAttribute attribute;
- attribute.d->_type = PpsAttribute::Object;
- attribute.d->_data = QVariant::fromValue(value);
- attribute.d->_flags = flags;
- return attribute;
-}
-
-///////////////////////////
-//
-// PpsAttribute
-//
-///////////////////////////
-
-PpsAttribute::PpsAttribute():
- d(new PpsAttributePrivate())
-{
-}
-
-PpsAttribute::~PpsAttribute()
-{
-}
-
-PpsAttribute::PpsAttribute(const PpsAttribute & other):
- d(other.d)
-{
-}
-
-PpsAttribute &PpsAttribute::operator=(const PpsAttribute & other)
-{
- d = other.d;
- return *this;
-}
-
-bool PpsAttribute::operator==(const PpsAttribute & other) const
-{
- if ( type() != other.type() ) {
- return false;
- }
- if ( flags() != other.flags() ) {
- return false;
- }
-
- switch ( type() ) {
- case PpsAttribute::Number:
- case PpsAttribute::Bool:
- case PpsAttribute::String:
- // QVariant can compare double, int, longlong, bool, and QString for us.
- return d->_data == other.d->_data;
- case PpsAttribute::Array:
- // QVariant can't compare custom types (like QList<PpsAttribute>), always returning false. So we pull
- // the lists out manually and compare them.
- return toList() == other.toList();
- case PpsAttribute::Object:
- // QVariant can't compare custom types (like QMap<QString, PpsAttribute>), always returning false. So
- // we pull the maps out manually and compare them.
- return toMap() == other.toMap();
- case PpsAttribute::None:
- // Both are "None" type, so the actual content doesn't matter.
- return true;
- }
- return d->_data == other.d->_data;
-}
-
-bool PpsAttribute::operator!=(const PpsAttribute & other) const
-{
- return !(*this == other);
-}
-
-bool PpsAttribute::isValid() const
-{
- return d->_type != PpsAttribute::None;
-}
-
-PpsAttribute::Type PpsAttribute::type() const
-{
- return d->_type;
-}
-
-bool PpsAttribute::isNumber() const
-{
- return type() == PpsAttribute::Number;
-}
-
-bool PpsAttribute::isBool() const
-{
- return type() == PpsAttribute::Bool;
-}
-
-bool PpsAttribute::isString() const
-{
- return type() == PpsAttribute::String;
-}
-
-bool PpsAttribute::isArray() const
-{
- return type() == PpsAttribute::Array;
-}
-
-bool PpsAttribute::isObject() const
-{
- return type() == PpsAttribute::Object;
-}
-
-double PpsAttribute::toDouble() const
-{
- return d->_data.toDouble();
-}
-
-qlonglong PpsAttribute::toLongLong() const
-{
- return d->_data.toLongLong();
-}
-
-int PpsAttribute::toInt() const
-{
- return d->_data.toInt();
-}
-
-bool PpsAttribute::toBool() const
-{
- return d->_data.toBool();
-}
-
-QString PpsAttribute::toString() const
-{
- return d->_data.toString();
-}
-
-QList<PpsAttribute> PpsAttribute::toList() const
-{
- return d->_data.value< QList<PpsAttribute> >();
-}
-
-QMap<QString, PpsAttribute> PpsAttribute::toMap() const
-{
- return d->_data.value< QMap<QString, PpsAttribute> >();
-}
-
-PpsAttributeFlag::Types PpsAttribute::flags() const
-{
- return d->_flags;
-}
-
-QVariant PpsAttribute::toVariant() const
-{
- return d->_data;
-}
-
-QDebug operator<<(QDebug dbg, const PpsAttribute &attribute)
-{
- dbg << "PpsAttribute(";
-
- switch ( attribute.type() ) {
- case PpsAttribute::Number:
- switch (attribute.toVariant().type()) {
- case QVariant::Int:
- dbg << "Number, " << attribute.flags() << ", " << attribute.toInt();
- break;
- case QVariant::LongLong:
- dbg << "Number, " << attribute.flags() << ", " << attribute.toLongLong();
- break;
- default:
- dbg << "Number, " << attribute.flags() << ", " << attribute.toDouble();
- break;
- }
- break;
- case PpsAttribute::Bool:
- dbg << "Bool, " << attribute.flags() << ", " << attribute.toBool();
- break;
- case PpsAttribute::String:
- dbg << "String, " << attribute.flags() << ", " << attribute.toString();
- break;
- case PpsAttribute::Array:
- dbg << "Array, " << attribute.flags() << ", " << attribute.toList();
- break;
- case PpsAttribute::Object:
- dbg << "Object, " << attribute.flags() << ", " << attribute.toMap();
- break;
- case PpsAttribute::None:
- dbg << "None";
- break;
- }
-
- dbg << ')';
-
- return dbg;
-}
-
-} // namespace bb
diff --git a/src/plugins/position/blackberry/bb/ppsattribute_p.h b/src/plugins/position/blackberry/bb/ppsattribute_p.h
deleted file mode 100644
index 8178648a..00000000
--- a/src/plugins/position/blackberry/bb/ppsattribute_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef BB_CORE_PPSATTRIBUTEPRIVATE_HPP
-#define BB_CORE_PPSATTRIBUTEPRIVATE_HPP
-
-#include <bb/PpsAttribute>
-#include <bb/PpsAttributeFlag>
-
-#include <QList>
-#include <QMap>
-#include <QSharedData>
-#include <QString>
-#include <QVariant>
-
-namespace bb
-{
-
-class PpsAttributePrivate : public QSharedData
-{
-public:
- PpsAttributePrivate();
-
- static PpsAttribute ppsAttribute( double value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( long long value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( int value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( bool value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( const QString &value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( const QList<PpsAttribute> &value, PpsAttributeFlag::Types flags );
- static PpsAttribute ppsAttribute( const QMap<QString, PpsAttribute> &value, PpsAttributeFlag::Types flags );
-
-private:
- friend class PpsAttribute;
-
- QVariant _data;
- PpsAttribute::Type _type;
- PpsAttributeFlag::Types _flags;
-};
-
-} // namespace bb
-
-#endif // BB_CORE_PPSOBJECTPRIVATE_HPP
diff --git a/src/plugins/position/blackberry/bb/ppsobject.cpp b/src/plugins/position/blackberry/bb/ppsobject.cpp
deleted file mode 100644
index 15f797ec..00000000
--- a/src/plugins/position/blackberry/bb/ppsobject.cpp
+++ /dev/null
@@ -1,735 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-// Indicate which dependencies to mock when testing
-// NOTE: These defines must occur before including any headers and
-// ProxyInjector.hpp must be the first header included
-#define USE_QT_QSOCKETNOTIFIER_PROXY
-#define USE_UNISTD_PROXY
-#define USE_FCNTL_PROXY
-#define USE_ERRNO_PROXY
-#define USE_STRING_PROXY
-//#include <private/proxy/ProxyInjector.hpp>
-
-// Disable symbol renaming when testing for open, close, read, and
-// write as these dependency names conflict with member method names
-// and we don't want to rename the member methods. Instead, use dummy
-// names for the dependencies in the production code and toggle
-// between the real/proxy versions here.
-#ifdef BB_TEST_BUILD
-# undef open
-# undef close
-# undef read
-# undef write
-# define PosixOpen open_proxy
-# define PosixClose close_proxy
-# define PosixRead read_proxy
-# define PosixWrite write_proxy
-#else
-# define PosixOpen ::open
-# define PosixClose ::close
-# define PosixRead ::read
-# define PosixWrite ::write
-#endif
-
-#include "ppsobject.h"
-
-#include "ppsattribute_p.h"
-#include "safeassign.h"
-
-#include <bb/PpsAttribute>
-
-#include <QDebug>
-#include <QObject>
-#include <QSocketNotifier>
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <exception>
-
-extern "C" {
-#include "sys/pps.h"
-}
-
-namespace bb
-{
-
-/**
- * From "QNX Persistent Publish/Subscribe Developer's Guide":
- *
- * "the maximum size for a PPS object is 64 kilobytes"
- */
-static const int PPS_MAX_SIZE = 64 * 1024;
-
-class PpsDecoder
-{
-public:
- PpsDecoder(char *str)
- {
- throwOnPpsDecoderError( pps_decoder_initialize(&_decoder, str) );
- }
-
- ~PpsDecoder()
- {
- pps_decoder_cleanup(&_decoder);
- }
-
- QMap<QString, PpsAttribute> decode()
- {
- return decodeObject();
- }
-
- static QVariantMap variantMapFromPpsAttributeMap(const QMap<QString, PpsAttribute> &data)
- {
- QVariantMap variantMap;
-
- for ( QMap<QString, PpsAttribute>::const_iterator it = data.begin(); it != data.end(); it++ ) {
- variantMap[it.key()] = variantFromPpsAttribute( it.value() );
- }
-
- return variantMap;
- }
-
-private:
- pps_decoder_t _decoder;
-
- static void throwOnPpsDecoderError(pps_decoder_error_t error)
- {
- switch ( error ) {
- case PPS_DECODER_OK:
- return;
- default:
- throw std::exception();
- }
- }
-
- bb::PpsAttributeFlag::Types readFlags()
- {
- int rawFlags = pps_decoder_flags(&_decoder, NULL);
-
- bb::PpsAttributeFlag::Types attributeFlags;
-
- if ( rawFlags & PPS_INCOMPLETE ) {
- attributeFlags |= bb::PpsAttributeFlag::Incomplete;
- }
- if ( rawFlags & PPS_DELETED ) {
- attributeFlags |= bb::PpsAttributeFlag::Deleted;
- }
- if ( rawFlags & PPS_CREATED ) {
- attributeFlags |= bb::PpsAttributeFlag::Created;
- }
- if ( rawFlags & PPS_TRUNCATED ) {
- attributeFlags |= bb::PpsAttributeFlag::Truncated;
- }
- if ( rawFlags & PPS_PURGED ) {
- attributeFlags |= bb::PpsAttributeFlag::Purged;
- }
-
- return attributeFlags;
- }
-
- bb::PpsAttribute decodeString()
- {
- const char * value = NULL;
- throwOnPpsDecoderError( pps_decoder_get_string(&_decoder, NULL, &value) );
- bb::PpsAttributeFlag::Types flags = readFlags();
- return bb::PpsAttributePrivate::ppsAttribute( QString::fromUtf8(value), flags );
- }
-
- bb::PpsAttribute decodeNumber()
- {
- // In order to support more number types, we have to do something stupid because
- // the PPS library won't let us work any other way
- // Basically, we have to probe the encoded type in order to try to get exactly what
- // we want
- long long llValue;
- double dValue;
- int iValue;
- bb::PpsAttributeFlag::Types flags;
-
- if (pps_decoder_is_integer( &_decoder, NULL )) {
- int result = pps_decoder_get_int(&_decoder, NULL, &iValue );
- switch (result) {
- case PPS_DECODER_OK:
- flags = readFlags();
- return bb::PpsAttributePrivate::ppsAttribute( iValue, flags );
- case PPS_DECODER_CONVERSION_FAILED:
- throwOnPpsDecoderError( pps_decoder_get_int64(&_decoder, NULL, &llValue) );
- flags = readFlags();
- return bb::PpsAttributePrivate::ppsAttribute( llValue, flags );
- default:
- throw std::exception();
- }
- } else {
- throwOnPpsDecoderError( pps_decoder_get_double(&_decoder, NULL, &dValue));
- flags = readFlags();
- return bb::PpsAttributePrivate::ppsAttribute( dValue, flags );
- }
- }
-
- bb::PpsAttribute decodeBool()
- {
- bool value;
- throwOnPpsDecoderError( pps_decoder_get_bool(&_decoder, NULL, &value) );
- bb::PpsAttributeFlag::Types flags = readFlags();
- return bb::PpsAttributePrivate::ppsAttribute( value, flags );
- }
-
- bb::PpsAttribute decodeData()
- {
- pps_node_type_t nodeType = pps_decoder_type(&_decoder, NULL);
- switch ( nodeType ) {
- case PPS_TYPE_BOOL:
- return decodeBool();
- case PPS_TYPE_NUMBER:
- return decodeNumber();
- case PPS_TYPE_STRING:
- return decodeString();
- case PPS_TYPE_ARRAY: {
- // We must read the flags before we push into the array, otherwise we'll get the flags for the first element in the array.
- bb::PpsAttributeFlag::Types flags = readFlags();
- throwOnPpsDecoderError( pps_decoder_push(&_decoder, NULL) );
- bb::PpsAttribute returnVal = bb::PpsAttributePrivate::ppsAttribute( decodeArray(), flags );
- throwOnPpsDecoderError( pps_decoder_pop(&_decoder) );
- return returnVal;
- }
- case PPS_TYPE_OBJECT: {
- // We must read the flags before we push into the object, otherwise we'll get the flags for the first alement in the object.
- bb::PpsAttributeFlag::Types flags = readFlags();
- throwOnPpsDecoderError( pps_decoder_push(&_decoder, NULL) );
- bb::PpsAttribute returnVal = bb::PpsAttributePrivate::ppsAttribute( decodeObject(), flags );
- throwOnPpsDecoderError( pps_decoder_pop(&_decoder) );
- return returnVal;
- }
- case PPS_TYPE_NULL:
- case PPS_TYPE_NONE:
- case PPS_TYPE_UNKNOWN:
- case PPS_TYPE_DELETED:
- default:
- return bb::PpsAttribute();
- }
- }
-
- QList<bb::PpsAttribute> decodeArray()
- {
- QList<bb::PpsAttribute> list;
-
- int length = pps_decoder_length( &_decoder );
- for ( int i = 0; i < length; i += 1 ) {
- // Force movement to a specific index.
- throwOnPpsDecoderError( pps_decoder_goto_index(&_decoder, i) );
- list << decodeData();
- }
-
- return list;
- }
-
- QMap<QString, bb::PpsAttribute> decodeObject()
- {
- QMap<QString, bb::PpsAttribute> map;
-
- int length = pps_decoder_length(&_decoder);
- for ( int i = 0; i < length; i += 1 ) {
- // Force movement to a specific index.
- throwOnPpsDecoderError( pps_decoder_goto_index(&_decoder, i) );
- QString name = QString::fromUtf8( pps_decoder_name(&_decoder) );
- map[name] = decodeData();
- }
-
- return map;
- }
-
- static QVariant variantFromPpsAttribute(const PpsAttribute &attribute)
- {
- switch ( attribute.type() ) {
- case PpsAttribute::Number:
- switch (attribute.toVariant().type()) {
- case QVariant::Int:
- return attribute.toInt();
- break;
- case QVariant::LongLong:
- return attribute.toLongLong();
- break;
- default:
- return attribute.toDouble();
- break;
- }
- break;
- case PpsAttribute::Bool:
- return attribute.toBool();
- break;
- case PpsAttribute::String:
- return attribute.toString();
- break;
- case PpsAttribute::Array: {
- QVariantList variantList;
- Q_FOREACH ( PpsAttribute attr, attribute.toList() ) {
- variantList << variantFromPpsAttribute(attr);
- }
- return variantList;
- }
- case PpsAttribute::Object: {
- return variantMapFromPpsAttributeMap( attribute.toMap() );
- }
- case PpsAttribute::None:
- default:
- return QVariant();
- }
- }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-class PpsEncoder
-{
-public:
- PpsEncoder()
- {
- pps_encoder_initialize(&_encoder, false);
- }
-
- ~PpsEncoder()
- {
- pps_encoder_cleanup(&_encoder);
- }
-
- QByteArray encode(const QVariantMap &ppsData)
- {
- encodeObject(ppsData);
- const char *rawData = pps_encoder_buffer(&_encoder);
- if (!rawData) {
- throw std::exception();
- }
- return QByteArray(rawData);
- }
-
-private:
- pps_encoder_t _encoder;
-
- static void throwOnPpsEncoderError(pps_encoder_error_t error)
- {
- switch ( error ) {
- case PPS_ENCODER_OK:
- return;
- default:
- throw std::exception();
- }
- }
-
- void encodeData(const char *name, QVariant data)
- {
- switch ( data.type() ) {
- case QVariant::Bool:
- throwOnPpsEncoderError( pps_encoder_add_bool(&_encoder, name, data.toBool()) );
- break;
- // We want to support encoding uint even though libpps doesn't support it directly. We can't encoding uint as an int
- // since that will lose precision (e.g. 2^31+1 can't be encoded that way). However, we can convert uint to double
- // without losing precision. QVariant.toDouble() conveniently takes care of the conversion for us.
- case QVariant::UInt:
- case QVariant::Double:
- throwOnPpsEncoderError( pps_encoder_add_double(&_encoder, name, data.toDouble()) );
- break;
- case QVariant::Int:
- throwOnPpsEncoderError( pps_encoder_add_int(&_encoder, name, data.toInt()) );
- break;
- case QVariant::LongLong:
- throwOnPpsEncoderError( pps_encoder_add_int64(&_encoder, name, data.toLongLong()) );
- break;
- case QVariant::String:
- throwOnPpsEncoderError( pps_encoder_add_string(&_encoder, name, data.toString().toUtf8().constData()) );
- break;
- case QVariant::List: {
- throwOnPpsEncoderError( pps_encoder_start_array(&_encoder, name) );
- encodeArray( data.toList() );
- throwOnPpsEncoderError( pps_encoder_end_array(&_encoder) );
- break;
- }
- case QVariant::Map: {
- throwOnPpsEncoderError( pps_encoder_start_object(&_encoder, name) );
- encodeObject( data.toMap() );
- throwOnPpsEncoderError( pps_encoder_end_object(&_encoder) );
- break;
- }
- case QVariant::Invalid: {
- throwOnPpsEncoderError( pps_encoder_add_null(&_encoder, name) );
- break;
- }
- default:
- throw std::exception();
- }
- }
-
- void encodeArray(QVariantList data)
- {
- for ( QVariantList::const_iterator it = data.constBegin(); it != data.constEnd(); it ++ ) {
- encodeData( NULL, *it );
- }
- }
-
- void encodeObject(QVariantMap data) {
- for ( QVariantMap::const_iterator it = data.constBegin(); it != data.constEnd(); it ++ ) {
- encodeData( it.key().toUtf8().constData(), it.value() );
- }
- }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-class PpsObjectPrivate
-{
-public:
- QSocketNotifier *_notifier;
- QString _path;
- mutable int _error;
- int _fd;
- bool _readyReadEnabled;
-
- explicit PpsObjectPrivate(const QString &path) :
- _notifier(NULL),
- _path(path),
- _error(EOK),
- _fd(-1),
- _readyReadEnabled(true)
- {
- }
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-PpsObject::PpsObject(const QString &path, QObject *parent) :
- QObject(parent),
- d_ptr(new PpsObjectPrivate(path))
-{
-}
-
-PpsObject::~PpsObject()
-{
- // RAII - ensure file gets closed
- if (isOpen()) {
- close();
- }
-}
-
-int PpsObject::error() const
-{
- Q_D(const PpsObject);
- return d->_error;
-}
-
-QString PpsObject::errorString() const
-{
- Q_D(const PpsObject);
- return QString(strerror(d->_error));
-}
-
-bool PpsObject::isReadyReadEnabled() const
-{
- Q_D(const PpsObject);
-
- // query state of read ready signal
- return d->_readyReadEnabled;
-}
-
-void PpsObject::setReadyReadEnabled(bool enable)
-{
- Q_D(PpsObject);
-
- // toggle whether socket notifier will emit a signal on read ready
- d->_readyReadEnabled = enable;
- if (isOpen()) {
- d->_notifier->setEnabled(enable);
- }
-}
-
-bool PpsObject::isBlocking() const
-{
- Q_D(const PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file not open
- if (!isOpen()) {
- d->_error = EBADF;
- return false;
- }
-
- // query file status flags
- int flags = fcntl(d->_fd, F_GETFL);
- if (flags != -1) {
- // check if non-blocking flag is unset
- return ((flags & O_NONBLOCK) != O_NONBLOCK);
- } else {
- d->_error = errno;
- return false;
- }
-}
-
-bool PpsObject::setBlocking(bool enable)
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file not open
- if (!isOpen()) {
- d->_error = EBADF;
- return false;
- }
-
- // query file status flags
- int flags = fcntl(d->_fd, F_GETFL);
- if (flags == -1) {
- d->_error = errno;
- return false;
- }
-
- // configure non-blocking flag
- if (enable) {
- flags &= ~O_NONBLOCK;
- } else {
- flags |= O_NONBLOCK;
- }
-
- // update file status flags
- flags = fcntl(d->_fd, F_SETFL, flags);
- if (flags == -1) {
- d->_error = errno;
- return false;
- }
-
- return true;
-}
-
-bool PpsObject::isOpen() const
-{
- Q_D(const PpsObject);
- return (d->_fd != -1);
-}
-
-bool PpsObject::open(PpsOpenMode::Types mode)
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file already open
- if (isOpen()) {
- d->_error = EBUSY;
- return false;
- }
-
- // convert pps flags to open flags
- int oflags = 0;
- if ((mode & PpsOpenMode::Publish) && (mode & PpsOpenMode::Subscribe)) {
- oflags |= O_RDWR;
- } else if (mode & PpsOpenMode::Publish) {
- oflags |= O_WRONLY;
- } else if (mode & PpsOpenMode::Subscribe) {
- oflags |= O_RDONLY;
- }
-
- if (mode & PpsOpenMode::Create) {
- oflags |= O_CREAT | O_EXCL;
- }
-
- if (mode & PpsOpenMode::DeleteContents) {
- oflags |= O_TRUNC;
- }
-
- // open pps file
- d->_fd = PosixOpen(d->_path.toUtf8().data(), oflags, 0666);
-
- // wire up socket notifier to know when reads are ready
- if (d->_fd != -1) {
- d->_notifier = new QSocketNotifier(d->_fd, QSocketNotifier::Read, this);
- d->_notifier->setEnabled(d->_readyReadEnabled);
- QObject::connect(d->_notifier, SIGNAL(activated(int)), this, SIGNAL(readyRead()));
- return true;
- } else {
- d->_error = errno;
- return false;
- }
-}
-
-bool PpsObject::close()
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file not open
- if (!isOpen()) {
- d->_error = EBADF;
- return false;
- }
-
- // shutdown socket notifier
- delete d->_notifier;
- d->_notifier = NULL;
-
- // close pps file
- int result = PosixClose(d->_fd);
- d->_fd = -1;
-
- // check success of operation
- if (result == 0) {
- return true;
- } else {
- d->_error = errno;
- return false;
- }
-}
-
-QByteArray PpsObject::read(bool * ok)
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file not open
- if (!isOpen()) {
- d->_error = EBADF;
- safeAssign(ok, false);
- return QByteArray();
- }
-
- QByteArray byteArray;
- byteArray.resize(PPS_MAX_SIZE); // resize doesn't initialize the data
- int result = PosixRead(d->_fd, byteArray.data(), byteArray.size());
-
- // check result of read operation
- if (result > 0) {
- // resize byte array to amount actually read
- byteArray.resize(result);
- safeAssign(ok, true);
- return byteArray;
- } else if (result == 0) {
- // normalize the behavior of read() when no data is ready so a pps object
- // put in non-blocking mode via opening w/o ?wait (read returns 0) looks
- // the same as a pps object put in non-blocking mode by setting O_NONBLOCK
- // (read returns EAGAIN)
- d->_error = EAGAIN;
- safeAssign(ok, false);
- return QByteArray(); // Specifically return a default-constructed QByteArray.
- } else {
- d->_error = errno;
- qWarning() << "PpsObject::read failed to read pps data, error " << errorString();
- safeAssign(ok, false);
- return QByteArray(); // Specifically return a default-constructed QByteArray.
- }
-}
-
-bool PpsObject::write(const QByteArray &byteArray)
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // abort if file not open
- if (!isOpen()) {
- d->_error = EBADF;
- return false;
- }
-
- // write entire byte array to pps file
- int result = PosixWrite(d->_fd, byteArray.data(), byteArray.size());
- if (result == -1) {
- d->_error = errno;
- }
- return (result == byteArray.size());
-}
-
-bool PpsObject::remove()
-{
- Q_D(PpsObject);
-
- // reset last error
- d->_error = EOK;
-
- // delete pps file
- int result = unlink(d->_path.toUtf8().data());
-
- // check success of operation
- if (result == 0) {
- return true;
- } else {
- d->_error = errno;
- return false;
- }
-}
-
-QVariantMap PpsObject::decode(const QByteArray &rawData, bool *ok)
-{
- QMap<QString, PpsAttribute> mapData = decodeWithFlags(rawData, ok);
-
- // If *ok is false, then mapData is empty, so the resulting QVariantMap will also be empty, as desired.
- return PpsDecoder::variantMapFromPpsAttributeMap(mapData);
-}
-
-QMap<QString, PpsAttribute> PpsObject::decodeWithFlags(const QByteArray &rawData, bool *ok)
-{
- bb::safeAssign(ok, true);
-
- try {
- QByteArray mutableData(rawData);
- PpsDecoder decoder(mutableData.data());
- return decoder.decode();
- } catch (...) {
- bb::safeAssign(ok, false);
- return QMap<QString, bb::PpsAttribute>();
- }
-}
-
-QByteArray PpsObject::encode(const QVariantMap &ppsData, bool *ok)
-{
- bb::safeAssign( ok, true );
-
- try {
- PpsEncoder encoder;
- return encoder.encode(ppsData);
- } catch (...) {
- bb::safeAssign(ok, false);
- return QByteArray();
- }
-}
-
-} // namespace bb
diff --git a/src/plugins/position/blackberry/bb/safeassign.h b/src/plugins/position/blackberry/bb/safeassign.h
deleted file mode 100644
index 8797f7b7..00000000
--- a/src/plugins/position/blackberry/bb/safeassign.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef BB_CORE_SAFEASSIGN_HPP
-#define BB_CORE_SAFEASSIGN_HPP
-
-namespace bb
-{
- template <typename T>
- void safeAssign( T * pointer, const T & value )
- {
- if ( pointer ) {
- *pointer = value;
- }
- }
-} // namespace bb
-
-#endif // HEADER GUARD
-
diff --git a/src/plugins/position/blackberry/blackberry.pro b/src/plugins/position/blackberry/blackberry.pro
deleted file mode 100644
index 7e140391..00000000
--- a/src/plugins/position/blackberry/blackberry.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET = qtposition_blackberry
-QT = core positioning
-
-PLUGIN_TYPE = position
-PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryBb
-load(qt_plugin)
-
-LIBS = -lwmm -llocation_manager -lpps
-
-SOURCES += qgeopositioninfosource_bb.cpp \
- qgeosatelliteinfosource_bb.cpp \
- locationmanagerutil_bb.cpp \
- qgeopositioninfosourcefactory_bb.cpp
-SOURCES += bb/ppsobject.cpp \
- bb/ppsattribute.cpp
-HEADERS += qgeopositioninfosource_bb_p.h \
- qgeopositioninfosource_bb.h \
- qgeosatelliteinfosource_bb_p.h \
- qgeosatelliteinfosource_bb.h \
- locationmanagerutil_bb.h \
- qgeopositioninfosourcefactory_bb.h
-HEADERS += bb/ppsobject.h \
- bb/ppsattribute_p.h
-
-OTHER_FILES += \
- plugin.json
diff --git a/src/plugins/position/blackberry/locationmanagerutil_bb.cpp b/src/plugins/position/blackberry/locationmanagerutil_bb.cpp
deleted file mode 100644
index b2fc9a1e..00000000
--- a/src/plugins/position/blackberry/locationmanagerutil_bb.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include "locationmanagerutil_bb.h"
-
-#include <bb/PpsObject>
-
-#include <QtCore/QVariantMap>
-#include <QtCore/QByteArray>
-#include <QtDebug>
-
-#include <errno.h>
-
-namespace {
-
-// Create a QVariantMap suitable for writing to a PpsObject specifying a cancel request to the
-// Location Manager.
-QVariantMap createCancelRequest()
-{
- QVariantMap map;
-
- map.insert("msg", "cancel");
- map.insert("id", ::global::libQtLocationId);
-
- return map;
-}
-
-} // unnamed namespace
-
-namespace global {
-
-const QString libQtLocationId = "libQtLocation";
-const QString locationManagerPpsFile = "/pps/services/geolocation/control";
-const int minUpdateInterval = 1000;
-const QVariantMap cancelRequest = createCancelRequest();
-
-} // namespace global
-
-
-// send a generic server-mode request, wrapped in a @control map, to ppsObject
-bool sendRequest(bb::PpsObject &ppsObject, const QVariantMap &request)
-{
- if (!ppsObject.isOpen()) {
- if (!ppsObject.open()) {
- qWarning() << "LocationManagerUtil.cpp:sendRequest(): error opening pps object, errno ="
- << ppsObject.error() << "("
- << strerror(ppsObject.error())
- << "). Clients should verify that they have access_location_services "
- "permission.";
- return false;
- }
- }
-
- // wrap the request in a @control map
- QVariantMap map;
- map.insert("@control", request);
-
-
- // encode it
- bool ok;
- QByteArray encodedRequest = bb::PpsObject::encode(map, &ok);
- if (!ok) {
- qWarning() << "LocationManagerUtil.cpp:sendRequest(): error encoding position request";
- ppsObject.close();
- return false;
- }
-
- // write it
- bool success = ppsObject.write(encodedRequest);
- if (!success) {
- qWarning() << "LocationManagerUtil.cpp:sendRequest(): error"
- << ppsObject.error()
- << "writing position request";
- ppsObject.close();
- return false;
- }
-
- return true;
-}
-
-// receive a generic server-mode reply from ppsObject, removing the @control map container
-bool receiveReply(QVariantMap *reply, bb::PpsObject &ppsObject)
-{
- if (!ppsObject.isOpen()) {
- if (!ppsObject.open()) {
- qWarning() << "LocationManagerUtil.cpp:receiveReply(): error opening pps object";
- return false;
- }
- }
-
- // read the reply
- bool ok;
- QByteArray encodedReply = ppsObject.read(&ok);
- if (!ok) {
- qWarning() << "LocationManagerUtil.cpp:receiveReply(): error"
- << ppsObject.error()
- << "reading position reply";
- ppsObject.close();
- return false;
- }
-
- // decode the reply
- *reply = bb::PpsObject::decode(encodedReply, &ok);
- if (!ok) {
- qWarning() << "LocationManagerUtil.cpp:receiveReply(): error decoding position reply";
- ppsObject.close();
- return false;
- }
-
- // peel out the control map from the reply
- *reply = reply->value("@control").toMap();
-
- // check for an error in the reply
- if (reply->contains("errCode")) {
- int errCode = reply->value("errCode").toInt();
- if (errCode) {
- qWarning() << "LocationManagerUtil.cpp:receiveReply(): (" << errCode << ")" <<
- reply->value("err").toString().toLocal8Bit().constData() << ":" <<
- reply->value("errstr").toString().toLocal8Bit().constData();
- return false;
- }
- }
-
- return true;
-}
-
diff --git a/src/plugins/position/blackberry/locationmanagerutil_bb.h b/src/plugins/position/blackberry/locationmanagerutil_bb.h
deleted file mode 100644
index 5b053c54..00000000
--- a/src/plugins/position/blackberry/locationmanagerutil_bb.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef LOCATIONMANAGERUTIL_BB_H
-#define LOCATIONMANAGERUTIL_BB_H
-
-#include <QtCore/QVariantMap>
-
-namespace bb
-{
-class PpsObject;
-}
-
-namespace global {
-
-// the libQtLocation id for the server-mode accessed pps file id field
-extern const QString libQtLocationId;
-
-// the path to the location manager pps file that is the gateway for positioning requests/replies
-extern const QString locationManagerPpsFile;
-
-// the minimum interval (in msec) that positional and satellite updates can be provided for
-extern const int minUpdateInterval;
-
-// a QVariantMap suitable for writing to a PpsObject specifying a cancel request to the Location
-// Manager. This cancels the current request
-extern const QVariantMap cancelRequest;
-
-} // namespace global
-
-// send a generic server-mode request, wrapped in a @control map, to ppsObject
-bool sendRequest(bb::PpsObject &ppsObject, const QVariantMap &request);
-
-// receive a generic server-mode reply from ppsObject, removing the @control map container
-bool receiveReply(QVariantMap *reply, bb::PpsObject &ppsObject);
-
-#endif
diff --git a/src/plugins/position/blackberry/plugin.json b/src/plugins/position/blackberry/plugin.json
deleted file mode 100644
index dca8e6a4..00000000
--- a/src/plugins/position/blackberry/plugin.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "Keys": ["blackberry"],
- "Provider": "blackberry",
- "Position": true,
- "Satellite": true,
- "Monitor": false,
- "Priority": 1000
-}
diff --git a/src/plugins/position/blackberry/qgeopositioninfosource_bb.cpp b/src/plugins/position/blackberry/qgeopositioninfosource_bb.cpp
deleted file mode 100644
index ae58c7b7..00000000
--- a/src/plugins/position/blackberry/qgeopositioninfosource_bb.cpp
+++ /dev/null
@@ -1,1268 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosource_bb_p.h"
-#include "locationmanagerutil_bb.h"
-
-#ifndef BB_TEST_BUILD
-# include <bb/PpsObject>
-#else
-# include "../tests/include/PpsObjectStuntDouble.hpp"
-#endif
-
-extern "C" {
-#include <wmm/wmm.h>
-}
-
-#include <location_manager.h>
-
-#include <QMap>
-#include <QVariantMap>
-#include <QByteArray>
-#include <QtDebug>
-#include <QStringList>
-
-#include <errno.h>
-
-///////////////////////////
-//
-// local variables/functions
-//
-///////////////////////////
-
-namespace global
-{
-
-// Currently the default behavior for Location Manager is simply to set a constant default
-// interval. 5 sec has been chosen as a compromise between timely updates and conserving power.
-static const int defaultPositionUpdatePeriod = 5;
-
-} // namespace global
-
-namespace
-{
-
-// map the Location Manager reply error codes to the PositionErrorCode enum values.
-QMap<int, bb::location::PositionErrorCode::Type> createIntToPositionErrorCodeMap()
-{
- QMap<int, bb::location::PositionErrorCode::Type> map;
-
- map.insert(0, bb::location::PositionErrorCode::None);
- map.insert(1, bb::location::PositionErrorCode::FatalDisabled);
- map.insert(2, bb::location::PositionErrorCode::FatalNoLastKnownPosition);
- map.insert(3, bb::location::PositionErrorCode::FatalInsufficientProviders);
- map.insert(4, bb::location::PositionErrorCode::FatalInvalidRequest);
- map.insert(5, bb::location::PositionErrorCode::FatalUnknown);
- map.insert(6, bb::location::PositionErrorCode::FatalPermission);
- map.insert(0x10000, bb::location::PositionErrorCode::WarnTimeout);
- map.insert(0x10001, bb::location::PositionErrorCode::WarnLostTracking);
- map.insert(0x10002, bb::location::PositionErrorCode::WarnStationary);
-
- return map;
-}
-
-const QMap<int, bb::location::PositionErrorCode::Type> intToPositionErrorCodeMap =
- createIntToPositionErrorCodeMap();
-
-bool fatalError(bb::location::PositionErrorCode::Type code)
-{
- if ( code == bb::location::PositionErrorCode::FatalDisabled
- || code == bb::location::PositionErrorCode::FatalNoLastKnownPosition
- || code == bb::location::PositionErrorCode::FatalInsufficientProviders
- || code == bb::location::PositionErrorCode::FatalInvalidRequest
- || code == bb::location::PositionErrorCode::FatalUnknown
- || code == bb::location::PositionErrorCode::FatalPermission ) {
- return true;
- }
- return false;
-}
-
-// map the PositionErrorCode enum values to the Qt5 QGeoPositionInfoSource::Error enum values.
-QMap<bb::location::PositionErrorCode::Type, QGeoPositionInfoSource::Error>
- createPositionErrorCodeToErrorMap()
-{
- QMap<bb::location::PositionErrorCode::Type, QGeoPositionInfoSource::Error> map;
-
- map.insert(bb::location::PositionErrorCode::FatalDisabled,
- QGeoPositionInfoSource::ClosedError);
- map.insert(bb::location::PositionErrorCode::FatalNoLastKnownPosition,
- QGeoPositionInfoSource::UnknownSourceError);
- map.insert(bb::location::PositionErrorCode::FatalInsufficientProviders,
- QGeoPositionInfoSource::UnknownSourceError);
- map.insert(bb::location::PositionErrorCode::FatalInvalidRequest,
- QGeoPositionInfoSource::UnknownSourceError);
- map.insert(bb::location::PositionErrorCode::FatalUnknown,
- QGeoPositionInfoSource::UnknownSourceError);
- map.insert(bb::location::PositionErrorCode::FatalPermission,
- QGeoPositionInfoSource::AccessError);
-
- return map;
-}
-
-const QMap<bb::location::PositionErrorCode::Type, QGeoPositionInfoSource::Error>
- positionErrorCodeToErrorMap = createPositionErrorCodeToErrorMap();
-
-// map the Location Manager provider names to the QGeoPositionInfoSource positioning methods
-QMap<QGeoPositionInfoSource::PositioningMethods, QString> createPositioningMethodsToProviderMap()
-{
- QMap<QGeoPositionInfoSource::PositioningMethods, QString> map;
-
- map.insert(QGeoPositionInfoSource::SatellitePositioningMethods, QString("gnss"));
- map.insert(QGeoPositionInfoSource::NonSatellitePositioningMethods, QString("network"));
- map.insert(QGeoPositionInfoSource::AllPositioningMethods, QString("hybrid"));
-
- return map;
-}
-
-const QMap<QGeoPositionInfoSource::PositioningMethods, QString>
- positioningMethodsToProviderMap = createPositioningMethodsToProviderMap();
-
-// list of valid strings for the Location Manager reset types
-QStringList createValidResetTypesList()
-{
- QStringList list;
- list.append("cold");
- list.append("warm");
- list.append("hot");
- list.append("factory");
- list.append("ee_data");
- list.append("almanac");
- list.append("ephemeris");
-
- return list;
-}
-
-const QStringList validResetTypes = createValidResetTypesList();
-
-void printGetGeomagneticFieldInputs(const wmm_location_t &location, const struct tm &date)
-{
- qWarning() << "location = ("
- << location.latitude_deg
- << ","
- << location.longitude_deg
- << ","
- << location.altitude_meters
- << ")";
- qWarning() << "date = (" << date.tm_sec <<
- "," << date.tm_min <<
- "," << date.tm_hour <<
- "," << date.tm_mday <<
- "," << date.tm_mon <<
- "," << date.tm_year <<
- "," << date.tm_wday <<
- "," << date.tm_yday <<
- "," << date.tm_isdst <<
-#ifndef BB_TEST_BUILD
-// the following fields are not present on host (at least Win32)
- "," << date.tm_gmtoff <<
- "," << date.tm_zone <<
-#endif
- ")";
-}
-
-bool magneticDeclination(double *declination, const QGeoPositionInfo &position)
-{
- if (!declination)
- return false;
-
- wmm_location_t location;
- struct tm date;
- wmm_geomagnetic_field_t field;
-
- location.latitude_deg = position.coordinate().latitude();
- location.longitude_deg = position.coordinate().longitude();
- if (position.coordinate().type() == QGeoCoordinate::Coordinate3D)
- location.altitude_meters = position.coordinate().altitude();
- else
- location.altitude_meters = 0.0;
-
- time_t time = (time_t)position.timestamp().toTime_t();
-#ifdef BB_TEST_BUILD
- // since gmtime_r() is not defined on host (at least Win32) risk reentrant side effects on the
- // returned data.
- struct tm *pDate = gmtime(&time);
- if (pDate == NULL) {
- qWarning() << "QGeoPositionInfoSourceBbPrivate.cpp:magneticDeclination(): "
- "gmtime() returned NULL";
- return false;
- }
- date = *pDate;
-#else
- if (gmtime_r(&time, &date) == NULL) {
- qWarning() << "QGeoPositionInfoSourceBbPrivate.cpp:magneticDeclination(): "
- "gmtime_r() returned NULL";
- return false;
- }
-#endif
-
- switch (wmm_get_geomagnetic_field(&location, &date, &field)) {
- case 0:
- break;
-
- case 1:
- qWarning() << "QGeoPositionInfoSourceBbPrivate.cpp:magneticDeclination(): "
- "wmm_get_geomagnetic_field() returned: inputs limited to model range";
- printGetGeomagneticFieldInputs(location, date);
- break;
-
- case -1:
- default:
- qWarning() << "QGeoPositionInfoSourceBbPrivate.cpp:magneticDeclination(): "
- "wmm_get_geomagnetic_field() returned: error";
- printGetGeomagneticFieldInputs(location, date);
- return false;
- }
-
- *declination = field.declination_deg;
- return true;
-}
-
-QVariantMap populateLastKnownPositionRequest(bool fromSatellitePositioningMethodsOnly)
-{
- QVariantMap map;
- QVariantMap datMap;
-
- if (fromSatellitePositioningMethodsOnly)
- datMap.insert("provider", "gnss");
- else
- datMap.insert("provider", "hybrid");
-
- datMap.insert("last_known", true);
- datMap.insert("period", 0);
-
- map.insert("msg", "location");
- map.insert("id", ::global::libQtLocationId);
- map.insert("dat", datMap);
-
- return map;
-}
-
-// From a QvariantMap representing a location response from the Location Manager fill a
-// QGeoPositionInfo instance intended to be emitted via positionUpdated() signal. Returns true
-// if the position info was successfully populated.
-bool populatePositionInfo(QGeoPositionInfo *position, const QVariantMap &map)
-{
- // populate position
-
- // set the reply dat property, which can be accessed by the user in the slot connected to
- //the positionUpdated() signal
- QVariantMap replyDat = map.value("dat").toMap();
-
- // check for required fields
- if (!replyDat.contains("latitude") || !replyDat.contains("longitude")
- || !replyDat.contains("accuracy")) {
- return false;
- }
-
- // set the lat/long/alt coordinate
- QGeoCoordinate coord;
- coord.setLatitude(replyDat.value("latitude").toDouble());
- coord.setLongitude(replyDat.value("longitude").toDouble());
- if (replyDat.contains("altitude"))
- coord.setAltitude(replyDat.value("altitude").toDouble());
-
- if (!coord.isValid())
- return false;
-
- position->setCoordinate(coord);
-
- // set the time stamp
- QDateTime dateTime;
- dateTime.setTimeSpec(Qt::UTC);
- if (replyDat.contains("utc") && static_cast<int>(replyDat.value("utc").toDouble()) != 0) {
- // utc is msec since epoch (1970-01-01T00:00:00)
- dateTime.setTime_t(qRound((replyDat.value("utc").toDouble() / 1000.0)));
- } else {
- // this relies on the device's clock being accurate
- dateTime = QDateTime::currentDateTimeUtc();
- }
- position->setTimestamp(dateTime);
-
- // attributes
- if (replyDat.contains("heading")) {
- position->setAttribute(QGeoPositionInfo::Direction,
- static_cast<qreal>(replyDat.value("heading").toDouble()));
- } else {
- position->removeAttribute(QGeoPositionInfo::Direction);
- }
-
- if (replyDat.contains("speed")) {
- position->setAttribute(QGeoPositionInfo::GroundSpeed,
- static_cast<qreal>(replyDat.value("speed").toDouble()));
- } else {
- position->removeAttribute(QGeoPositionInfo::GroundSpeed);
- }
-
- if (replyDat.contains("verticalSpeed")) {
- position->setAttribute(QGeoPositionInfo::VerticalSpeed,
- static_cast<qreal>(replyDat.value("verticalSpeed").toDouble()));
- } else {
- position->removeAttribute(QGeoPositionInfo::VerticalSpeed);
- }
-
- if (replyDat.contains("declination")) {
- position->setAttribute(QGeoPositionInfo::MagneticVariation,
- static_cast<qreal>(replyDat.value("declination").toDouble()));
- } else {
- double declination;
-
- if (magneticDeclination(&declination, *position) == true) {
- position->setAttribute(QGeoPositionInfo::MagneticVariation,
- static_cast<qreal>(declination));
- } else {
- position->removeAttribute(QGeoPositionInfo::MagneticVariation);
- }
- }
-
- // replyDat.contains("accuracy") was confirmed above
- position->setAttribute(QGeoPositionInfo::HorizontalAccuracy,
- static_cast<qreal>(replyDat.value("accuracy").toDouble()));
-
- if (replyDat.contains("altitudeAccuracy")) {
- position->setAttribute(QGeoPositionInfo::VerticalAccuracy,
- static_cast<qreal>(replyDat.value("altitudeAccuracy").toDouble()));
- } else {
- position->removeAttribute(QGeoPositionInfo::VerticalAccuracy);
- }
-
- return true;
-}
-
-} // unnamed namespace
-
-///////////////////////////
-//
-// QGeoPositionInfoSourceBbPrivate
-//
-///////////////////////////
-
-// Create a QVariantMap suitable for writing to a PpsObject specifying a location request to the
-// Location Manager. If the request is periodic then the update interval is used. Otherwise 0
-// indicates to the Location Manager that it is a request for a single, immediate location response.
-// singleRequestMsec applies only to the single, immediate location response. It represents the
-// expected location response time, after which it is assumed a timeout response occurs.
-QVariantMap QGeoPositionInfoSourceBbPrivate::populateLocationRequest(bool periodic,
- int singleRequestMsec) const
-{
- Q_Q(const QGeoPositionInfoSourceBb);
-
- QVariantMap map;
- QVariantMap datMap;
-
- int period;
- int responseTime;
- if (periodic) {
- // rounding is performed here because the Location Manager truncates to nearest integer
- period = (q->updateInterval() + 500) / 1000;
- // The Qt MObility API treats a period of 0 as indicating default behavior
- if (period == 0) {
- // specify global::defaultPositionUpdatePeriod as the default behavior for Location
- // Manager
- period = ::global::defaultPositionUpdatePeriod;
- }
- responseTime = qRound(_responseTime);
- } else {
- period = 0;
- responseTime = (singleRequestMsec + 500) / 1000;
- }
-
- // period is the only mandatory field
- datMap.insert("period", period);
-
- if (_accuracy > 0.0)
- datMap.insert("accuracy", _accuracy);
- if (responseTime > 0.0)
- datMap.insert("response_time", responseTime);
-
- // since there is no uninitialized state for bool always specify the background mode
- datMap.insert("background", _canRunInBackground);
-
- QString provider = positioningMethodsToProviderMap.value(q->preferredPositioningMethods());
- if (!provider.isEmpty())
- datMap.insert("provider", provider);
-
- if (!_fixType.isEmpty())
- datMap.insert("fix_type", _fixType);
-
- if (!_appId.isEmpty())
- datMap.insert("app_id", _appId);
-
- if (!_appPassword.isEmpty())
- datMap.insert("app_password", _appPassword);
-
- if (!_pdeUrl.isEmpty())
- datMap.insert("pde_url", _pdeUrl.toEncoded().constData());
-
- if (!_slpUrl.isEmpty())
- datMap.insert("slp_url", _slpUrl.toEncoded().constData());
-
- map.insert("msg", "location");
- map.insert("id", global::libQtLocationId);
- map.insert("dat", datMap);
-
- return map;
-}
-
-QVariantMap QGeoPositionInfoSourceBbPrivate::populateResetRequest() const
-{
- QVariantMap map;
- QVariantMap datMap;
-
- datMap.insert("reset_type", _resetType);
-
- map.insert("msg", "reset");
- map.insert("id", ::global::libQtLocationId);
- map.insert("dat", datMap);
-
- return map;
-}
-
-bool QGeoPositionInfoSourceBbPrivate::requestPositionInfo(bool periodic, int singleRequestMsec)
-{
- // build up the request
- QVariantMap request = populateLocationRequest(periodic, singleRequestMsec);
-
- bb::PpsObject *ppsObject;
- if (periodic)
- ppsObject = _periodicUpdatePpsObject;
- else
- ppsObject = _singleUpdatePpsObject;
-
- bool returnVal = sendRequest(*ppsObject, request);
-#ifndef BB_TEST_BUILD
- if (!returnVal) {
- // test for pps file error
- switch (ppsObject->error()) {
- case EACCES:
- _replyErrorCode = bb::location::PositionErrorCode::FatalPermission;
- _replyErr = "failed";
- _replyErrStr = ppsObject->errorString();
- break;
-
- case EOK:
- _replyErrorCode = bb::location::PositionErrorCode::FatalUnknown;
- _replyErr = "failed";
- _replyErrStr = "Unknown error occurred sending request";
- qWarning() << "QGeoPositionInfoSourceBbPrivate::requestPositionInfo() :"
- << _replyErrStr;
- break;
-
- default:
- _replyErrorCode = bb::location::PositionErrorCode::FatalUnknown;
- _replyErr = "failed";
- _replyErrStr = ppsObject->errorString();
- qWarning() << "QGeoPositionInfoSourceBbPrivate::requestPositionInfo() : "
- "unexpected error, errno ="
- << ppsObject->error()
- << " ("
- << ppsObject->errorString()
- << ")";
- break;
- }
- }
-#endif // !BB_TEST_BUILD
-
- return returnVal;
-}
-
-void QGeoPositionInfoSourceBbPrivate::cancelPositionInfo(bool periodic)
-{
- bb::PpsObject *ppsObject;
- if (periodic)
- ppsObject = _periodicUpdatePpsObject;
- else
- ppsObject = _singleUpdatePpsObject;
-
- (void)sendRequest(*ppsObject, global::cancelRequest);
-}
-
-void QGeoPositionInfoSourceBbPrivate::resetLocationProviders()
-{
- QVariantMap map = populateResetRequest();
- (void)sendRequest(*_periodicUpdatePpsObject, map);
-}
-
-// Get the last known position from the Location Manager. Any error results in the return of an
-// invalid position.
-QGeoPositionInfo QGeoPositionInfoSourceBbPrivate::lastKnownPosition(
- bool fromSatellitePositioningMethodsOnly) const
-{
- QGeoPositionInfo position = QGeoPositionInfo();
- bb::PpsObject ppsObject(global::locationManagerPpsFile);
- QVariantMap lastKnown = populateLastKnownPositionRequest(fromSatellitePositioningMethodsOnly);
-
- if (!ppsObject.open())
- return position;
-
- // Location Manager promises to reply immediately with the last known position or an error.
- ppsObject.setBlocking(true);
-
- if (!sendRequest(ppsObject, lastKnown))
- return position;
-
- if (!receiveReply(&lastKnown, ppsObject))
- return position;
-
- if (!lastKnown.contains("res") || lastKnown.value("res").toString() != "location")
- return position;
-
- // the return value of populatePositionInfo() is ignored since either way position is returned
- // by lastKnownPosition()
- (void)populatePositionInfo(&position, lastKnown);
-
- return position;
-}
-
-// Constructor. Note there are two PpsObjects for handling the two different types of requests that
-// can be simultaneously made and which must be handled independently (apart from both being
-// emitted through the same signal when done-part of Qt Mobility spec.
-QGeoPositionInfoSourceBbPrivate::QGeoPositionInfoSourceBbPrivate(QGeoPositionInfoSourceBb *parent)
- : QObject(parent),
- _startUpdatesInvoked(false),
- _requestUpdateInvoked(false),
- _canEmitPeriodicUpdatesTimeout(true),
- q_ptr(parent),
- _periodicUpdatePpsObject(new bb::PpsObject(global::locationManagerPpsFile, this)),
- _singleUpdatePpsObject(new bb::PpsObject(global::locationManagerPpsFile, this)),
- _sourceError(QGeoPositionInfoSource::NoError),
- _accuracy(0.0),
- _responseTime(0.0),
- _canRunInBackground(false),
- _fixType(QString()),
- _appId(QString()),
- _appPassword(QString()),
- _pdeUrl(QUrl()),
- _slpUrl(QUrl()),
- _replyDat(QVariantMap()),
- _replyErrorCode(bb::location::PositionErrorCode::None),
- _replyErr(QString()),
- _replyErrStr(QString()),
- _resetType(QString())
-{
- // register bb::location::PositionErrorCode::Type so it can be used with QObject::property()
- qRegisterMetaType<bb::location::PositionErrorCode::Type>();
-
- // connect to periodic update PpsObject::readyRead()
- connect(_periodicUpdatePpsObject, SIGNAL(readyRead()), SLOT(receivePeriodicPositionReply()));
-
- // connect to single update PpsObject::readyRead()
- connect(_singleUpdatePpsObject, SIGNAL(readyRead()), SLOT(receiveSinglePositionReply()));
-
- // queued connection to signal updateTimeout()
- connect(this, SIGNAL(queuedUpdateTimeout()), SLOT(emitUpdateTimeout()), Qt::QueuedConnection);
-}
-
-QGeoPositionInfoSourceBbPrivate::~QGeoPositionInfoSourceBbPrivate()
-{
- stopUpdates();
-}
-
-// request periodic updates
-void QGeoPositionInfoSourceBbPrivate::startUpdates()
-{
- // do nothing if periodic updates have already been started
- if (_startUpdatesInvoked)
- return;
-
- // This flag is used to limit emitting the timeout signal to once per each interruption in the
- // periodic updates. Since updates are being started here ensure the flag is set to true.
- _canEmitPeriodicUpdatesTimeout = true;
-
- // build a request and initiate it
- if (requestPositionInfo(true)) {
- _startUpdatesInvoked = true;
- _currentPosition = QGeoPositionInfo();
- } else {
- // With Qt5 the error() signal was introduced. If there are any receivers emit error() else
- // maintain QtMobility behavior.
- _sourceError
- = positionErrorCodeToErrorMap.value(_replyErrorCode,
- QGeoPositionInfoSource::UnknownSourceError);
- Q_Q(QGeoPositionInfoSourceBb);
- if (q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
- Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
- } else {
- // user is expecting a signal to be emitted, cannot emit positionUpdated() because of
- // error so emit timeout signal. The connection is queued because it is possible for the
- // user to call startUpdates() from within the slot handling the timeout. The queued
- // connection avoids potential infinite recursion.
- Q_EMIT queuedUpdateTimeout();
- }
- }
-}
-
-// stop periodic updates
-void QGeoPositionInfoSourceBbPrivate::stopUpdates()
-{
- // do nothing if periodic updates have not been started
- if (!_startUpdatesInvoked)
- return;
-
- cancelPositionInfo(true);
- _startUpdatesInvoked = false;
- _currentPosition = QGeoPositionInfo();
-
- // close the pps file to ensure readyRead() does not spin in the event that we don't read the
- // reply to the cancel request. Note that open() is done lazily in sendRequest().
- _periodicUpdatePpsObject->close();
-}
-
-// periodic updates have timed out
-void QGeoPositionInfoSourceBbPrivate::periodicUpdatesTimeout()
-{
- // do nothing if periodic updates have not been started
- if (!_startUpdatesInvoked)
- return;
-
- // timeout has occurred, but periodic updates are still active. Ensure the timeout signal is
- // emitted only once per interruption of updates. _canEmitPeriodicUpdatesTimeout is set back
- // to true when the next successful periodic update occurs (see emitPositionUpdated()). This
- // behavior is per the Qt Mobility Location API documentation.
- if (_canEmitPeriodicUpdatesTimeout) {
- _canEmitPeriodicUpdatesTimeout = false;
- emitUpdateTimeout();
- }
-}
-
-// request single update
-void QGeoPositionInfoSourceBbPrivate::requestUpdate(int msec)
-{
- // do nothing if an immediate update has already been requested
- if (_requestUpdateInvoked)
- return;
-
- if (msec) {
- // If it is not possible to update in msec timeout immediately.
- Q_Q(QGeoPositionInfoSourceBb);
- if (msec < q->minimumUpdateInterval()) {
- // The connection is queued because it is possible for the user to call requestUpdate()
- // from within the slot handling the timeout. The queued connection avoids potential
- // infinite recursion.
- Q_EMIT queuedUpdateTimeout();
- return;
- }
- }
-
- if (requestPositionInfo(false, msec)) {
- _requestUpdateInvoked = true;
- } else {
- // With Qt5 the error() signal was introduced. If there are any receivers emit error() else
- // maintain QtMobility behavior.
- _sourceError
- = positionErrorCodeToErrorMap.value(_replyErrorCode,
- QGeoPositionInfoSource::UnknownSourceError);
- Q_Q(QGeoPositionInfoSourceBb);
- if (q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
- Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
- } else {
- // user is expecting a signal to be emitted, cannot emit positionUpdated() because of
- // error so emit timeout signal. The connection is queued because it is possible for the
- // user to call startUpdates() from within the slot handling the timeout. The queued
- // connection avoids potential infinite recursion.
- Q_EMIT queuedUpdateTimeout();
- }
- }
-}
-
-// single update has timed out. This is a slot for the requestUpdate timer
-void QGeoPositionInfoSourceBbPrivate::singleUpdateTimeout()
-{
- _requestUpdateInvoked = false;
-
- emitUpdateTimeout();
-
- if (!_requestUpdateInvoked) {
- // close the pps file to ensure readyRead() does not spin in the event that there are
- // unexpected replies that we don't read. Note that open() is done lazily in sendRequest().
- _singleUpdatePpsObject->close();
- }
-}
-
-// This slot is intended for queued connection to the signal queuedUpdateTimeout(). If an error
-// occurs when an update is requested the error is relayed via updateTimeout() but the connection
-// is queued to avoid potential infinite recursion.
-void QGeoPositionInfoSourceBbPrivate::emitUpdateTimeout()
-{
- Q_Q(QGeoPositionInfoSourceBb);
- Q_EMIT q->updateTimeout();
-}
-
-void QGeoPositionInfoSourceBbPrivate::emitPositionUpdated(const QGeoPositionInfo &update)
-{
- // having successfully received a position update, set _canEmitPeriodicUpdatesTimeout to true,
- // which (re)enables a timeout to be emitted upon any subsequent error in periodic updating.
- _canEmitPeriodicUpdatesTimeout = true;
-
- Q_Q(QGeoPositionInfoSourceBb);
- Q_EMIT q->positionUpdated(update);
-}
-
-bool QGeoPositionInfoSourceBbPrivate::receivePositionReply(bb::PpsObject &ppsObject)
-{
- QVariantMap reply;
- // receiveReply() tests for errors associated with the request being replied to
- if (!receiveReply(&reply, ppsObject)) {
- _replyErrorCode = bb::location::PositionErrorCode::FatalUnknown;
-
- // if there is an error from Location Manager report it so user can access it through the
- // properties when responding to the updateTimeout() signal.
- if (reply.contains("errCode")) {
- int errCode = reply.value("errCode").toInt();
- _replyErrorCode
- = intToPositionErrorCodeMap.value(errCode,
- bb::location::PositionErrorCode::FatalUnknown);
- if (fatalError(_replyErrorCode)) {
- _sourceError
- = positionErrorCodeToErrorMap.value(_replyErrorCode,
- QGeoPositionInfoSource::UnknownSourceError);
- }
-
- if (reply.contains("err")) {
- _replyErr = reply.value("err").toString();
- if (reply.contains("errstr")) {
- _replyErrStr = reply.value("errstr").toString();
- }
- }
- } else {
- _sourceError = QGeoPositionInfoSource::UnknownSourceError;
- }
- return false;
- }
-
- // clear any errors
- _replyErrorCode = bb::location::PositionErrorCode::None;
- _replyErr = QString();
- _replyErrStr = QString();
-
- // check that this is a location reply (could be a reply to another request type, eg. cancel,
- // which is ignored here)
- if (reply.contains("res") && reply.value("res").toString() == "location") {
- // keep the raw LM reply for access via Qt properties.
- _replyDat = reply.value("dat").toMap();
-
- // extract the geo position info from the reply into _currentPosition
- if (populatePositionInfo(&_currentPosition, reply)) {
- emitPositionUpdated(_currentPosition);
- }
- }
-
- return true;
-}
-
-void QGeoPositionInfoSourceBbPrivate::receivePeriodicPositionReply()
-{
- // don't try to receive a reply if periodic updates have not been started. This is
- // necessary because this slot is connected to PpsObject::readyRead() and could be
- // invoked any time the pps file is updated by the server. Under error conditions
- // this would otherwise lead to a circular calling sequence: receive, timeout due to
- // error, cancel, receive...
- if (!_startUpdatesInvoked)
- return;
-
- if (!receivePositionReply(*_periodicUpdatePpsObject)) {
- Q_Q(QGeoPositionInfoSourceBb);
- if (fatalError(_replyErrorCode)
- && q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
- Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
- } else {
- periodicUpdatesTimeout();
- }
- }
-}
-
-void QGeoPositionInfoSourceBbPrivate::receiveSinglePositionReply()
-{
- // don't try to receive a reply if a single update has not been requested. This is
- // necessary because this slot is connected to PpsObject::readyRead() and could be
- // invoked any time the pps file is updated by the server. Under error conditions
- // this would otherwise lead to a circular calling sequence: receive, timeout due to
- // error, cancel, receive...
- if (!_requestUpdateInvoked)
- return;
-
- // clear this before calling receivePositionReply() which can emit the positionUpdated()
- // signal. It is possible to call requestUpdate() in the slot connected to
- // positionUpdated() so for requestUpdate() to work _requestUpdateInvoked must be false
- _requestUpdateInvoked = false;
-
- if (!receivePositionReply(*_singleUpdatePpsObject)) {
- Q_Q(QGeoPositionInfoSourceBb);
- if (fatalError(_replyErrorCode)
- && q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
- Q_EMIT ((QGeoPositionInfoSource *)q)->error(_sourceError);
- } else {
- singleUpdateTimeout();
- }
- }
-
- if (!_requestUpdateInvoked) {
- // close the pps file to ensure readyRead() does not spin in the event that there are
- // unexpected replies that we don't read. Note that open() is done lazily in sendRequest().
- _singleUpdatePpsObject->close();
- }
-}
-
-///////////////////////////
-//
-// QGeoPositionInfoSourceBb
-//
-///////////////////////////
-
-/*!
- \class QGeoPositionInfoSourceBb
- \brief The QGeoPositionInfoSourceBb class is for the distribution of positional updates obtained
- from the underlying Qnx Location Manager.
-
- QGeoPositionInfoSourceBb is a subclass of QGeoPositionInfoSource. The static function
- QGeoPositionInfoSource::createDefaultSource() creates a default
- position source that is appropriate for the platform, if one is available. On BB10 this is
- a QGeoPositionInfoSourceBb instance.
-
- Users of a QGeoPositionInfoSource subclass can request the current position using
- requestUpdate(), or start and stop regular position updates using
- startUpdates() and stopUpdates(). When an update is available,
- positionUpdated() is emitted. The last known position can be accessed with
- lastKnownPosition().
-
- If regular position updates are required, setUpdateInterval() can be used
- to specify how often these updates should be emitted. If no interval is
- specified, updates are simply provided whenever they are available.
- For example:
-
- \code
- // Emit updates every 10 seconds if available
- QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(0);
- if (source)
- source->setUpdateInterval(10000);
- \endcode
-
- To remove an update interval that was previously set, call
- setUpdateInterval() with a value of 0.
-
- Note that the position source may have a minimum value requirement for
- update intervals, as returned by minimumUpdateInterval().
-*/
-
-/*!
- Constructs a QGeoPositionInfoSourceBb instance with the given \a parent
- and \a updateMode.
-*/
-QGeoPositionInfoSourceBb::QGeoPositionInfoSourceBb(QObject *parent)
- : QGeoPositionInfoSource(parent),
- d_ptr(new QGeoPositionInfoSourceBbPrivate(this))
-{
-}
-
-/*!
- Destroys the position source.
-*/
-QGeoPositionInfoSourceBb::~QGeoPositionInfoSourceBb()
-{
-}
-
-/*!
- \reimp
-*/
-void QGeoPositionInfoSourceBb::setUpdateInterval(int msec)
-{
- int interval = msec;
- if (interval != 0)
- interval = qMax(msec, minimumUpdateInterval());
-
- if (interval == updateInterval())
- return;
-
- QGeoPositionInfoSource::setUpdateInterval(interval);
-
- Q_D(QGeoPositionInfoSourceBb);
- if (d->_startUpdatesInvoked) {
- d->stopUpdates();
- d->startUpdates();
- }
-}
-
-/*!
- \reimp
-*/
-void QGeoPositionInfoSourceBb::setPreferredPositioningMethods(PositioningMethods methods)
-{
- PositioningMethods previousPreferredPositioningMethods = preferredPositioningMethods();
- QGeoPositionInfoSource::setPreferredPositioningMethods(methods);
- if (previousPreferredPositioningMethods == preferredPositioningMethods())
- return;
-
- Q_D(QGeoPositionInfoSourceBb);
- if (d->_startUpdatesInvoked) {
- d->stopUpdates();
- d->startUpdates();
- }
-}
-
-/*!
- \reimp
-*/
-void QGeoPositionInfoSourceBb::startUpdates()
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->startUpdates();
-}
-
-/*!
- \reimp
-*/
-void QGeoPositionInfoSourceBb::stopUpdates()
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->stopUpdates();
-}
-
-/*!
- \reimp
-*/
-void QGeoPositionInfoSourceBb::requestUpdate(int msec)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->requestUpdate(msec);
-}
-
-/*!
- \reimp
-*/
-QGeoPositionInfo
- QGeoPositionInfoSourceBb::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->lastKnownPosition(fromSatellitePositioningMethodsOnly);
-}
-
-/*!
- \reimp
-*/
-QGeoPositionInfoSource::PositioningMethods
- QGeoPositionInfoSourceBb::supportedPositioningMethods() const
-{
- return AllPositioningMethods;
-}
-
-/*!
- \reimp
-*/
-int QGeoPositionInfoSourceBb::minimumUpdateInterval() const
-{
- return global::minUpdateInterval;
-}
-
-QGeoPositionInfoSource::Error QGeoPositionInfoSourceBb::error() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_sourceError;
-}
-
-// these properties extend QGeoPositionInfoSource allowing use of additional features of the Qnx Location Manager
-
-// the following properties are the fields of the dat parameter of the location request
-
-/*!
- \property QGeoPositionInfoSourceBb::period
- \brief This property specifies the period of the location request, in seconds. A value of
- '0' indicates a one-time location request.
-*/
-double QGeoPositionInfoSourceBb::period() const
-{
- // convert from msec to sec
- return updateInterval() / 1000.0;
-}
-
-void QGeoPositionInfoSourceBb::setPeriod(double period)
-{
- // convert from sec to msec, round to nearest msec
- setUpdateInterval(qRound(static_cast<qreal>(period * 1000.0)));
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::accuracy
- \brief This property specifies the desired accuracy of the fix, in meters. A value of '0'
- disables accuracy criteria.
-*/
-double QGeoPositionInfoSourceBb::accuracy() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_accuracy;
-}
-
-void QGeoPositionInfoSourceBb::setAccuracy(double accuracy)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_accuracy = accuracy;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::responseTime
- \brief This property specifies the desired response time of the fix, in seconds. A value of
- '0' disables response time criteria.
-*/
-double QGeoPositionInfoSourceBb::responseTime() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_responseTime;
-}
-
-void QGeoPositionInfoSourceBb::setResponseTime(double responseTime)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_responseTime = responseTime;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::canRunInBackground
- \brief This property determines whether or not requests are allowed to run with the device
- in standby (i.e. screen off)
-*/
-bool QGeoPositionInfoSourceBb::canRunInBackground() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_canRunInBackground;
-}
-
-void QGeoPositionInfoSourceBb::setCanRunInBackground(bool canRunInBackground)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_canRunInBackground = canRunInBackground;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::provider
- \brief This property specifies the location provider you wish to use (hybrid, gnss,
- network).
-*/
-QString QGeoPositionInfoSourceBb::provider() const
-{
- return positioningMethodsToProviderMap.value(preferredPositioningMethods());
-}
-
-void QGeoPositionInfoSourceBb::setProvider(const QString &provider)
-{
- setPreferredPositioningMethods(positioningMethodsToProviderMap.key(provider));
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::fixType
- \brief This property specifies the fix type you wish to use (best, gps_ms_based,
- gps_ms_assisted, gps_autonomous, cellsite, wifi).
-*/
-QString QGeoPositionInfoSourceBb::fixType() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_fixType;
-}
-
-void QGeoPositionInfoSourceBb::setFixType(const QString &fixType)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_fixType = fixType;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::appId
- \brief This property specifies a special application id.
-*/
-QString QGeoPositionInfoSourceBb::appId() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_appId;
-}
-
-void QGeoPositionInfoSourceBb::setAppId(const QString &appId)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_appId = appId;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::appPassword
- \brief This property specifies a special application password, goes with appId above.
-*/
-QString QGeoPositionInfoSourceBb::appPassword() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_appPassword;
-}
-
-void QGeoPositionInfoSourceBb::setAppPassword(const QString &appPassword)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_appPassword = appPassword;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::pdeUrl
- \brief This property specifies the PDE URL (i.e. tcp://user:pass@address.dom:1234).
-*/
-QUrl QGeoPositionInfoSourceBb::pdeUrl() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_pdeUrl;
-}
-
-void QGeoPositionInfoSourceBb::setPdeUrl(const QUrl &pdeUrl)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_pdeUrl = pdeUrl;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::slpUrl
- \brief This property specifies the SLP URL (i.e. tcp://user:pass@address.dom:1234).
-*/
-QUrl QGeoPositionInfoSourceBb::slpUrl() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_slpUrl;
-}
-
-void QGeoPositionInfoSourceBb::setSlpUrl(const QUrl &slpUrl)
-{
- Q_D(QGeoPositionInfoSourceBb);
- d->_slpUrl = slpUrl;
-}
-
-// the following read-only properties are the fields of the Location Manager generic reply
-
-/*!
- \property QGeoPositionInfoSourceBb::replyDat
- \brief This property specifies the object containing the reply data (such as latitude,
- longitude, satellites, etc). If the replyErr is not empty then replyDat may be empty or
- stale. replyDat is expected to be consumed in the slot connected to the positionUpdated()
- signal, otherwise its contents are undefined.
-*/
-QVariantMap QGeoPositionInfoSourceBb::replyDat() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_replyDat;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::replyErrorCode
- \brief If not empty this property indicates that an error has occurred, and identifies the
- error.
-
- Possible values are:
-
- Code | Description
- None | No error
- FatalDisabled | Location services is disabled
- FatalNoLastKnownPosition | There is no last known position on the device
- FatalInsufficientProviders | There are insufficient available location technology providers
- to process your request
- FatalInvalidRequest | One or more of the request parameters are invalid.
- WarnTimeout | A timeout has occurred while processing your request. The request will
- continue until your location is obtained
- WarnLostTracking | The location fix has been lost due to insufficient coverage. The request
- will continue until your location is reacquired
- WarnStationary | The device is stationary. No further updates until the device resumes
- movement
-
- replyErrorCode is expected to be consumed in the slot connected to the updateTimeout()
- signal, which is emitted when an error is detected. Otherwise its contents are undefined.
-*/
-bb::location::PositionErrorCode::Type QGeoPositionInfoSourceBb::replyErrorCode() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_replyErrorCode;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::replyErr
- \brief If not empty this property indicates that an error has occurred, and identifies the
- error. replyErr is expected to be consumed in the slot connected to the updateTimeout()
- signal, which is emitted when an error is detected. Otherwise its contents are undefined.
-*/
-QString QGeoPositionInfoSourceBb::replyErr() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_replyErr;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::replyErrStr
- \brief This property is not empty if and only if the replyErr parameter is present, it
- describes the error. replyErrStr is expected to be consumed in the slot connected to the
- updateTimeout() signal, which is emitted when an error is detected. Otherwise its contents
- are undefined.
-*/
-QString QGeoPositionInfoSourceBb::replyErrStr() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_replyErrStr;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::locationServicesEnabled
- \brief This property indicates whether the location services are enabled or not. If
- location services are disabled then no position updates will occur. The user must enable
- location services through the Settings app before any position updates will be available.
-*/
-bool QGeoPositionInfoSourceBb::locationServicesEnabled() const
-{
- bool locationEnabled = false;
- if (location_manager_get_status(&locationEnabled) != 0) {
- qWarning() << "QGeoPositionInfoSourceBb::locationServicesEnabled() : "
- "call to location_manager_get_status() failed.";
- }
- return locationEnabled;
-}
-
-/*!
- \property QGeoPositionInfoSourceBb::reset
- \brief By setting this property a reset of all location providers is requested through the
- Location Manager. The value of reset specifies the type of reset to be performed. Valid
- reset types are "cold", "warm", "hot", and "factory". The reset is not actually carried out
- until position updates are restarted. The current value of this property, i.e.
- property("reset"), is not particularly useful, it is simply the reset type corresponding to
- the last time setProperty("reset", resetType) was called. A Qt property must have a READ
- method, hence the reason for defining resetType().
-*/
-QString QGeoPositionInfoSourceBb::resetType() const
-{
- Q_D(const QGeoPositionInfoSourceBb);
- return d->_resetType;
-}
-
-void QGeoPositionInfoSourceBb::requestReset(const QString &resetType)
-{
- if (validResetTypes.contains(resetType)) {
- Q_D(QGeoPositionInfoSourceBb);
- d->_resetType = resetType;
- d->resetLocationProviders();
- }
-}
diff --git a/src/plugins/position/blackberry/qgeopositioninfosource_bb.h b/src/plugins/position/blackberry/qgeopositioninfosource_bb.h
deleted file mode 100644
index cd1ab331..00000000
--- a/src/plugins/position/blackberry/qgeopositioninfosource_bb.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCE_BB_H
-#define QGEOPOSITIONINFOSOURCE_BB_H
-
-#include <QGeoPositionInfoSource>
-
-#include <bb/location/PositionErrorCode>
-
-#include <QString>
-#include <QVariantMap>
-#include <QScopedPointer>
-#include <QUrl>
-
-class QGeoPositionInfoSourceBbPrivate;
-class BB_LOCATION_EXPORT QGeoPositionInfoSourceBb : public QGeoPositionInfoSource
-{
- Q_OBJECT
-
- Q_PROPERTY(double period READ period WRITE setPeriod FINAL)
- Q_PROPERTY(double accuracy READ accuracy WRITE setAccuracy FINAL)
- Q_PROPERTY(double responseTime READ responseTime WRITE setResponseTime FINAL)
- Q_PROPERTY(bool canRunInBackground READ canRunInBackground WRITE setCanRunInBackground FINAL)
- Q_PROPERTY(QString provider READ provider WRITE setProvider FINAL)
- Q_PROPERTY(QString fixType READ fixType WRITE setFixType FINAL)
- Q_PROPERTY(QString appId READ appId WRITE setAppId FINAL)
- Q_PROPERTY(QString appPassword READ appPassword WRITE setAppPassword FINAL)
- Q_PROPERTY(QUrl pdeUrl READ pdeUrl WRITE setPdeUrl FINAL)
- Q_PROPERTY(QUrl slpUrl READ slpUrl WRITE setSlpUrl FINAL)
-
- Q_PROPERTY(QVariantMap replyDat READ replyDat FINAL)
- Q_PROPERTY(bb::location::PositionErrorCode::Type replyErrorCode READ replyErrorCode FINAL)
- Q_PROPERTY(QString replyErr READ replyErr FINAL)
- Q_PROPERTY(QString replyErrStr READ replyErrStr FINAL)
-
- Q_PROPERTY(bool locationServicesEnabled READ locationServicesEnabled FINAL)
-
- Q_PROPERTY(QString reset READ resetType WRITE requestReset FINAL)
-
-public:
- explicit QGeoPositionInfoSourceBb(QObject *parent = 0);
- virtual ~QGeoPositionInfoSourceBb();
-
- void setUpdateInterval(int msec);
- void setPreferredPositioningMethods(PositioningMethods methods);
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly = false) const;
- PositioningMethods supportedPositioningMethods() const;
- int minimumUpdateInterval() const;
- Error error() const;
-
- double period() const;
- void setPeriod(double period);
-
- double accuracy() const;
- void setAccuracy(double accuracy);
-
- double responseTime() const;
- void setResponseTime(double responseTime);
-
- bool canRunInBackground() const;
- void setCanRunInBackground(bool canRunInBackground);
-
- QString provider() const;
- void setProvider(const QString &provider);
-
- QString fixType() const;
- void setFixType(const QString &fixType);
-
- QString appId() const;
- void setAppId(const QString &appId);
-
- QString appPassword() const;
- void setAppPassword(const QString &appPassword);
-
- QUrl pdeUrl() const;
- void setPdeUrl(const QUrl &pdeUrl);
-
- QUrl slpUrl() const;
- void setSlpUrl(const QUrl &slpUrl);
-
- QVariantMap replyDat() const;
-
- bb::location::PositionErrorCode::Type replyErrorCode() const;
-
- QString replyErr() const;
-
- QString replyErrStr() const;
-
- bool locationServicesEnabled() const;
-
- QString resetType() const;
- void requestReset(const QString &resetType);
-
-
-public Q_SLOTS:
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int timeout = 0);
-
-private:
- Q_DECLARE_PRIVATE(QGeoPositionInfoSourceBb)
- Q_DISABLE_COPY(QGeoPositionInfoSourceBb)
- QScopedPointer<QGeoPositionInfoSourceBbPrivate> d_ptr;
-};
-
-#endif
diff --git a/src/plugins/position/blackberry/qgeopositioninfosource_bb_p.h b/src/plugins/position/blackberry/qgeopositioninfosource_bb_p.h
deleted file mode 100644
index f6a6304b..00000000
--- a/src/plugins/position/blackberry/qgeopositioninfosource_bb_p.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef QGEOPOSITIONINFOSOURCEBB_P_H
-#define QGEOPOSITIONINFOSOURCEBB_P_H
-
-#include "qgeopositioninfosource_bb.h"
-#include "qgeopositioninfo.h"
-
-#include <bb/location/PositionErrorCode>
-
-#include <QObject>
-#include <QVariantMap>
-#include <QUrl>
-
-namespace bb
-{
-class PpsObject;
-}
-
-class QGeoPositionInfoSourceBbPrivate : public QObject
-{
- Q_OBJECT
-public:
- ~QGeoPositionInfoSourceBbPrivate();
-
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int msec);
-
- bool _startUpdatesInvoked;
- bool _requestUpdateInvoked;
-
-private Q_SLOTS:
- void singleUpdateTimeout();
- void receivePeriodicPositionReply();
- void receiveSinglePositionReply();
-
- void emitUpdateTimeout();
-
-Q_SIGNALS:
- void queuedUpdateTimeout();
-
-private:
- Q_DECLARE_PUBLIC(QGeoPositionInfoSourceBb)
- explicit QGeoPositionInfoSourceBbPrivate(QGeoPositionInfoSourceBb *parent);
-
- void periodicUpdatesTimeout();
-
- void emitPositionUpdated(const QGeoPositionInfo &update);
- bool requestPositionInfo(bool periodic, int singleRequestMsec = 0);
- void cancelPositionInfo(bool periodic);
- void resetLocationProviders();
- QGeoPositionInfo lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const;
-
- QVariantMap populateLocationRequest(bool periodic, int singleRequestMsec = 0) const;
- QVariantMap populateResetRequest() const;
-
- bool receivePositionReply(bb::PpsObject &ppsObject);
-
- bool _canEmitPeriodicUpdatesTimeout;
-
- QGeoPositionInfoSourceBb *q_ptr;
- bb::PpsObject *_periodicUpdatePpsObject;
- bb::PpsObject *_singleUpdatePpsObject;
- QGeoPositionInfo _currentPosition;
- QGeoPositionInfoSource::Error _sourceError;
-
- // these are Location Manager parameters that are represented by properties. These parameters
- // represent additional functionality beyond what is provided by the base class
- // QGeoPositionInfoSource
- double _accuracy;
- double _responseTime;
- bool _canRunInBackground;
- QString _fixType;
- QString _appId;
- QString _appPassword;
- QUrl _pdeUrl;
- QUrl _slpUrl;
- QVariantMap _replyDat;
- bb::location::PositionErrorCode::Type _replyErrorCode;
- QString _replyErr;
- QString _replyErrStr;
- QString _resetType;
-
-};
-
-#endif
diff --git a/src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.cpp b/src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.cpp
deleted file mode 100644
index 99e3a630..00000000
--- a/src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include "qgeopositioninfosourcefactory_bb.h"
-#include "qgeopositioninfosource_bb.h"
-#include "qgeosatelliteinfosource_bb.h"
-
-#include <QGeoPositionInfoSource>
-#include <QGeoSatelliteInfoSource>
-
-
-///////////////////////////
-//
-// QGeoPositionInfoSourceFactoryBb
-//
-///////////////////////////
-
-QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryBb::positionInfoSource(QObject *parent)
-{
- return new QGeoPositionInfoSourceBb(parent);
-}
-
-QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryBb::satelliteInfoSource(QObject *parent)
-{
- return new QGeoSatelliteInfoSourceBb(parent);
-}
-
-QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryBb::areaMonitor(QObject *parent)
-{
- Q_UNUSED(parent);
- return 0;
-}
diff --git a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb.cpp b/src/plugins/position/blackberry/qgeosatelliteinfosource_bb.cpp
deleted file mode 100644
index d87ff12d..00000000
--- a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb.cpp
+++ /dev/null
@@ -1,613 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#include <bb/PpsObject>
-
-#include "qgeosatelliteinfosource_bb_p.h"
-#include "locationmanagerutil_bb.h"
-
-#include <location_manager.h>
-
-extern "C" {
-#include <wmm/wmm.h>
-}
-
-#include <QVariantMap>
-#include <QByteArray>
-#include <QtDebug>
-
-#include <errno.h>
-
-///////////////////////////
-//
-// local variables/functions
-//
-///////////////////////////
-
-namespace global
-{
-
-// While waiting for a position fix a satellite update period of 1 sec is considered reasonable.
-static const double defaultSatelliteUpdatePeriod = 1.0;
-
-} // namespace global
-
-namespace
-{
-// map the Location Manager reply error codes to the QGeoSatelliteInfoSource::Error enum values.
-QMap<int, QGeoSatelliteInfoSource::Error> createIntToErrorCodeMap()
-{
- QMap<int, QGeoSatelliteInfoSource::Error> map;
-
- map.insert(0, QGeoSatelliteInfoSource::NoError);
- map.insert(1, QGeoSatelliteInfoSource::ClosedError);
- map.insert(2, QGeoSatelliteInfoSource::UnknownSourceError);
- map.insert(3, QGeoSatelliteInfoSource::UnknownSourceError);
- map.insert(4, QGeoSatelliteInfoSource::UnknownSourceError);
- map.insert(5, QGeoSatelliteInfoSource::UnknownSourceError);
- map.insert(6, QGeoSatelliteInfoSource::AccessError);
- // the following are not considered errors from QGeoSatelliteInfoSource perspective
- // (they are timeout conditions)
- map.insert(0x10000, QGeoSatelliteInfoSource::NoError);
- map.insert(0x10001, QGeoSatelliteInfoSource::NoError);
- map.insert(0x10002, QGeoSatelliteInfoSource::NoError);
-
- return map;
-}
-
-const QMap<int, QGeoSatelliteInfoSource::Error> intToErrorCodeMap =
- createIntToErrorCodeMap();
-
-QGeoSatelliteInfo::SatelliteSystem determineSatSystem(int satId)
-{
- if (satId >= 1 && satId <= 32)
- return QGeoSatelliteInfo::GPS;
-
- if (satId >= 65 && satId <= 88)
- return QGeoSatelliteInfo::GLONASS;
-
- return QGeoSatelliteInfo::Undefined;
-}
-
-}
-
-///////////////////////////
-//
-// QGeoSatelliteInfoSourceBbPrivate
-//
-///////////////////////////
-
-// Create a QVariantMap suitable for writing to a PpsObject specifying a location request to the
-// Location Manager. If the request is periodic then the update interval is used. Otherwise 0
-// indicates to the Location Manager that it is a request for a single, immediate location response.
-// singleRequestMsec applies only to the single, immediate location response. It represents the
-// expected location response time, after which it is assumed a timeout response occurs.
-QVariantMap QGeoSatelliteInfoSourceBbPrivate::populateLocationRequest(bool periodic,
- int singleRequestMsec)
-{
- Q_Q(const QGeoSatelliteInfoSourceBb);
-
- QVariantMap map;
- QVariantMap datMap;
-
- int period;
- int responseTime;
- if (periodic) {
- // rounding is performed here because the Location Manager truncates to nearest integer
- period = (q->updateInterval() + 500) / 1000;
- if (period == 0)
- period = ::global::defaultSatelliteUpdatePeriod;
-
- responseTime = _responseTime;
- } else {
- period = 0;
- responseTime = (singleRequestMsec + 500) / 1000;
- }
-
- datMap.insert("period", period);
- datMap.insert("accuracy", 0);
- datMap.insert("response_time", responseTime);
- datMap.insert("background", _backgroundMode);
-
- datMap.insert("provider", "gnss");
- datMap.insert("fix_type", "gps_autonomous");
-
- // have the Location Manager return the satellite information even if it does not have a
- // position fix.
- datMap.insert("report_sat", true);
-
- map.insert("msg", "location");
- map.insert("id", global::libQtLocationId);
- map.insert("dat", datMap);
-
- return map;
-}
-
-// From a QvariantMap representing a location response from the Location Manager fill the lists of
-// QGeoSatelliteInfo instances intended to be emitted via satellitesInUseUpdated() and
-// satellitesInViewUpdated() signals.
-void QGeoSatelliteInfoSourceBbPrivate::populateSatelliteLists(const QVariantMap &map)
-{
- // populate _currentSatelliteInfo
- QVariantMap datMap = map.value("dat").toMap();
- QVariantList satelliteList = datMap.value("satellites").toList();
-
- _satellitesInView.clear();
- _satellitesInUse.clear();
-
- Q_FOREACH (const QVariant &satelliteData, satelliteList) {
- datMap = satelliteData.toMap();
- QGeoSatelliteInfo satelliteInfo = QGeoSatelliteInfo();
-
- if (datMap.contains("id"))
- satelliteInfo.setSatelliteIdentifier(static_cast<int>(datMap.value("id").toDouble()));
-
- satelliteInfo.setSatelliteSystem(determineSatSystem(satelliteInfo.satelliteIdentifier()));
-
- if (datMap.contains("cno"))
- satelliteInfo.setSignalStrength(static_cast<int>(datMap.value("cno").toDouble()));
-
- // attributes
- if (datMap.contains("elevation"))
- satelliteInfo.setAttribute(QGeoSatelliteInfo::Elevation,
- static_cast<qreal>(datMap.value("elevation").toDouble()));
- else
- satelliteInfo.removeAttribute(QGeoSatelliteInfo::Elevation);
-
- if (datMap.contains("azimuth"))
- satelliteInfo.setAttribute(QGeoSatelliteInfo::Azimuth,
- static_cast<qreal>(datMap.value("azimuth").toDouble()));
- else
- satelliteInfo.removeAttribute(QGeoSatelliteInfo::Azimuth);
-
- // each satellite in this list is considered "in view"
- _satellitesInView.append(satelliteInfo);
-
- if (datMap.value("used").toBool() == true)
- _satellitesInUse.append(satelliteInfo);
- }
-}
-
-// The satellite data is retrieved from a location request
-bool QGeoSatelliteInfoSourceBbPrivate::requestSatelliteInfo(bool periodic,
- int singleRequestMsec)
-{
- // build up the request
- QVariantMap request = populateLocationRequest(periodic, singleRequestMsec);
-
- bb::PpsObject *ppsObject;
- if (periodic)
- ppsObject = _periodicUpdatePpsObject;
- else
- ppsObject = _singleUpdatePpsObject;
-
- if (sendRequest(*ppsObject, request) == false) {
- stopUpdates();
-
-#ifndef BB_TEST_BUILD
- // test for pps file error
- switch (ppsObject->error()) {
- case EACCES:
- _sourceError = QGeoSatelliteInfoSource::AccessError;
- break;
- default:
- _sourceError = QGeoSatelliteInfoSource::UnknownSourceError;
- break;
- }
-#endif // !BB_TEST_BUILD
-
- return false;
- }
-
- return true;
-}
-
-void QGeoSatelliteInfoSourceBbPrivate::cancelSatelliteInfo(bool periodic)
-{
- bb::PpsObject *ppsObject;
- if (periodic)
- ppsObject = _periodicUpdatePpsObject;
- else
- ppsObject = _singleUpdatePpsObject;
-
- (void)sendRequest(*ppsObject, global::cancelRequest);
-}
-
-// Constructor. Note there are two PpsObjects for handling the two different types of requests that
-// can be simultaneously made and which must be handled independently (apart from both being emitted
-// through the same signal when done-part of Qt Mobility spec.
-QGeoSatelliteInfoSourceBbPrivate::QGeoSatelliteInfoSourceBbPrivate(
- QGeoSatelliteInfoSourceBb *parent)
- : QObject(parent),
- _startUpdatesInvoked(false),
- _requestUpdateInvoked(false),
- q_ptr(parent),
- _periodicUpdatePpsObject(new bb::PpsObject(global::locationManagerPpsFile, this)),
- _singleUpdatePpsObject(new bb::PpsObject(global::locationManagerPpsFile, this)),
- _sourceError(QGeoSatelliteInfoSource::NoError),
- _backgroundMode(false),
- _responseTime(0)
-{
- // connect to periodic update PpsObject::readyRead()
- connect(_periodicUpdatePpsObject, SIGNAL(readyRead()), SLOT(receivePeriodicSatelliteReply()));
-
- // connect to single update PpsObject::readyRead()
- connect(_singleUpdatePpsObject, SIGNAL(readyRead()), SLOT(receiveSingleSatelliteReply()));
-
- // queued connection to signal requestTimeout()
- connect(this, SIGNAL(queuedRequestTimeout()), SLOT(emitRequestTimeout()), Qt::QueuedConnection);
-}
-
-QGeoSatelliteInfoSourceBbPrivate::~QGeoSatelliteInfoSourceBbPrivate()
-{
- stopUpdates();
-}
-
-// request periodic updates
-void QGeoSatelliteInfoSourceBbPrivate::startUpdates()
-{
- // do nothing if periodic updates have already been started
- if (_startUpdatesInvoked)
- return;
-
- // build a request and initiate it
- if (requestSatelliteInfo(true)) {
- _startUpdatesInvoked = true;
- } else {
- Q_Q(QGeoSatelliteInfoSourceBb);
- Q_EMIT ((QGeoSatelliteInfoSource *)q)->error(_sourceError);
- }
-}
-
-// stop periodic updates
-void QGeoSatelliteInfoSourceBbPrivate::stopUpdates()
-{
- // do nothing if periodic updates have not been started
- if (!_startUpdatesInvoked)
- return;
-
- cancelSatelliteInfo(true);
- _startUpdatesInvoked = false;
-
- // close the pps file to ensure readyRead() does not spin in the event that we don't read the
- // reply to the cancel request. Note that open() is done lazily in sendRequest().
- _periodicUpdatePpsObject->close();
-}
-
-// request single update
-void QGeoSatelliteInfoSourceBbPrivate::requestUpdate(int msec)
-{
- // do nothing if an immediate update has already been requested
- if (_requestUpdateInvoked)
- return;
-
- if (msec) {
- // If it is not possible to update in msec timeout immediately.
- if (msec < global::minUpdateInterval) {
- // The connection is queued because it is possible for the user to call requestUpdate()
- // from within the slot handling the timeout. The queued connection avoids potential
- // infinite recursion.
- Q_EMIT queuedRequestTimeout();
- return;
- }
- }
-
- if (requestSatelliteInfo(false, msec)) {
- _requestUpdateInvoked = true;
- } else {
- // With Qt5 the error() signal was introduced. If there are any receivers emit error() else
- // maintain QtMobility behavior.
- Q_Q(QGeoSatelliteInfoSourceBb);
- if (q->receivers(SIGNAL(error(QGeoPositionInfoSource::Error)))) {
- Q_EMIT ((QGeoSatelliteInfoSource *)q)->error(_sourceError);
- } else {
- // The connection is queued because it is possible for the user to call requestUpdate()
- // from within the slot handling the timeout. The queued connection avoids potential
- // infinite recursion.
- Q_EMIT queuedRequestTimeout();
- }
- }
-}
-
-// single update has timed out. This is a slot for the requestUpdate timer
-void QGeoSatelliteInfoSourceBbPrivate::singleUpdateTimeout()
-{
- _requestUpdateInvoked = false;
-
- emitRequestTimeout();
-
- if (!_requestUpdateInvoked) {
- // close the pps file to ensure readyRead() does not spin in the event that there are
- // unexpected replies that we don't read. Note that open() is done lazily in sendRequest().
- _singleUpdatePpsObject->close();
- }
-}
-
-// This slot is intended for queued connection to the signal queuedUpdateTimeout(). If an error
-// occurs when an update is requested the error is relayed via updateTimeout() but the connection
-// is queued to avoid potential infinite recursion.
-void QGeoSatelliteInfoSourceBbPrivate::emitRequestTimeout()
-{
- Q_Q(QGeoSatelliteInfoSourceBb);
- Q_EMIT q->requestTimeout();
-}
-
-bool QGeoSatelliteInfoSourceBbPrivate::receiveSatelliteReply(bool periodic)
-{
- bb::PpsObject *ppsObject;
- if (periodic)
- ppsObject = _periodicUpdatePpsObject;
- else
- ppsObject = _singleUpdatePpsObject;
-
- QVariantMap reply;
- // receiveReply() tests for errors associated with the request being replied to
- if (!receiveReply(&reply, *ppsObject)) {
- QGeoSatelliteInfoSource::Error fatalError = QGeoSatelliteInfoSource::UnknownSourceError;
-
- // if there is an error from Location Manager translate it to a
- // QGeoSatelliteInfoSource::Error
- if (reply.contains("errCode")) {
- fatalError = intToErrorCodeMap.value(reply.value("errCode").toInt(),
- QGeoSatelliteInfoSource::UnknownSourceError);
- }
-
- if (fatalError != QGeoSatelliteInfoSource::NoError)
- _sourceError = fatalError;
-
- if (!periodic || fatalError != QGeoSatelliteInfoSource::NoError)
- return false;
- }
-
- // check that this is a location reply (could be a reply to another request type, eg. cancel,
- // which is ignored here)
- if (reply.contains("res") && reply.value("res").toString() == "location") {
- // extract the satellite info from the reply into _satellitesInView and _satellitesInUse
- populateSatelliteLists(reply);
-
- Q_Q(QGeoSatelliteInfoSourceBb);
- Q_EMIT q->satellitesInUseUpdated(_satellitesInUse);
- Q_EMIT q->satellitesInViewUpdated(_satellitesInView);
- }
-
- return true;
-}
-
-void QGeoSatelliteInfoSourceBbPrivate::receivePeriodicSatelliteReply()
-{
- // don't try to receive a reply if periodic updates have not been started. This is
- // necessary because this slot is connected to PpsObject::readyRead() and could be
- // invoked any time the pps file is updated by the server. Under error conditions
- // this would otherwise lead to a circular calling sequence: receive, timeout due to
- // error, cancel, receive...
- if (!_startUpdatesInvoked)
- return;
-
- if (!receiveSatelliteReply(true)) {
- Q_Q(QGeoSatelliteInfoSourceBb);
- Q_EMIT ((QGeoSatelliteInfoSource *)q)->error(_sourceError);
- }
-}
-
-void QGeoSatelliteInfoSourceBbPrivate::receiveSingleSatelliteReply()
-{
- // don't try to receive a reply if a single update has not been requested. This is
- // necessary because this slot is connected to PpsObject::readyRead() and could be
- // invoked any time the pps file is updated by the server. Under error conditions
- // this would otherwise lead to a circular calling sequence: receive, timeout due to
- // error, cancel, receive...
- if (!_requestUpdateInvoked)
- return;
-
- // clear this before calling receivePositionReply() which can emit the positionUpdated()
- // signal. It is possible to call requestUpdate() in the slot connected to
- // positionUpdated() so for requestUpdate() to work _requestUpdateInvoked must be false
- _requestUpdateInvoked = false;
-
- if (!receiveSatelliteReply(false)) {
- Q_Q(QGeoSatelliteInfoSourceBb);
- if (_sourceError != QGeoSatelliteInfoSource::NoError)
- Q_EMIT ((QGeoSatelliteInfoSource *)q)->error(_sourceError);
- else
- singleUpdateTimeout();
- }
-
- if (!_requestUpdateInvoked) {
- // close the pps file to ensure readyRead() does not spin in the event that there are
- // unexpected replies that we don't read. Note that open() is done lazily in sendRequest().
- _singleUpdatePpsObject->close();
- }
-}
-
-///////////////////////////
-//
-// QGeoSatelliteInfoSourceBb
-//
-///////////////////////////
-
-/*!
- \class QGeoSatelliteInfoSourceBb
- \brief The QGeoSatelliteInfoSourceBb class is for the distribution of positional updates
- obtained from the underlying Qnx Location Manager.
-
- QGeoSatelliteInfoSourceBb is a subclass of QGeoSatelliteInfoSource.
- The static function QGeoSatelliteInfoSource::createDefaultSource() creates a default
- satellite data source that is appropriate for the platform, if one is
- available. On BB10 this is a QGeoSatelliteInfoSourceBb instance. Otherwise, available
- QGeoPositionInfoSourceFactory plugins will
- be checked for one that has a satellite data source available.
-
- Call startUpdates() and stopUpdates() to start and stop regular updates,
- or requestUpdate() to request a single update.
- When an update is available, satellitesInViewUpdated() and/or
- satellitesInUseUpdated() will be emitted.
-*/
-
-
-
-/*!
- Constructs a QGeoSatelliteInfoSourceBb instance with the given \a parent
- and \a updateMode.
-*/
-QGeoSatelliteInfoSourceBb::QGeoSatelliteInfoSourceBb(QObject *parent)
- : QGeoSatelliteInfoSource(parent),
- d_ptr(new QGeoSatelliteInfoSourceBbPrivate(this))
-{
-}
-
-/*!
- Destroys the satellite source.
-*/
-QGeoSatelliteInfoSourceBb::~QGeoSatelliteInfoSourceBb()
-{
-}
-
-/*!
- \reimp
-*/
-int QGeoSatelliteInfoSourceBb::minimumUpdateInterval() const
-{
- return global::minUpdateInterval;
-}
-
-/*!
- \reimp
-*/
-void QGeoSatelliteInfoSourceBb::setUpdateInterval(int msec)
-{
- int interval = msec;
- if (interval != 0)
- interval = qMax(msec, minimumUpdateInterval());
-
- if (interval == updateInterval())
- return;
-
- QGeoSatelliteInfoSource::setUpdateInterval(interval);
-
- Q_D(QGeoSatelliteInfoSourceBb);
- if (d->_startUpdatesInvoked) {
- d->stopUpdates();
- d->startUpdates();
- }
-}
-
-/*!
- \reimp
-*/
-void QGeoSatelliteInfoSourceBb::startUpdates()
-{
- Q_D(QGeoSatelliteInfoSourceBb);
- d->startUpdates();
-}
-
-/*!
- \reimp
-*/
-void QGeoSatelliteInfoSourceBb::stopUpdates()
-{
- Q_D(QGeoSatelliteInfoSourceBb);
- d->stopUpdates();
-}
-
-/*!
- \reimp
-*/
-void QGeoSatelliteInfoSourceBb::requestUpdate(int msec)
-{
- Q_D(QGeoSatelliteInfoSourceBb);
- d->requestUpdate(msec);
-}
-
-/*!
- \reimp
-*/
-QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceBb::error() const
-{
- Q_D(const QGeoSatelliteInfoSourceBb);
- return d->_sourceError;
-}
-
-// property managers. These properties extend QGeoSatelliteInfoSource by allowing additional
-// control provided by the Location Manager
-
-/*!
- \property QGeoSatelliteInfoSourceBb::period
- \brief The period of the location request, in seconds. A value of '0' indicates that this
- would be a one-time location request.
-*/
-double QGeoSatelliteInfoSourceBb::period() const
-{
- // convert from msec to sec
- return updateInterval() / 1000.0;
-}
-
-void QGeoSatelliteInfoSourceBb::setPeriod(double period)
-{
- // convert from sec to msec, round to nearest msec
- setUpdateInterval(qRound(static_cast<qreal>(period * 1000.0)));
-}
-
-
-/*!
- \property QGeoSatelliteInfoSourceBb::backgroundMode
- \brief This property determines whether or not requests are allowed to run with the device
- in standby (i.e. screen off)
-*/
-bool QGeoSatelliteInfoSourceBb::backgroundMode() const
-{
- Q_D(const QGeoSatelliteInfoSourceBb);
- return d->_backgroundMode;
-}
-
-void QGeoSatelliteInfoSourceBb::setBackgroundMode(bool mode)
-{
- Q_D(QGeoSatelliteInfoSourceBb);
- d->_backgroundMode = mode;
-}
-
-/*!
- \property QGeoSatelliteInfoSourceBb::responseTime
- \brief This property specifies the desired response time of the fix, in seconds. A value
- of '0' disables response time criteria.
-*/
-int QGeoSatelliteInfoSourceBb::responseTime() const
-{
- Q_D(const QGeoSatelliteInfoSourceBb);
- return d->_responseTime;
-}
-
-void QGeoSatelliteInfoSourceBb::setResponseTime(int responseTime)
-{
- Q_D(QGeoSatelliteInfoSourceBb);
- d->_responseTime = responseTime;
-}
diff --git a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb_p.h b/src/plugins/position/blackberry/qgeosatelliteinfosource_bb_p.h
deleted file mode 100644
index 9feabafa..00000000
--- a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtPositioning module 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$
-**
-****************************************************************************/
-
-#ifndef QGEOSATELLITEINFOSOURCE_BB_P_H
-#define QGEOSATELLITEINFOSOURCE_BB_P_H
-
-#include "qgeosatelliteinfosource_bb.h"
-#include "qgeosatelliteinfo.h"
-
-#include <QObject>
-#include <QtCore/QVariantMap>
-
-namespace bb
-{
-class PpsObject;
-}
-
-class QGeoSatelliteInfoSourceBbPrivate : public QObject
-{
- Q_OBJECT
-public:
- ~QGeoSatelliteInfoSourceBbPrivate();
-
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int msec);
-
- bool _startUpdatesInvoked;
- bool _requestUpdateInvoked;
-
-private Q_SLOTS:
- void singleUpdateTimeout();
- void receivePeriodicSatelliteReply();
- void receiveSingleSatelliteReply();
-
- void emitRequestTimeout();
-
-Q_SIGNALS:
- void queuedRequestTimeout();
-
-private:
- Q_DECLARE_PUBLIC(QGeoSatelliteInfoSourceBb)
- explicit QGeoSatelliteInfoSourceBbPrivate(QGeoSatelliteInfoSourceBb *parent);
-
- void emitSatelliteUpdated(const QGeoSatelliteInfo &update);
- bool requestSatelliteInfo(bool periodic, int singleRequestMsec = 0);
- void cancelSatelliteInfo(bool periodic);
-
- QVariantMap populateLocationRequest(bool periodic, int singleRequestMsec = 0);
- void populateSatelliteLists(const QVariantMap &reply);
-
- bool receiveSatelliteReply(bool periodic);
-
- QGeoSatelliteInfoSourceBb *q_ptr;
- bb::PpsObject *_periodicUpdatePpsObject;
- bb::PpsObject *_singleUpdatePpsObject;
- QList<QGeoSatelliteInfo> _satellitesInUse;
- QList<QGeoSatelliteInfo> _satellitesInView;
- QGeoSatelliteInfoSource::Error _sourceError;
-
- // properties (extension of QGeoSatelliteInfoSource for additional Location Manager features)
- bool _backgroundMode;
- int _responseTime;
-
-};
-
-#endif
diff --git a/src/plugins/position/corelocation/plugin.json b/src/plugins/position/corelocation/plugin.json
index 96e5cbf1..58e3acd0 100644
--- a/src/plugins/position/corelocation/plugin.json
+++ b/src/plugins/position/corelocation/plugin.json
@@ -4,5 +4,6 @@
"Position": true,
"Satellite": false,
"Monitor" : false,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": false
}
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
index c92e468f..0e5e261b 100644
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
+++ b/src/plugins/position/corelocation/qgeopositioninfosource_cl.mm
@@ -88,6 +88,10 @@
m_positionInfoSource->setError(QGeoPositionInfoSource::AccessError);
qWarning() << QString::fromNSString([error localizedDescription]);
+
+ if ([error code] == 0
+ && QString::fromNSString([error domain]) == QStringLiteral("kCLErrorDomain"))
+ qWarning() << "(is Wi-Fi turned on?)";
}
@end
diff --git a/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h b/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h
index d5c0313c..53b3d412 100644
--- a/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h
+++ b/src/plugins/position/corelocation/qgeopositioninfosource_cl_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOPOSITIONINFOSOURCECL_H
#define QGEOPOSITIONINFOSOURCECL_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#import <CoreLocation/CoreLocation.h>
#include "qgeopositioninfosource.h"
diff --git a/src/plugins/position/geoclue/geoclue.pro b/src/plugins/position/geoclue/geoclue.pro
index a3c34ece..0d9aab7d 100644
--- a/src/plugins/position/geoclue/geoclue.pro
+++ b/src/plugins/position/geoclue/geoclue.pro
@@ -1,32 +1,37 @@
TARGET = qtposition_geoclue
-QT = core positioning
+QT = core positioning dbus
PLUGIN_TYPE = position
PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactoryGeoclue
load(qt_plugin)
HEADERS += \
- qgeopositioninfosource_geocluemaster_p.h \
+ qgeopositioninfosource_geocluemaster.h \
+ qgeosatelliteinfosource_geocluemaster.h \
qgeopositioninfosourcefactory_geoclue.h \
- qgeocluemaster.h
+ qgeocluemaster.h \
+ geocluetypes.h
SOURCES += \
qgeopositioninfosource_geocluemaster.cpp \
+ qgeosatelliteinfosource_geocluemaster.cpp \
qgeopositioninfosourcefactory_geoclue.cpp \
- qgeocluemaster.cpp
+ qgeocluemaster.cpp \
+ geocluetypes.cpp
+
+QDBUSXML2CPP_INTERFACE_HEADER_FLAGS += "-N -i geocluetypes.h"
+DBUS_INTERFACES += \
+ org.freedesktop.Geoclue.MasterClient.xml \
+ org.freedesktop.Geoclue.Master.xml \
+ org.freedesktop.Geoclue.Position.xml \
+ org.freedesktop.Geoclue.Velocity.xml \
+ org.freedesktop.Geoclue.Satellite.xml \
+ org.freedesktop.Geoclue.xml
-qtHaveModule(dbus):config_geoclue-satellite {
- DEFINES += HAS_SATELLITE
-
- QT *= dbus
-
- HEADERS += qgeosatelliteinfosource_geocluemaster.h
- SOURCES += qgeosatelliteinfosource_geocluemaster.cpp
-}
+OTHER_FILES += \
+ $$DBUS_INTERFACES
-CONFIG += link_pkgconfig
-PKGCONFIG += geoclue
+INCLUDEPATH += $$QT.location.includes $$OUT_PWD
OTHER_FILES += \
- plugin.json \
- plugin-satellite.json
+ plugin.json
diff --git a/src/plugins/position/geoclue/geocluetypes.cpp b/src/plugins/position/geoclue/geocluetypes.cpp
new file mode 100644
index 00000000..ece3d113
--- /dev/null
+++ b/src/plugins/position/geoclue/geocluetypes.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Aaron McCarthy <mccarthy.aaron@gmail.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtPositioning module 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$
+**
+****************************************************************************/
+
+#include "geocluetypes.h"
+
+const QDBusArgument &dbus_argument_helper(const QDBusArgument &arg, Accuracy &accuracy)
+{
+ arg.beginStructure();
+ qint32 level;
+ arg >> level;
+ accuracy.m_level = static_cast<Accuracy::Level>(level);
+ arg >> accuracy.m_horizontal;
+ arg >> accuracy.m_vertical;
+ arg.endStructure();
+
+ return arg;
+}
+
+QT_BEGIN_NAMESPACE
+
+QDBusArgument &operator<<(QDBusArgument &arg, const Accuracy &accuracy)
+{
+ arg.beginStructure();
+ arg << qint32(accuracy.level());
+ arg << accuracy.horizontal();
+ arg << accuracy.vertical();
+ arg.endStructure();
+
+ return arg;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, Accuracy &accuracy)
+{
+ return dbus_argument_helper(arg, accuracy);
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QGeoSatelliteInfo &si)
+{
+ qint32 a;
+
+ argument.beginStructure();
+ argument >> a;
+ si.setSatelliteIdentifier(a);
+ argument >> a;
+ si.setAttribute(QGeoSatelliteInfo::Elevation, a);
+ argument >> a;
+ si.setAttribute(QGeoSatelliteInfo::Azimuth, a);
+ argument >> a;
+ si.setSignalStrength(a);
+ argument.endStructure();
+ return argument;
+}
+
+const QDBusArgument &operator>>(const QDBusArgument &argument, QList<QGeoSatelliteInfo> &sis)
+{
+ sis.clear();
+
+ argument.beginArray();
+ while (!argument.atEnd()) {
+ QGeoSatelliteInfo si;
+ argument >> si;
+ sis.append(si);
+ }
+ argument.endArray();
+
+ return argument;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb.h b/src/plugins/position/geoclue/geocluetypes.h
index 89fcf716..ff748b13 100644
--- a/src/plugins/position/blackberry/qgeosatelliteinfosource_bb.h
+++ b/src/plugins/position/geoclue/geocluetypes.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
+** Copyright (C) 2015 Aaron McCarthy <mccarthy.aaron@gmail.com>
+** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtPositioning module of the Qt Toolkit.
**
@@ -31,49 +31,57 @@
**
****************************************************************************/
-#ifndef QGEOSATELLITEINFOSOURCE_BB_H
-#define QGEOSATELLITEINFOSOURCE_BB_H
+#ifndef GEOCLUETYPES_H
+#define GEOCLUETYPES_H
-#include <QGeoSatelliteInfoSource>
+#include <QtDBus/QDBusArgument>
+#include <QtPositioning/QGeoSatelliteInfo>
-#include <QString>
-#include <QScopedPointer>
-
-class QGeoSatelliteInfoSourceBbPrivate;
-class QGeoSatelliteInfoSourceBb : public QGeoSatelliteInfoSource
+class Accuracy
{
- Q_OBJECT
+public:
+ enum Level {
+ None = 0,
+ Country,
+ Region,
+ Locality,
+ PostalCode,
+ Street,
+ Detailed
+ };
- Q_PROPERTY(double period READ period WRITE setPeriod FINAL)
- Q_PROPERTY(bool backgroundMode READ backgroundMode WRITE setBackgroundMode FINAL)
- Q_PROPERTY(int responseTime READ responseTime WRITE setResponseTime FINAL)
+ Accuracy()
+ : m_level(None), m_horizontal(0), m_vertical(0)
+ {
+ }
-public:
- explicit QGeoSatelliteInfoSourceBb(QObject *parent = 0);
- virtual ~QGeoSatelliteInfoSourceBb();
+ inline Level level() const { return m_level; }
+ inline double horizontal() const { return m_horizontal; }
+ inline double vertical() const { return m_vertical; }
- void setUpdateInterval(int msec);
- int minimumUpdateInterval() const;
- Error error() const;
+private:
+ Level m_level;
+ double m_horizontal;
+ double m_vertical;
- double period() const;
- void setPeriod(double period);
+ friend const QDBusArgument &dbus_argument_helper(const QDBusArgument &arg, Accuracy &accuracy);
+};
- bool backgroundMode() const;
- void setBackgroundMode(bool mode);
+Q_DECLARE_METATYPE(Accuracy)
+Q_DECLARE_METATYPE(QList<QGeoSatelliteInfo>)
- int responseTime() const;
- void setResponseTime(int responseTime);
-public Q_SLOTS:
- void startUpdates();
- void stopUpdates();
- void requestUpdate(int timeout = 0);
+QT_BEGIN_NAMESPACE
-private:
- Q_DECLARE_PRIVATE(QGeoSatelliteInfoSourceBb)
- Q_DISABLE_COPY(QGeoSatelliteInfoSourceBb)
- QScopedPointer<QGeoSatelliteInfoSourceBbPrivate> d_ptr;
-};
+Q_DECLARE_TYPEINFO(Accuracy, Q_MOVABLE_TYPE);
+
+QDBusArgument &operator<<(QDBusArgument &arg, const Accuracy &accuracy);
+const QDBusArgument &operator>>(const QDBusArgument &arg, Accuracy &accuracy);
+
+const QDBusArgument &operator>>(const QDBusArgument &arg, QGeoSatelliteInfo &si);
+const QDBusArgument &operator>>(const QDBusArgument &arg, QList<QGeoSatelliteInfo> &sis);
+
+QT_END_NAMESPACE
+
+#endif // GEOCLUETYPES_H
-#endif
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.Master.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Master.xml
new file mode 100644
index 00000000..e7df140c
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Master.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.Geoclue.Master">
+ <method name="Create">
+ <arg name="path" type="o" direction="out"/>
+ </method>
+ </interface>
+</node>
+
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.MasterClient.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.MasterClient.xml
new file mode 100644
index 00000000..29c95885
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.MasterClient.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.Geoclue.MasterClient">
+ <method name="GetPositionProvider">
+ <arg name="name" type="s" direction="out"/>
+ <arg name="description" type="s" direction="out"/>
+ <arg name="service" type="s" direction="out"/>
+ <arg name="path" type="s" direction="out"/>
+ </method>
+ <method name="GetAddressProvider">
+ <arg name="name" type="s" direction="out"/>
+ <arg name="description" type="s" direction="out"/>
+ <arg name="service" type="s" direction="out"/>
+ <arg name="path" type="s" direction="out"/>
+ </method>
+ <method name="PositionStart">
+ </method>
+ <method name="AddressStart">
+ </method>
+ <method name="SetRequirements">
+ <arg name="accuracyLevel" type="i" direction="in"/>
+ <arg name="time" type="i" direction="in"/>
+ <arg name="requireUpdates" type="b" direction="in"/>
+ <arg name="allowedResources" type="i" direction="in"/>
+ </method>
+ <signal name="PositionProviderChanged">
+ <arg name="name" type="s"/>
+ <arg name="description" type="s"/>
+ <arg name="service" type="s"/>
+ <arg name="path" type="s"/>
+ </signal>
+ <signal name="AddressProviderChanged">
+ <arg name="name" type="s"/>
+ <arg name="description" type="s"/>
+ <arg name="service" type="s"/>
+ <arg name="path" type="s"/>
+ </signal>
+ </interface>
+</node>
+
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.Position.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Position.xml
new file mode 100644
index 00000000..ce5c80de
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Position.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.Geoclue.Position">
+ <method name="GetPosition">
+ <arg name="fields" type="i" direction="out"/>
+ <arg name="timestamp" type="i" direction="out"/>
+ <arg name="latitude" type="d" direction="out"/>
+ <arg name="longitude" type="d" direction="out"/>
+ <arg name="altitude" type="d" direction="out"/>
+ <arg name="accuracy" type="(idd)" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out5" value="Accuracy"/>
+ </method>
+ <signal name="PositionChanged">
+ <arg name="fields" type="i"/>
+ <arg name="timestamp" type="i"/>
+ <arg name="latitude" type="d"/>
+ <arg name="longitude" type="d"/>
+ <arg name="altitude" type="d"/>
+ <arg name="accuracy" type="(idd)"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In5" value="Accuracy"/>
+ </signal>
+ </interface>
+</node>
+
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.Satellite.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Satellite.xml
new file mode 100644
index 00000000..2ed112c9
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Satellite.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/">
+ <interface name="org.freedesktop.Geoclue.Satellite">
+ <method name="GetSatellite">
+ <arg name="timestamp" type="i" direction="out" />
+ <arg name="satelliteUsed" type="i" direction="out" />
+ <arg name="satelliteVisible" type="i" direction="out" />
+ <arg name="usedPrn" type="ai" direction="out" />
+ <arg name="satInfo" type="a(iiii)" direction="out" />
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out3" value="QList&lt;qint32&gt;"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out4" value="QList&lt;QGeoSatelliteInfo&gt;"/>
+ </method>
+ <method name="GetLastSatellite">
+ <arg name="timestamp" type="i" direction="out" />
+ <arg name="satelliteUsed" type="i" direction="out" />
+ <arg name="satelliteVisible" type="i" direction="out" />
+ <arg name="usedPrn" type="ai" direction="out" />
+ <arg name="satInfo" type="a(iiii)" direction="out" />
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out3" value="QList&lt;qint32&gt;"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out4" value="QList&lt;QGeoSatelliteInfo&gt;"/>
+ </method>
+ <signal name="SatelliteChanged">
+ <arg name="timestamp" type="i" />
+ <arg name="satelliteUsed" type="i" />
+ <arg name="satelliteVisible" type="i" />
+ <arg name="usedPrn" type="ai" />
+ <arg name="satInfo" type="a(iiii)" />'
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="QList&lt;qint32&gt;"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QList&lt;QGeoSatelliteInfo&gt;"/>
+ </signal>
+ </interface>
+</node>
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.Velocity.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Velocity.xml
new file mode 100644
index 00000000..a1be122a
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.Velocity.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node name="/">
+ <interface name="org.freedesktop.Geoclue.Velocity">
+ <method name="GetVelocity">
+ <arg name="fields" type="i" direction="out" />
+ <arg name="timestamp" type="i" direction="out" />
+ <arg name="speed" type="d" direction="out" />
+ <arg name="direction" type="d" direction="out" />
+ <arg name="climb" type="d" direction="out" />
+ </method>
+ <signal name="VelocityChanged">
+ <arg name="fields" type="i" />
+ <arg name="timestamp" type="i" />
+ <arg name="speed" type="d" />
+ <arg name="direction" type="d" />
+ <arg name="climb" type="d" />
+ </signal>
+ </interface>
+</node>
diff --git a/src/plugins/position/geoclue/org.freedesktop.Geoclue.xml b/src/plugins/position/geoclue/org.freedesktop.Geoclue.xml
new file mode 100644
index 00000000..c9b6f635
--- /dev/null
+++ b/src/plugins/position/geoclue/org.freedesktop.Geoclue.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.freedesktop.Geoclue">
+ <method name="RemoveReference">
+ </method>
+ <method name="AddReference">
+ </method>
+ <method name="SetOptions">
+ <arg name="options" type="a{sv}" direction="in"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
+ </method>
+ <method name="GetStatus">
+ <arg name="status" type="i" direction="out"/>
+ </method>
+ <method name="GetProviderInfo">
+ <arg name="name" type="s" direction="out"/>
+ <arg name="description" type="s" direction="out"/>
+ </method>
+ <signal name="StatusChanged">
+ <arg name="status" type="i"/>
+ </signal>
+ </interface>
+</node>
diff --git a/src/plugins/position/geoclue/plugin-satellite.json b/src/plugins/position/geoclue/plugin-satellite.json
deleted file mode 100644
index 59e190f1..00000000
--- a/src/plugins/position/geoclue/plugin-satellite.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "Keys": ["geoclue"],
- "Provider": "geoclue",
- "Position": true,
- "Satellite": true,
- "Priority": 1000
-}
diff --git a/src/plugins/position/geoclue/plugin.json b/src/plugins/position/geoclue/plugin.json
index cac7345b..82f8afc6 100644
--- a/src/plugins/position/geoclue/plugin.json
+++ b/src/plugins/position/geoclue/plugin.json
@@ -2,7 +2,8 @@
"Keys": ["geoclue"],
"Provider": "geoclue",
"Position": true,
- "Satellite": false,
+ "Satellite": true,
"Monitor": false,
- "Priority": 1000
+ "Priority": 999,
+ "Testable": false
}
diff --git a/src/plugins/position/geoclue/qgeocluemaster.cpp b/src/plugins/position/geoclue/qgeocluemaster.cpp
index 7c340ba7..b7f4c6a3 100644
--- a/src/plugins/position/geoclue/qgeocluemaster.cpp
+++ b/src/plugins/position/geoclue/qgeocluemaster.cpp
@@ -33,94 +33,85 @@
#include "qgeocluemaster.h"
-#include <QtCore/QByteArray>
-#include <QtCore/QMetaMethod>
+#include <master_interface.h>
+#include <geoclue_interface.h>
+#include <masterclient_interface.h>
-QT_BEGIN_NAMESPACE
-
-namespace
-{
-
-void position_provider_changed(GeoclueMasterClient *client, char *name, char *description,
- char *service, char *path, QObject *handler)
-{
- Q_UNUSED(client)
- Q_UNUSED(name)
- Q_UNUSED(description)
+#include <QtCore/QLoggingCategory>
- const QByteArray pService = QByteArray(service);
- const QByteArray pPath = QByteArray(path);
+Q_DECLARE_LOGGING_CATEGORY(lcPositioningGeoclue)
- QMetaObject::invokeMethod(handler, "positionProviderChanged", Qt::QueuedConnection,
- Q_ARG(QByteArray, pService), Q_ARG(QByteArray, pPath));
-}
-
-}
+QT_BEGIN_NAMESPACE
-QGeoclueMaster::QGeoclueMaster(QObject *handler)
-: m_client(0), m_masterPosition(0), m_handler(handler)
+QGeoclueMaster::QGeoclueMaster(QObject *parent)
+: QObject(parent), m_master(0), m_provider(0), m_client(0)
{
-#if !defined(GLIB_VERSION_2_36)
- g_type_init();
-#endif
}
QGeoclueMaster::~QGeoclueMaster()
{
releaseMasterClient();
+
+ delete m_master;
}
bool QGeoclueMaster::hasMasterClient() const
{
- return m_client && m_masterPosition;
+ return m_client;
}
-bool QGeoclueMaster::createMasterClient(GeoclueAccuracyLevel accuracy, GeoclueResourceFlags resourceFlags)
+bool QGeoclueMaster::createMasterClient(Accuracy::Level accuracyLevel, ResourceFlags resourceFlags)
{
- Q_ASSERT(!m_client && !m_masterPosition);
+ Q_ASSERT(!m_provider || !m_client);
- GeoclueMaster *master = geoclue_master_get_default();
- if (!master) {
- qCritical("QGeoclueMaster error creating GeoclueMaster");
+ if (!m_master) {
+ qCDebug(lcPositioningGeoclue) << "creating master interface";
+ m_master = new OrgFreedesktopGeoclueMasterInterface(QStringLiteral("org.freedesktop.Geoclue.Master"),
+ QStringLiteral("/org/freedesktop/Geoclue/Master"),
+ QDBusConnection::sessionBus());
+ }
+
+ qCDebug(lcPositioningGeoclue) << "creating client";
+ QDBusPendingReply<QDBusObjectPath> client = m_master->Create();
+ if (client.isError()) {
+ QDBusError e = client.error();
+ qCritical("Failed to create Geoclue client interface. Geoclue error: %s",
+ qPrintable(e.errorString(e.type())));
return false;
}
- GError *error = 0;
+ qCDebug(lcPositioningGeoclue) << "Geoclue client path:" << client.value().path();
- m_client = geoclue_master_create_client(master, 0, &error);
- g_object_unref (master);
+ m_provider = new OrgFreedesktopGeoclueInterface(QStringLiteral("org.freedesktop.Geoclue.Master"),
+ client.value().path(), QDBusConnection::sessionBus());
+ m_provider->AddReference();
- if (!m_client) {
- qCritical("QGeoclueMaster error creating GeoclueMasterClient.");
- if (error) {
- qCritical("Geoclue error: %s", error->message);
- g_error_free(error);
- }
- return false;
- }
+ m_client = new OrgFreedesktopGeoclueMasterClientInterface(QStringLiteral("org.freedesktop.Geoclue.Master"),
+ client.value().path(),
+ QDBusConnection::sessionBus());
+
+ connect(m_client, SIGNAL(PositionProviderChanged(QString,QString,QString,QString)),
+ this, SIGNAL(positionProviderChanged(QString,QString,QString,QString)));
- g_signal_connect(G_OBJECT(m_client), "position-provider-changed",
- G_CALLBACK(position_provider_changed), m_handler);
-
- if (!geoclue_master_client_set_requirements(m_client, accuracy, 0, true,
- resourceFlags, &error)) {
- qCritical("QGeoclueMaster geoclue set_requirements failed.");
- if (error) {
- qCritical ("Geoclue error: %s", error->message);
- g_error_free (error);
- }
- g_object_unref(m_client);
- m_client = 0;
+ QDBusPendingReply<> reply = m_client->SetRequirements(accuracyLevel, 0, true, resourceFlags);
+ if (reply.isError()) {
+ QDBusError e = reply.error();
+ qCritical("Failed to set Geoclue positioning requirements. Geoclue error: %s",
+ qPrintable(e.errorString(e.type())));
+
+ releaseMasterClient();
return false;
}
// Need to create the master position interface even though it will not be used, otherwise
// GetPositionProvider always returns empty strings.
- m_masterPosition = geoclue_master_client_create_position(m_client, 0);
- if (!m_masterPosition) {
- qCritical("QGeoclueMaster failed to get master position object");
- g_object_unref(m_client);
- m_client = 0;
+ reply = m_client->PositionStart();
+ if (reply.isError()) {
+ QDBusError e = reply.error();
+ qCritical("Failed to start positioning. Geoclue error: %s",
+ qPrintable(e.errorString(e.type())));
+
+ releaseMasterClient();
return false;
}
@@ -129,16 +120,12 @@ bool QGeoclueMaster::createMasterClient(GeoclueAccuracyLevel accuracy, GeoclueRe
void QGeoclueMaster::releaseMasterClient()
{
- if (m_masterPosition) {
- g_object_unref(m_masterPosition);
- m_masterPosition = 0;
- }
- if (m_client) {
- g_signal_handlers_disconnect_by_func(G_OBJECT(m_client), (void *)position_provider_changed,
- m_handler);
- g_object_unref(m_client);
- m_client = 0;
- }
+ if (m_provider)
+ m_provider->RemoveReference();
+ delete m_provider;
+ m_provider = 0;
+ delete m_client;
+ m_client = 0;
}
QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue/qgeocluemaster.h b/src/plugins/position/geoclue/qgeocluemaster.h
index 0451f812..83c1eb94 100644
--- a/src/plugins/position/geoclue/qgeocluemaster.h
+++ b/src/plugins/position/geoclue/qgeocluemaster.h
@@ -34,29 +34,51 @@
#ifndef QGEOCLUEMASTER_H
#define QGEOCLUEMASTER_H
+#include "geocluetypes.h"
+
#include <QtCore/QObject>
-#include <geoclue/geoclue-master.h>
+class OrgFreedesktopGeoclueMasterInterface;
+class OrgFreedesktopGeoclueInterface;
+class OrgFreedesktopGeoclueMasterClientInterface;
QT_BEGIN_NAMESPACE
-class QGeoclueMaster
+class QGeoclueMaster : public QObject
{
+ Q_OBJECT
+
public:
- QGeoclueMaster(QObject *handler);
- virtual ~QGeoclueMaster();
+ QGeoclueMaster(QObject *parent = 0);
+ ~QGeoclueMaster();
+
+ enum ResourceFlag
+ {
+ ResourceNone = 0,
+ ResourceNetwork = 1 << 0,
+ ResourceCell = 1 << 1,
+ ResourceGps = 1 << 2,
+ ResourceAll = (1 << 10) - 1
+ };
+
+ Q_DECLARE_FLAGS(ResourceFlags, ResourceFlag)
bool hasMasterClient() const;
- bool createMasterClient(GeoclueAccuracyLevel accuracy, GeoclueResourceFlags resourceFlags);
+ bool createMasterClient(Accuracy::Level accuracyLevel, ResourceFlags resourceFlags);
void releaseMasterClient();
-private:
- GeoclueMasterClient *m_client;
- GeocluePosition *m_masterPosition;
+signals:
+ void positionProviderChanged(const QString &name, const QString &description,
+ const QString &service, const QString &path);
- QObject *m_handler;
+private:
+ OrgFreedesktopGeoclueMasterInterface *m_master;
+ OrgFreedesktopGeoclueInterface *m_provider;
+ OrgFreedesktopGeoclueMasterClientInterface *m_client;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QGeoclueMaster::ResourceFlags)
+
QT_END_NAMESPACE
#endif // QGEOCLUEMASTER_H
diff --git a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
index fe5b048e..5311e18f 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.cpp
@@ -33,7 +33,11 @@
**
****************************************************************************/
-#include "qgeopositioninfosource_geocluemaster_p.h"
+#include "qgeopositioninfosource_geocluemaster.h"
+
+#include <geoclue_interface.h>
+#include <position_interface.h>
+#include <velocity_interface.h>
#include <QtCore/QDateTime>
#include <QtCore/QFile>
@@ -41,64 +45,22 @@
#include <QtCore/QStandardPaths>
#include <QtCore/QVariantMap>
#include <QtCore/QtNumeric>
-
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
-#include <QDebug>
-#endif
-
-#include <dbus/dbus-glib.h>
+#include <QtCore/QLoggingCategory>
+#include <QtDBus/QDBusMetaType>
#ifndef QT_NO_DATASTREAM
#include <QtCore/QDataStream>
#endif
-QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcPositioningGeoclue)
#define MINIMUM_UPDATE_INTERVAL 1000
#define UPDATE_TIMEOUT_COLD_START 120000
-namespace
-{
-
-void position_changed(GeocluePosition *position, GeocluePositionFields fields, int timestamp,
- double latitude, double longitude, double altitude,
- GeoclueAccuracy *accuracy, QGeoPositionInfoSourceGeoclueMaster *master)
-{
- Q_UNUSED(position)
-
- if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)
- master->updatePosition(fields, timestamp, latitude, longitude, altitude, accuracy);
- else
- master->regularUpdateFailed();
-}
-
-void velocity_changed(GeoclueVelocity *velocity, GeoclueVelocityFields fields, int timestamp,
- double speed, double direction, double climb,
- QGeoPositionInfoSourceGeoclueMaster *master)
-{
- Q_UNUSED(velocity)
-
- if (fields == GEOCLUE_VELOCITY_FIELDS_NONE)
- master->velocityUpdateFailed();
- else
- master->velocityUpdateSucceeded(fields, timestamp, speed, direction, climb);
-}
+QT_BEGIN_NAMESPACE
-void position_callback(GeocluePosition *pos, GeocluePositionFields fields, int timestamp,
- double latitude, double longitude, double altitude,
- GeoclueAccuracy *accuracy, GError *error, gpointer userdata)
+namespace
{
- Q_UNUSED(pos)
-
- if (error)
- g_error_free(error);
-
- QGeoPositionInfoSourceGeoclueMaster *master =
- static_cast<QGeoPositionInfoSourceGeoclueMaster *>(userdata);
-
- if (fields & GEOCLUE_POSITION_FIELDS_LATITUDE && fields & GEOCLUE_POSITION_FIELDS_LONGITUDE)
- master->updatePosition(fields, timestamp, latitude, longitude, altitude, accuracy);
-}
double knotsToMetersPerSecond(double knots)
{
@@ -108,11 +70,13 @@ double knotsToMetersPerSecond(double knots)
}
QGeoPositionInfoSourceGeoclueMaster::QGeoPositionInfoSourceGeoclueMaster(QObject *parent)
-: QGeoPositionInfoSource(parent), QGeoclueMaster(this), m_pos(0), m_vel(0),
- m_lastVelocityIsFresh(false), m_regularUpdateTimedOut(false), m_lastVelocity(qQNaN()),
+: QGeoPositionInfoSource(parent), m_master(new QGeoclueMaster(this)), m_provider(0), m_pos(0),
+ m_vel(0), m_lastVelocityIsFresh(false), m_regularUpdateTimedOut(false), m_lastVelocity(qQNaN()),
m_lastDirection(qQNaN()), m_lastClimb(qQNaN()), m_lastPositionFromSatellite(false),
- m_methods(AllPositioningMethods), m_running(false), m_error(NoError)
+ m_running(false), m_error(NoError)
{
+ qDBusRegisterMetaType<Accuracy>();
+
#ifndef QT_NO_DATASTREAM
// Load the last known location
QFile file(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
@@ -123,8 +87,11 @@ QGeoPositionInfoSourceGeoclueMaster::QGeoPositionInfoSourceGeoclueMaster(QObject
}
#endif
+ connect(m_master, SIGNAL(positionProviderChanged(QString,QString,QString,QString)),
+ this, SLOT(positionProviderChanged(QString,QString,QString,QString)));
+
m_requestTimer.setSingleShot(true);
- QObject::connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestUpdateTimeout()));
+ connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestUpdateTimeout()));
setPreferredPositioningMethods(AllPositioningMethods);
}
@@ -144,54 +111,12 @@ QGeoPositionInfoSourceGeoclueMaster::~QGeoPositionInfoSourceGeoclueMaster()
}
#endif
- if (m_pos)
- g_object_unref (m_pos);
- if (m_vel)
- g_object_unref(m_vel);
-}
-
-void QGeoPositionInfoSourceGeoclueMaster::velocityUpdateFailed()
-{
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster velocity update failed.";
-#endif
- // Set the velocitydata non-fresh.
- m_lastVelocityIsFresh = false;
-}
-
-void QGeoPositionInfoSourceGeoclueMaster::velocityUpdateSucceeded(GeoclueVelocityFields fields,
- int timestamp, double speed,
- double direction, double climb)
-{
- Q_UNUSED(timestamp);
-
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster velocity update succeeded, speed: " << speed;
-#endif
- // Store the velocity and mark it as fresh. Simple but hopefully adequate.
- if (fields & GEOCLUE_VELOCITY_FIELDS_SPEED)
- m_lastVelocity = knotsToMetersPerSecond(speed);
- else
- m_lastVelocity = qQNaN();
-
- if (fields & GEOCLUE_VELOCITY_FIELDS_DIRECTION)
- m_lastDirection = direction;
- else
- m_lastDirection = qQNaN();
-
- if (fields & GEOCLUE_VELOCITY_FIELDS_CLIMB)
- m_lastClimb = climb;
- else
- m_lastClimb = qQNaN();
-
- m_lastVelocityIsFresh = true;
+ cleanupPositionSource();
}
-void QGeoPositionInfoSourceGeoclueMaster::regularUpdateFailed()
+void QGeoPositionInfoSourceGeoclueMaster::positionUpdateFailed()
{
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster regular update failed.";
-#endif
+ qCDebug(lcPositioningGeoclue) << "position update failed.";
m_lastVelocityIsFresh = false;
if (m_running && !m_regularUpdateTimedOut) {
@@ -200,33 +125,25 @@ void QGeoPositionInfoSourceGeoclueMaster::regularUpdateFailed()
}
}
-void QGeoPositionInfoSourceGeoclueMaster::updatePosition(GeocluePositionFields fields,
- int timestamp, double latitude,
- double longitude, double altitude,
- GeoclueAccuracy *accuracy)
+void QGeoPositionInfoSourceGeoclueMaster::updatePosition(PositionFields fields, int timestamp,
+ double latitude, double longitude,
+ double altitude, Accuracy accuracy)
{
if (m_requestTimer.isActive())
m_requestTimer.stop();
QGeoCoordinate coordinate(latitude, longitude);
- if (fields & GEOCLUE_POSITION_FIELDS_ALTITUDE)
+ if (fields & Altitude)
coordinate.setAltitude(altitude);
m_lastPosition = QGeoPositionInfo(coordinate, QDateTime::fromTime_t(timestamp));
- if (accuracy) {
- double horizontalAccuracy = qQNaN();
- double verticalAccuracy = qQNaN();
- GeoclueAccuracyLevel accuracyLevel = GEOCLUE_ACCURACY_LEVEL_NONE;
- geoclue_accuracy_get_details(accuracy, &accuracyLevel, &horizontalAccuracy, &verticalAccuracy);
-
- m_lastPositionFromSatellite = accuracyLevel & GEOCLUE_ACCURACY_LEVEL_DETAILED;
+ m_lastPositionFromSatellite = accuracy.level() == Accuracy::Detailed;
- if (!qIsNaN(horizontalAccuracy))
- m_lastPosition.setAttribute(QGeoPositionInfo::HorizontalAccuracy, horizontalAccuracy);
- if (!qIsNaN(verticalAccuracy))
- m_lastPosition.setAttribute(QGeoPositionInfo::VerticalAccuracy, verticalAccuracy);
- }
+ if (!qIsNaN(accuracy.horizontal()))
+ m_lastPosition.setAttribute(QGeoPositionInfo::HorizontalAccuracy, accuracy.horizontal());
+ if (!qIsNaN(accuracy.vertical()))
+ m_lastPosition.setAttribute(QGeoPositionInfo::VerticalAccuracy, accuracy.vertical());
if (m_lastVelocityIsFresh) {
if (!qIsNaN(m_lastVelocity))
@@ -242,80 +159,61 @@ void QGeoPositionInfoSourceGeoclueMaster::updatePosition(GeocluePositionFields f
emit positionUpdated(m_lastPosition);
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "Lat, lon, alt, speed:"
- << m_lastPosition.coordinate().latitude()
- << m_lastPosition.coordinate().longitude()
- << m_lastPosition.coordinate().altitude()
- << m_lastPosition.attribute(QGeoPositionInfo::GroundSpeed);
-#endif
+ qCDebug(lcPositioningGeoclue) << m_lastPosition;
// Only stop positioning if regular updates not active.
if (!m_running) {
cleanupPositionSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
}
}
+void QGeoPositionInfoSourceGeoclueMaster::velocityUpdateFailed()
+{
+ qCDebug(lcPositioningGeoclue) << "velocity update failed.";
+
+ // Set the velocitydata non-fresh.
+ m_lastVelocityIsFresh = false;
+}
+
+void QGeoPositionInfoSourceGeoclueMaster::updateVelocity(VelocityFields fields, int timestamp,
+ double speed, double direction,
+ double climb)
+{
+ Q_UNUSED(timestamp)
+
+ // Store the velocity and mark it as fresh. Simple but hopefully adequate.
+ m_lastVelocity = (fields & Speed) ? knotsToMetersPerSecond(speed) : qQNaN();
+ m_lastDirection = (fields & Direction) ? direction : qQNaN();
+ m_lastClimb = (fields & Climb) ? climb : qQNaN();
+ m_lastVelocityIsFresh = true;
+
+ qCDebug(lcPositioningGeoclue) << m_lastVelocity << m_lastDirection << m_lastClimb;
+}
+
void QGeoPositionInfoSourceGeoclueMaster::cleanupPositionSource()
{
- if (m_pos) {
- g_object_unref(m_pos);
- m_pos = 0;
- }
- if (m_vel) {
- g_object_unref(m_vel);
- m_vel = 0;
- }
+ qCDebug(lcPositioningGeoclue) << "cleaning up position source";
+
+ if (m_provider)
+ m_provider->RemoveReference();
+ delete m_provider;
+ m_provider = 0;
+ delete m_pos;
+ m_pos = 0;
+ delete m_vel;
+ m_vel = 0;
}
void QGeoPositionInfoSourceGeoclueMaster::setOptions()
{
- if (!m_pos)
+ if (!m_provider)
return;
QVariantMap options;
options.insert(QStringLiteral("UpdateInterval"), updateInterval());
- GHashTable *gOptions = g_hash_table_new(g_str_hash, g_str_equal);
-
- for (QVariantMap::ConstIterator i = options.constBegin(); i != options.constEnd(); ++i) {
- char *key = qstrdup(i.key().toUtf8().constData());
-
- const QVariant v = i.value();
-
- GValue *value = new GValue;
- memset(value, 0, sizeof(*value));
-
- switch (v.userType()) {
- case QMetaType::QString:
- g_value_init(value, G_TYPE_STRING);
- g_value_set_string(value, v.toString().toUtf8().constData());
- break;
- case QMetaType::Int:
- g_value_init(value, G_TYPE_INT);
- g_value_set_int(value, v.toInt());
- break;
- default:
- qWarning("Unexpected type %d %s", v.userType(), v.typeName());
- }
-
- g_hash_table_insert(gOptions, key, value);
- }
-
- geoclue_provider_set_options(GEOCLUE_PROVIDER(m_pos), gOptions, 0);
-
- GHashTableIter iter;
- char *key;
- GValue *value;
-
- g_hash_table_iter_init(&iter, gOptions);
- while (g_hash_table_iter_next(&iter, reinterpret_cast<void **>(&key), reinterpret_cast<void **>(&value))) {
- delete[] key;
- delete value;
- }
-
- g_hash_table_destroy(gOptions);
+ m_provider->SetOptions(options);
}
void QGeoPositionInfoSourceGeoclueMaster::setUpdateInterval(int msec)
@@ -331,23 +229,21 @@ void QGeoPositionInfoSourceGeoclueMaster::setPreferredPositioningMethods(Positio
if (previousPreferredPositioningMethods == preferredPositioningMethods())
return;
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster requested to set methods to" << methods
- << ", and set them to:" << preferredPositioningMethods();
-#endif
+ qCDebug(lcPositioningGeoclue) << "requested to set methods to" << methods
+ << ", and set them to:" << preferredPositioningMethods();
m_lastVelocityIsFresh = false;
m_regularUpdateTimedOut = false;
// Don't start Geoclue provider until necessary. Don't currently have a master client, no need
// no recreate one.
- if (!hasMasterClient())
+ if (!m_master->hasMasterClient())
return;
// Free potential previous sources, because new requirements can't be set for the client
// (creating a position object after changing requirements seems to fail).
cleanupPositionSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
// Restart Geoclue provider with new requirements.
configurePositionSource();
@@ -356,34 +252,30 @@ void QGeoPositionInfoSourceGeoclueMaster::setPreferredPositioningMethods(Positio
QGeoPositionInfo QGeoPositionInfoSourceGeoclueMaster::lastKnownPosition(bool fromSatellitePositioningMethodsOnly) const
{
- if (fromSatellitePositioningMethodsOnly) {
- if (m_lastPositionFromSatellite)
- return m_lastPosition;
- else
- return QGeoPositionInfo();
- }
+ if (fromSatellitePositioningMethodsOnly && !m_lastPositionFromSatellite)
+ return QGeoPositionInfo();
+
return m_lastPosition;
}
QGeoPositionInfoSourceGeoclueMaster::PositioningMethods QGeoPositionInfoSourceGeoclueMaster::supportedPositioningMethods() const
{
- // There is no really knowing which methods the GeoClue master supports.
return AllPositioningMethods;
}
void QGeoPositionInfoSourceGeoclueMaster::startUpdates()
{
if (m_running) {
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster already running";
-#endif
+ qCDebug(lcPositioningGeoclue) << "already running.";
return;
}
m_running = true;
+ qCDebug(lcPositioningGeoclue) << "starting updates";
+
// Start Geoclue provider.
- if (!hasMasterClient()) {
+ if (!m_master->hasMasterClient()) {
configurePositionSource();
setOptions();
}
@@ -402,20 +294,29 @@ int QGeoPositionInfoSourceGeoclueMaster::minimumUpdateInterval() const
void QGeoPositionInfoSourceGeoclueMaster::stopUpdates()
{
- if (!m_running)
+ if (!m_running) {
+ qCDebug(lcPositioningGeoclue) << "already stopped.";
return;
+ }
- if (m_pos)
- g_signal_handlers_disconnect_by_func(G_OBJECT(m_pos), (void *)position_changed, this);
- if (m_vel)
- g_signal_handlers_disconnect_by_func(G_OBJECT(m_vel), (void *)velocity_changed, this);
+ qCDebug(lcPositioningGeoclue) << "stopping updates";
+
+ if (m_pos) {
+ disconnect(m_pos, SIGNAL(PositionChanged(qint32,qint32,double,double,double,Accuracy)),
+ this, SLOT(positionChanged(qint32,qint32,double,double,double,Accuracy)));
+ }
+
+ if (m_vel) {
+ disconnect(m_vel, SIGNAL(VelocityChanged(qint32,qint32,double,double,double)),
+ this, SLOT(velocityChanged(qint32,qint32,double,double,double)));
+ }
m_running = false;
// Only stop positioning if single update not requested.
if (!m_requestTimer.isActive()) {
cleanupPositionSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
}
}
@@ -426,13 +327,11 @@ void QGeoPositionInfoSourceGeoclueMaster::requestUpdate(int timeout)
return;
}
if (m_requestTimer.isActive()) {
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster request timer was active, ignoring startUpdates.";
-#endif
+ qCDebug(lcPositioningGeoclue) << "request timer was active, ignoring startUpdates.";
return;
}
- if (!hasMasterClient()) {
+ if (!m_master->hasMasterClient()) {
configurePositionSource();
setOptions();
}
@@ -442,85 +341,141 @@ void QGeoPositionInfoSourceGeoclueMaster::requestUpdate(int timeout)
// for whole cold start time.
m_requestTimer.start(timeout ? timeout : UPDATE_TIMEOUT_COLD_START);
- if (m_pos)
- geoclue_position_get_position_async(m_pos, position_callback, this);
+ if (m_pos) {
+ QDBusPendingReply<qint32, qint32, double, double, double, Accuracy> reply = m_pos->GetPosition();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(getPositionFinished(QDBusPendingCallWatcher*)));
+ }
+}
+
+void QGeoPositionInfoSourceGeoclueMaster::positionProviderChanged(const QString &name,
+ const QString &description,
+ const QString &service,
+ const QString &path)
+{
+ Q_UNUSED(name)
+ Q_UNUSED(description)
+
+ cleanupPositionSource();
+
+ if (service.isEmpty() || path.isEmpty()) {
+ if (!m_regularUpdateTimedOut) {
+ m_regularUpdateTimedOut = true;
+ emit updateTimeout();
+ }
+ return;
+ }
+
+ qCDebug(lcPositioningGeoclue) << "position provider changed to" << name;
+
+ m_provider = new OrgFreedesktopGeoclueInterface(service, path, QDBusConnection::sessionBus());
+ m_provider->AddReference();
+
+ m_pos = new OrgFreedesktopGeocluePositionInterface(service, path, QDBusConnection::sessionBus());
+
+ if (m_running) {
+ connect(m_pos, SIGNAL(PositionChanged(qint32,qint32,double,double,double,Accuracy)),
+ this, SLOT(positionChanged(qint32,qint32,double,double,double,Accuracy)));
+ }
+
+ // Get the current position immediately.
+ QDBusPendingReply<qint32, qint32, double, double, double, Accuracy> reply = m_pos->GetPosition();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(getPositionFinished(QDBusPendingCallWatcher*)));
+
+ setOptions();
+
+ m_vel = new OrgFreedesktopGeoclueVelocityInterface(service, path, QDBusConnection::sessionBus());
+ if (m_vel->isValid() && m_running) {
+ connect(m_vel, SIGNAL(VelocityChanged(qint32,qint32,double,double,double)),
+ this, SLOT(velocityChanged(qint32,qint32,double,double,double)));
+ }
}
void QGeoPositionInfoSourceGeoclueMaster::requestUpdateTimeout()
{
-#ifdef Q_LOCATION_GEOCLUE_DEBUG
- qDebug() << "QGeoPositionInfoSourceGeoclueMaster requestUpdate timeout occurred.";
-#endif
+ qCDebug(lcPositioningGeoclue) << "request update timeout occurred.";
+
// If we end up here, there has not been valid position update.
emit updateTimeout();
// Only stop positioning if regular updates not active.
if (!m_running) {
cleanupPositionSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
}
}
-void QGeoPositionInfoSourceGeoclueMaster::positionProviderChanged(const QByteArray &service, const QByteArray &path)
+void QGeoPositionInfoSourceGeoclueMaster::getPositionFinished(QDBusPendingCallWatcher *watcher)
{
- if (m_pos)
- cleanupPositionSource();
+ QDBusPendingReply<qint32, qint32, double, double, double, Accuracy> reply = *watcher;
+ watcher->deleteLater();
- if (service.isEmpty() || path.isEmpty()) {
- if (!m_regularUpdateTimedOut) {
- m_regularUpdateTimedOut = true;
- emit updateTimeout();
- }
+ if (reply.isError())
return;
- }
- m_pos = geoclue_position_new(service.constData(), path.constData());
- if (m_pos) {
- if (m_running) {
- g_signal_connect(G_OBJECT(m_pos), "position-changed",
- G_CALLBACK(position_changed), this);
- }
+ PositionFields fields = static_cast<PositionFields>(reply.argumentAt<0>());
- // Get the current position immediately.
- geoclue_position_get_position_async(m_pos, position_callback, this);
- setOptions();
+ qCDebug(lcPositioningGeoclue) << "got position update with fields" << int(fields);
- m_vel = geoclue_velocity_new(service.constData(), path.constData());
- if (m_vel && m_running) {
- g_signal_connect(G_OBJECT(m_vel), "velocity-changed",
- G_CALLBACK(velocity_changed), this);
- }
+ if (fields & Latitude && fields & Longitude) {
+ qint32 timestamp = reply.argumentAt<1>();
+ double latitude = reply.argumentAt<2>();
+ double longitude = reply.argumentAt<3>();
+ double altitude = reply.argumentAt<4>();
+ Accuracy accuracy = reply.argumentAt<5>();
+ updatePosition(fields, timestamp, latitude, longitude, altitude, accuracy);
}
}
+void QGeoPositionInfoSourceGeoclueMaster::positionChanged(qint32 fields, qint32 timestamp, double latitude, double longitude, double altitude, const Accuracy &accuracy)
+{
+ PositionFields pFields = static_cast<PositionFields>(fields);
+
+ qCDebug(lcPositioningGeoclue) << "position changed with fields" << fields;
+
+ if (pFields & Latitude && pFields & Longitude)
+ updatePosition(pFields, timestamp, latitude, longitude, altitude, accuracy);
+ else
+ positionUpdateFailed();
+}
+
+void QGeoPositionInfoSourceGeoclueMaster::velocityChanged(qint32 fields, qint32 timestamp, double speed, double direction, double climb)
+{
+ VelocityFields vFields = static_cast<VelocityFields>(fields);
+
+ if (vFields == NoVelocityFields)
+ velocityUpdateFailed();
+ else
+ updateVelocity(vFields, timestamp, speed, direction, climb);
+}
+
void QGeoPositionInfoSourceGeoclueMaster::configurePositionSource()
{
- GeoclueAccuracyLevel accuracy;
- GeoclueResourceFlags resourceFlags;
+ qCDebug(lcPositioningGeoclue);
+
+ bool created = false;
switch (preferredPositioningMethods()) {
case SatellitePositioningMethods:
- accuracy = GEOCLUE_ACCURACY_LEVEL_DETAILED;
- resourceFlags = GEOCLUE_RESOURCE_GPS;
+ created = m_master->createMasterClient(Accuracy::Detailed, QGeoclueMaster::ResourceGps);
break;
case NonSatellitePositioningMethods:
- accuracy = GEOCLUE_ACCURACY_LEVEL_NONE;
- resourceFlags = GeoclueResourceFlags(GEOCLUE_RESOURCE_CELL | GEOCLUE_RESOURCE_NETWORK);
+ created = m_master->createMasterClient(Accuracy::None, QGeoclueMaster::ResourceCell | QGeoclueMaster::ResourceNetwork);
break;
case AllPositioningMethods:
- accuracy = GEOCLUE_ACCURACY_LEVEL_NONE;
- resourceFlags = GEOCLUE_RESOURCE_ALL;
+ created = m_master->createMasterClient(Accuracy::None, QGeoclueMaster::ResourceAll);
break;
default:
- qWarning("GeoPositionInfoSourceGeoClueMaster unknown preferred method.");
+ qWarning("QGeoPositionInfoSourceGeoclueMaster unknown preferred method.");
m_error = UnknownSourceError;
emit QGeoPositionInfoSource::error(m_error);
return;
}
- if (createMasterClient(accuracy, resourceFlags)) {
- m_error = NoError;
- } else {
+ if (!created) {
m_error = UnknownSourceError;
emit QGeoPositionInfoSource::error(m_error);
}
@@ -531,6 +486,4 @@ QGeoPositionInfoSource::Error QGeoPositionInfoSourceGeoclueMaster::error() const
return m_error;
}
-#include "moc_qgeopositioninfosource_geocluemaster_p.cpp"
-
QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.h
index 2dcd3824..09f6812c 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster_p.h
+++ b/src/plugins/position/geoclue/qgeopositioninfosource_geocluemaster.h
@@ -36,33 +36,26 @@
#ifndef QGEOPOSITIONINFOSOURCE_GEOCLUEMASTER_H
#define QGEOPOSITIONINFOSOURCE_GEOCLUEMASTER_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
#include "qgeocluemaster.h"
+#include "geocluetypes.h"
-#include <qgeopositioninfosource.h>
-#include <geoclue/geoclue-velocity.h>
-#include <QTimer>
+#include <QtCore/QTimer>
+#include <QtPositioning/QGeoPositionInfoSource>
-//#define Q_LOCATION_GEOCLUE_DEBUG
+class OrgFreedesktopGeoclueInterface;
+class OrgFreedesktopGeocluePositionInterface;
+class OrgFreedesktopGeoclueVelocityInterface;
QT_BEGIN_NAMESPACE
-class QGeoPositionInfoSourceGeoclueMaster : public QGeoPositionInfoSource, public QGeoclueMaster
+class QDBusPendingCallWatcher;
+
+class QGeoPositionInfoSourceGeoclueMaster : public QGeoPositionInfoSource
{
Q_OBJECT
public:
- QGeoPositionInfoSourceGeoclueMaster(QObject *parent = 0);
+ explicit QGeoPositionInfoSourceGeoclueMaster(QObject *parent = 0);
~QGeoPositionInfoSourceGeoclueMaster();
// From QGeoPositionInfoSource
@@ -72,34 +65,61 @@ public:
void setPreferredPositioningMethods(PositioningMethods methods);
int minimumUpdateInterval() const;
- void updatePosition(GeocluePositionFields fields, int timestamp, double latitude,
- double longitude, double altitude, GeoclueAccuracy *accuracy);
-
- void regularUpdateFailed();
-
- void velocityUpdateFailed();
- void velocityUpdateSucceeded(GeoclueVelocityFields fields, int timestamp, double speed,
- double direction, double climb);
-
Error error() const;
-public slots:
- virtual void startUpdates();
- virtual void stopUpdates();
- virtual void requestUpdate(int timeout = 5000);
+ virtual void startUpdates() Q_DECL_OVERRIDE;
+ virtual void stopUpdates() Q_DECL_OVERRIDE;
+ virtual void requestUpdate(int timeout = 5000) Q_DECL_OVERRIDE;
private slots:
+ void positionProviderChanged(const QString &name, const QString &description,
+ const QString &service, const QString &path);
void requestUpdateTimeout();
- void positionProviderChanged(const QByteArray &service, const QByteArray &path);
+
+ void getPositionFinished(QDBusPendingCallWatcher *watcher);
+ void positionChanged(qint32 fields, qint32 timestamp, double latitude, double longitude,
+ double altitude, const Accuracy &accuracy);
+ void velocityChanged(qint32 fields, qint32 timestamp, double speed, double direction,
+ double climb);
private:
void configurePositionSource();
void cleanupPositionSource();
void setOptions();
+ enum PositionField
+ {
+ NoPositionFields = 0,
+ Latitude = 1 << 0,
+ Longitude = 1 << 1,
+ Altitude = 1 << 2
+ };
+ Q_DECLARE_FLAGS(PositionFields, PositionField)
+
+ void updatePosition(PositionFields fields, int timestamp, double latitude,
+ double longitude, double altitude, Accuracy accuracy);
+ void positionUpdateFailed();
+
+ enum VelocityField
+ {
+ NoVelocityFields = 0,
+ Speed = 1 << 0,
+ Direction = 1 << 1,
+ Climb = 1 << 2
+ };
+ Q_DECLARE_FLAGS(VelocityFields, VelocityField)
+
+ void updateVelocity(VelocityFields fields, int timestamp, double speed, double direction,
+ double climb);
+ void velocityUpdateFailed();
+
private:
- GeocluePosition *m_pos;
- GeoclueVelocity *m_vel;
+ QGeoclueMaster *m_master;
+
+ OrgFreedesktopGeoclueInterface *m_provider;
+ OrgFreedesktopGeocluePositionInterface *m_pos;
+ OrgFreedesktopGeoclueVelocityInterface *m_vel;
+
QTimer m_requestTimer;
bool m_lastVelocityIsFresh;
bool m_regularUpdateTimedOut;
@@ -108,7 +128,6 @@ private:
double m_lastClimb;
bool m_lastPositionFromSatellite;
QGeoPositionInfo m_lastPosition;
- PositioningMethods m_methods;
bool m_running;
QGeoPositionInfoSource::Error m_error;
};
diff --git a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp
index a7c92678..05d96547 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp
+++ b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.cpp
@@ -34,13 +34,17 @@
****************************************************************************/
#include "qgeopositioninfosourcefactory_geoclue.h"
-#include "qgeopositioninfosource_geocluemaster_p.h"
-#ifdef HAS_SATELLITE
+#include "qgeopositioninfosource_geocluemaster.h"
#include "qgeosatelliteinfosource_geocluemaster.h"
-#endif
+
+#include <QtCore/QLoggingCategory>
Q_DECLARE_METATYPE(QGeoPositionInfo)
+Q_LOGGING_CATEGORY(lcPositioningGeoclue, "qt.positioning.geoclue")
+
+QT_BEGIN_NAMESPACE
+
QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGeoclue::positionInfoSource(QObject *parent)
{
qRegisterMetaType<QGeoPositionInfo>();
@@ -49,17 +53,13 @@ QGeoPositionInfoSource *QGeoPositionInfoSourceFactoryGeoclue::positionInfoSource
QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactoryGeoclue::satelliteInfoSource(QObject *parent)
{
-#ifdef HAS_SATELLITE
return new QGeoSatelliteInfoSourceGeoclueMaster(parent);
-#else
- Q_UNUSED(parent)
-
- return 0;
-#endif
}
QGeoAreaMonitorSource *QGeoPositionInfoSourceFactoryGeoclue::areaMonitor(QObject *parent)
{
- Q_UNUSED(parent);
+ Q_UNUSED(parent)
return 0;
}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h
index fdd0675f..17da509e 100644
--- a/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h
+++ b/src/plugins/position/geoclue/qgeopositioninfosourcefactory_geoclue.h
@@ -36,28 +36,29 @@
#ifndef QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE_H
#define QGEOPOSITIONINFOSOURCEFACTORY_GEOCLUE_H
-#include <QObject>
-#include <qgeopositioninfosourcefactory.h>
+#include <QtCore/QObject>
+#include <QtPositioning/QGeoPositionInfoSourceFactory>
-#ifdef HAS_SATELLITE
-#define PLUGIN_JSON "plugin-satellite.json"
-#else
-#define PLUGIN_JSON "plugin.json"
-#endif
+QT_BEGIN_NAMESPACE
+/*
+ Qt Positioning plugin for Geoclue. This plugin supports Geoclue version 0.12.99.
+*/
class QGeoPositionInfoSourceFactoryGeoclue : public QObject, public QGeoPositionInfoSourceFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
- FILE PLUGIN_JSON)
+ FILE "plugin.json")
Q_INTERFACES(QGeoPositionInfoSourceFactory)
public:
- QGeoPositionInfoSource *positionInfoSource(QObject *parent);
- QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent);
- QGeoAreaMonitorSource *areaMonitor(QObject *parent);
+ QGeoPositionInfoSource *positionInfoSource(QObject *parent) Q_DECL_OVERRIDE;
+ QGeoSatelliteInfoSource *satelliteInfoSource(QObject *parent) Q_DECL_OVERRIDE;
+ QGeoAreaMonitorSource *areaMonitor(QObject *parent) Q_DECL_OVERRIDE;
};
+QT_END_NAMESPACE
+
#endif
diff --git a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp
index 501a983c..8e646bff 100644
--- a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp
+++ b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.cpp
@@ -33,122 +33,25 @@
#include "qgeosatelliteinfosource_geocluemaster.h"
-#include <QtDBus/QDBusConnection>
-#include <QtDBus/QDBusMessage>
-#include <QtDBus/QDBusArgument>
+#include <geoclue_interface.h>
+#include <satellite_interface.h>
-#define MINIMUM_UPDATE_INTERVAL 1000
-
-QT_BEGIN_NAMESPACE
-
-namespace
-{
-
-void satellite_changed(GeoclueSatellite *satellite, int timestamp, int satellite_used,
- int satellite_visible, GArray *used_prn, GPtrArray *sat_info,
- gpointer userdata)
-{
- Q_UNUSED(satellite)
-
- QGeoSatelliteInfoSourceGeoclueMaster *source =
- static_cast<QGeoSatelliteInfoSourceGeoclueMaster *>(userdata);
-
- QList<int> usedPrns;
- for (unsigned int i = 0; i < used_prn->len; ++i)
- usedPrns.append(g_array_index(used_prn, int, i));
-
- QList<QGeoSatelliteInfo> satInfos;
- for (unsigned int i = 0; i < sat_info->len; ++i) {
- GValueArray *a = static_cast<GValueArray *>(g_ptr_array_index(sat_info, i));
-
- QGeoSatelliteInfo satInfo;
-
- satInfo.setSatelliteIdentifier(g_value_get_int(g_value_array_get_nth(a, 0)));
- satInfo.setAttribute(QGeoSatelliteInfo::Elevation,
- g_value_get_int(g_value_array_get_nth(a, 1)));
- satInfo.setAttribute(QGeoSatelliteInfo::Azimuth,
- g_value_get_int(g_value_array_get_nth(a, 2)));
- satInfo.setSignalStrength(g_value_get_int(g_value_array_get_nth(a, 3)));
-
- satInfos.append(satInfo);
- }
-
- source->satelliteChanged(timestamp, satellite_used, satellite_visible, usedPrns, satInfos);
-}
-
-void satellite_callback(GeoclueSatellite *satellite, int timestamp, int satellite_used,
- int satellite_visible, GArray *used_prn, GPtrArray *sat_info,
- GError *error, gpointer userdata)
-{
- Q_UNUSED(satellite)
-
- if (error)
- g_error_free(error);
-
- QGeoSatelliteInfoSourceGeoclueMaster *source =
- static_cast<QGeoSatelliteInfoSourceGeoclueMaster *>(userdata);
+#include <QtCore/QLoggingCategory>
+#include <QtDBus/QDBusPendingCallWatcher>
- QList<int> usedPrns;
- for (unsigned int i = 0; i < used_prn->len; ++i)
- usedPrns.append(g_array_index(used_prn, int, i));
+Q_DECLARE_LOGGING_CATEGORY(lcPositioningGeoclue)
- QList<QGeoSatelliteInfo> satInfos;
- for (unsigned int i = 0; i < sat_info->len; ++i) {
- GValueArray *a = static_cast<GValueArray *>(g_ptr_array_index(sat_info, i));
-
- QGeoSatelliteInfo satInfo;
-
- satInfo.setSatelliteIdentifier(g_value_get_int(g_value_array_get_nth(a, 0)));
- satInfo.setAttribute(QGeoSatelliteInfo::Elevation,
- g_value_get_int(g_value_array_get_nth(a, 1)));
- satInfo.setAttribute(QGeoSatelliteInfo::Azimuth,
- g_value_get_int(g_value_array_get_nth(a, 2)));
- satInfo.setSignalStrength(g_value_get_int(g_value_array_get_nth(a, 3)));
-
- satInfos.append(satInfo);
- }
-
- source->requestUpdateFinished(timestamp, satellite_used, satellite_visible, usedPrns, satInfos);
-}
-
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, QGeoSatelliteInfo &si)
-{
- int a;
-
- argument.beginStructure();
- argument >> a;
- si.setSatelliteIdentifier(a);
- argument >> a;
- si.setAttribute(QGeoSatelliteInfo::Elevation, a);
- argument >> a;
- si.setAttribute(QGeoSatelliteInfo::Azimuth, a);
- argument >> a;
- si.setSignalStrength(a);
- argument.endStructure();
- return argument;
-}
-
-const QDBusArgument &operator>>(const QDBusArgument &argument, QList<QGeoSatelliteInfo> &sis)
-{
- sis.clear();
-
- argument.beginArray();
- while (!argument.atEnd()) {
- QGeoSatelliteInfo si;
- argument >> si;
- sis.append(si);
- }
- argument.endArray();
+#define MINIMUM_UPDATE_INTERVAL 1000
- return argument;
-}
+QT_BEGIN_NAMESPACE
QGeoSatelliteInfoSourceGeoclueMaster::QGeoSatelliteInfoSourceGeoclueMaster(QObject *parent)
-: QGeoSatelliteInfoSource(parent), QGeoclueMaster(this), m_sat(0), m_error(NoError),
- m_satellitesChangedConnected(false), m_running(false)
+: QGeoSatelliteInfoSource(parent), m_master(new QGeoclueMaster(this)), m_provider(0), m_sat(0),
+ m_error(NoError), m_satellitesChangedConnected(false), m_running(false)
{
+ connect(m_master, SIGNAL(positionProviderChanged(QString,QString,QString,QString)),
+ this, SLOT(positionProviderChanged(QString,QString,QString,QString)));
+
m_requestTimer.setSingleShot(true);
connect(&m_requestTimer, SIGNAL(timeout()), this, SLOT(requestUpdateTimeout()));
}
@@ -163,6 +66,14 @@ int QGeoSatelliteInfoSourceGeoclueMaster::minimumUpdateInterval() const
return MINIMUM_UPDATE_INTERVAL;
}
+void QGeoSatelliteInfoSourceGeoclueMaster::setUpdateInterval(int msec)
+{
+ if (msec < 0 || (msec > 0 && msec < MINIMUM_UPDATE_INTERVAL))
+ msec = MINIMUM_UPDATE_INTERVAL;
+
+ QGeoSatelliteInfoSource::setUpdateInterval(msec);
+}
+
QGeoSatelliteInfoSource::Error QGeoSatelliteInfoSourceGeoclueMaster::error() const
{
return m_error;
@@ -176,14 +87,10 @@ void QGeoSatelliteInfoSourceGeoclueMaster::startUpdates()
m_running = true;
// Start Geoclue provider.
- if (!hasMasterClient())
+ if (!m_master->hasMasterClient())
configureSatelliteSource();
- // m_sat is likely to be invalid until Geoclue master selects a position provider.
- if (!m_sat)
- return;
-
- g_signal_connect(G_OBJECT(m_sat), "satellite-changed", G_CALLBACK(satellite_changed), this);
+ m_requestTimer.start(updateInterval());
}
void QGeoSatelliteInfoSourceGeoclueMaster::stopUpdates()
@@ -191,15 +98,17 @@ void QGeoSatelliteInfoSourceGeoclueMaster::stopUpdates()
if (!m_running)
return;
- if (m_sat)
- g_signal_handlers_disconnect_by_func(G_OBJECT(m_sat), gpointer(satellite_changed), this);
+ if (m_sat) {
+ disconnect(m_sat, SIGNAL(SatelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)),
+ this, SLOT(satelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)));
+ }
m_running = false;
// Only stop positioning if single update not requested.
if (!m_requestTimer.isActive()) {
cleanupSatelliteSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
}
}
@@ -213,19 +122,24 @@ void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdate(int timeout)
if (m_requestTimer.isActive())
return;
- if (!hasMasterClient())
+ if (!m_master->hasMasterClient())
configureSatelliteSource();
m_requestTimer.start(qMax(timeout, minimumUpdateInterval()));
- if (m_sat)
- geoclue_satellite_get_satellite_async(m_sat, satellite_callback, this);
+ if (m_sat) {
+ QDBusPendingReply<qint32, qint32, qint32, QList<qint32>, QList<QGeoSatelliteInfo> > reply =
+ m_sat->GetSatellite();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(getSatelliteFinished(QDBusPendingCallWatcher*)));
+ }
}
-void QGeoSatelliteInfoSourceGeoclueMaster::satelliteChanged(int timestamp, int satellitesUsed,
- int satellitesVisible,
- const QList<int> &usedPrn,
- const QList<QGeoSatelliteInfo> &satInfos)
+void QGeoSatelliteInfoSourceGeoclueMaster::updateSatelliteInfo(int timestamp, int satellitesUsed,
+ int satellitesVisible,
+ const QList<int> &usedPrn,
+ const QList<QGeoSatelliteInfo> &satInfos)
{
Q_UNUSED(timestamp)
@@ -252,36 +166,57 @@ void QGeoSatelliteInfoSourceGeoclueMaster::satelliteChanged(int timestamp, int s
m_inUse = inUse;
emit satellitesInUseUpdated(m_inUse);
-}
-void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdateFinished(int timestamp, int satellitesUsed,
- int satellitesVisible,
- const QList<int> &usedPrn,
- const QList<QGeoSatelliteInfo> &satInfos)
-{
- m_requestTimer.stop();
- satelliteChanged(timestamp, satellitesUsed, satellitesVisible, usedPrn, satInfos);
+ m_requestTimer.start(updateInterval());
}
void QGeoSatelliteInfoSourceGeoclueMaster::requestUpdateTimeout()
{
// If we end up here, there has not been a valid satellite info update.
- emit requestTimeout();
+ if (m_running) {
+ m_inView.clear();
+ m_inUse.clear();
+ emit satellitesInViewUpdated(m_inView);
+ emit satellitesInUseUpdated(m_inUse);
+ } else {
+ emit requestTimeout();
- // Only stop satellite info if regular updates not active.
- if (!m_running) {
+ // Only stop satellite info if regular updates not active.
cleanupSatelliteSource();
- releaseMasterClient();
+ m_master->releaseMasterClient();
}
}
-void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QByteArray &service, const QByteArray &path)
+void QGeoSatelliteInfoSourceGeoclueMaster::getSatelliteFinished(QDBusPendingCallWatcher *watcher)
{
- if (m_sat)
- cleanupSatelliteSource();
+ QDBusPendingReply<qint32, qint32, qint32, QList<qint32>, QList<QGeoSatelliteInfo> > reply = *watcher;
+ watcher->deleteLater();
+
+ if (reply.isError())
+ return;
+
+ m_requestTimer.stop();
+ updateSatelliteInfo(reply.argumentAt<0>(), reply.argumentAt<1>(), reply.argumentAt<2>(),
+ reply.argumentAt<3>(), reply.argumentAt<4>());
+}
+
+void QGeoSatelliteInfoSourceGeoclueMaster::satelliteChanged(int timestamp, int satellitesUsed, int satellitesVisible, const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos)
+{
+ updateSatelliteInfo(timestamp, satellitesUsed, satellitesVisible, usedPrn, satInfos);
+}
- QByteArray providerService;
- QByteArray providerPath;
+void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QString &name,
+ const QString &description,
+ const QString &service,
+ const QString &path)
+{
+ Q_UNUSED(name)
+ Q_UNUSED(description)
+
+ cleanupSatelliteSource();
+
+ QString providerService;
+ QString providerPath;
if (service.isEmpty() || path.isEmpty()) {
// No valid position provider has been selected. This probably means that the GPS provider
@@ -290,7 +225,7 @@ void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QByteAr
QDBusConnection conn = QDBusConnection::sessionBus();
conn.connect(QString(), QString(), QStringLiteral("org.freedesktop.Geoclue.Satellite"),
QStringLiteral("SatelliteChanged"), this,
- SLOT(satellitesChanged(QDBusMessage)));
+ SLOT(satelliteChanged(QDBusMessage)));
m_satellitesChangedConnected = true;
return;
}
@@ -300,7 +235,7 @@ void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QByteAr
conn.disconnect(QString(), QString(),
QStringLiteral("org.freedesktop.Geoclue.Satellite"),
QStringLiteral("SatelliteChanged"), this,
- SLOT(satellitesChanged(QDBusMessage)));
+ SLOT(satelliteChanged(QDBusMessage)));
m_satellitesChangedConnected = false;
}
@@ -314,17 +249,18 @@ void QGeoSatelliteInfoSourceGeoclueMaster::positionProviderChanged(const QByteAr
return;
}
- m_sat = geoclue_satellite_new(providerService.constData(), providerPath.constData());
- if (!m_sat) {
- m_error = AccessError;
- emit QGeoSatelliteInfoSource::error(m_error);
- return;
- }
+ m_provider = new OrgFreedesktopGeoclueInterface(providerService, providerPath, QDBusConnection::sessionBus());
+ m_provider->AddReference();
- g_signal_connect(G_OBJECT(m_sat), "satellite-changed", G_CALLBACK(satellite_changed), this);
+ m_sat = new OrgFreedesktopGeoclueSatelliteInterface(providerService, providerPath, QDBusConnection::sessionBus());
+
+ if (m_running) {
+ connect(m_sat, SIGNAL(SatelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)),
+ this, SLOT(satelliteChanged(qint32,qint32,qint32,QList<qint32>,QList<QGeoSatelliteInfo>)));
+ }
}
-void QGeoSatelliteInfoSourceGeoclueMaster::satellitesChanged(const QDBusMessage &message)
+void QGeoSatelliteInfoSourceGeoclueMaster::satelliteChanged(const QDBusMessage &message)
{
QVariantList arguments = message.arguments();
if (arguments.length() != 5)
@@ -347,17 +283,22 @@ void QGeoSatelliteInfoSourceGeoclueMaster::satellitesChanged(const QDBusMessage
satelliteChanged(timestamp, usedSatellites, visibleSatellites, usedPrn, satelliteInfos);
}
-bool QGeoSatelliteInfoSourceGeoclueMaster::configureSatelliteSource()
+void QGeoSatelliteInfoSourceGeoclueMaster::configureSatelliteSource()
{
- return createMasterClient(GEOCLUE_ACCURACY_LEVEL_DETAILED, GEOCLUE_RESOURCE_GPS);
+ if (!m_master->createMasterClient(Accuracy::Detailed, QGeoclueMaster::ResourceGps)) {
+ m_error = UnknownSourceError;
+ emit QGeoSatelliteInfoSource::error(m_error);
+ }
}
void QGeoSatelliteInfoSourceGeoclueMaster::cleanupSatelliteSource()
{
- if (m_sat) {
- g_object_unref(m_sat);
- m_sat = 0;
- }
+ if (m_provider)
+ m_provider->RemoveReference();
+ delete m_provider;
+ m_provider = 0;
+ delete m_sat;
+ m_sat = 0;
}
QT_END_NAMESPACE
diff --git a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h
index 3269a423..e840e8a3 100644
--- a/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h
+++ b/src/plugins/position/geoclue/qgeosatelliteinfosource_geocluemaster.h
@@ -36,17 +36,18 @@
#include "qgeocluemaster.h"
-#include <geoclue/geoclue-satellite.h>
-
-#include <QtCore/qcompilerdetection.h>
#include <QtCore/QTimer>
#include <QtPositioning/QGeoSatelliteInfoSource>
+class OrgFreedesktopGeoclueInterface;
+class OrgFreedesktopGeoclueSatelliteInterface;
+
QT_BEGIN_NAMESPACE
class QDBusMessage;
+class QDBusPendingCallWatcher;
-class QGeoSatelliteInfoSourceGeoclueMaster : public QGeoSatelliteInfoSource, public QGeoclueMaster
+class QGeoSatelliteInfoSourceGeoclueMaster : public QGeoSatelliteInfoSource
{
Q_OBJECT
@@ -55,28 +56,36 @@ public:
~QGeoSatelliteInfoSourceGeoclueMaster();
int minimumUpdateInterval() const Q_DECL_OVERRIDE;
+ void setUpdateInterval(int msec) Q_DECL_OVERRIDE;
+
Error error() const Q_DECL_OVERRIDE;
void startUpdates() Q_DECL_OVERRIDE;
void stopUpdates() Q_DECL_OVERRIDE;
void requestUpdate(int timeout = 0) Q_DECL_OVERRIDE;
- void satelliteChanged(int timestamp, int satellitesUsed, int satellitesVisible,
- const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos);
-
- void requestUpdateFinished(int timestamp, int satellitesUsed, int satellitesVisible,
- const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos);
-
private slots:
+ void positionProviderChanged(const QString &name, const QString &description,
+ const QString &service, const QString &path);
void requestUpdateTimeout();
- void positionProviderChanged(const QByteArray &service, const QByteArray &path);
- void satellitesChanged(const QDBusMessage &message);
+
+ void getSatelliteFinished(QDBusPendingCallWatcher *watcher);
+ void satelliteChanged(int timestamp, int satellitesUsed, int satellitesVisible,
+ const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos);
+ void satelliteChanged(const QDBusMessage &message);
private:
- bool configureSatelliteSource();
+ void configureSatelliteSource();
void cleanupSatelliteSource();
- GeoclueSatellite *m_sat;
+ void updateSatelliteInfo(int timestamp, int satellitesUsed, int satellitesVisible,
+ const QList<int> &usedPrn, const QList<QGeoSatelliteInfo> &satInfos);
+
+ QGeoclueMaster *m_master;
+
+ OrgFreedesktopGeoclueInterface *m_provider;
+ OrgFreedesktopGeoclueSatelliteInterface *m_sat;
+
QTimer m_requestTimer;
QList<QGeoSatelliteInfo> m_inView;
QList<QGeoSatelliteInfo> m_inUse;
diff --git a/src/plugins/position/gypsy/plugin.json b/src/plugins/position/gypsy/plugin.json
index b3ecc0f7..9cef03f8 100644
--- a/src/plugins/position/gypsy/plugin.json
+++ b/src/plugins/position/gypsy/plugin.json
@@ -4,5 +4,6 @@
"Position": false,
"Satellite": true,
"Monitor" : false,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": false
}
diff --git a/src/plugins/position/position.pro b/src/plugins/position/position.pro
index 636bcc54..f9492a79 100644
--- a/src/plugins/position/position.pro
+++ b/src/plugins/position/position.pro
@@ -1,12 +1,12 @@
TEMPLATE = subdirs
-config_geoclue:SUBDIRS += geoclue
+qtHaveModule(dbus):SUBDIRS += geoclue
config_gypsy:SUBDIRS += gypsy
qtHaveModule(simulator):SUBDIRS += simulator
-blackberry:SUBDIRS += blackberry
-ios:SUBDIRS += corelocation
+osx|ios:SUBDIRS += corelocation
android:!android-no-sdk:SUBDIRS += android
winrt:SUBDIRS += winrt
+win32:qtHaveModule(serialport):SUBDIRS += serialnmea
SUBDIRS += \
positionpoll
diff --git a/src/plugins/position/positionpoll/plugin.json b/src/plugins/position/positionpoll/plugin.json
index a5b2f602..df1f47de 100644
--- a/src/plugins/position/positionpoll/plugin.json
+++ b/src/plugins/position/positionpoll/plugin.json
@@ -4,5 +4,6 @@
"Position": false,
"Satellite": false,
"Monitor": true,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": true
}
diff --git a/src/plugins/position/serialnmea/plugin.json b/src/plugins/position/serialnmea/plugin.json
new file mode 100644
index 00000000..826836c3
--- /dev/null
+++ b/src/plugins/position/serialnmea/plugin.json
@@ -0,0 +1,9 @@
+{
+ "Keys": ["serialnmea"],
+ "Provider": "serialnmea",
+ "Position": true,
+ "Satellite": false,
+ "Monitor" : false,
+ "Priority": 1000,
+ "Testable": false
+}
diff --git a/src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.cpp b/src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.cpp
new file mode 100644
index 00000000..2b6b3ce6
--- /dev/null
+++ b/src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtPositioning module 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$
+**
+****************************************************************************/
+
+#include "qgeopositioninfosourcefactory_serialnmea.h"
+#include <QtPositioning/qnmeapositioninfosource.h>
+#include <QtSerialPort/qserialport.h>
+#include <QtSerialPort/qserialportinfo.h>
+#include <QtCore/qloggingcategory.h>
+
+Q_LOGGING_CATEGORY(lcSerial, "qt.positioning.serialnmea")
+
+class NmeaSource : public QNmeaPositionInfoSource
+{
+public:
+ NmeaSource(QObject *parent);
+ bool isValid() const { return !m_port.isNull(); }
+
+private:
+ QScopedPointer<QSerialPort> m_port;
+};
+
+NmeaSource::NmeaSource(QObject *parent)
+ : QNmeaPositionInfoSource(RealTimeMode, parent),
+ m_port(new QSerialPort)
+{
+ QByteArray requestedPort = qgetenv("QT_NMEA_SERIAL_PORT");
+ if (requestedPort.isEmpty()) {
+ const QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
+ qCDebug(lcSerial) << "Found" << ports.count() << "serial ports";
+ if (ports.isEmpty()) {
+ qWarning("serialnmea: No serial ports found");
+ m_port.reset();
+ return;
+ }
+
+ // Try to find a well-known device.
+ QString portName;
+ for (int i = 0; i < ports.count(); ++i) {
+ const QString candidatePortName = ports[i].portName();
+ bool acceptThis = false;
+
+ // GlobalSat (BU-353S4 and probably others)
+ acceptThis |= ports[i].hasVendorIdentifier() && ports[i].vendorIdentifier() == 0x67b;
+
+ if (acceptThis) {
+ portName = candidatePortName;
+ break;
+ }
+ }
+
+ if (portName.isEmpty()) {
+ qWarning("serialnmea: No known GPS device found. Specify the COM port via QT_NMEA_SERIAL_PORT.");
+ m_port.reset();
+ return;
+ }
+
+ m_port->setPortName(portName);
+ } else {
+ m_port->setPortName(QString::fromUtf8(requestedPort));
+ }
+
+ m_port->setBaudRate(4800);
+
+ qCDebug(lcSerial) << "Opening serial port" << m_port->portName();
+
+ if (!m_port->open(QIODevice::ReadOnly)) {
+ qWarning("serialnmea: Failed to open %s", qPrintable(m_port->portName()));
+ m_port.reset();
+ return;
+ }
+
+ setDevice(m_port.data());
+
+ qCDebug(lcSerial) << "Opened successfully";
+}
+
+QGeoPositionInfoSource *QGeoPositionInfoSourceFactorySerialNmea::positionInfoSource(QObject *parent)
+{
+ QScopedPointer<NmeaSource> src(new NmeaSource(parent));
+ return src->isValid() ? src.take() : Q_NULLPTR;
+}
+
+QGeoSatelliteInfoSource *QGeoPositionInfoSourceFactorySerialNmea::satelliteInfoSource(QObject *parent)
+{
+ Q_UNUSED(parent);
+ return Q_NULLPTR;
+}
+
+QGeoAreaMonitorSource *QGeoPositionInfoSourceFactorySerialNmea::areaMonitor(QObject *parent)
+{
+ Q_UNUSED(parent);
+ return Q_NULLPTR;
+}
diff --git a/src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.h b/src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.h
index 30153a70..b28d9834 100644
--- a/src/plugins/position/blackberry/qgeopositioninfosourcefactory_bb.h
+++ b/src/plugins/position/serialnmea/qgeopositioninfosourcefactory_serialnmea.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 - 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtPositioning module of the Qt Toolkit.
@@ -31,16 +31,13 @@
**
****************************************************************************/
-#ifndef QGEOPOSITIONINFOSOURCEFACTORY_BB_H
-#define QGEOPOSITIONINFOSOURCEFACTORY_BB_H
-
-#include <bb/Global>
-
-#include <QGeoPositionInfoSourceFactory>
+#ifndef QGEOPOSITIONINFOSOURCEFACTORY_SERIALNMEA_H
+#define QGEOPOSITIONINFOSOURCEFACTORY_SERIALNMEA_H
#include <QObject>
+#include <qgeopositioninfosourcefactory.h>
-class QGeoPositionInfoSourceFactoryBb : public QObject, public QGeoPositionInfoSourceFactory
+class QGeoPositionInfoSourceFactorySerialNmea : public QObject, public QGeoPositionInfoSourceFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.qt.position.sourcefactory/5.0"
@@ -53,4 +50,4 @@ public:
QGeoAreaMonitorSource *areaMonitor(QObject *parent);
};
-#endif // include guard
+#endif
diff --git a/src/plugins/position/serialnmea/serialnmea.pro b/src/plugins/position/serialnmea/serialnmea.pro
new file mode 100644
index 00000000..81570837
--- /dev/null
+++ b/src/plugins/position/serialnmea/serialnmea.pro
@@ -0,0 +1,15 @@
+TARGET = qtposition_serialnmea
+QT = core positioning serialport
+
+PLUGIN_TYPE = position
+PLUGIN_CLASS_NAME = QGeoPositionInfoSourceFactorySerialNmea
+load(qt_plugin)
+
+HEADERS += \
+ qgeopositioninfosourcefactory_serialnmea.h
+
+SOURCES += \
+ qgeopositioninfosourcefactory_serialnmea.cpp
+
+OTHER_FILES += \
+ plugin.json
diff --git a/src/plugins/position/simulator/plugin.json b/src/plugins/position/simulator/plugin.json
index 8aa5e79f..0935f4dc 100644
--- a/src/plugins/position/simulator/plugin.json
+++ b/src/plugins/position/simulator/plugin.json
@@ -4,5 +4,6 @@
"Position": true,
"Satellite": true,
"Monitor" : false,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": true
}
diff --git a/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h b/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h
index 323956aa..0f5cce6e 100644
--- a/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h
+++ b/src/plugins/position/simulator/qgeopositioninfosource_simulator_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOPOSITIONINFOSOURCESIMULATOR_H
#define QGEOPOSITIONINFOSOURCESIMULATOR_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qgeopositioninfosource.h"
#include "qgeopositioninfo.h"
#include "qlocationdata_simulator_p.h"
diff --git a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h
index 5a687368..745d76b3 100644
--- a/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h
+++ b/src/plugins/position/simulator/qgeosatelliteinfosource_simulator_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOSATELLITEINFOSOURCE_SIMULATOR_H
#define QGEOSATELLITEINFOSOURCE_SIMULATOR_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QTimer>
#include "qgeosatelliteinfosource.h"
#include "qgeosatelliteinfo.h"
diff --git a/src/plugins/position/simulator/qlocationconnection_simulator_p.h b/src/plugins/position/simulator/qlocationconnection_simulator_p.h
index 17635dfc..21b1fdef 100644
--- a/src/plugins/position/simulator/qlocationconnection_simulator_p.h
+++ b/src/plugins/position/simulator/qlocationconnection_simulator_p.h
@@ -34,6 +34,17 @@
#ifndef QLOCATIONCONNECTION_H
#define QLOCATIONCONNECTION_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qlocationdata_simulator_p.h"
#include <QtCore/QObject>
diff --git a/src/plugins/position/winrt/plugin.json b/src/plugins/position/winrt/plugin.json
index 5bb21702..0696cb0a 100644
--- a/src/plugins/position/winrt/plugin.json
+++ b/src/plugins/position/winrt/plugin.json
@@ -4,5 +4,6 @@
"Position": true,
"Satellite": false,
"Monitor" : false,
- "Priority": 1000
+ "Priority": 1000,
+ "Testable": false
}
diff --git a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h
index a7d3cae1..45c22847 100644
--- a/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h
+++ b/src/plugins/position/winrt/qgeopositioninfosource_winrt_p.h
@@ -37,6 +37,17 @@
#ifndef QGEOPOSITIONINFOSOURCEWINRT_H
#define QGEOPOSITIONINFOSOURCEWINRT_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qgeopositioninfosource.h"
#include "qgeopositioninfo.h"
diff --git a/src/positioning/doc/qtpositioning.qdocconf b/src/positioning/doc/qtpositioning.qdocconf
index 608b30a1..1645c092 100644
--- a/src/positioning/doc/qtpositioning.qdocconf
+++ b/src/positioning/doc/qtpositioning.qdocconf
@@ -40,7 +40,7 @@ headerdirs += .. \
sourcedirs += .. \
../../imports/positioning
-examplesinstallpath = positioning
+examplesinstallpath = qtlocation/positioning
exampledirs += ../../../examples/positioning \
snippets/
diff --git a/src/positioning/doc/src/qtpositioning.qdoc b/src/positioning/doc/src/qtpositioning.qdoc
index c2d6912d..1ce33085 100644
--- a/src/positioning/doc/src/qtpositioning.qdoc
+++ b/src/positioning/doc/src/qtpositioning.qdoc
@@ -61,10 +61,12 @@
The Qt Positioning API provides positioning information via QML and C++ interfaces.
-Currently the API is supported on \l{Qt for Android}{Android},
-\l{Qt for iOS}{iOS},
-\l{Qt for Linux/X11}{Linux} (using \l{http://www.freedesktop.org/wiki/Software/GeoClue}{GeoClue})
-and \l {Qt for WinRT} {WinRT}.
+Currently the API is supported on \l {Qt for Android}{Android}, \l {Qt for iOS}{iOS},
+\l {Qt for OS X}{OS X},
+\l {Qt for Linux/X11}{Linux} (using
+\l {http://www.freedesktop.org/wiki/Software/GeoClue}{GeoClue version 0.12.99}),
+\l {Qt for Windows}{Windows} (with GPS receivers exposed as a serial port providing NMEA sentences),
+and \l {Qt for WinRT}{WinRT} (using Windows.Devices.Geolocation).
\section1 Overview
diff --git a/src/positioning/qdeclarativegeoaddress_p.h b/src/positioning/qdeclarativegeoaddress_p.h
index 7f51d555..c8210878 100644
--- a/src/positioning/qdeclarativegeoaddress_p.h
+++ b/src/positioning/qdeclarativegeoaddress_p.h
@@ -34,6 +34,17 @@
#ifndef QDECLARATIVEGEOADDRESS_P_H
#define QDECLARATIVEGEOADDRESS_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtPositioning/QGeoAddress>
diff --git a/src/positioning/qdeclarativegeolocation_p.h b/src/positioning/qdeclarativegeolocation_p.h
index 832dac61..446dd1f0 100644
--- a/src/positioning/qdeclarativegeolocation_p.h
+++ b/src/positioning/qdeclarativegeolocation_p.h
@@ -34,6 +34,17 @@
#ifndef QDECLARATIVEGEOLOCATION_P_H
#define QDECLARATIVEGEOLOCATION_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QObject>
#include <QtPositioning/QGeoLocation>
#include <QtPositioning/QGeoRectangle>
diff --git a/src/positioning/qgeocoordinate.cpp b/src/positioning/qgeocoordinate.cpp
index d061562b..36434eba 100644
--- a/src/positioning/qgeocoordinate.cpp
+++ b/src/positioning/qgeocoordinate.cpp
@@ -60,11 +60,11 @@ inline static double qgeocoordinate_radToDeg(double rad)
}
-QGeoCoordinatePrivate::QGeoCoordinatePrivate() {
- lat = qQNaN();
- lng = qQNaN();
- alt = qQNaN();
-}
+QGeoCoordinatePrivate::QGeoCoordinatePrivate():
+ lat(qQNaN()),
+ lng(qQNaN()),
+ alt(qQNaN())
+{}
QGeoCoordinatePrivate::QGeoCoordinatePrivate(const QGeoCoordinatePrivate &other)
: QSharedData(other),
@@ -77,6 +77,21 @@ QGeoCoordinatePrivate::~QGeoCoordinatePrivate()
{}
+QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate():
+ QGeoCoordinatePrivate(),
+ m_mercatorX(qQNaN()),
+ m_mercatorY(qQNaN())
+{}
+
+QGeoMercatorCoordinatePrivate::QGeoMercatorCoordinatePrivate(const QGeoMercatorCoordinatePrivate &other)
+ : QGeoCoordinatePrivate(other),
+ m_mercatorX(other.m_mercatorX),
+ m_mercatorY(other.m_mercatorY)
+{}
+
+QGeoMercatorCoordinatePrivate::~QGeoMercatorCoordinatePrivate()
+{}
+
/*!
\class QGeoCoordinate
\inmodule QtPositioning
@@ -666,6 +681,11 @@ QString QGeoCoordinate::toString(CoordinateFormat format) const
return QString::fromLatin1("%1, %2, %3m").arg(latStr, longStr, QString::number(d->alt));
}
+QGeoCoordinate::QGeoCoordinate(QGeoCoordinatePrivate &dd):
+ d(&dd)
+{
+}
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QGeoCoordinate &coord)
{
diff --git a/src/positioning/qgeocoordinate.h b/src/positioning/qgeocoordinate.h
index a1a636db..3c08bc04 100644
--- a/src/positioning/qgeocoordinate.h
+++ b/src/positioning/qgeocoordinate.h
@@ -104,9 +104,10 @@ public:
Q_INVOKABLE QString toString(CoordinateFormat format = DegreesMinutesSecondsWithHemisphere) const;
private:
+ QGeoCoordinate(QGeoCoordinatePrivate &dd);
QSharedDataPointer<QGeoCoordinatePrivate> d;
-
friend class QGeoCoordinatePrivate;
+ friend class QQuickGeoCoordinateAnimation;
};
Q_DECLARE_TYPEINFO(QGeoCoordinate, Q_MOVABLE_TYPE);
diff --git a/src/positioning/qgeocoordinate_p.h b/src/positioning/qgeocoordinate_p.h
index b9304b0c..c052d465 100644
--- a/src/positioning/qgeocoordinate_p.h
+++ b/src/positioning/qgeocoordinate_p.h
@@ -64,8 +64,23 @@ public:
static void atDistanceAndAzimuth(const QGeoCoordinate &coord,
qreal distance, qreal azimuth,
double *lon, double *lat);
+ static const QGeoCoordinatePrivate *get(const QGeoCoordinate *c) {
+ return c->d.constData();
+ }
};
+class Q_POSITIONING_EXPORT QGeoMercatorCoordinatePrivate : public QGeoCoordinatePrivate
+{
+public:
+ QGeoMercatorCoordinatePrivate();
+ QGeoMercatorCoordinatePrivate(const QGeoMercatorCoordinatePrivate &other);
+ ~QGeoMercatorCoordinatePrivate();
+
+ double m_mercatorX;
+ double m_mercatorY;
+};
+
+
QT_END_NAMESPACE
#endif // QGEOCOORDINATE_P_H
diff --git a/src/positioning/qgeolocation_p.h b/src/positioning/qgeolocation_p.h
index cafcafea..62db53b3 100644
--- a/src/positioning/qgeolocation_p.h
+++ b/src/positioning/qgeolocation_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOLOCATION_P_H
#define QGEOLOCATION_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/QSharedData>
#include <QtPositioning/QGeoAddress>
#include <QtPositioning/QGeoCoordinate>
diff --git a/src/positioning/qgeopositioninfosource.cpp b/src/positioning/qgeopositioninfosource.cpp
index 1cdd4116..0cec8eaa 100644
--- a/src/positioning/qgeopositioninfosource.cpp
+++ b/src/positioning/qgeopositioninfosource.cpp
@@ -158,6 +158,12 @@ void QGeoPositionInfoSourcePrivate::loadPluginMetadata(QHash<QString, QJsonObjec
QList<QJsonObject> meta = l->metaData();
for (int i = 0; i < meta.size(); ++i) {
QJsonObject obj = meta.at(i).value(QStringLiteral("MetaData")).toObject();
+ const QString testableKey = QStringLiteral("Testable");
+ if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
+ static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
+ if (inTest)
+ continue;
+ }
obj.insert(QStringLiteral("index"), i);
plugins.insertMulti(obj.value(QStringLiteral("Provider")).toString(), obj);
}
diff --git a/src/positioning/qgeopositioninfosource_p.h b/src/positioning/qgeopositioninfosource_p.h
index aedf3319..b11d6451 100644
--- a/src/positioning/qgeopositioninfosource_p.h
+++ b/src/positioning/qgeopositioninfosource_p.h
@@ -34,6 +34,17 @@
#ifndef QGEOPOSITIONINFOSOURCE_P_H
#define QGEOPOSITIONINFOSOURCE_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include "qgeopositioninfosource.h"
#include "qgeopositioninfosourcefactory.h"
#include <QJsonObject>
diff --git a/src/positioning/qgeoprojection.cpp b/src/positioning/qgeoprojection.cpp
index a2e087b0..ff708567 100644
--- a/src/positioning/qgeoprojection.cpp
+++ b/src/positioning/qgeoprojection.cpp
@@ -128,19 +128,4 @@ QGeoCoordinate QGeoProjection::coordinateInterpolation(const QGeoCoordinate &fro
return result;
}
-QVariant geoCoordinateInterpolator(const QGeoCoordinate &from, const QGeoCoordinate &to, qreal progress)
-{
- if (from == to) {
- if (progress < 0.5) {
- return QVariant::fromValue(from);
- } else {
- return QVariant::fromValue(to);
- }
- }
-
- QGeoCoordinate result = QGeoProjection::coordinateInterpolation(from, to, progress);
-
- return QVariant::fromValue(result);
-}
-
QT_END_NAMESPACE
diff --git a/src/positioning/qgeoprojection_p.h b/src/positioning/qgeoprojection_p.h
index f1b32525..fba8442a 100644
--- a/src/positioning/qgeoprojection_p.h
+++ b/src/positioning/qgeoprojection_p.h
@@ -57,10 +57,6 @@ QT_BEGIN_NAMESPACE
class QGeoCoordinate;
class QDoubleVector2D;
-Q_POSITIONING_EXPORT QVariant geoCoordinateInterpolator(const QGeoCoordinate &from,
- const QGeoCoordinate &to,
- qreal progress);
-
class Q_POSITIONING_EXPORT QGeoProjection
{
public:
diff --git a/src/positioning/qgeosatelliteinfosource.cpp b/src/positioning/qgeosatelliteinfosource.cpp
index 06d6771d..da6eb8a0 100644
--- a/src/positioning/qgeosatelliteinfosource.cpp
+++ b/src/positioning/qgeosatelliteinfosource.cpp
@@ -167,6 +167,12 @@ QGeoSatelliteInfoSource *QGeoSatelliteInfoSource::createDefaultSource(QObject *p
if (obj.value(QStringLiteral("Satellite")).isBool()
&& obj.value(QStringLiteral("Satellite")).toBool())
{
+ const QString testableKey = QStringLiteral("Testable");
+ if (obj.contains(testableKey) && !obj.value(testableKey).toBool()) {
+ static bool inTest = qEnvironmentVariableIsSet("QT_QTESTLIB_RUNNING");
+ if (inTest)
+ continue;
+ }
QGeoPositionInfoSourcePrivate d;
d.metaData = obj;
d.loadPlugin();
diff --git a/sync.profile b/sync.profile
index afc5e035..fa9885a4 100644
--- a/sync.profile
+++ b/sync.profile
@@ -16,4 +16,5 @@
"qtxmlpatterns" => "",
"qtdeclarative" => "",
"qtquickcontrols" => "",
+ "qtserialport" => "",
);
diff --git a/tests/applications/declarative_map/Dialog.qml b/tests/applications/declarative_map/Dialog.qml
deleted file mode 100644
index d7b9a1d8..00000000
--- a/tests/applications/declarative_map/Dialog.qml
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** 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
-import "common" as Common
-
-Item {
- id: dialog
- signal goButtonClicked
- signal cancelButtonClicked
-
- anchors.fill: parent
-
- property alias title: titleBar.text
- property alias dialogModel: dialogModel
- property alias length: dialogModel.count
- property int gap: 20
- property int listItemHeight: 54
-
- function setModel(objects)
- {
- for (var i=0; i< objects.length; i++){
- dialogModel.append({"label": objects[i][0], "inputText": objects[i][1]})
- }
- }
-
- Rectangle {
- id: fader
- anchors.fill: parent
- opacity: 0.7
- color: "darkgrey"
- MouseArea {
- id: mouseArea
- anchors.fill: parent
- }
- }
-
- Rectangle {
- id: dialogRectangle
-
- color: "lightsteelblue"
- opacity: 1
- width: parent.width - gap;
- height: listview.height + titleBar.height + buttonGo.height + gap*2
-
- anchors {
- top: parent.top
- topMargin: 50
- left: parent.left
- leftMargin: gap/2
- }
-
- border.width: 1
- border.color: "darkblue"
- radius: 5
-
- Common.TitleBar {
- id: titleBar;
- width: parent.width; height: 40;
- anchors.top: parent.top; anchors.left: parent.left;
- opacity: 0.9; text: dialog.title;
- onClicked: { dialog.cancelButtonClicked() }
- }
-
- ListModel {
- id: dialogModel
- }
-
- Component{
- id: listDelegate
- Column {
- id: column1
- height: listItemHeight
- Text { id: fieldTitle; text: label; height: 24;}
- Rectangle {
- id: inputRectangle
- width: dialogRectangle.width - gap; height: 30
- color: "whitesmoke"
- border.width: 1
- radius: 5
- TextInput {
- id: inputField
- text: inputText
- focus: true
- width: parent.width - anchors.leftMargin
-
- anchors {
- left: parent.left;
- verticalCenter: parent.verticalCenter;
- leftMargin: 5
- }
- onTextChanged:
- {
- dialogModel.set(index, {"inputText": text})
- }
- }
- MouseArea {
- anchors.fill: parent
- onClicked: inputField.forceActiveFocus();
- }
- }
- }
- }
-
- ListView {
- id: listview
- anchors {
- top: titleBar.bottom
- topMargin: gap
- left: parent.left
- leftMargin: gap/2
- }
- model: dialogModel
- delegate: listDelegate
- spacing: gap
- interactive: false
- Component.onCompleted: {
- height = (listItemHeight + gap)*length
- }
- }
-
- Common.Button {
- id: buttonGo
- text: "Go!"
- anchors.top: listview.bottom
- width: 80; height: 32
- anchors.horizontalCenter: parent.horizontalCenter
- onClicked: {
- dialog.goButtonClicked ()
- }
- }
- }
-}
-
diff --git a/tests/applications/declarative_map/TitleBar.qml b/tests/applications/declarative_map/TitleBar.qml
deleted file mode 100644
index 9a2cb185..00000000
--- a/tests/applications/declarative_map/TitleBar.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** 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 5.0
-
-Item {
- id: titleBar
- BorderImage { source: "titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
-
- Item {
- id: container
- width: (parent.width * 2) - 55 ; height: parent.height
-
- Image {
- id: quitButton
- anchors.left: parent.left//; anchors.leftMargin: 0
- anchors.verticalCenter: parent.verticalCenter
- source: "quit.png"
- MouseArea {
- anchors.fill: parent
- onClicked: Qt.quit()
- }
- }
-
- Text {
- id: categoryText
- anchors {
- left: quitButton.right; leftMargin: 10; rightMargin: 10
- verticalCenter: parent.verticalCenter
- }
- elide: Text.ElideLeft
- text: "Mapviewer example"
- font.bold: true; color: "White"; style: Text.Raised; styleColor: "Black"
- }
- }
- transitions: Transition {
- NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad }
- }
-}
diff --git a/tests/applications/declarative_map/blinky.gif b/tests/applications/declarative_map/blinky.gif
deleted file mode 100644
index f665b527..00000000
--- a/tests/applications/declarative_map/blinky.gif
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/common/Button.qml b/tests/applications/declarative_map/common/Button.qml
deleted file mode 100644
index 978e220f..00000000
--- a/tests/applications/declarative_map/common/Button.qml
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Item {
- id: container
-
- signal clicked
-
- property alias text: buttonText.text
- property alias color: buttonText.color
-
- function disable() {
- container.state = "Disabled";
- }
-
- function enable() {
- container.state = "";
- }
-
- BorderImage {
- id: buttonImage
- source: "../resources/button.sci"
- width: container.width; height: container.height
- }
-
- MouseArea {
- id: mouseRegion
- anchors.fill: buttonImage
- hoverEnabled: true
- onClicked: { container.clicked(); }
- }
- Text {
- id: buttonText
- color: "white"
- anchors.centerIn: buttonImage; font.bold: true
- style: Text.Raised; styleColor: "black"
- }
-
- states: [
- State {
- name: "Pressed"
- when: mouseRegion.pressed == true
- PropertyChanges { target: buttonImage; source: "../resources/button_pressed.png" }
- PropertyChanges { target: buttonText; style: Text.Sunken }
- },
- State {
- name: "Hovered"
- when: mouseRegion.containsMouse
- PropertyChanges{ target: buttonImage; source: "../resources/button_hovered.png" }
- },
- State {
- name: "Disabled"
- PropertyChanges{ target: buttonText; color: "grey" }
- PropertyChanges{ target: mouseRegion; enabled: false }
- }
- ]
-}
diff --git a/tests/applications/declarative_map/common/Menu.qml b/tests/applications/declarative_map/common/Menu.qml
deleted file mode 100644
index d61cb336..00000000
--- a/tests/applications/declarative_map/common/Menu.qml
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Item {
- id: menu
- property int gap: 0
- property int button: 0
- property alias orientation: menuView.orientation
- property alias count: menuModel.count
- property int itemHeight //to create menu just set menu item height and width, do not set menu's height and width explicitly
- property int itemWidth
-// height: (menuView.orientation == ListView.Horizontal)? itemHeight : itemHeight * count
- width: (menuView.orientation == ListView.Horizontal)? itemWidth * count : itemWidth
-
- signal clicked
-
- function setModel(objects)
- {
- for (var i=0; i< objects.length; i++){
- menuModel.append({"label": objects[i], "enabledItem" : true})
- }
- height = (menuView.orientation == ListView.Horizontal)? itemHeight : itemHeight * count
- }
-
- function disableItem(index){
- menuModel.set(index, {"enabledItem": false})
- }
-
- function enableItem(index){
- menuModel.set(index, {"enabledItem": true})
- }
-
- ListModel {
- id: menuModel
- }
-
- Component{
- id: menuItemDelegate
- Item {
- height: itemHeight
- width: itemWidth
-
- BorderImage {
- id: menuItemImage;
- source: "../resources/menuItem.sci";
- height: parent.height + 14;
- width: parent.width
- y: -7
- }
-
- Text {
- id: menuItemText
- text: label;
- elide: Text.ElideLeft
- font.bold: true;
- color: "white"
- style: Text.Raised;
- styleColor: "dimgrey"
- anchors.verticalCenter: parent.verticalCenter
- Component.onCompleted: {
- if (menuView.orientation == ListView.Horizontal){
- anchors.horizontalCenter = parent.horizontalCenter
- }
- else {
- anchors.left = parent.left
- anchors.leftMargin = 10
- }
- }
- }
- MouseArea {
- id: mouseRegion
- anchors.fill: parent
- hoverEnabled: true
- enabled: enabledItem
- onClicked: {
- button = index
- menu.clicked()
- }
- }
-
- states: [
- State {
- name: "Pressed"
- when: mouseRegion.pressed == true
- PropertyChanges { target: menuItemImage; source: "../resources/menuItem_pressed.png"}
- PropertyChanges { target: menuItemText; style: Text.Sunken }
- },
- State {
- name: "Hovered"
- when: mouseRegion.containsMouse == true
- PropertyChanges { target: menuItemImage; source: "../resources/menuItem_hovered.png"}
- },
- State {
- name: "Disabled"
- when: mouseRegion.enabled == false
- PropertyChanges { target: menuItemText; color: "grey"}
- }
- ]
- }
- }
-
- ListView {
- id: menuView
- anchors.fill: parent
- model: menuModel
- delegate: menuItemDelegate
- spacing: gap
- interactive: false
- }
-}
diff --git a/tests/applications/declarative_map/common/Slider.qml b/tests/applications/declarative_map/common/Slider.qml
deleted file mode 100644
index cd98daea..00000000
--- a/tests/applications/declarative_map/common/Slider.qml
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Item {
- id: slider;
- height: 40
- // value is read/write.
- property int value
- property real minimum: 0
- property real maximum: 1
- property int xMin: 2
- property int xMax: slider.width - handle.width-xMin
-
- Rectangle {
- anchors.fill: parent
- border.width: 0;
- radius: 8
- color: "dimgrey"
- opacity: 0.6
- }
-
- Rectangle {
- id: handle; smooth: true
- width: 30;
- y: xMin;
- x: xMin + (value - minimum) * slider.xMax / (maximum - minimum)
-
- height: slider.height-4; radius: 6
- gradient: normalGradient
-
- Gradient {
- id: normalGradient
- GradientStop { position: 0.0; color: "lightgrey" }
- GradientStop { position: 1.0; color: "gray" }
- }
-
- Gradient {
- id: pressedGradient
- GradientStop { position: 0.0; color: "lightgray" }
- GradientStop { position: 1.0; color: "black" }
- }
-
- Gradient {
- id: hoveredGradient
- GradientStop { position: 0.0; color: "lightgrey" }
- GradientStop { position: 1.0; color: "dimgrey" }
- }
-
- MouseArea {
- id: mouseRegion
- hoverEnabled: true
- anchors.fill: parent; drag.target: parent
- drag.axis: Drag.XAxis; drag.minimumX: slider.xMin; drag.maximumX: slider.xMax
- onPositionChanged: { value = (maximum - minimum) * (handle.x-slider.xMin) / (slider.xMax - slider.xMin) + minimum; }
- }
- }
-
- states: [
- State {
- name: "Pressed"
- when: mouseRegion.pressed
- PropertyChanges { target: handle; gradient: pressedGradient }
- },
- State {
- name: "Hovered"
- when: mouseRegion.containsMouse
- PropertyChanges { target: handle; gradient: hoveredGradient }
- }
- ]
-}
diff --git a/tests/applications/declarative_map/common/TitleBar.qml b/tests/applications/declarative_map/common/TitleBar.qml
deleted file mode 100644
index 553d1235..00000000
--- a/tests/applications/declarative_map/common/TitleBar.qml
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** 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
-
-Item {
- id: titleBar
-
- property alias text:titleText.text
- property alias hoverEnabled: mouseRegion.hoverEnabled
- signal clicked
-
- BorderImage { source: "../resources/titlebar.sci"; width: parent.width; height: parent.height + 14; y: -7 }
-
- Image {
- id: quitButton
- anchors.right: parent.right; anchors.rightMargin: 10
- anchors.verticalCenter: parent.verticalCenter
- source: "../resources/quit.png"
- MouseArea {
- id: mouseRegion
- hoverEnabled: true
- anchors.fill: parent
- onClicked: { titleBar.clicked(); }
- }
- }
-
- Text {
- id: titleText
- anchors {
- left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter
- }
- elide: Text.ElideLeft
- font.bold: true; color: "white"; style: Text.Raised; styleColor: "dimgrey"
- }
-
- states: [
- State {
- name: "Pressed"
- when: mouseRegion.pressed
- PropertyChanges { target: quitButton; source: "../resources/quit_pressed.png" }
- },
- State {
- name: "Hover"
- when: mouseRegion.containsMouse
- PropertyChanges { target: quitButton; source: "../resources/quit_hovered.png" }
- }
- ]
-}
diff --git a/tests/applications/declarative_map/map3d.pro b/tests/applications/declarative_map/map3d.pro
deleted file mode 100644
index 79d3e9a0..00000000
--- a/tests/applications/declarative_map/map3d.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET = qml_location_map3d
-TEMPLATE=app
-
-QT += network quick
-
-SOURCES += qmlmap3d.cpp
-
-RESOURCES += \
- map3d.qrc
-
-target.path = $$[QT_INSTALL_DEMOS]/qtlocation/declarative/mapviewer
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.qml *.png *.sci
-sources.path = $$[QT_INSTALL_DEMOS]/qtlocation/declarative/mapviewer
-
-INSTALLS += target sources
-
-OTHER_FILES += \
- map3d.qml
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/applications/declarative_map/map3d.qml b/tests/applications/declarative_map/map3d.qml
deleted file mode 100644
index 7a574ad2..00000000
--- a/tests/applications/declarative_map/map3d.qml
+++ /dev/null
@@ -1,1073 +0,0 @@
-/****************************************************************************
-**
-** 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
-import QtPositioning 5.2
-import QtLocation 5.3
-import QtLocation.test 5.0
-import "common" as Common
-
-//import Qt3D 1.0
-//import Qt.multimediakit 4.0
-
-Rectangle {
- objectName: "The page."
- color: 'yellow'
- width: 1140
- height: 1085
- id: page
-
- // From location.test plugin
- TestModel {
- id: testModel
- datatype: 'coordinate'
- datacount: 8
- delay: 0
- crazyMode: false // generate arbitrarily updates. interval is set below, and the number of items is varied between 0..datacount
- crazyLevel: 2000 // the update interval varies between 3...crazyLevel (ms)
- }
-
- Column {
- id: buttonColumn
- anchors.top: page.top
- anchors.left: map.right
- spacing: 2
-
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Crazy mode:\n" + testModel.crazyMode + "\nclick to\ntoggle."}
- MouseArea{ anchors.fill: parent;
- onClicked: testModel.crazyMode = !testModel.crazyMode
- onDoubleClicked: map.removeMapItem(mapItem1)
- }
- }
- AnimatedImage {
- MouseArea { anchors.fill: parent; onClicked: mapItem2.source = parent }
- width: 80
- height: 80
- playing: testModel.crazyMode
- source: "blinky.gif"
- }
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Click:\nadd item1\nDouble-click:\nrm item1"}
- MouseArea{ anchors.fill: parent;
- onClicked: {console.log('----------------adding item 1'); map.addMapItem(externalStaticMapItem1);}
- onDoubleClicked: {console.log('+++++++++++++++ removing item 1'); map.removeMapItem(externalStaticMapItem1);}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Add\nitem"}
- MouseArea{ anchors.fill: parent; onClicked: map.addMapItem(extMapCircle)}
- }
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Click:\nadd item2\nDouble-click:\nrm item2"}
- MouseArea{ anchors.fill: parent;
- onClicked: {console.log('adding item 2'); map.addMapItem(externalStaticMapItem2);}
- onDoubleClicked: {console.log('removing item 2'); map.removeMapItem(externalStaticMapItem2);}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nlat++"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.latitude += 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nlat--"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.latitude -= 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nlon++"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.longitude += 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nlon--"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.longitude -= 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nalt++"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.altitude += 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nalt--"}
- MouseArea{ anchors.fill: parent;
- onClicked: { mapCenterCoordinate.altitude -= 1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nbear++"}
- MouseArea{ anchors.fill: parent;
- onClicked: { map.bearing += 1.1}
- onDoubleClicked: { map.bearing += 20.1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\nbear--"}
- MouseArea{ anchors.fill: parent;
- onClicked: { map.bearing -= 1.1}
- onDoubleClicked: { map.bearing -= 20.1}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Click:\pinch"}
- MouseArea{ anchors.fill: parent;
- onClicked: {
- pinchGenerator.pinch(
- Qt.point(100,100), // point1From
- Qt.point(150,150), // point1To
- Qt.point(300,300), // point2From
- Qt.point(150,150), // point2To
- 20, // interval between touch events (swipe1), default 20ms
- 20, // interval between touch events (swipe2), defualt 20ms
- 10, // number of touchevents in point1from -> point1to, default 10
- 10); // number of touchevents in point2from -> point2to, default 10
- }
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Width++"}
- MouseArea{ anchors.fill: parent; onClicked: map.width += 10}
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Width--"}
- MouseArea{ anchors.fill: parent; onClicked: map.width -= 10}
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Height++"}
- MouseArea{ anchors.fill: parent; onClicked: map.height += 10}
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "Height--"}
- MouseArea{ anchors.fill: parent; onClicked: map.height -= 10}
- }
- Rectangle {color: "lightblue"; width: 80; height: 40;
- Text {text: "toScrPos"}
- MouseArea{ anchors.fill: parent;
- onClicked: console.log('coordinate: ' +
- beyondCoordinate.latitude +
- ' to screen pos: ' +
- map.toScreenPosition(beyondCoordinate).x +
- ' ' + map.toScreenPosition(beyondCoordinate).y) }
- }
- }
-
- Coordinate {
- id: beyondCoordinate
- latitude: 80
- longitude: 80
- altitude: 0
- }
-
- Coordinate {
- id: brisbaneCoordinate
- latitude: -27.5
- longitude: 140
- }
-
- Coordinate {
- id: brisbaneCoordinate2
- latitude: -30.5
- longitude: 140
- }
-
- Coordinate {id: londonCoordinate3; latitude: 51.6; longitude: -0.11}
-
- MapCircle {
- id: extMapCircle
- z: 5
- center: londonCoordinate3
- radius: 10000
- color: 'yellow'
-
- MapMouseArea {
- id: mouseAreaOfExtMapCircle
- anchors.fill: parent
- drag.target: parent
- onClicked: console.log('....[extCircle].... map mouse area of extCircle clicked')
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapCircle ext '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + extMapCircle.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + extMapCircle.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: extMapCircle.width + 30;
- text: ' c lat: ' + extMapCircle.center.latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: extMapCircle.width + 30;
- text: ' c lon: ' + extMapCircle.center.longitude}
- }
- }
-
-
- Map {
- id: map
- property bool disableFlickOnStarted: false
- x: 10
- y: 10
- MapMouseArea {
- id: mapMouseArea
- anchors.fill: parent
- onClicked: console.log('.....[Map]..... mouse area of maps clicked, coordinate lat: ' + mapMouseArea.mouseToCoordinate(mouse).latitude +
- 'coordinate lon: ' + mapMouseArea.mouseToCoordinate(mouse).longitude);
- //' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x +
- //' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
-
- MapCircle {
- id: mapCircle
- z: 5
- center: londonCoordinate
- radius: 10000
- color: 'red'
- border.color: 'darkcyan'
- border.width: 15
-
- MapMouseArea {
- id: mouseAreaOfMapCircle
- anchors.fill: parent
- drag.target: parent
- onClicked: console.log('....[Circle].... map mouse area of circle clicked')
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapCircle '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + mapCircle.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + mapCircle.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapCircle.width + 30;
- text: ' c lat: ' + mapCircle.center.latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapCircle.width + 30;
- text: ' c lon: ' + mapCircle.center.longitude}
- }
- }
-
- Coordinate { id: southEastLondonCoordinate; latitude: 51.2; longitude: 0.3 }
-
- MapPolyline {
- id: mapPolyline
- z: 15
- line.color: 'red'
- line.width: 10
- path: [
- Coordinate { id: pathCoord1; latitude: 50.7; longitude: 0.1},
- Coordinate { id: pathCoord2; latitude: 50.8; longitude: 0.4},
- Coordinate { id: pathCoord3; latitude: 50.9; longitude: 0.2}
- ]
- MapMouseArea {
- id: mouseAreaOfMapPolyline
- anchors.fill: parent
- drag.target: parent
- onClicked: console.log('....[Polyline].... map mouse area of polyline clicked')
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapPolyline '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + mapPolyline.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + mapPolyline.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapPolyline.width + 30;
- text: ' at(0) lat: ' + mapPolyline.path[0].latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapPolyline.width + 30;
- text: ' at(0) lon: ' + mapPolyline.path[0].longitude}
- }
- }
-
- MapPolygon {
- id: mapPolygon
- color: 'pink'
- border.color: 'darkmagenta'
- border.width: 10
- path: [
- Coordinate { id: pathCoord_1; latitude: 51; longitude: 0.2},
- Coordinate { id: pathCoord_2; latitude: 51.1; longitude: 0.6},
- Coordinate { id: pathCoord_3; latitude: 51.2; longitude: 0.4}
- ]
- MapMouseArea {
- id: mouseAreaOfMapPolygon
- anchors.fill: parent
- hoverEnabled: true
- drag.target: parent
- onClicked: console.log('....[Polygon].... map mouse area of polygon clicked')
- onEntered: parent.color = 'red'
- onExited: parent.color = 'pink'
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapPolygon '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + mapPolygon.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + mapPolygon.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapPolygon.width + 30;
- text: ' at(0) lat: ' + mapPolygon.path[0].latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapPolygon.width + 30;
- text: ' at(0) lon: ' + mapPolygon.path[0].longitude}
- }
- }
-
- MapRoute {
- id: mapRoute
- line.color: 'green'
- line.width: 7
- // don't do this at home - route is not user instantiable,
- // use polyline instead
- route: Route {
- path: [
- Coordinate { latitude: 51.6; longitude: 0.2},
- Coordinate { latitude: 51.7; longitude: 1.2},
- Coordinate { latitude: 51.7; longitude: 1.3},
- Coordinate { latitude: 51.8; longitude: 0.6},
- Coordinate { latitude: 51.7; longitude: 0.6}
- ]
- }
- MapMouseArea {
- id: mouseAreaOfMapRoute
- anchors.fill: parent
- drag.target: parent
- onClicked: console.log('....[Polygon].... map mouse area of polygon clicked')
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapRoute '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + mapRoute.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + mapRoute.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRoute.width + 30;
- text: ' at(0) lat: ' + mapRoute.route.path[0].latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRoute.width + 30;
- text: ' at(0) lon: ' + mapRoute.route.path[0].longitude}
- }
- }
-
- MapRectangle {
- id: mapRectangle
- z: 5
- topLeft: londonCoordinate
- bottomRight: southEastLondonCoordinate
- color: 'green'
- MapMouseArea {
- id: mouseAreaOfMapRectangle
- anchors.fill: parent
- drag.target: parent
- onClicked: console.log('....[Rectangle].... map mouse area of rectangle clicked')
- }
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapRectangle '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + mapRectangle.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + mapRectangle.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRectangle.width - 10;
- text: ' tl lat: ' + mapRectangle.topLeft.latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRectangle.width - 10;
- text: ' tl lon: ' + mapRectangle.topLeft.longitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRectangle.width - 10;
- text: ' br lat: ' + mapRectangle.bottomRight.latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: mapRectangle.width - 10;
- text: ' br lon: ' + mapRectangle.bottomRight.longitude}
- }
- }
-
- /*
- MapQuickItem {
- objectName: "blinky quick item 1"
- coordinate: Coordinate { latitude: -19; longitude : 146 }
- sourceItem: AnimatedImage {
- width: 80
- height: 80
- playing: true
- source: "blinky.gif"
- }
- }
- */
-
- Coordinate {id: londonCoordinate; latitude: 51.5; longitude: -0.11}
-
- /*
- MapQuickItem {
- objectName: "mousetestrectanglelower yellow"
- coordinate: londonCoordinate
- MapMouseArea {
- anchors.fill: parent
- onClicked: console.log('....... yellow map mouse clicked at x: ' + mouse.x + ' y: ' + mouse.y)
- }
- sourceItem: Rectangle {
- width: 160
- height: 160
- color: 'yellow'
- }
- }
- */
-
-
- MapQuickItem {
- objectName: "mousetestrectangleupper purple"
- id: purpleRectMapItem
- coordinate: londonCoordinate
-
- MapMouseArea {
- id: mapMouseAreaUpperPurple
- objectName: 'mapMouseAreaUpperPurple'
- anchors.fill: parent
- //z: 100
- drag.target: parent
- onClicked: {
- console.log('....[purple]..... purple map mouse clicked() area upper coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
- onPressed: {
- console.log('....[purple]..... map mouse pressed() area purple coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
- onReleased: {
- console.log('....[purple]..... map mouse released() area purple coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
- onDoubleClicked: {
- console.log('....[purple]..... map mouse doubleClicked() area purple coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
- //onPositionChanged: {
- // console.log('....[purple]..... map mouse positionChanged() area purple coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- //}
- onPressAndHold: {
- console.log('....[purple]..... map mouse pressAndHold() area purple coordinate: ' + mapMouseAreaUpperPurple.mouseToCoordinate(mouse).latitude + ' to screen pos: ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).x + ' ' + map.toScreenPosition(mapMouseAreaUpperPurple.mouseToCoordinate(mouse)).y)
- }
- onEntered: {
- console.log('....[purple]..... map mouse area purple entered()')
- }
- onExited: {
- console.log('....[purple]..... map mouse area purple exited()')
- }
- }
- sourceItem: Rectangle {
- id: rectangleSourceItem
- width: 200
- height: 200
- color: 'purple'
- Column {
- spacing: 2
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' MapQuickItem '}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' w: ' + purpleRectMapItem.width}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' h: ' + purpleRectMapItem.height}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' x: ' + purpleRectMapItem.x}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black';
- text: ' y: ' + purpleRectMapItem.y}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: purpleRectMapItem.width - 30;
- text: ' c lat: ' + purpleRectMapItem.coordinate.latitude}
- Text { color: 'yellow'; font.bold: true; style: Text.Outline; styleColor: 'black'; elide: Text.ElideRight; width: purpleRectMapItem.width - 30;
- text: ' c lon: ' + purpleRectMapItem.coordinate.longitude}
- }
- }
- }
-
- /*
- MapQuickItem {
- z: 10
- objectName: "video item"
- coordinate: londonCoordinate
- sourceItem: Rectangle {
- color: "green"
- width: 200;
- height: 200;
- MediaPlayer {
- id: player
- source: "file:///home/juvuolle/Downloads/Big_Buck_Bunny_Trailer_400p.ogg.ogv"
- playing: true
- }
- VideoOutput {
- id: videoItem
- source: player
- anchors.fill: parent
- }
- }
- }
- */
-
-/*
- MapQuickItem {
- z: 11
- objectName: "3d item"
- coordinate: londonCoordinate
- sourceItem: Item {
- width: 200
- height: 200
- Viewport {
- width: 200
- height: 200
- Item3D {
- mesh: Mesh { source: "file:///home/juvuolle/qt/qt5/qtlocation/tests/applications/declarative_map/basket.bez" }
- effect: Effect { texture: "file:///home/juvuolle/qt/qt5/qtlocation/tests/applications/declarative_map/basket.jpg" }
- //! [2]
- //! [3]
-
- transform: [
- Scale3D { scale: 1.5 },
- Rotation3D {
- axis: Qt.vector3d(0, 1, 0)
- NumberAnimation on angle {
- running: true
- loops: Animation.Infinite
- from: 0
- to: 360
- duration: 2000
- }
- }
- ]
- }
- }
- }
- }
-*/
- /*
- MapQuickItem {
- objectName: "blinky quick item 2"
- coordinate: brisbaneCoordinate
- anchorPoint: Qt.point(40, 40)
- zoomLevel: 6.0
- sourceItem: AnimatedImage {
- width: 80
- height: 80
- playing: true
- source: "blinky.gif"
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- parent.parent.zoomLevel += 1
- }
- }
- }
- }
- */
-
- /*
- MapItem {
- objectName: 'blinky static item'
- zoomLevel: 7 // at which map's zoom level the width and height are '1-to-1'
- coordinate: brisbaneCoordinate
- sourceItem: AnimatedImage {
- width: 80
- height: 80
- playing: true
- source: "blinky.gif"
- }
- }
- */
-
-
- MapItemView {
- id: theItemView
- model: testModel
- delegate: Component {
- MapQuickItem {
- objectName: 'one of many items from model'
- visible: true
- zoomLevel: 7
- sourceItem: Rectangle {
- width: 300; height: 300; color: 'green'
- Component.onCompleted: {
- var num = (Math.floor(4 * Math.random()));
- switch (num % 4) {
- case 0:
- color = "#ff0000";
- break;
- case 1:
- color = "#0000ff";
- break;
- case 2:
- color = "#00ffff";
- break;
- case 3:
- color = "#00ff00";
- break;
- }
- }
-
- }
- coordinate: Coordinate {
- latitude: modeldata.coordinate.latitude;
- longitude: modeldata.coordinate.longitude;
- }
- }
- }
- }
-
- // From location.test plugin
- PinchGenerator {
- id: pinchGenerator
- anchors.fill: parent
- target: map
- enabled: false
- focus: true // enables keyboard control for convenience
- replaySpeedFactor: 1.7 // replay with 1.1 times the recording speed to better see what happens
- Text {
- id: pinchGenText
- text: "PinchArea state: " + pinchGenerator.state + "\n"
- + "Swipes recorded: " + pinchGenerator.count + "\n"
- + "Replay speed factor: " + pinchGenerator.replaySpeedFactor
- }
- }
-
- Column {
- id: infoText
- y: 100
- spacing: 2
- Text {id: positionText; text: "Map zoom level: " + map.zoomLevel; color: 'red'; font.bold: true}
- Text {color: positionText.color; font.bold: true; width: page.width / 2; elide: Text.ElideRight; text: "Map center lat: " + mapCenterCoordinate.latitude }
- Text {color: positionText.color; font.bold: true; width: page.width / 2; elide: Text.ElideRight; text: "Map center lon: " + mapCenterCoordinate.longitude }
- Text {color: positionText.color; font.bold: true; width: page.width / 2; elide: Text.ElideRight; text: "Map bearing: " + map.bearing }
- Text {color: positionText.color; font.bold: true; width: page.width / 2; elide: Text.ElideRight; text: "Map tilt: " + map.tilt }
- }
-
- Grid {
- id: panNav
- z: 10
- anchors.top: infoText.bottom
- columns: 3
- spacing: 2
- Rectangle { id: navRect; width: 50; height: 50; color: 'peru'; Text {text: "\u2196";} MouseArea {anchors.fill: parent; onClicked: { map.pan(-5,5)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2191";} MouseArea {anchors.fill: parent; onClicked: {map.pan(0,5)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2197";} MouseArea {anchors.fill: parent; onClicked: {map.pan(5,5)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2190";} MouseArea {anchors.fill: parent; onClicked: {map.pan(-5,0)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "Pan\nMap";} MouseArea {anchors.fill: parent; onClicked: {console.log('ticle tickle hehehe')}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2192";} MouseArea {anchors.fill: parent; onClicked: {map.pan(5,0)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2199";} MouseArea {anchors.fill: parent; onClicked: {map.pan(-5,-5)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2193";} MouseArea {anchors.fill: parent; onClicked: {map.pan(0,-5)}}}
- Rectangle { width: navRect.width; height: navRect.height; color: navRect.color; Text {text: "\u2198";} MouseArea {anchors.fill: parent; onClicked: {map.pan(5,-5)}}}
- }
-
- Grid {
- id: itemMover
- z: 10
- anchors.top: panNav.bottom
- columns: 3
- spacing: 2
- property variant target: mapCircle
-
- Rectangle { id: itemMoverRect; width: 50; height: 50; color: 'peru'; Text {text: "\u2196";} MouseArea {anchors.fill: parent; onClicked: { itemMover.target.y -= 5; itemMover.target.x -= 5 }}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2191";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.y -= 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2197";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.y -= 5; itemMover.target.x += 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2190";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.x -= 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "Move\nCircle";} MouseArea {anchors.fill: parent; onClicked: {console.log('ticle tickle hehehe')}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2192";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.x += 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2199";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.x -= 5; itemMover.target.y += 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2193";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.y += 5}}}
- Rectangle { width: itemMoverRect.width; height: itemMoverRect.height; color: itemMoverRect.color; Text {text: "\u2198";} MouseArea {anchors.fill: parent; onClicked: {itemMover.target.y += 5; itemMover.target.x += 5}}}
- }
-
- Rectangle {
- id: itemDataBackground
- opacity: 0.8
- anchors.top: itemMover.bottom
- anchors.bottom: rectangleData.bottom
- width: itemMover.width
- }
- Column {
- id: circleData;
- anchors.top: itemMover.bottom
- spacing: 1
- Text { text: ' MapCircle '; font.bold: true; font.pixelSize: 10; }
- Text { text: ' x: ' + mapCircle.x; font.pixelSize: 10; }
- Text { text: ' y: ' + mapCircle.y; font.pixelSize: 10; }
- Text { text: ' c lat: ' + mapCircle.center.latitude; font.pixelSize: 10; }
- Text { text: ' c lon: ' + mapCircle.center.longitude; font.pixelSize: 10; }
- }
- Column {
- id: polylineData;
- anchors.top: circleData.bottom
- spacing: 1
- Text { text: ' MapPolyline '; font.bold: true;font.pixelSize: 10; }
- Text { text: ' x: ' + mapPolyline.x; font.pixelSize: 10; }
- Text {text: ' y: ' + mapPolyline.y; font.pixelSize: 10; }
- Text {text: ' at(0) lat: ' + mapPolyline.path[0].latitude; font.pixelSize: 10; }
- Text {text: ' at(0) lon: ' + mapPolyline.path[0].longitude; font.pixelSize: 10; }
- }
- Column {
- id: polygonData;
- anchors.top: polylineData.bottom
- spacing: 1
- Text { text: ' MapPolygon '; font.bold: true;font.pixelSize: 10; }
- Text { text: ' x: ' + mapPolygon.x; font.pixelSize: 10; }
- Text {text: ' y: ' + mapPolygon.y; font.pixelSize: 10; }
- Text {text: ' at(0) lat: ' + mapPolygon.path[0].latitude; font.pixelSize: 10; }
- Text {text: ' at(0) lon: ' + mapPolygon.path[0].longitude; font.pixelSize: 10; }
- }
- Column {
- id: routeData;
- anchors.top: polygonData.bottom
- spacing: 1
- Text { text: ' MapRoute '; font.bold: true;font.pixelSize: 10; }
- Text { text: ' x: ' + mapRoute.x; font.pixelSize: 10; }
- Text {text: ' y: ' + mapRoute.y; font.pixelSize: 10; }
- Text {text: ' at(0) lat: ' + mapRoute.route.path[0].latitude; font.pixelSize: 10; }
- Text {text: ' at(0) lon: ' + mapRoute.route.path[0].longitude; font.pixelSize: 10; }
- }
- Column {
- id: quickItemData
- spacing: 1
- anchors.top: routeData.bottom
- Text {text: ' MapQuickItem ';font.bold: true; font.pixelSize: 10; }
- Text {text: ' x: ' + purpleRectMapItem.x; font.pixelSize: 10; }
- Text {text: ' y: ' + purpleRectMapItem.y; font.pixelSize: 10; }
- Text {text: ' tl lat: ' + purpleRectMapItem.coordinate.latitude; font.pixelSize: 10; }
- Text {text: ' tl lon: ' + purpleRectMapItem.coordinate.longitude; font.pixelSize: 10; }
- }
- Column {
- id: rectangleData
- spacing: 1
- anchors.top: quickItemData.bottom
- Text {text: ' MapRectangle '; font.bold: true; font.pixelSize: 10; }
- Text {text: ' x: ' + mapRectangle.x; font.pixelSize: 10; }
- Text {text: ' y: ' + mapRectangle.y; font.pixelSize: 10; }
- Text {text: ' tl lat: ' + mapRectangle.topLeft.latitude; font.pixelSize: 10; }
- Text {text: ' tl lon: ' + mapRectangle.topLeft.longitude; font.pixelSize: 10; }
- Text {text: ' br lat: ' + mapRectangle.bottomRight.latitude; font.pixelSize: 10; }
- Text {text: ' br lon: ' + mapRectangle.bottomRight.longitude; font.pixelSize: 10; }
- }
-
-
-
- /*
- Keys.onPressed: {
- if (event.key == Qt.Key_A) {
- console.log('Key A was pressed');
- //event.accepted = true;
- }
- }
- */
-
- Row {
- id: textRow1
- spacing: 15
- y: 1050
- Text {id: firstText; text: "Map zoom level: " + map.zoomLevel; color: 'red'; font.bold: true}
- Text {text: "Pinch zoom sensitivity: " + map.pinch.maximumZoomLevelChange; color: firstText.color; font.bold: true}
- Text {text: "Pinch rotation sensitivity: " + map.pinch.rotationFactor; color: firstText.color; font.bold: true}
- }
-
- Row {
- spacing: 15
- anchors.top: textRow1.bottom
- Text {text: "Flick deceleration: " + map.flick.deceleration; color: firstText.color; font.bold: true}
- Text {text: "Weather: Sunny, mild, late showers."; color: firstText.color; font.bold: true}
- }
-
-
- //plugin : Plugin {name : "nokia"}
-
- plugin: Plugin {
- id: testPlugin;
- name: "qmlgeo.test.plugin"
- parameters: [
- // Parms to guide the test plugin
- PluginParameter { name: "finishRequestImmediately"; value: true}
- ]
- }
-
- // commented features are checked to work at least somehow
- //anchors.left: parent.left
- //anchors.bottom: parent.bottom
- //anchors.leftMargin: 70
- //scale: 2
- //visible: false
- //transform: Translate {y: 200}
- //anchors.fill: page
- width: page.width - 80
- height: 1000
- zoomLevel: 9
-
- // pinch.activeGestures: MapPinchArea.ZoomGesture | RotationGesture
- pinch.activeGestures: MapPinchArea.NoGesture
- pinch.enabled: true
- pinch.maximumZoomLevelChange: 4.0 // maximum zoomlevel changes per pinch
- pinch.rotationFactor: 1.0 // default ~follows angle between fingers
-
- // Flicking
- flick.enabled: true
- // flick.deceleration: 500
- //flick.onFlickStarted: {console.log ('flick started signal F Start ++++++++++++++++++ ') }
- //flick.onFlickEnded: {console.log ('flick ended signal F Stop ------------------ ') }
- //flick.onMovementStarted: {console.log('movement started signal M Start ++++++++++++++++++ ') }
-
- //flick.onMovementEnded: {console.log ('movement ended signal M Stop ------------------ ') }
-
- onWheel: {
- //console.log('map wheel event, rotation in degrees: ' + delta/8);
- if (delta > 0) map.zoomLevel += 0.25
- else map.zoomLevel -= 0.25
- }
-
- pinch.onPinchStarted: {
- console.log('Map element pinch started---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.x = pinch.point1.x; pinchRect1.y = pinch.point1.y;
- pinchRect2.x = pinch.point2.x; pinchRect2.y = pinch.point2.y;
- pinchRect1.visible = true; pinchRect2.visible = true;
- console.log('Center : ' + pinch.center)
- console.log('Angle: ' + pinch.angle)
- console.log('Point count: ' + pinch.pointCount)
- console.log('Accepted: ' + pinch.accepted)
- console.log('Point 1: ' + pinch.point1)
- console.log('Point 2: ' + pinch.point2)
- }
- pinch.onPinchUpdated: {
- console.log('Map element pinch updated---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.x = pinch.point1.x; pinchRect1.y = pinch.point1.y;
- pinchRect2.x = pinch.point2.x; pinchRect2.y = pinch.point2.y;
- console.log('Center : ' + pinch.center)
- console.log('Angle: ' + pinch.angle)
- console.log('Point count: ' + pinch.pointCount)
- console.log('Accepted: ' + pinch.accepted)
- console.log('Point 1: ' + pinch.point1)
- console.log('Point 2: ' + pinch.point2)
- }
- pinch.onPinchFinished: {
- console.log('Map element pinch finished ---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.visible = false; pinchRect2.visible = false;
- console.log('Center : ' + pinch.center)
- console.log('Angle: ' + pinch.angle)
- console.log('Point count: ' + pinch.pointCount)
- console.log('Accepted: ' + pinch.accepted)
- console.log('Point 1: ' + pinch.point1)
- console.log('Point 2: ' + pinch.point2)
- }
-
- center: Coordinate {
- id: mapCenterCoordinate
- latitude: 51.5
- longitude: -0.11
- }
-
- // <unsupported so far>
- //rotation: 10 // strangely impacts the size of the map element though
- //transform: Scale { origin.x: 25; origin.y: 25; xScale: 3} // weirdly translates the item
- //transform: Rotation { origin.y: 25; origin.x: 25; angle: 45} // weirdly translates the item
- //z: 4 // map will always be under everything, will not be supported
- //opacity: 0.4 // doesn't probably make sense
- //clip: true // not implemented, not sure if very useful either
- // </unsupported so far>
- }
-
- Plugin {id: nokia_plugin; name: "nokia"}
-
- Row {
- id: buttonRow
- anchors.leftMargin: 2
- anchors.topMargin: 2
- anchors.top: map.bottom;
- spacing: 2
- Rectangle { id: rowRect1; width: 80; height: 45; color: 'peru';
- MouseArea { anchors.fill: parent; onClicked: { map.pinch.maximumZoomLevelChange += 0.1}
- Text {text: "Pinch zoom\nsensitivity+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.maximumZoomLevelChange -= 0.1}
- Text {text: "Pinch zoom\nsensitivity-"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.rotationFactor += 0.1}
- Text {text: "Pinch rotation\nsensitivity+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.rotationFactor -= 0.1}
- Text {text: "Pinch rotation\nsensitivity-"}
- }
- }
- Rectangle { id: rowRectPinchGen; width: rowRect1.width; height: rowRect1.height; color: 'lightsteelblue';
- Text { text: "Pinch\nzoom:\n" + ((map.pinch.activeGestures & MapPinchArea.ZoomGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.ZoomGesture)
- map.pinch.activeGestures &= ~MapPinchArea.ZoomGesture
- else
- map.pinch.activeGestures += MapPinchArea.ZoomGesture
- }
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { text: "Pinch\nrotation:\n" + ((map.pinch.activeGestures & MapPinchArea.RotationGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.RotationGesture)
- map.pinch.activeGestures &= ~MapPinchArea.RotationGesture
- else
- map.pinch.activeGestures += MapPinchArea.RotationGesture
- }
- }
- }
-
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { text: "Pinch\ntilt:\n" + ((map.pinch.activeGestures & MapPinchArea.TiltGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.TiltGesture)
- map.pinch.activeGestures &= ~MapPinchArea.TiltGesture
- else
- map.pinch.activeGestures += MapPinchArea.TiltGesture
- }
- }
-
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { id: generatorEnabledText; text: pinchGenerator.enabled? "Pinch Gen\nEnabled" : "Pinch Gen\nDisabled"; font.bold: true}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- if (pinchGenerator.focus == true) {
- pinchGenerator.focus = false;
- pinchGenerator.enabled = false;
- pinchGenerator.z = -1
- map.focus = true;
- } else {
- pinchGenerator.focus = true
- pinchGenerator.enabled = true;
- pinchGenerator.z = 10
- map.focus = false
- }
- }
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- Text {text: map.flick.enabled? "Flick\nEnabled":"Flick\nDisabled"; font.bold: true}
- MouseArea { anchors.fill: parent; onClicked: {map.flick.enabled = !map.flick.enabled} }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.flick.deceleration += 200}
- Text {text: "Flick\ndeceleration+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.flick.deceleration -= 200}
- Text {text: "Flick\ndeceleration-"}
- }
- }
- } // Row
-
- Rectangle {
- id: pinchRect1
- color: 'red'
- visible: false
- z: 10
- width: 5
- height: 5
- }
- Rectangle {
- id: pinchRect2
- color: 'red'
- visible: false
- z: 10
- width: 5
- height: 5
- }
-
- Repeater {
- id: swipeView1
- model: pinchGenerator.swipe1
- delegate: Component {
- Rectangle {
- Text {id: touchPointText}
- Component.onCompleted: {
- if (modelData.touchState == 1) { // Qt.TouchPointPressed
- color = "pink"; width = 15; height = 15
- touchPointText.text = 'From'
- }
- else if (modelData.touchState == 2) { // Qt.TouchPointMoved
- color = 'yellow'; width = 5; height = 5
- }
- else if (modelData.touchState == 8) { // Qt.TouchPointReleased
- color = 'red'; width = 15; height = 15
- touchPointText.text = 'To'
- }
- }
- x: modelData.targetX; y: modelData.targetY
- }
- }
- }
-
- Repeater {
- id: swipeView2
- model: pinchGenerator.swipe2
- delegate: Component {
- Rectangle {
- Text {id: touchPoint2Text}
- Component.onCompleted: {
- if (modelData.touchState == 1) { // Qt.TouchPointPressed
- color = "green"; width = 15; height = 15
- touchPoint2Text.text = 'From'
- }
- else if (modelData.touchState == 2) { // Qt.TouchPointMoved
- color = 'yellow'; width = 5; height = 5
- }
- else if (modelData.touchState == 8) { // Qt.TouchPointReleased
- color = 'blue'; width = 15; height = 15
- touchPoint2Text.text = 'To'
- }
- }
- x: modelData.targetX; y: modelData.targetY
- }
- }
- }
-}
diff --git a/tests/applications/declarative_map/map3d.qrc b/tests/applications/declarative_map/map3d.qrc
deleted file mode 100644
index 9cc8af12..00000000
--- a/tests/applications/declarative_map/map3d.qrc
+++ /dev/null
@@ -1,25 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>map3d.qml</file>
- <file>map3d_mousetest.qml</file>
- <file>Dialog.qml</file>
- <file>common/TitleBar.qml</file>
- <file>common/Button.qml</file>
- <file>common/Slider.qml</file>
- <file>common/Menu.qml</file>
- <file>resources/button.png</file>
- <file>resources/button.sci</file>
- <file>resources/quit.png</file>
- <file>resources/titlebar.png</file>
- <file>resources/titlebar.sci</file>
- <file>resources/quit_pressed.png</file>
- <file>resources/menuItem.png</file>
- <file>resources/menuItem.sci</file>
- <file>resources/menuItem_pressed.png</file>
- <file>resources/quit_hovered.png</file>
- <file>resources/menuItem_hovered.png</file>
- <file>resources/button_pressed.png</file>
- <file>resources/button_hovered.png</file>
- <file>blinky.gif</file>
- </qresource>
-</RCC>
diff --git a/tests/applications/declarative_map/map3d_mousetest.qml b/tests/applications/declarative_map/map3d_mousetest.qml
deleted file mode 100644
index 45eb4536..00000000
--- a/tests/applications/declarative_map/map3d_mousetest.qml
+++ /dev/null
@@ -1,1049 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Mobility Components.
-**
-** $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
-import QtPositioning 5.2
-import QtLocation 5.3
-import QtLocation.test 5.0
-import "common" as Common
-
-Item {
- objectName: "The page."
- width: 1140 //360
- height: 1085 // 640
- //width: 360
- //height: 640
- id: page
-
- //Rectangle {
- // id: bottleAnimation
- // width: animation.width; height: animation.height + 8
- // }
-
- // From location.test plugin
- TestModel {
- id: testModel
- datatype: 'coordinate'
- datacount: 8
- delay: 0
- crazyMode: false // generate arbitrarily updates. interval is set below, and the number of items is varied between 0..datacount
- crazyLevel: 2000 // the update interval varies between 3...crazyLevel (ms)
- }
-
- Item {
- visible: false
- id: shaderItem
- width: 256
- height: 256
- x: 100
- y: 100
- Rectangle {
- radius: 20
- id: shaderRect
- width: parent.width
- height: parent.height/4
- color: 'red'
- z: 1
- Text {text: "Wicked!"}
-
- SequentialAnimation on color {
- loops: Animation.Infinite
- ColorAnimation { from: "DeepSkyBlue"; to: "red"; duration: 2000 }
- ColorAnimation { from: "red"; to: "DeepSkyBlue"; duration: 2000 }
- }
- }
- Rectangle {
- id: shaderRect2
- opacity: 0.5
- //width: parent.width
- anchors.fill: shaderRect
- //height: parent.height/4
- color: 'green'
- Text {text: "Sick!"}
- }
- Rectangle {
- id: shaderRect3
- width: parent.width
- anchors.top: shaderRect2.bottom
- height: parent.height/4
- color: 'blue'
- Text {text: "Sick!"}
- }
- Rectangle {
- width: parent.width
- anchors.top: shaderRect3.bottom
- height: parent.height/4
- color: 'yellow'
- Text {text: "Sick!"}
- }
- }
-
- Column {
- id: buttonColumn
- anchors.top: page.top
- anchors.left: map.right
- spacing: 2
-
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Crazy mode:\n" + testModel.crazyMode + "\nclick to\ntoggle."}
- MouseArea{ anchors.fill: parent;
- onClicked: testModel.crazyMode = !testModel.crazyMode
- onDoubleClicked: map.removeMapItem(mapItem1)
- }
- }
- AnimatedImage {
- MouseArea { anchors.fill: parent; onClicked: mapItem2.source = parent }
- width: 80
- height: 80
- playing: testModel.crazyMode
- source: "blinky.gif"
- }
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Click:\nadd item1\nDouble-click:\nrm item1"}
- MouseArea{ anchors.fill: parent;
- onClicked: {console.log('oooQML: ----------------adding item 1'); map.addMapItem(externalStaticMapItem1);}
- onDoubleClicked: {console.log('oooQML: +++++++++++++++ removing item 1'); map.removeMapItem(externalStaticMapItem1);}
- }
- }
- Rectangle {color: "lightblue"; width: 80; height: 80;
- Text {text: "Click:\nadd item2\nDouble-click:\nrm item2"}
- MouseArea{ anchors.fill: parent;
- onClicked: {console.log('oooQML: adding item 2'); map.addMapItem(externalStaticMapItem2);}
- onDoubleClicked: {console.log('oooQML: removing item 2'); map.removeMapItem(externalStaticMapItem2);}
- }
- }
- }
-
- /*
- MapItem {
- id: externalStaticMapItem1
- objectName: "externalStaticMapItem1"
- coordinate: brisbaneCoordinate
- zoomLevel: 5.0
- source: Rectangle {
- color: "gray"
- width: 140
- height: 20
- Text {font.pixelSize: 15;text: "ext map item 1"; font.bold: true; color: 'red'}
- }
- }
-
- MapItem {
- id: externalStaticMapItem2
- objectName: "externalStaticMapItem2"
- coordinate: brisbaneCoordinate2
- zoomLevel: 5.0
- source: Rectangle {
- color: "gray"
- width: 140
- height: 20
- Text {font.pixelSize: 15;text: "ext map item 2"; font.bold: true; color: 'red'}
- }
- }
- */
-
- /*
- MapItem {
- id: mapItem1
- source: AnimatedImage {width: 80; height: 80; playing: true; source: "walk.gif"}
- }
- */
-
- //AnimatedImage {width: 80; height: 80; playing: true; source: "walk.gif"}
- //MapItem {id: mapItem2 }
- //MapItem {id: mapItem3 }
- //MapItem {id: mapItem4 }
- //MapItem {id: mapItem5 }
- //MapItem {id: mapItem6 }
- //MapItem {id: mapItem7 }
- //MapItem {id: mapItem8 }
-
- Coordinate {
- id: brisbaneCoordinate
- latitude: -27.5
- longitude: 140
- }
-
- Coordinate {
- id: brisbaneCoordinate2
- latitude: -30.5
- longitude: 140
- }
-
- Map {
- id: map
- /*
- MapItem {
- objectName: 'blinky static item'
- zoomLevel: 7 // at which map's zoom level the width and height are '1-to-1'
- coordinate: brisbaneCoordinate
- source: AnimatedImage {
- width: 80
- height: 80
- playing: true
- source: "blinky.gif"
- }
- }
- */
-
-
- //MapItem {
- // source: Rectangle { width: 40; height: 40; color: 'chocolate'
- // }
- // }
- /*
- MapObjectView {
- id: theObjectView
- model: testModel
- delegate: Component {
- MapItem {
- objectName: 'one of many items from model'
- visible: true
- live: true
- recursive: true
- source: Rectangle {
- width: 300; height: 300; color: 'green'
- Component.onCompleted: {
- var num = (Math.floor(4 * Math.random()));
- switch (num % 4) {
- case 0:
- color = "#ff0000";
- break;
- case 1:
- color = "#0000ff";
- break;
- case 2:
- color = "#00ffff";
- break;
- case 3:
- color = "#00ff00";
- break;
- }
- }
-
- }
- coordinate: Coordinate {
- latitude: modeldata.coordinate.latitude;
- longitude: modeldata.coordinate.longitude;
- }
- }
- }
- }
- */
-
- // From location.test plugin
- PinchGenerator {
- id: pinchGenerator
- anchors.fill: parent
- target: map
- enabled: false
- focus: true // enables keyboard control for convenience
- replaySpeedFactor: 1.1 // replay with 1.1 times the recording speed to better see what happens
- Text {
- text: "PinchArea state: " + pinchGenerator.state + "\n"
- + "Swipes recorded: " + pinchGenerator.count + "\n"
- + "Replay speed factor: " + pinchGenerator.replaySpeedFactor
- }
- }
- /*
- Keys.onPressed: {
- if (event.key == Qt.Key_A) {
- console.log('oooQML: Key A was pressed');
- //event.accepted = true;
- }
- }
- */
- plugin : Plugin {name : "nokia"}
- // commented features are checked to work at least somehow
- x: 0
- y: 0
- //size.width: 100
- //size.height: 100
- //anchors.left: parent.left
- //anchors.bottom: parent.bottom
- //anchors.leftMargin: 70
- //scale: 2
- //visible: false
- //transform: Translate {y: 200}
- //anchors.fill: page
- width: page.width - 80
- height: 800
- zoomLevel: 5.1
-
- // pinch.activeGestures: MapPinchArea.ZoomGesture | RotationGesture
- pinch.activeGestures: MapPinchArea.NoGesture
-
- pinch.enabled: true
-
- // Flicking
- flick.enabled: true
- flick.deceleration: 3000
- flick.onFlickStarted: {console.log ('flick started signal F Start ++++++++++++++++++ ') }
- flick.onFlickEnded: {console.log ('flick ended signal F Stop ------------------ ') }
- flick.onMovementStarted: {console.log('oooQML: movement started signal M Start ++++++++++++++++++ ') }
- flick.onMovementEnded: {console.log ('movement ended signal M Stop ------------------ ') }
-
-
- onWheel: {
- console.log('oooQML: map wheel event, rotation in degrees: ' + delta/8);
- if (delta > 0) map.zoomLevel += 0.25
- else map.zoomLevel -= 0.25
- }
-
- pinch.onPinchStarted: {
- console.log('oooQML: Map element pinch started---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.x = pinch.point1.x; pinchRect1.y = pinch.point1.y;
- pinchRect2.x = pinch.point2.x; pinchRect2.y = pinch.point2.y;
- pinchRect1.visible = true; pinchRect2.visible = true;
- //console.log('oooQML: Point 1 x: ' + pinch.point1.x + ' Point2 x' + pinch.point2.x)
- //console.log('oooQML: Center x: ' + pinch.center.x + ' Point1 y: ' + pinch.point1.y)
- }
- pinch.onPinchUpdated: {
- console.log('oooQML: Map element pinch updated---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.x = pinch.point1.x; pinchRect1.y = pinch.point1.y;
- pinchRect2.x = pinch.point2.x; pinchRect2.y = pinch.point2.y;
- }
- pinch.onPinchFinished: {
- console.log('oooQML: Map element pinch finished ---------+++++++++++++++++++++++++++++++++++++')
- pinchRect1.visible = false; pinchRect2.visible = false;
- //map.pinch.minimumZoomLevel = map.zoomLevel - 2
- //map.pinch.maximumZoomLevel = map.zoomLevel + 2
- }
-
-
- Rectangle {
- id: mouseRectUpper
- color: 'green'
- border.color: "yellow"
- border.width: 5
- radius: 10
- opacity: 0.2
- x: 0; y: 0;
- width: map.width;
- height: map.height / 2
- Text { font.pixelSize: 20; text: '\n\n\n\n\n\n upper MapMouseArea, z value: ' + mouseAreaOfMap.z}
- }
-
- MapMouseArea {
- id: mouseAreaOfMap
- objectName: 'map mouse area'
- z: 5
- x: 0; y: 0;
- width: map.width;
- height: map.height / 2;
-
- onAcceptedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea acceptedButtonsChanged: ' + mouseAreaOfMap.acceptedButtons + ' ' + acceptedButtons)
- }
- onEnabledChanged: {
- console.log('oooQML: in QML MapMouseArea enabledChanged: ' + mouseAreaOfMap.enabled)
- }
- onPressed: {
- console.log('oooQML: in QML MapMouseArea pressed: ' +
- mouse.x + ' y:' + mouse.y + ' pressed: '
- + pressed + ' mouseX: ' + mouseAreaOfMap.mouseX + ' mouseY: ' + mouseAreaOfMap.mouseY + ' button: ' + mouse.button + ' buttons: ' + mouse.buttons)
- }
- onPressedChanged: {
- console.log('oooQML: in QML MapMouseArea pressedChanged, pressedButtons: ' + mouseAreaOfMap.pressedButtons)
- }
- onPressedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea pressedButtonChanged ' + ' pressed button: ' + mouseAreaOfMap.pressedButtons)
- }
- onReleased: {
- console.log('oooQML: in QML MapMouseArea released: ' + mouse.x + ' y: ' + mouse.y)
- }
- onDoubleClicked: {
- console.log('oooQML: in QML MapMouseArea doubleclicked---------------------------------------- dump event: ')
- console.log('oooQML: accepted: ' + mouse.accepted);
- console.log('oooQML: button: ' + mouse.button);
- console.log('oooQML: modifiers: ' + mouse.modifiers);
- console.log('oooQML: wasHeld: ' + mouse.wasHeld);
- console.log('oooQML: x: ' + mouse.x);
- console.log('oooQML: y: ' + mouse.y);
- console.log('oooQML: mouse area x,y, width, height: ' + mouseAreaOfMap.x + ' ' + mouseAreaOfMap.y + ' ' + mouseAreaOfMap.width + ' ' + mouseAreaOfMap.height)
-
- console.log('oooQML: in QML MapMouseArea doubleclicked---------------------------------------- end dump ')
- }
- onClicked: {
- console.log('oooQML: in QML MapMouseArea clicked')
- }
- onPositionChanged: {
- console.log('oooQML: in QML MapMouseArea position changed, x: ' + mouse.x + ' y: ' + mouse.y
- + ' mouseX: ' + mouseAreaOfMap.mouseX + ' mouseY: ' + mouseAreaOfMap.mouseY + ' button: ' + mouse.button + ' buttons: ' + mouse.buttons)
- }
- onEntered: {
- console.log('oooQML: in QML MapMouseArea entered')
- }
- onExited: {
- console.log('oooQML: in QML MapMouseArea exited')
- }
- onPressAndHold: {
- console.log('oooQML: in QML MapMouseArea press and hold')
- }
- // This signal is not officially public per se, but used to notify containsMouse changes
- onHoveredChanged: {
- console.log('oooQML: in QML MapMouseArea hoveredChanged, containsMouse is: ' + mouseAreaOfMap.containsMouse)
- }
- }
-
- Rectangle {
- id: mouseRectLower
- color: 'green'
- border.color: "yellow"
- border.width: 5
- radius: 10
- opacity: 0.2
- x: 0; y: map.height/2;
- width: map.width;
- height: map.height/2;
- Text { font.pixelSize: 20; text: ' lower MapMouseArea, z value: ' + mouseAreaOfMap2.z}
- }
-
- MapMouseArea {
- id: mouseAreaOfMap2
- objectName: 'map mouse area 2'
- x: 0; y: map.height/2;
- width: map.width;
- height: map.height/2;
-
- hoverEnabled: true
-
- onAcceptedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea2 acceptedButtonsChanged: ' + mouseAreaOfMap2.acceptedButtons + ' ' + acceptedButtons)
- }
- onEnabledChanged: {
- console.log('oooQML: in QML MapMouseArea2 enabledChanged: ' + mouseAreaOfMap2.enabled)
- }
- onPressed: {
- console.log('oooQML: in QML MapMouseArea2 pressed: ' +
- mouse.x + ' y:' + mouse.y + ' pressed: '
- + pressed + ' mouseX: ' + mouseAreaOfMap2.mouseX + ' mouseY: ' + mouseAreaOfMap2.mouseY)
- console.log('oooQML: and the geo coordinate for that is, lat: '
- + mouseAreaOfMap2.mouseToCoordinate(mouse).latitude + ' + lon : ' +
- mouseAreaOfMap2.mouseToCoordinate(mouse).longitude)
- }
- onPressedChanged: {
- console.log('oooQML: in QML MapMouseArea2 pressedChanged, pressedButtons: ' + mouseAreaOfMap2.pressedButtons)
- }
- onPressedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea2 pressedButtonChanged ' + ' pressed button: ' + mouseAreaOfMap2.pressedButtons)
- }
- onReleased: {
- console.log('oooQML: in QML MapMouseArea2 released: ' + mouse.x + ' y: ' + mouse.y)
- }
- onDoubleClicked: {
- console.log('oooQML: in QML MapMouseArea2 doubleclicked---------------------------------------- dump event: ')
- console.log('oooQML: accepted: ' + mouse.accepted);
- console.log('oooQML: button: ' + mouse.button);
- console.log('oooQML: modifiers: ' + mouse.modifiers);
- console.log('oooQML: wasHeld: ' + mouse.wasHeld);
- console.log('oooQML: x: ' + mouse.x);
- console.log('oooQML: y: ' + mouse.y);
- console.log('oooQML: mouse area x,y, width, height: ' + mouseAreaOfMap2.x + ' ' + mouseAreaOfMap2.y + ' ' + mouseAreaOfMap2.width + ' ' + mouseAreaOfMap2.height)
-
- console.log('oooQML: in QML MapMouseArea2 doubleclicked---------------------------------------- end dump ')
- }
- onClicked: {
- console.log('oooQML: in QML MapMouseArea2 clicked')
- }
- onPositionChanged: {
- console.log('oooQML: in QML MapMouseArea2 position changed, x: ' + mouse.x + ' y: ' + mouse.y
- + ' mouseX: ' + mouseAreaOfMap2.mouseX + ' mouseY: ' + mouseAreaOfMap2.mouseY)
- }
- onEntered: {
- console.log('oooQML: in QML MapMouseArea2 entered')
- }
- onExited: {
- console.log('oooQML: in QML MapMouseArea2 exited')
- }
- onPressAndHold: {
- console.log('oooQML: in QML MapMouseArea2 press and hold')
- }
- // This signal is not officially public per se, but used to notify containsMouse changes
- onHoveredChanged: {
- console.log('oooQML: in QML MapMouseArea2 hoveredChanged, containsMouse is: ' + mouseAreaOfMap2.containsMouse)
- }
- }
-
- // overlaps both mouse areas 1 and 2 (rhs)
- Rectangle {
- id: mouseRectRightOverlapping
- color: 'green'
- border.color: "red"
- border.width: 5
- radius: 10
- opacity: 0.2
- x: map.width/2; y: 0;
- width: map.width/2;
- height: map.height;
- Text { font.pixelSize: 20; text: '\n\n\n\n\n overlapping MapMouseArea (3), Z value: ' + mouseAreaOfMap3.z}
- }
-
- MapMouseArea {
- id: mouseAreaOfMap3
- objectName: 'map mouse area 3'
- z: 4
- x: map.width/2; y: 0;
- width: map.width/2;
- height: map.height;
-
- onAcceptedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea3 acceptedButtonsChanged: ' + mouseAreaOfMap3.acceptedButtons + ' ' + acceptedButtons)
- }
- onEnabledChanged: {
- console.log('oooQML: in QML MapMouseArea3 enabledChanged: ' + mouseAreaOfMap3.enabled)
- }
- onPressed: {
- console.log('oooQML: in QML MapMouseArea3 pressed: ' +
- mouse.x + ' y:' + mouse.y + ' pressed: '
- + pressed + ' mouseX: ' + mouseAreaOfMap3.mouseX + ' mouseY: ' + mouseAreaOfMap3.mouseY)
-
- console.log('oooQML: in QML MapMouseArea3, the x mapped: ' + map.mapFromItem(mouseAreaOfMap3, mouse.x, mouse.y).x + ' the y mapped: ' + map.mapFromItem(mouseAreaOfMap3, mouse.x, mouse.y).y)
- }
- onPressedChanged: {
- console.log('oooQML: in QML MapMouseArea3 pressedChanged, pressedButtons: ' + mouseAreaOfMap3.pressedButtons)
- }
- onPressedButtonsChanged: {
- console.log('oooQML: in QML MapMouseArea3 pressedButtonChanged ' + ' pressed button: ' + mouseAreaOfMap3.pressedButtons)
- }
- onReleased: {
- console.log('oooQML: in QML MapMouseArea3 released: ' + mouse.x + ' y: ' + mouse.y)
- }
- onDoubleClicked: {
- console.log('oooQML: in QML MapMouseArea3 doubleclicked---------------------------------------- dump event: ')
- console.log('oooQML: accepted: ' + mouse.accepted);
- console.log('oooQML: button: ' + mouse.button);
- console.log('oooQML: modifiers: ' + mouse.modifiers);
- console.log('oooQML: wasHeld: ' + mouse.wasHeld);
- console.log('oooQML: x: ' + mouse.x);
- console.log('oooQML: y: ' + mouse.y);
- console.log('oooQML: mouse area x,y, width, height: ' + mouseAreaOfMap3.x + ' ' + mouseAreaOfMap3.y + ' ' + mouseAreaOfMap3.width + ' ' + mouseAreaOfMap3.height)
- console.log('oooQML: in QML MapMouseArea3 doubleclicked---------------------------------------- end dump ')
- }
- onClicked: {
- console.log('oooQML: in QML MapMouseArea3 clicked')
- }
- onPositionChanged: {
- console.log('oooQML: in QML MapMouseArea3 position changed, x: ' + mouse.x + ' y: ' + mouse.y
- + ' mouseX: ' + mouseAreaOfMap3.mouseX + ' mouseY: ' + mouseAreaOfMap3.mouseY)
- }
- onEntered: {
- console.log('oooQML: in QML MapMouseArea3 entered')
- }
- onExited: {
- console.log('oooQML: in QML MapMouseArea3 exited')
- }
- onPressAndHold: {
- console.log('oooQML: in QML MapMouseArea3 press and hold')
- }
- // This signal is not officially public per se, but used to notify containsMouse changes
- onHoveredChanged: {
- console.log('oooQML: in QML MapMouseArea3 hoveredChanged, containsMouse is: ' + mouseAreaOfMap3.containsMouse)
- }
- }
-
-
- //focus : true
- center: Coordinate {
- latitude: 51.5
- longitude: -0.11
- }
- // <unsupported so far>
- //rotation: 10 // strangely impacts the size of the map element though
- //transform: Scale { origin.x: 25; origin.y: 25; xScale: 3} // weirdly translates the item
- //transform: Rotation { origin.y: 25; origin.x: 25; angle: 45} // weirdly translates the item
- //z: 4 // map will always be under everything, will not be supported
- //opacity: 0.4 // doesn't probably make sense
- //clip: true // not implemented, not sure if very useful either
- // </unsupported so far>
- }
-
- Rectangle {
- id: referenceMouseAreaRectangleUpper
- color: 'steelblue'
- border.color: "black"
- border.width: 5
- radius: 10
- width: 250
- height: 150
- x: map.width - 250
- y: map.height- 300
- Text { text: " Reference mouse area upper\n (the main reference area)"}
- MouseArea {
- anchors.fill: parent;
- id: referenceMouseAreaUpper
- objectName: 'referenceMouseAreaUpper'
-
- onAcceptedButtonsChanged: {
- console.log('oooQML: in QML Reference MouseArea upper acceptedButtonsChanged: ' + referenceMouseAreaUpper.acceptedButtons)
- }
- onEnabledChanged: {
- console.log('oooQML: in QML Reference MouseArea upper enabledChanged: ' + referenceMouseAreaUpper.enabled)
- }
- onPressed: {
- console.log('oooQML: in QML Reference MouseArea upper pressed, x: ' + mouse.x + ' y:' + mouse.y + ' pressed: ' + pressed)
- }
- onPressedChanged: {
- console.log('oooQML: in QML Reference MouseArea upper pressedChanged ' + ' pressed button: ' + referenceMouseAreaUpper.pressedButtons)
- }
- onReleased: {
- console.log('oooQML: in QML Reference MouseArea upper released: ' + mouse.x + ' y: ' + mouse.y)
- }
- onDoubleClicked: {
- console.log('oooQML: in QML mouse area doubleclicked---------------------------------------- dump event: ')
- console.log('oooQML: accepted: ' + mouse.accepted);
- console.log('oooQML: button: ' + mouse.button);
- console.log('oooQML: modifiers: ' + mouse.modifiers);
- console.log('oooQML: wasHeld: ' + mouse.wasHeld);
- console.log('oooQML: x: ' + mouse.x);
- console.log('oooQML: y: ' + mouse.y);
- console.log('oooQML: in QML Reference MouseArea upper doubleclicked---------------------------------------- end dump ')
- }
- onClicked: {
- console.log('oooQML: in QML Reference MouseArea upper clicked')
- }
- onPositionChanged: {
- console.log('oooQML: in QML MouseArea upper reference position changed, x: ' + mouse.x + ' y: ' + mouse.y)
- }
- onEntered: {
- console.log('oooQML: in QML Reference upper MouseArea entered')
- }
- onExited: {
- console.log('oooQML: in QML Reference MouseArea upper exited')
- }
- onPressAndHold: {
- console.log('oooQML: in QML Reference MouseArea upper press and hold')
- }
- // This signal is not officially public per se, but used to notify containsMouse changes
- onHoveredChanged: {
- console.log('oooQML: in QML Reference MouseArea upper hoveredChanged, containsMouse is: ' + referenceMouseAreaUpper.containsMouse)
- }
- }
- }
-
- Rectangle {
- id: referenceMouseAreaRectangleLower
- color: 'steelblue'
- border.color: "black"
- border.width: 5
- radius: 10
- width: 250
- height: 150
- anchors.top: referenceMouseAreaRectangleUpper.bottom
- anchors.left: referenceMouseAreaRectangleUpper.left
- Text { text: " Reference mouse area lower"}
- MouseArea {
- anchors.fill: parent;
- id: referenceMouseAreaLower
- objectName: 'referenceMouseAreaLower'
- onClicked: console.log('oooQML: clicked: ' + referenceMouseAreaLower.objectName)
-
- onPositionChanged: {
- console.log('oooQML: in QML MouseArea lower reference position changed, x: ' + mouse.x + ' y: ' + mouse.y)
- }
- onEntered: {
- console.log('oooQML: in QML Reference lower MouseArea entered')
- }
- onExited: {
- console.log('oooQML: in QML Reference MouseArea lower exited')
- }
-
- }
- }
-
- Rectangle {
- id: referenceMouseAreaRectangleOverlapping
- color: 'red'
- border.color: "black"
- border.width: 5
- radius: 10
- opacity: 0.5
- z: 30
- width: referenceMouseAreaRectangleUpper.width / 2
- height: referenceMouseAreaRectangleUpper.height * 2
- //width: 100
- //height: 100
- //x: 100
- //y: 100
- x: referenceMouseAreaRectangleUpper.x + 150
- y: referenceMouseAreaRectangleUpper.y
- Text { text: " Reference\nmouse\noverlap"}
- MouseArea {
- anchors.fill: parent;
- id: referenceMouseAreaOverlapping
- objectName: 'referenceMouseAreaOverLapping'
-
- onAcceptedButtonsChanged: {
- console.log('oooQML: in QML Reference MouseArea OL acceptedButtonsChanged: ' + referenceMouseAreaUpper.acceptedButtons)
- }
- onEnabledChanged: {
- console.log('oooQML: in QML Reference MouseArea OL enabledChanged: ' + referenceMouseAreaUpper.enabled)
- }
- onPressed: {
- console.log('oooQML: in QML Reference MouseArea OL pressed: ' + mouse.x + ' y:' + mouse.y + ' pressed: ' + pressed)
- }
- onPressedChanged: {
- console.log('oooQML: in QML Reference MouseArea OL pressedChanged ' + ' pressed button: ' + referenceMouseAreaUpper.pressedButtons)
- }
- onReleased: {
- console.log('oooQML: in QML Reference MouseArea OL released: ' + mouse.x + ' y: ' + mouse.y)
- }
- onDoubleClicked: {
- console.log('oooQML: in QML mouse area doubleclicked---------------------------------------- dump event: ')
- console.log('oooQML: accepted: ' + mouse.accepted);
- console.log('oooQML: button: ' + mouse.button);
- console.log('oooQML: modifiers: ' + mouse.modifiers);
- console.log('oooQML: wasHeld: ' + mouse.wasHeld);
- console.log('oooQML: x: ' + mouse.x);
- console.log('oooQML: y: ' + mouse.y);
- console.log('oooQML: in QML Reference MouseArea doubleclicked---------------------------------------- end dump ')
- }
- onClicked: {
- console.log('oooQML: in QML Reference MouseArea OL clicked')
- }
- onPositionChanged: {
- console.log('oooQML: in QML MouseArea OL reference position changed, x: ' + mouse.x + ' y: ' + mouse.y)
- }
- onEntered: {
- console.log('oooQML: in QML Reference MouseArea OL entered')
- }
- onExited: {
- console.log('oooQML: in QML Reference MouseArea OL exited')
- }
- onPressAndHold: {
- console.log('oooQML: in QML Reference MouseArea OL press and hold')
- }
- // This signal is not officially public per se, but used to notify containsMouse changes
- onHoveredChanged: {
- console.log('oooQML: in QML Reference MouseArea OL hoveredChanged, containsMouse is: ' + referenceMouseAreaUpper.containsMouse)
- }
- }
- }
-
- Row {
- id: buttonRow
- anchors.leftMargin: 2
- anchors.topMargin: 2
- anchors.top: map.bottom;
- spacing: 2
- Rectangle { id: rowRect1; width: 80; height: 65; color: 'peru';
- MouseArea { anchors.fill: parent; onClicked: { map.pinch.maximumZoomLevelChange += 0.1}
- Text {text: "Pinch zoom\nsensitivity+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.maximumZoomLevelChange -= 0.1}
- Text {text: "Pinch zoom\nsensitivity-"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.rotationSpeed += 0.1}
- Text {text: "Pinch rotation\nsensitivity+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.rotationSpeed -= 0.1}
- Text {text: "Pinch rotation\nsensitivity-"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.maximumTiltChange += 1}
- Text {text: "Pinch tilt\nsensitivity+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.pinch.maximumTiltChange -= 1}
- Text {text: "Pinch tilt\nsensitivity-"}
- }
- }
- Rectangle { id: rowRectPinchGen; width: rowRect1.width; height: rowRect1.height; color: 'lightsteelblue';
- Text { text: "Pinch\nzoom:\n" + ((map.pinch.activeGestures & MapPinchArea.ZoomGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('oooQML: map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.ZoomGesture)
- map.pinch.activeGestures &= ~MapPinchArea.ZoomGesture
- else
- map.pinch.activeGestures += MapPinchArea.ZoomGesture
- }
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { text: "Pinch\nrotation:\n" + ((map.pinch.activeGestures & MapPinchArea.RotationGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('oooQML: map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.RotationGesture)
- map.pinch.activeGestures &= ~MapPinchArea.RotationGesture
- else
- map.pinch.activeGestures += MapPinchArea.RotationGesture
- }
- }
- }
-
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { text: "Pinch\ntilt:\n" + ((map.pinch.activeGestures & MapPinchArea.TiltGesture) > 0? "Yes":"No")}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- console.log('oooQML: map pinch active gestures' + map.pinch.activeGestures);
- if (map.pinch.activeGestures & MapPinchArea.TiltGesture)
- map.pinch.activeGestures &= ~MapPinchArea.TiltGesture
- else
- map.pinch.activeGestures += MapPinchArea.TiltGesture
- }
- }
-
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRectPinchGen.color;
- Text { id: generatorEnabledText; text: pinchGenerator.enabled? "Pinch Gen\nEnabled" : "Pinch Gen\nDisabled"; font.bold: true}
- MouseArea {
- anchors.fill: parent;
- onClicked: {
- if (pinchGenerator.focus == true) {
- pinchGenerator.focus = false;
- pinchGenerator.enabled = false;
- pinchGenerator.z = -1
- map.focus = true;
- } else {
- pinchGenerator.focus = true
- pinchGenerator.enabled = true;
- pinchGenerator.z = 10
- map.focus = false
- }
- }
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- Text {text: map.flick.enabled? "Flick\nEnabled":"Flick\nDisabled"; font.bold: true}
- MouseArea { anchors.fill: parent; onClicked: {map.flick.enabled = !map.flick.enabled} }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.flick.deceleration += 200}
- Text {text: "Flick\ndeceleration+"}
- }
- }
- Rectangle { width: rowRect1.width; height: rowRect1.height; color: rowRect1.color;
- MouseArea { anchors.fill: parent; onClicked: {map.flick.deceleration -= 200}
- Text {text: "Flick\ndeceleration-"}
- }
- }
- } // Row
-
- // Info texts
- Row {
- id: textRow1
- spacing: 15
- anchors.top: buttonRow.bottom
- Text {id: firstText; text: "Map zoom level: " + map.zoomLevel; color: 'red'; font.bold: true}
- Text {text: "Pinch zoom sensitivity: " + map.pinch.maximumZoomLevelChange; color: firstText.color; font.bold: true}
- Text {text: "Pinch rotation sensitivity: " + map.pinch.rotationSpeed; color: firstText.color; font.bold: true}
- }
- Row {
- id: textRow2
- spacing: 15
- anchors.top: textRow1.bottom
- Text {text: "Pinch tilt sensitivity: " + map.pinch.maximumTiltChange; color: firstText.color; font.bold: true}
- Text {text: "Flick deceleration: " + map.flick.deceleration; color: firstText.color; font.bold: true}
- Text {text: "Weather: Sunny, mild, late showers."; color: firstText.color; font.bold: true}
- } // info texts
-
- // Row 2 (mouse area)
- Row {
- id: buttonRow2
- anchors.leftMargin: 2
- anchors.topMargin: 2
- anchors.top: textRow2.bottom;
- spacing: 2
- Rectangle { id: rowRect2; width: 80; height: 65; color: 'peru';
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap.enabled? "Map mouse\nenabled":"Map mouse\ndisabled" }
- onClicked: {mouseAreaOfMap.enabled = !mouseAreaOfMap.enabled}
- }
- }
- Rectangle { width: rowRect2.width; height: rowRect2.height; color: rowRect2.color;
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap.hoverEnabled? "MMouseU\nhover\nenabled":"MMouseU\nhover\ndisabled" }
- onClicked: {mouseAreaOfMap.hoverEnabled = !mouseAreaOfMap.hoverEnabled}
- }
- }
- Rectangle { width: rowRect2.width; height: rowRect2.height; color: rowRect2.color;
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap2.hoverEnabled? "MMouseL\nhover\nenabled":"MMouseL\nhover\ndisabled" }
- onClicked: {mouseAreaOfMap2.hoverEnabled = !mouseAreaOfMap2.hoverEnabled}
- }
- }
- Rectangle { width: rowRect2.width; height: rowRect2.height; color: rowRect2.color;
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap3.hoverEnabled? "MMouseO\nhover\nenabled":"MMouseO\nhover\ndisabled" }
- onClicked: {mouseAreaOfMap3.hoverEnabled = !mouseAreaOfMap3.hoverEnabled}
- }
- }
- Rectangle { width: rowRect2.width; height: rowRect2.height; color: rowRect2.color;
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap2.enabled? "Map ML\nenabled":"Map ML\ndisabled" }
- onClicked: {mouseAreaOfMap2.enabled = !mouseAreaOfMap2.enabled}
- }
- }
- }
-
- // Row 3 reference mouse area
- Row {
- id: buttonRow3
- anchors.leftMargin: 2
- anchors.topMargin: 2
- anchors.top: buttonRow2.bottom;
- spacing: 2
- Rectangle { id: rowRect3; width: 80; height: 65; color: 'steelblue';
- MouseArea { anchors.fill: parent;
- Text {text: referenceMouseAreaOverlapping.enabled? "OL mouse\nenabled":"OL mouse\ndisabled" }
- onClicked: {
- //referenceMouseAreaUpper.enabled = !referenceMouseAreaUpper.enabled
- //referenceMouseAreaLower.enabled = !referenceMouseAreaLower.enabled
- referenceMouseAreaOverlapping.enabled = !referenceMouseAreaOverlapping.enabled
- }
- }
- }
- Rectangle { width: rowRect3.width; height: rowRect3.height; color: rowRect3.color;
- MouseArea { anchors.fill: parent;
- Text {text: referenceMouseAreaUpper.hoverEnabled? "Map mouse\nhover enabled":"Map mouse\nhover disabled" }
- onClicked: {
- referenceMouseAreaUpper.hoverEnabled = !referenceMouseAreaUpper.hoverEnabled
- referenceMouseAreaLower.hoverEnabled = !referenceMouseAreaLower.hoverEnabled
- referenceMouseAreaOverlapping.hoverEnabled = !referenceMouseAreaOverlapping.hoverEnabled
- }
- }
- }
- Rectangle { width: rowRect3.width; height: rowRect3.height; color: rowRect3.color;
- MouseArea { anchors.fill: parent;
- Text {text: referenceMouseAreaLower.enabled? "Low mouse\nenabled":"Low mouse\ndisabled" }
- onClicked: {
- //referenceMouseAreaUpper.enabled = !referenceMouseAreaUpper.enabled
- referenceMouseAreaLower.enabled = !referenceMouseAreaLower.enabled
- //referenceMouseAreaOverlapping.enabled = !referenceMouseAreaOverlapping.enabled
- }
- }
- }
- Rectangle { width: rowRect3.width; height: rowRect3.height; color: rowRect3.color;
- MouseArea { anchors.fill: parent;
- Text {text: referenceMouseAreaUpper.enabled? "Up mouse\nenabled":"Up mouse\ndisabled" }
- onClicked: {
- referenceMouseAreaUpper.enabled = !referenceMouseAreaUpper.enabled
- //referenceMouseAreaLower.enabled = !referenceMouseAreaLower.enabled
- //referenceMouseAreaOverlapping.enabled = !referenceMouseAreaOverlapping.enabled
- }
- }
- }
- Rectangle { width: rowRect3.width; height: rowRect3.height; color: rowRect3.color;
- MouseArea { anchors.fill: parent;
- Text {text: mouseAreaOfMap3.enabled? "Map MOL\nenabled":"Map MOL\ndisabled" }
- onClicked: {mouseAreaOfMap3.enabled = !mouseAreaOfMap3.enabled}
- }
- }
- }
- // Row 3 (reference mouse area)
-
- Rectangle {
- id: pinchRect1
- color: 'red'
- visible: false
- z: 10
- width: 5
- height: 5
- }
- Rectangle {
- id: pinchRect2
- color: 'red'
- visible: false
- z: 10
- width: 5
- height: 5
- }
-
- Repeater {
- id: swipeView1
- model: pinchGenerator.swipe1
- delegate: Component {
- Rectangle {
- Text {id: touchPointText}
- Component.onCompleted: {
- if (modelData.touchState == 1) { // Qt.TouchPointPressed
- color = "pink"; width = 15; height = 15
- touchPointText.text = 'From'
- }
- else if (modelData.touchState == 2) { // Qt.TouchPointMoved
- color = 'yellow'; width = 5; height = 5
- }
- else if (modelData.touchState == 8) { // Qt.TouchPointReleased
- color = 'red'; width = 15; height = 15
- touchPointText.text = 'To'
- }
- }
- x: modelData.targetX; y: modelData.targetY
- }
- }
- }
-
- Repeater {
- id: swipeView2
- model: pinchGenerator.swipe2
- delegate: Component {
- Rectangle {
- Text {id: touchPoint2Text}
- Component.onCompleted: {
- if (modelData.touchState == 1) { // Qt.TouchPointPressed
- color = "green"; width = 15; height = 15
- touchPoint2Text.text = 'From'
- }
- else if (modelData.touchState == 2) { // Qt.TouchPointMoved
- color = 'yellow'; width = 5; height = 5
- }
- else if (modelData.touchState == 8) { // Qt.TouchPointReleased
- color = 'blue'; width = 15; height = 15
- touchPoint2Text.text = 'To'
- }
- }
- x: modelData.targetX; y: modelData.targetY
- }
- }
- }
-}
diff --git a/tests/applications/declarative_map/qmlmap3d.cpp b/tests/applications/declarative_map/qmlmap3d.cpp
deleted file mode 100644
index 9b4a1763..00000000
--- a/tests/applications/declarative_map/qmlmap3d.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <QtGui/QGuiApplication>
-#include <QtCore/QStringList>
-#include <QtQml/QQmlEngine>
-#include <QNetworkProxy>
-#include <QtQuick/qquickview.h>
-
-// QML2 app
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- QQuickView view;
- const QString mainQmlApp = QLatin1String("qrc:///map3d.qml");
- view.setSource(QUrl(mainQmlApp));
- // Temporary development-time proxy setting. TODO improve later.
- QNetworkProxy proxy;
- proxy.setType(QNetworkProxy::HttpProxy);
- proxy.setHostName("nokes.nokia.com");
- proxy.setPort(8080);
- QNetworkProxy::setApplicationProxy(proxy);
- // Qt.quit() called in embedded .qml by default only emits
- // quit() signal, so do this (optionally use Qt.exit()).
- QObject::connect(view.engine(), SIGNAL(quit()), qApp, SLOT(quit()));
- if (QCoreApplication::arguments().contains(QLatin1String("-maximize"))) {
- view.showMaximized();
- } else if (QCoreApplication::arguments().contains(QLatin1String("-fullscreen"))) {
- view.showFullScreen();
- } else {
- //view.setGeometry(QRect(100, 100, 360, 640));
- //view.showMaximized();
- view.show();
- }
- view.raise();
- return app.exec();
-}
diff --git a/tests/applications/declarative_map/quit.png b/tests/applications/declarative_map/quit.png
deleted file mode 100644
index 5bda1b6e..00000000
--- a/tests/applications/declarative_map/quit.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/button.png b/tests/applications/declarative_map/resources/button.png
deleted file mode 100644
index 11310013..00000000
--- a/tests/applications/declarative_map/resources/button.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/button.sci b/tests/applications/declarative_map/resources/button.sci
deleted file mode 100644
index a34a58b6..00000000
--- a/tests/applications/declarative_map/resources/button.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 15
-border.top: 4
-border.bottom: 4
-border.right: 15
-source: button.png
diff --git a/tests/applications/declarative_map/resources/button_hovered.png b/tests/applications/declarative_map/resources/button_hovered.png
deleted file mode 100644
index 7c9b9b63..00000000
--- a/tests/applications/declarative_map/resources/button_hovered.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/button_pressed.png b/tests/applications/declarative_map/resources/button_pressed.png
deleted file mode 100644
index b290b6b9..00000000
--- a/tests/applications/declarative_map/resources/button_pressed.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/menuItem.png b/tests/applications/declarative_map/resources/menuItem.png
deleted file mode 100644
index 51c90082..00000000
--- a/tests/applications/declarative_map/resources/menuItem.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/menuItem.sci b/tests/applications/declarative_map/resources/menuItem.sci
deleted file mode 100644
index 0418d94c..00000000
--- a/tests/applications/declarative_map/resources/menuItem.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
diff --git a/tests/applications/declarative_map/resources/menuItem_hovered.png b/tests/applications/declarative_map/resources/menuItem_hovered.png
deleted file mode 100644
index 16c1a94e..00000000
--- a/tests/applications/declarative_map/resources/menuItem_hovered.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/menuItem_pressed.png b/tests/applications/declarative_map/resources/menuItem_pressed.png
deleted file mode 100644
index 3ab14f1f..00000000
--- a/tests/applications/declarative_map/resources/menuItem_pressed.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/quit.png b/tests/applications/declarative_map/resources/quit.png
deleted file mode 100644
index 5bda1b6e..00000000
--- a/tests/applications/declarative_map/resources/quit.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/quit_hovered.png b/tests/applications/declarative_map/resources/quit_hovered.png
deleted file mode 100644
index d4b900cf..00000000
--- a/tests/applications/declarative_map/resources/quit_hovered.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/quit_pressed.png b/tests/applications/declarative_map/resources/quit_pressed.png
deleted file mode 100644
index 05c4ef83..00000000
--- a/tests/applications/declarative_map/resources/quit_pressed.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/titlebar.png b/tests/applications/declarative_map/resources/titlebar.png
deleted file mode 100644
index 51c90082..00000000
--- a/tests/applications/declarative_map/resources/titlebar.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/resources/titlebar.sci b/tests/applications/declarative_map/resources/titlebar.sci
deleted file mode 100644
index 0418d94c..00000000
--- a/tests/applications/declarative_map/resources/titlebar.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
diff --git a/tests/applications/declarative_map/titlebar.png b/tests/applications/declarative_map/titlebar.png
deleted file mode 100644
index 51c90082..00000000
--- a/tests/applications/declarative_map/titlebar.png
+++ /dev/null
Binary files differ
diff --git a/tests/applications/declarative_map/titlebar.sci b/tests/applications/declarative_map/titlebar.sci
deleted file mode 100644
index 0418d94c..00000000
--- a/tests/applications/declarative_map/titlebar.sci
+++ /dev/null
@@ -1,5 +0,0 @@
-border.left: 10
-border.top: 12
-border.bottom: 12
-border.right: 10
-source: titlebar.png
diff --git a/tests/applications/positioning_backend/main.cpp b/tests/applications/positioning_backend/main.cpp
index 99ca3578..454a8486 100644
--- a/tests/applications/positioning_backend/main.cpp
+++ b/tests/applications/positioning_backend/main.cpp
@@ -39,14 +39,14 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
- Widget w1;
- Widget w2;
+ Widget *w1 = new Widget;
+ Widget *w2 = new Widget;
QTabWidget tabWidget;
tabWidget.setTabPosition(QTabWidget::South);
- tabWidget.addTab(&w1, "Instance 1");
- tabWidget.addTab(&w2, "Instance 2");
+ tabWidget.addTab(w1, "Instance 1");
+ tabWidget.addTab(w2, "Instance 2");
tabWidget.show();
return a.exec();
diff --git a/tests/auto/declarative_core/declarative_core.pro b/tests/auto/declarative_core/declarative_core.pro
index 34f54b2a..f6c7a11a 100644
--- a/tests/auto/declarative_core/declarative_core.pro
+++ b/tests/auto/declarative_core/declarative_core.pro
@@ -6,6 +6,8 @@ TARGET = tst_declarative_core
CONFIG += qmltestcase
SOURCES += main.cpp
+CONFIG -= app_bundle
+
QT += location quick
OTHER_FILES = *.qml *.js
diff --git a/tests/auto/declarative_core/main.cpp b/tests/auto/declarative_core/main.cpp
index d910270a..261c7094 100644
--- a/tests/auto/declarative_core/main.cpp
+++ b/tests/auto/declarative_core/main.cpp
@@ -37,8 +37,13 @@
static void initializeLibraryPath()
{
// Set custom path since CI doesn't install test plugins
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
QStringLiteral("/../../../plugins"));
+#endif
}
Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
diff --git a/tests/auto/declarative_core/tst_coordinate.qml b/tests/auto/declarative_core/tst_coordinate.qml
index 02740a57..7fc0771a 100644
--- a/tests/auto/declarative_core/tst_coordinate.qml
+++ b/tests/auto/declarative_core/tst_coordinate.qml
@@ -33,7 +33,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtPositioning 5.2
+import QtPositioning 5.5
Item {
id: item
@@ -73,10 +73,38 @@ Item {
id: invalidLocation
}
+
+ Item {
+ id: coordinateItem
+ property variant coordinate
+ property int animationDuration: 100
+ property var coordinateList: []
+ property int coordinateCount: 0
+
+ CoordinateAnimation {
+ id: coordinateAnimation
+ target: coordinateItem
+ property: "coordinate"
+ duration: coordinateItem.animationDuration
+ }
+ onCoordinateChanged: {
+ if (!coordinateList) {
+ coordinateList = []
+ }
+ coordinateList[coordinateCount] = QtPositioning.coordinate(coordinate.latitude,coordinate.longitude)
+ coordinateCount++
+ }
+
+ SignalSpy { id: coordinateAnimationStartSpy; target: coordinateAnimation; signalName: "started" }
+ SignalSpy { id: coordinateAnimationStopSpy; target: coordinateAnimation; signalName: "stopped" }
+ SignalSpy { id: coordinateAnimationDirectionSpy; target: coordinateAnimation; signalName: "directionChanged" }
+ }
+
TestCase {
name: "GeoLocation"
- function test_Location_complete() {
+ function test_Location_complete()
+ {
compare (testLocation.coordinate.longitude, inside.longitude)
compare (testLocation.coordinate.latitude, inside.latitude)
@@ -93,7 +121,8 @@ Item {
compare (testLocation.address.street, "53 Brandl St")
}
- function test_Location_invalid() {
+ function test_Location_invalid()
+ {
compare(invalidLocation.coordinate.isValid, false)
compare(invalidLocation.boundingBox.isEmpty, true)
compare(invalidLocation.boundingBox.isValid, false)
@@ -104,7 +133,8 @@ Item {
TestCase {
name: "Coordinate"
- function test_validity() {
+ function test_validity()
+ {
compare(empty.isValid, false)
empty.longitude = 0.0;
@@ -113,7 +143,8 @@ Item {
compare(empty.isValid, true)
}
- function test_accessors() {
+ function test_accessors()
+ {
compare(base.longitude, 1.0)
compare(base.latitude, 1.0)
compare(base.altitude, 5.0)
@@ -130,7 +161,8 @@ Item {
compare(coordSpy.count, 3)
}
- function test_comparison_data() {
+ function test_comparison_data()
+ {
return [
{ tag: "empty", coord1: empty, coord2: QtPositioning.coordinate(), result: true },
{ tag: "zero", coord1: zero, coord2: QtPositioning.coordinate(0, 0), result: true },
@@ -143,27 +175,31 @@ Item {
]
}
- function test_comparison(data) {
+ function test_comparison(data)
+ {
compare(data.coord1 === data.coord2, data.result)
compare(data.coord1 !== data.coord2, !data.result)
compare(data.coord1 == data.coord2, data.result)
compare(data.coord1 != data.coord2, !data.result)
}
- function test_distance() {
+ function test_distance()
+ {
compare(zero.distanceTo(plusone), zero.distanceTo(minusone))
compare(2*plusone.distanceTo(zero), plusone.distanceTo(minusone))
compare(zero.distanceTo(plusone) > 0, true)
}
- function test_azimuth() {
+ function test_azimuth()
+ {
compare(zero.azimuthTo(north), 0)
compare(zero.azimuthTo(plusone), 90)
compare(zero.azimuthTo(minusone), 270)
compare(minusone.azimuthTo(plusone), 360 - plusone.azimuthTo(minusone))
}
- function test_atDistanceAndAzimuth() {
+ function test_atDistanceAndAzimuth()
+ {
// 112km is approximately one degree of arc
var coord_0d = zero.atDistanceAndAzimuth(112000, 0)
@@ -192,4 +228,137 @@ Item {
compare(zero.distanceTo(coord_30d2), 20200)
}
}
+
+ TestCase {
+ name: "CoordinateAnimation"
+
+ function init()
+ {
+ coordinateAnimation.stop()
+ coordinateAnimationStartSpy.clear()
+ coordinateAnimationStopSpy.clear()
+ coordinateAnimationDirectionSpy.clear()
+ coordinateAnimation.from = QtPositioning.coordinate(50,50)
+ coordinateAnimation.to = QtPositioning.coordinate(50,50)
+ coordinateAnimation.direction = CoordinateAnimation.Shortest
+ coordinateItem.coordinate = QtPositioning.coordinate(50,50)
+ coordinateItem.coordinateList = []
+ coordinateItem.coordinateCount = 0
+ }
+
+ function initTestCase()
+ {
+ compare(coordinateAnimation.direction, CoordinateAnimation.Shortest)
+ compare(coordinateAnimationDirectionSpy.count,0)
+ coordinateAnimation.direction = CoordinateAnimation.Shortest
+ compare(coordinateAnimationDirectionSpy.count,0)
+ coordinateAnimation.direction = CoordinateAnimation.West
+ compare(coordinateAnimationDirectionSpy.count,1)
+ coordinateAnimation.direction = CoordinateAnimation.East
+ compare(coordinateAnimationDirectionSpy.count,2)
+ }
+
+ function toMercator(coord)
+ {
+ var pi = Math.PI
+ var lon = coord.longitude / 360.0 + 0.5;
+
+ var lat = coord.latitude;
+ lat = 0.5 - (Math.log(Math.tan((pi / 4.0) + (pi / 2.0) * lat / 180.0)) / pi) / 2.0;
+ lat = Math.max(0.0, lat);
+ lat = Math.min(1.0, lat);
+
+ return {'latitude': lat, 'longitude': lon};
+ }
+
+ function coordinate_animation(from, to, movingEast)
+ {
+ var fromMerc = toMercator(from)
+ var toMerc = toMercator(to)
+ var delta = (toMerc.latitude - fromMerc.latitude) / (toMerc.longitude - fromMerc.longitude)
+
+ compare(coordinateItem.coordinateList.length, 0);
+ coordinateAnimation.from = from
+ coordinateAnimation.to = to
+ coordinateAnimation.start()
+ tryCompare(coordinateAnimationStartSpy,"count",1)
+ tryCompare(coordinateAnimationStopSpy,"count",1)
+
+ //check correct start position
+ compare(coordinateItem.coordinateList[0], from)
+ //check correct end position
+ compare(coordinateItem.coordinateList[coordinateItem.coordinateList.length - 1],to)
+
+ var i
+ var lastLongitude
+ for (i in coordinateItem.coordinateList) {
+ var coordinate = coordinateItem.coordinateList[i]
+ var mercCoordinate = toMercator(coordinate)
+
+ //check that coordinates from the animation is along a straight line between from and to
+ var estimatedLatitude = fromMerc.latitude + (mercCoordinate.longitude - fromMerc.longitude) * delta
+ verify(mercCoordinate.latitude - estimatedLatitude < 0.00000000001);
+
+ //check that each step has moved in the right direction
+
+ if (lastLongitude) {
+ if (movingEast) {
+ if (coordinate.longitude > 0 && lastLongitude < 0)
+ verify(coordinate.longitude < lastLongitude + 360)
+ else
+ verify(coordinate.longitude < lastLongitude)
+ } else {
+ if (coordinate.longitude < 0 && lastLongitude > 0)
+ verify(coordinate.longitude + 360 > lastLongitude)
+ else
+ verify(coordinate.longitude > lastLongitude)
+ }
+ }
+ lastLongitude = coordinate.longitude
+ }
+ }
+
+ function test_default_coordinate_animation()
+ {
+ //shortest
+ coordinate_animation(QtPositioning.coordinate(58.0,12.0),
+ QtPositioning.coordinate(62.0,24.0),
+ false)
+ }
+
+ function test_east_direction_coordinate_animation(data)
+ {
+ coordinateAnimation.direction = CoordinateAnimation.East
+ coordinate_animation(data.from,
+ data.to,
+ true)
+ }
+
+ function test_east_direction_coordinate_animation_data()
+ {
+ return [
+ { from: QtPositioning.coordinate(58.0,24.0), to: QtPositioning.coordinate(58.0,12.0) },
+ { from: QtPositioning.coordinate(58.0,12.0), to: QtPositioning.coordinate(58.0,24.0) },
+ ]
+ }
+
+
+ function test_west_direction_coordinate_animation(data)
+ {
+ coordinateAnimation.direction = CoordinateAnimation.West
+ coordinate_animation(data.from,
+ data.to,
+ false)
+ }
+
+ function test_west_direction_coordinate_animation_data()
+ {
+ return [
+ { from: QtPositioning.coordinate(58.0,24.0),to: QtPositioning.coordinate(58.0,12.0) },
+ { from: QtPositioning.coordinate(58.0,12.0),to: QtPositioning.coordinate(58.0,24.0) },
+ ]
+ }
+
+
+ }
}
diff --git a/tests/auto/declarative_ui/tst_map_geocoding.qml b/tests/auto/declarative_core/tst_geocoding.qml
index 1828c1ba..984fde65 100644
--- a/tests/auto/declarative_ui/tst_map_geocoding.qml
+++ b/tests/auto/declarative_core/tst_geocoding.qml
@@ -37,8 +37,14 @@ import QtLocation 5.3
import QtPositioning 5.2
Item {
- Plugin { id: herePlugin; name: "qmlgeo.test.plugin"; allowExperimental: true}
- Plugin { id: invalidPlugin; name: "invalid"}
+ Plugin { id: testPlugin1; name: "qmlgeo.test.plugin"; allowExperimental: true}
+ Plugin { id: errorPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true
+ parameters: [
+ PluginParameter { name: "error"; value: "1"},
+ PluginParameter { name: "errorString"; value: "This error was expected. No worries !"}
+ ]
+ }
+
property variant coordinate1: QtPositioning.coordinate(51, 41)
property variant coordinate2: QtPositioning.coordinate(52, 42)
@@ -64,7 +70,7 @@ Item {
TestCase {
id: testCase1
- name: "Map GeocodeModel basic API"
+ name: "GeocodeModel"
function test_model_defaults_and_setters() {
// Query: address
compare (querySpy.count, 0)
@@ -162,26 +168,54 @@ Item {
// Plugin
compare(pluginSpy.count, 0)
- emptyModel.plugin = herePlugin
+ emptyModel.plugin = testPlugin1
compare(pluginSpy.count, 1)
- compare(emptyModel.plugin, herePlugin)
- emptyModel.plugin = herePlugin
+ compare(emptyModel.plugin, testPlugin1)
+ emptyModel.plugin = testPlugin1
compare(pluginSpy.count, 1)
- emptyModel.plugin = invalidPlugin
+ emptyModel.plugin = errorPlugin
compare(pluginSpy.count, 2)
}
// Test that model acts gracefully when plugin is not set or is invalid
- // (does not support routing)
- GeocodeModel {id: invalidModel; plugin: invalidPlugin}
- SignalSpy {id: countInvalidSpy; target: invalidModel; signalName: "countChanged"}
- function test_invalid_plugin() {
- invalidModel.update()
- invalidModel.cancel()
- invalidModel.reset()
- invalidModel.update()
- invalidModel.get(-1)
- invalidModel.get(1)
- }
+ // (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() {
+ // 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.EngineNotSetError)
+ compare(errorModel.errorString,qsTr("Cannot geocode, geocode manager not set."))
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ errorModel.cancel()
+ compare(errorModel.error,GeocodeModel.NoError)
+ compare(errorModel.errorString,"")
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ errorModel.reset()
+ compare(errorModel.error,GeocodeModel.NoError)
+ compare(errorModel.errorString,"")
+ compare(errorSpy.count, 0)
+ errorSpy.clear()
+ errorModel.update()
+ compare(errorModel.error,GeocodeModel.EngineNotSetError)
+ compare(errorModel.errorString,qsTr("Cannot geocode, geocode manager not set."))
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ var location = errorModel.get(-1)
+ compare(location, null)
+ }
}
Address {id: address1; street: "wellknown street"; city: "expected city"; county: "2"}
@@ -196,7 +230,7 @@ Item {
Address {id: automaticAddress1; street: "Auto st"; city: "Detroit"; county: "4"}
Plugin {
- id: testPlugin;
+ id: testPlugin2;
name: "qmlgeo.test.plugin"
allowExperimental: true
parameters: [
@@ -243,7 +277,7 @@ Item {
]
}
- GeocodeModel {id: testModel; plugin: testPlugin}
+ GeocodeModel {id: testModel; plugin: testPlugin2}
SignalSpy {id: locationsSpy; target: testModel; signalName: "locationsChanged"}
SignalSpy {id: countSpy; target: testModel; signalName: "countChanged"}
SignalSpy {id: testQuerySpy; target: testModel; signalName: "queryChanged"}
@@ -253,7 +287,7 @@ Item {
SignalSpy {id: locationsSlackSpy; target: slackModel; signalName: "locationsChanged"}
SignalSpy {id: countSlackSpy; target: slackModel; signalName: "countChanged"}
SignalSpy {id: querySlackSpy; target: slackModel; signalName: "queryChanged"}
- SignalSpy {id: errorStringSlackSpy; target: slackModel; signalName: "errorStringChanged"}
+ SignalSpy {id: errorStringSlackSpy; target: slackModel; signalName: "errorChanged"}
SignalSpy {id: errorSlackSpy; target: slackModel; signalName: "errorChanged"}
SignalSpy {id: pluginSlackSpy; target: slackModel; signalName: "pluginChanged"}
@@ -262,14 +296,14 @@ Item {
SignalSpy {id: countImmediateSpy; target: immediateModel; signalName: "countChanged"}
SignalSpy {id: queryImmediateSpy; target: immediateModel; signalName: "queryChanged"}
SignalSpy {id: statusImmediateSpy; target: immediateModel; signalName: "statusChanged"}
- SignalSpy {id: errorStringImmediateSpy; target: immediateModel; signalName: "errorStringChanged"}
+ SignalSpy {id: errorStringImmediateSpy; target: immediateModel; signalName: "errorChanged"}
SignalSpy {id: errorImmediateSpy; target: immediateModel; signalName: "errorChanged"}
GeocodeModel {id: automaticModel; plugin: autoPlugin; query: automaticAddress1; autoUpdate: true}
SignalSpy {id: automaticLocationsSpy; target: automaticModel; signalName: "locationsChanged"}
TestCase {
- name: "Map GeocodeModel basic (reverse) geocoding"
+ name: "GeocodeModelGeocoding"
function clear_slack_model() {
slackModel.reset()
locationsSlackSpy.clear()
@@ -332,7 +366,7 @@ Item {
slackModel.update()
wait (100)
compare (countSlackSpy.count, 0)
- slackModel.plugin = invalidPlugin
+ slackModel.plugin = errorPlugin
wait (200)
compare (countSlackSpy.count, 0)
compare (pluginSlackSpy.count, 1)
@@ -416,7 +450,7 @@ Item {
compare (slackModel.errorString, "")
compare (slackModel.error, GeocodeModel.NoError)
}
- function test_basic_address_geocode() {
+ function test_address_geocode() {
testQuerySpy.clear()
locationsSpy.clear()
testStatusSpy.clear()
@@ -440,7 +474,7 @@ Item {
compare (testModel.get(0).address.city, "expected city")
}
- function test_basic_freetext_geocode() {
+ function test_freetext_geocode() {
testQuerySpy.clear()
locationsSpy.clear()
testStatusSpy.clear()
@@ -486,9 +520,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()
@@ -510,9 +543,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
}
@@ -548,8 +580,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
@@ -572,12 +603,11 @@ 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_basic_reverse_geocode() {
+ function test_reverse_geocode() {
testModel.reset()
testQuerySpy.clear()
locationsSpy.clear()
@@ -608,8 +638,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
@@ -632,9 +662,9 @@ 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
}
}
diff --git a/tests/auto/declarative_core/tst_map_routing.qml b/tests/auto/declarative_core/tst_routing.qml
index 28c9eb54..3567bc1a 100644
--- a/tests/auto/declarative_core/tst_map_routing.qml
+++ b/tests/auto/declarative_core/tst_routing.qml
@@ -38,7 +38,12 @@ import QtPositioning 5.2
Item {
Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true }
- Plugin { id: invalidPlugin; name: "invalid"}
+ Plugin { id: errorPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true
+ parameters: [
+ PluginParameter { name: "error"; value: "1"},
+ PluginParameter { name: "errorString"; value: "This error was expected. No worries !"}
+ ]
+ }
property variant coordinate1: QtPositioning.coordinate(51, 0)
property variant coordinate2: QtPositioning.coordinate(52, 0)
@@ -431,7 +436,7 @@ Item {
compare(emptyModel.plugin, testPlugin)
emptyModel.plugin = testPlugin
compare(pluginSpy.count, 1)
- emptyModel.plugin = invalidPlugin
+ emptyModel.plugin = errorPlugin
compare(pluginSpy.count, 2)
// Must act gracefully
@@ -440,14 +445,43 @@ Item {
}
// Test that model acts gracefully when plugin is not set or is invalid
// (does not support routing)
- RouteModel {id: invalidModel; plugin: invalidPlugin}
- SignalSpy {id: countInvalidSpy; target: invalidModel; signalName: "countChanged"}
- function test_invalid_plugin() {
- invalidModel.update()
- invalidModel.reset()
- invalidModel.update()
- invalidModel.get(-1)
- invalidModel.get(1)
+ 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() {
+ // 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.EngineNotSetError)
+ compare(errorModel.errorString,qsTr("Cannot route, route manager not set."))
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ errorModel.cancel()
+ compare(errorModel.error,RouteModel.NoError)
+ compare(errorModel.errorString,"")
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ errorModel.reset()
+ compare(errorModel.error,RouteModel.NoError)
+ compare(errorModel.errorString,"")
+ compare(errorSpy.count, 0)
+ errorSpy.clear()
+ errorModel.update()
+ compare(errorModel.error,RouteModel.EngineNotSetError)
+ compare(errorModel.errorString,qsTr("Cannot route, route manager not set."))
+ compare(errorSpy.count, 1)
+ errorSpy.clear()
+ var data = errorModel.get(-1)
+ compare(data, null)
}
}
@@ -532,7 +566,7 @@ Item {
SignalSpy {id: testRoutesSpy; target: routeModel; signalName: "routesChanged"}
SignalSpy {id: testCountSpy; target: routeModel; signalName: "countChanged" }
SignalSpy {id: testStatusSpy; target: routeModel; signalName: "statusChanged"}
- SignalSpy {id: testErrorStringSpy; target: routeModel; signalName: "errorStringChanged"}
+ SignalSpy {id: testErrorStringSpy; target: routeModel; signalName: "errorChanged"}
SignalSpy {id: testErrorSpy; target: routeModel; signalName: "errorChanged"}
SignalSpy {id: testWaypointsSpy; target: routeQuery; signalName: "waypointsChanged"}
@@ -540,7 +574,7 @@ Item {
SignalSpy {id: testRoutesSlackSpy; target: routeModelSlack; signalName: "routesChanged"}
SignalSpy {id: testCountSlackSpy; target: routeModelSlack; signalName: "countChanged" }
SignalSpy {id: testStatusSlackSpy; target: routeModelSlack; signalName: "statusChanged"}
- SignalSpy {id: testErrorStringSlackSpy; target: routeModelSlack; signalName: "errorStringChanged"}
+ SignalSpy {id: testErrorStringSlackSpy; target: routeModelSlack; signalName: "errorChanged"}
SignalSpy {id: testErrorSlackSpy; target: routeModelSlack; signalName: "errorChanged"}
SignalSpy {id: testPluginSlackSpy; target: routeModelSlack; signalName: "pluginChanged"}
@@ -588,8 +622,7 @@ Item {
compare (routeModelSlack.count, 0)
// Check that results are cleared
routeModelSlack.update()
- wait (300)
- compare (routeModelSlack.count, 3) // numberALternativeRoutes
+ tryCompare(routeModelSlack, "count", 3) // numberALternativeRoutes
routeModelSlack.reset()
compare (routeModelSlack.count, 0)
// Check that changing plugin resets any ongoing requests
@@ -682,8 +715,7 @@ Item {
wait (100)
compare (testRoutesSlackSpy.count, 0)
compare (testCountSlackSpy.count, 0)
- wait (200)
- compare (testRoutesSlackSpy.count, 1)
+ tryCompare(testRoutesSlackSpy, "count", 1)
compare (testCountSlackSpy.count, 1)
compare(routeModelSlack.count, 1)
compare (routeModelSlack.get(0).path.length, 5)
@@ -709,31 +741,27 @@ Item {
wait (100)
compare(testRoutesSlackSpy.count, 0)
compare(testCountSlackSpy.count, 0)
- wait (200)
- compare (testRoutesSlackSpy.count, 1)
+ tryCompare(testRoutesSlackSpy, "count", 1)
compare(testCountSlackSpy.count, 1)
compare(routeModelSlack.count, 1)
// 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);
@@ -746,15 +774,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
@@ -765,8 +791,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);
}
diff --git a/tests/auto/declarative_ui/declarative_ui.pro b/tests/auto/declarative_ui/declarative_ui.pro
index 1936fbc6..89518a5c 100644
--- a/tests/auto/declarative_ui/declarative_ui.pro
+++ b/tests/auto/declarative_ui/declarative_ui.pro
@@ -6,6 +6,8 @@ TARGET = tst_declarative_ui
!no_ui_tests:CONFIG += qmltestcase
SOURCES += main.cpp
+CONFIG -= app_bundle
+
QT += location quick
OTHER_FILES = *.qml
diff --git a/tests/auto/declarative_ui/main.cpp b/tests/auto/declarative_ui/main.cpp
index 13f5de4e..0e448a6e 100644
--- a/tests/auto/declarative_ui/main.cpp
+++ b/tests/auto/declarative_ui/main.cpp
@@ -37,8 +37,13 @@
static void initializeLibraryPath()
{
// Set custom path since CI doesn't install test plugins
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
QStringLiteral("/../../../plugins"));
+#endif
}
Q_COREAPP_STARTUP_FUNCTION(initializeLibraryPath)
diff --git a/tests/auto/declarative_ui/tst_map.qml b/tests/auto/declarative_ui/tst_map.qml
index 7b485256..34f109d1 100644
--- a/tests/auto/declarative_ui/tst_map.qml
+++ b/tests/auto/declarative_ui/tst_map.qml
@@ -33,8 +33,8 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
+import QtLocation 5.6
+import QtPositioning 5.5
Item {
width:100
@@ -44,15 +44,15 @@ Item {
Plugin { id: testPlugin2; name: "gmlgeo.test.plugin"; allowExperimental: true }
Plugin { id: herePlugin; name: "here";
parameters: [
- PluginParameter {
- name: "here.app_id"
- value: "stub"
- },
- PluginParameter {
- name: "here.token"
- value: "stub"
- }
- ]
+ PluginParameter {
+ name: "here.app_id"
+ value: "stub"
+ },
+ PluginParameter {
+ name: "here.token"
+ value: "stub"
+ }
+ ]
}
property variant coordinate1: QtPositioning.coordinate(10, 11)
@@ -64,12 +64,12 @@ Item {
property variant altitudelessCoordinate: QtPositioning.coordinate(50, 50)
Map { id: mapZoomOnCompleted; width: 200; height: 200;
- zoomLevel: 3; center: coordinate1; plugin: testPlugin;
- Component.onCompleted: { zoomLevel = 7 } }
+ zoomLevel: 3; center: coordinate1; plugin: testPlugin;
+ Component.onCompleted: { zoomLevel = 7 } }
Map { id: mapZoomDefault; width: 200; height: 200;
- center: coordinate1; plugin: testPlugin; }
+ center: coordinate1; plugin: testPlugin; }
Map { id: mapZoomUserInit; width: 200; height: 200;
- zoomLevel: 4; center: coordinate1; plugin: testPlugin; }
+ zoomLevel: 4; center: coordinate1; plugin: testPlugin; }
Map {id: map; plugin: testPlugin; center: coordinate1; width: 100; height: 100}
Map {id: coordinateMap; plugin: herePlugin; center: coordinate3; width: 1000; height: 1000; zoomLevel: 15}
@@ -78,7 +78,7 @@ Item {
TestCase {
when: windowShown
- name: "Basic Map properties"
+ name: "MapProperties"
function fuzzy_compare(val, ref) {
var tolerance = 0.01;
@@ -88,9 +88,11 @@ Item {
return false;
}
- function test_map_center() {
+ function init() {
mapCenterSpy.clear();
+ }
+ function test_map_center() {
// coordinate is set at map element declaration
compare(map.center.latitude, 10)
compare(map.center.longitude, 11)
@@ -117,7 +119,8 @@ Item {
compare(map.center.latitude, 12)
}
- function test_zoom_limits() {
+ function test_zoom_limits()
+ {
map.center.latitude = 30
map.center.longitude = 60
map.zoomLevel = 4
@@ -156,7 +159,8 @@ Item {
compare(map.maximumZoomLevel, 20)
}
- function test_zoom() {
+ function test_zoom()
+ {
wait(100)
compare(mapZoomOnCompleted.zoomLevel, 7)
compare(mapZoomDefault.zoomLevel, 8)
@@ -168,7 +172,8 @@ Item {
}
- function test_pan() {
+ function test_pan()
+ {
map.center.latitude = 30
map.center.longitude = 60
map.zoomLevel = 4
@@ -250,7 +255,8 @@ Item {
mapCenterSpy.clear()
}
- function test_coordinate_conversion() {
+ function test_coordinate_conversion()
+ {
wait(1000)
mapCenterSpy.clear();
compare(coordinateMap.center.latitude, 50)
diff --git a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml
index e9614f6b..ec8042fd 100644
--- a/tests/auto/declarative_ui/tst_map_coordinateanimation.qml
+++ b/tests/auto/declarative_ui/tst_map_coordinateanimation.qml
@@ -33,8 +33,8 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.3
+import QtLocation 5.6
+import QtPositioning 5.5
Item {
width:100
@@ -54,7 +54,6 @@ Item {
Behavior on center {
id: centerBehavior
-
enabled: false
CoordinateAnimation { duration: animationDuration }
}
@@ -83,7 +82,7 @@ Item {
TestCase {
when: windowShown
- name: "Coordinate animation"
+ name: "CoordinateAnimation"
function test_coordinate_animation() {
diff --git a/tests/auto/declarative_ui/tst_map_error.qml b/tests/auto/declarative_ui/tst_map_error.qml
index 96ce127f..68752f11 100644
--- a/tests/auto/declarative_ui/tst_map_error.qml
+++ b/tests/auto/declarative_ui/tst_map_error.qml
@@ -33,54 +33,190 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
-import QtLocation.test 5.0
-
+import QtLocation 5.6
+import QtPositioning 5.5
Item {
id: page
x: 0; y: 0;
- width: 120
- height: 120
+ width: 200
+ height: 100
+ property variant coordinate: QtPositioning.coordinate(20, 20)
- Plugin { id: errorPlugin;
- name: "qmlgeo.test.plugin"
- allowExperimental: true
- parameters: [
- PluginParameter { name: "error"; value: "1"},
- PluginParameter { name: "errorString"; value: "This error was expected. No worries !"}
- ]
- }
+ Plugin {
+ id: errorPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true
+ parameters: [
+ PluginParameter { name: "error"; value: "1"},
+ PluginParameter { name: "errorString"; value: "This error was expected. No worries !"}
+ ]
+ }
Map {
- id: map;
+ id: map_error_plugin;
+ property alias mouseClickedSpy: mouseClickedSpy1
x: 0; y: 0; width: 100; height: 100; plugin: errorPlugin;
- center {
- latitude: 20
- longitude: 20
- }
MouseArea {
- id: mouseArea
+ id: mouseArea1
objectName: "mouseArea"
- x: 0; y: 0; width: 100; height: 100
+ x: 25; y: 25; width: 50; height: 50;
preventStealing: true
}
+
+ SignalSpy {id: mouseClickedSpy1; target: mouseArea1; signalName: "clicked"}
}
- SignalSpy {id: mouseClickedSpy; target: mouseArea; signalName: "clicked"}
+ Map {
+ id: map_no_plugin;
+ property alias mouseClickedSpy: mouseClickedSpy2
+ x: 100; y: 0; width: 100; height: 100;
+
+ MouseArea {
+ id: mouseArea2
+ objectName: "mouseArea"
+ x: 25; y: 25; width: 50; height: 50;
+ preventStealing: true
+ }
+
+ SignalSpy {id: mouseClickedSpy2; target: mouseArea2; signalName: "clicked"}
+ }
TestCase {
- name: "MouseAreaWithoutInitializedMap"
+ name: "MapErrorHandling"
when: windowShown
- function test_basic_click() {
- wait(50);
- mouseClick(map, 5, 25)
- mouseClick(map, 5, 25)
- mouseClick(map, 5, 25)
- compare(mouseClickedSpy.count, 3)
+ function init() {
+ map_error_plugin.zoomLevel = 0
+ map_no_plugin.zoomLevel = 0
+ map_error_plugin.center = QtPositioning.coordinate(0, 0)
+ map_no_plugin.center = QtPositioning.coordinate(0, 0)
+ map_error_plugin.mouseClickedSpy.clear()
+ map_no_plugin.mouseClickedSpy.clear()
+ }
+
+ function map_clicked(map)
+ {
+ mouseClick(map, 5, 5)
+ mouseClick(map, 50, 50)
+ mouseClick(map, 50, 50)
+ mouseClick(map, 50, 50)
+ compare(map.mouseClickedSpy.count, 3)
+ }
+
+ function test_map_clicked_wiht_no_plugin()
+ {
+ map_clicked(map_no_plugin)
+ }
+
+ function test_map_clicked_with_error_plugin()
+ {
+ map_clicked(map_error_plugin)
+ }
+
+ function test_map_no_supportedMapTypes()
+ {
+ compare(map_no_plugin.supportedMapTypes.length , 0)
+ compare(map_error_plugin.supportedMapTypes.length , 0)
+ }
+
+ function test_map_set_zoom_level()
+ {
+ map_no_plugin.zoomLevel = 9
+ compare(map_no_plugin.zoomLevel,9)
+ map_error_plugin.zoomLevel = 9
+ compare(map_error_plugin.zoomLevel,9)
+ }
+
+ function test_map_set_center()
+ {
+ map_no_plugin.center = coordinate
+ verify(map_no_plugin.center === coordinate)
+ map_error_plugin.center = coordinate
+ verify(map_error_plugin.center === coordinate)
+ }
+
+ function test_map_no_mapItems()
+ {
+ compare(map_no_plugin.mapItems.length , 0)
+ compare(map_error_plugin.mapItems.length , 0)
+ }
+
+ function test_map_error()
+ {
+ compare(map_no_plugin.error , 0)
+ compare(map_no_plugin.errorString , "")
+ compare(map_error_plugin.error , 1)
+ compare(map_error_plugin.errorString ,"This error was expected. No worries !")
+ }
+
+ function test_map_toCoordinate()
+ {
+ map_no_plugin.center = coordinate
+ compare(map_no_plugin.toCoordinate(50,50).isValid,false)
+ map_error_plugin.center = coordinate
+ compare(map_error_plugin.toCoordinate(50,50).isValid,false)
+ }
+
+ function test_map_fromCoordinate()
+ {
+ verify(isNaN(map_error_plugin.fromCoordinate(coordinate).x))
+ verify(isNaN(map_error_plugin.fromCoordinate(coordinate).y))
+ verify(isNaN(map_no_plugin.fromCoordinate(coordinate).x))
+ verify(isNaN(map_no_plugin.fromCoordinate(coordinate).y))
+ }
+
+ function test_map_gesture_enabled()
+ {
+ verify(map_error_plugin.gesture.enabled)
+ verify(map_no_plugin.gesture.enabled)
+ }
+
+ function test_map_pan()
+ {
+ map_no_plugin.center = coordinate
+ map_no_plugin.pan(20,20)
+ verify(map_no_plugin.center === coordinate)
+ map_error_plugin.center = coordinate
+ map_error_plugin.pan(20,20)
+ verify(map_error_plugin.center === coordinate)
+ }
+
+ function test_map_prefetchData()
+ {
+ map_error_plugin.prefetchData()
+ map_no_plugin.prefetchData()
+ }
+
+ function test_map_fitViewportToMapItems()
+ {
+ map_error_plugin.fitViewportToMapItems()
+ map_no_plugin.fitViewportToMapItems()
+ }
+
+ function test_map_fitViewportToGeoShape()
+ {
+ map_no_plugin.fitViewportToGeoShape(QtPositioning.circle(coordinate,1000))
+ verify(map_no_plugin.center != coordinate)
+ map_error_plugin.fitViewportToGeoShape(QtPositioning.circle(coordinate,1000))
+ verify(map_error_plugin.center != coordinate)
+ }
+
+ function test_map_setVisibleRegion()
+ {
+ map_no_plugin.visibleRegion = QtPositioning.circle(coordinate,1000)
+ verify(map_no_plugin.center != coordinate)
+ verify(map_no_plugin.visibleRegion == QtPositioning.circle(coordinate,1000))
+ map_error_plugin.visibleRegion = QtPositioning.circle(coordinate,1000)
+ verify(map_error_plugin.center != coordinate)
+ verify(map_no_plugin.visibleRegion == QtPositioning.circle(coordinate,1000))
+ }
+
+ function test_map_activeMapType()
+ {
+ compare(map_no_plugin.supportedMapTypes.length, 0)
+ compare(map_no_plugin.activeMapType.style, MapType.NoMap)
+ compare(map_error_plugin.supportedMapTypes.length, 0)
+ compare(map_error_plugin.activeMapType.style, MapType.NoMap)
}
}
}
diff --git a/tests/auto/declarative_ui/tst_map_flick.qml b/tests/auto/declarative_ui/tst_map_flick.qml
new file mode 100644
index 00000000..526cbb6f
--- /dev/null
+++ b/tests/auto/declarative_ui/tst_map_flick.qml
@@ -0,0 +1,307 @@
+/****************************************************************************
+**
+** 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.6
+import QtPositioning 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)
+
+ 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 real flickStartedLatitude
+ property real flickStartedLongitude
+ property bool disableFlickOnStarted: false
+ property bool disableFlickOnMovementStarted: false
+ gesture.onPanStarted: {
+ if (disableFlickOnMovementStarted)
+ map.gesture.panEnabled = false
+ }
+ gesture.onFlickStarted: {
+ flickStartedLatitude = map.center.latitude
+ flickStartedLatitude = map.center.longitude
+ if (disableFlickOnStarted)
+ map.gesture.panEnabled = false
+ }
+ MouseArea {
+ id: mouseAreaTop
+ anchors.fill: parent
+ visible: false
+ }
+ }
+
+ SignalSpy {id: centerSpy; target: map; signalName: 'centerChanged'}
+ SignalSpy {id: panFinishedSpy; target: map.gesture; signalName: 'panFinished'}
+ SignalSpy {id: gestureEnabledSpy; target: map.gesture; signalName: 'enabledChanged'}
+ SignalSpy {id: flickDecelerationSpy; target: map.gesture; signalName: 'flickDecelerationChanged'}
+ SignalSpy {id: flickStartedSpy; target: map.gesture; signalName: 'flickStarted'}
+ SignalSpy {id: flickFinishedSpy; target: map.gesture; signalName: 'flickFinished'}
+ SignalSpy {id: mouseAreaTopSpy; target: mouseAreaTop; signalName: 'onPressed'}
+ SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'}
+
+ TestCase {
+ when: windowShown
+ name: "MapFlick"
+
+ function init()
+ {
+ map.gesture.activeGestures = MapGestureArea.PanGesture | MapGestureArea.FlickGesture;
+ map.gesture.enabled = true
+ map.gesture.panEnabled = true
+ map.gesture.flickDeceleration = 500
+ map.zoomLevel = 0
+ map.disableFlickOnStarted = false
+ map.disableFlickOnMovementStarted = false
+ centerSpy.clear()
+ gestureEnabledSpy.clear()
+ flickDecelerationSpy.clear()
+ panFinishedSpy.clear()
+ flickStartedSpy.clear()
+ flickFinishedSpy.clear()
+ mouseAreaTopSpy.clear()
+ mouseAreaBottomSpy.clear()
+ mouseAreaBottom.visible = false
+ mouseAreaTop.visible = false
+ }
+
+ function initTestCase()
+ {
+ //check default values
+ 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)
+ map.gesture.activeGestures = MapGestureArea.NoGesture
+ compare(map.gesture.activeGestures, MapGestureArea.NoGesture)
+ map.gesture.activeGestures = MapGestureArea.ZoomGesture | MapGestureArea.PanGesture
+ compare(map.gesture.activeGestures, MapGestureArea.ZoomGesture | MapGestureArea.PanGesture)
+ map.gesture.activeGestures = MapGestureArea.PanGesture
+ compare(map.gesture.activeGestures, MapGestureArea.PanGesture)
+ compare(map.gesture.flickDeceleration, 2500)
+ map.gesture.flickDeceleration = 2600
+ compare(flickDecelerationSpy.count, 1)
+ compare(map.gesture.flickDeceleration, 2600)
+ map.gesture.flickDeceleration = 2600
+ compare(flickDecelerationSpy.count, 1)
+ compare(map.gesture.flickDeceleration, 2600)
+ map.gesture.flickDeceleration = 400 // too small
+ compare(flickDecelerationSpy.count, 2)
+ compare(map.gesture.flickDeceleration, 500) // clipped to min
+ map.gesture.flickDeceleration = 11000 // too big
+ compare(flickDecelerationSpy.count, 3)
+ compare(map.gesture.flickDeceleration, 10000) // clipped to max
+ }
+
+ function flick_down()
+ {
+ map.center.latitude = 10
+ map.center.longitude = 11
+ mousePress(page, 0, 50)
+ for (var i = 0; i < 50; i += 5) {
+ wait(20)
+ mouseMove(page, 0, (50 + i), 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 0, 100)
+
+ // order of signals is: flickStarted, either order: (flickEnded, movementEnded)
+ verify(map.center.latitude > 10) // latitude increases we are going 'up/north' (moving mouse down)
+ var moveLatitude = map.center.latitude // store lat and check that flick continues
+
+ tryCompare(flickStartedSpy, "count", 1)
+ tryCompare(panFinishedSpy, "count", 1)
+ tryCompare(flickFinishedSpy, "count", 1)
+
+ verify(map.center.latitude > moveLatitude)
+ compare(map.center.longitude, 11) // should remain the same
+ }
+
+ function test_flick_down()
+ {
+ flick_down()
+ }
+
+ function test_flick_down_with_filtetring()
+ {
+ mouseAreaTop.visible = true
+ mouseAreaBottom.visible = true
+ flick_down()
+ tryCompare(mouseAreaTopSpy, "count", 1)
+ tryCompare(mouseAreaBottomSpy, "count",0)
+ }
+
+ function flick_up()
+ {
+ map.center.latitude = 70
+ map.center.longitude = 11
+ mousePress(page, 10, 95)
+ for (var i = 45; i > 0; i -= 5) {
+ wait(20)
+ mouseMove(page, 10, (50 + i), 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 10, 50)
+ verify(map.center.latitude < 70)
+ var moveLatitude = map.center.latitude // store lat and check that flick continues
+ tryCompare(flickStartedSpy, "count", 1)
+ tryCompare(panFinishedSpy, "count", 1)
+ tryCompare(flickFinishedSpy, "count", 1)
+ verify(map.center.latitude < moveLatitude)
+ compare(map.center.longitude, 11) // should remain the same
+ }
+
+ function test_flick_up()
+ {
+ flick_up()
+ }
+
+ function test_flick_up_with_filtering()
+ {
+ mouseAreaTop.visible = true
+ mouseAreaBottom.visible = true
+ flick_up()
+ tryCompare(mouseAreaTopSpy, "count", 1)
+ tryCompare(mouseAreaBottomSpy, "count",0)
+ }
+
+
+ function test_flick_diagonal()
+ {
+ map.center.latitude = 50
+ map.center.longitude = 50
+ mousePress(page, 0, 0)
+ for (var i = 0; i < 50; i += 5) {
+ wait(20)
+ mouseMove(page, i, i, 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 50, 50)
+ verify(map.center.latitude > 50)
+ verify(map.center.longitude < 50)
+ var moveLatitude = map.center.latitude
+ var moveLongitude = map.center.longitude
+ tryCompare(flickStartedSpy, "count", 1)
+ tryCompare(panFinishedSpy, "count", 1)
+ tryCompare(flickFinishedSpy, "count", 1)
+ verify(map.center.latitude > moveLatitude)
+ verify(map.center.longitude < moveLongitude)
+ }
+
+ function test_flicking_while_disabled()
+ {
+ map.gesture.panEnabled = false
+ map.center.latitude = 50
+ map.center.longitude = 50
+ mousePress(page, 0, 0)
+ for (var i = 0; i < 50; i += 5) {
+ wait(20)
+ mouseMove(page, i, i, 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 50, 50)
+ compare(flickStartedSpy.count, 0)
+ compare(flickFinishedSpy.count, 0)
+ compare(panFinishedSpy.count, 0)
+ }
+
+ function test_disable_onFlickStarted()
+ {
+ map.disableFlickOnStarted = true
+ map.center.latitude = 50
+ map.center.longitude = 50
+ mousePress(page, 0, 0)
+ for (var i = 0; i < 50; i += 5) {
+ wait(20)
+ mouseMove(page, i, i, 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 50, 50)
+ var latitude = map.center.latitude;
+ var longitude = map.center.longitude
+ tryCompare(flickStartedSpy, "count", 1)
+ verify(map.center.latitude > 50)
+ tryCompare(flickStartedSpy, "count", 1)
+ tryCompare(panFinishedSpy, "count", 1)
+ tryCompare(flickFinishedSpy, "count", 1)
+ // compare that flick was interrupted (less movement than without interrupting)
+ compare(latitude, map.center.latitude)
+ compare(longitude, map.center.longitude)
+ map.disableFlickOnStarted = false
+ map.gesture.panEnabled = true
+ }
+
+ function test_disable_onMovementStarted()
+ {
+ map.disableFlickOnMovementStarted = true
+ map.center.latitude = 50
+ map.center.longitude = 50
+ mousePress(page, 0, 0)
+ for (var i = 0; i < 50; i += 5) {
+ wait(20)
+ mouseMove(page, i, i, 0, Qt.LeftButton);
+ }
+ mouseRelease(page, 50, 50)
+ compare(map.center.latitude,50)
+ compare(map.center.longitude,50)
+ tryCompare(panFinishedSpy, "count", 1)
+ // compare that flick was interrupted (less movement than without interrupting)
+ compare(map.center.latitude,50)
+ compare(map.center.longitude,50)
+ }
+ }
+}
diff --git a/tests/auto/declarative_ui/tst_map_item.qml b/tests/auto/declarative_ui/tst_map_item.qml
index 8aeb8108..32de8efd 100644
--- a/tests/auto/declarative_ui/tst_map_item.qml
+++ b/tests/auto/declarative_ui/tst_map_item.qml
@@ -33,9 +33,8 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtLocation.test 5.0
-import QtPositioning 5.0
+import QtLocation 5.6
+import QtPositioning 5.5
/*
@@ -238,7 +237,7 @@ Item {
}
}
TestCase {
- name: "Map Items"
+ name: "MapItems"
when: windowShown
function test_aa_items_on_map() { // aa et al. for execution order
diff --git a/tests/auto/declarative_ui/tst_map_item_details.qml b/tests/auto/declarative_ui/tst_map_item_details.qml
index baa31a77..b4468301 100644
--- a/tests/auto/declarative_ui/tst_map_item_details.qml
+++ b/tests/auto/declarative_ui/tst_map_item_details.qml
@@ -33,9 +33,8 @@
import QtQuick 2.0
import QtTest 1.0
-import QtPositioning 5.0
-import QtLocation 5.3
-import QtLocation.test 5.0
+import QtPositioning 5.5
+import QtLocation 5.6
Item {
id: page
@@ -279,7 +278,7 @@ Item {
Text {id: progressText}
TestCase {
- name: "Map Item 2"
+ name: "MapItemDeatils"
when: windowShown
/*
diff --git a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
index 5a992fe7..55fbd348 100644
--- a/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
+++ b/tests/auto/declarative_ui/tst_map_item_fit_viewport.qml
@@ -33,9 +33,9 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
-import QtLocation.test 5.0
+import QtLocation 5.6
+import QtPositioning 5.5
+import QtLocation.Test 5.5
/*
@@ -224,7 +224,7 @@ Item {
}
TestCase {
- name: "Map Items Fit Viewport"
+ name: "MapItemsFitViewport"
when: windowShown
function test_aa_visible_basic() { // aa et al. for execution order
diff --git a/tests/auto/declarative_ui/tst_map_itemview.qml b/tests/auto/declarative_ui/tst_map_itemview.qml
index 2ec0b65b..5fe00d97 100644
--- a/tests/auto/declarative_ui/tst_map_itemview.qml
+++ b/tests/auto/declarative_ui/tst_map_itemview.qml
@@ -33,9 +33,9 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
-import QtLocation.test 5.0
+import QtLocation 5.6
+import QtPositioning 5.5
+import QtLocation.Test 5.5
Item {
id: masterItem
@@ -176,11 +176,15 @@ Item {
SignalSpy {id: mapItemsChangedSpy; target: mapForTestingRouteModel; signalName: "mapItemsChanged"}
Map {
- id: mapForView;
- center: mapDefaultCenter;
- plugin: testPlugin;
- anchors.fill: parent;
+ id: mapForView
+
+ property int mapItemsLength: mapItems.length
+
+ center: mapDefaultCenter
+ plugin: testPlugin
+ anchors.fill: parent
zoomLevel: 2
+
MapCircle {
id: internalCircle
radius: 2000000
@@ -203,14 +207,19 @@ Item {
}
Map {
- id: mapForTestingListModel;
- center: mapDefaultCenter;
- plugin: testPlugin;
- anchors.fill: parent;
+ id: mapForTestingListModel
+
+ center: mapDefaultCenter
+ plugin: testPlugin
+ anchors.fill: parent
zoomLevel: 2
- property variant firstItemCoord: QtPositioning.coordinate(11, 31)
- property variant secondItemCoord: QtPositioning.coordinate(12, 32)
+ property int mapItemsLength: mapItems.length
+ property variant itemCoordinates: [
+ QtPositioning.coordinate(11, 31),
+ QtPositioning.coordinate(12, 32),
+ QtPositioning.coordinate(13, 33)
+ ]
MapItemView {
id: listModelItemView
@@ -233,11 +242,15 @@ Item {
}
Map {
- id: mapForTestingRouteModel;
- plugin: testPlugin;
- center: mapDefaultCenter;
- anchors.fill: parent;
+ id: mapForTestingRouteModel
+
+ property int mapItemsLength: mapItems.length
+
+ plugin: testPlugin
+ center: mapDefaultCenter
+ anchors.fill: parent
zoomLevel: 2
+
MapItemView {
id: routeItemView
model: routeModel
@@ -355,7 +368,7 @@ Item {
function test_add_and_remove_with_view() {
// Basic adding and removing of static object
- compare(mapForView.mapItems.length, 8) // 1 declared and 7 from model
+ tryCompare(mapForView, "mapItemsLength", 8) // 1 declared and 7 from model
mapForView.addMapItem(internalCircle)
compare(mapForView.mapItems.length, 8)
mapForView.removeMapItem(internalCircle)
@@ -374,37 +387,49 @@ Item {
SignalSpy {id: model1Spy; target: testModel; signalName: "modelChanged"}
SignalSpy {id: model2Spy; target: testModel2; signalName: "modelChanged"}
function test_model_change() {
+ // Ensure that internalCircle is removed
+ mapForView.removeMapItem(internalCircle)
+
// Change the model of an MapItemView on the fly
// and verify that object counts change accordingly.
testModel.datacount = 7
testModel.update()
- compare(mapForView.mapItems.length, 7)
+
+ tryCompare(mapForView, "mapItemsLength", 7)
testModel.datacount += 2
testModel2.datacount += 1
- compare(mapForView.mapItems.length, 9)
+ tryCompare(mapForView, "mapItemsLength", 9)
+
theItemView.model = testModel
compare(mapForView.mapItems.length, 9)
theItemView.model = testModel2
- compare(mapForView.mapItems.length, 4)
+ tryCompare(mapForView, "mapItemsLength", 4)
}
function test_listmodel() {
- compare(mapForTestingListModel.mapItems.length, 3);
- compare(mapForTestingListModel.mapItems[0].center.longitude,
- mapForTestingListModel.firstItemCoord.longitude);
- compare(mapForTestingListModel.mapItems[0].center.latitude,
- mapForTestingListModel.firstItemCoord.latitude);
- testingListModel.remove(0);
- compare(mapForTestingListModel.mapItems.length, 2);
- compare(mapForTestingListModel.mapItems[0].center.longitude,
- mapForTestingListModel.secondItemCoord.longitude);
- compare(mapForTestingListModel.mapItems[0].center.latitude,
- mapForTestingListModel.secondItemCoord.latitude);
- testingListModel.append({ lat: 1, lon: 1 });
- compare(mapForTestingListModel.mapItems.length, 3);
- compare(mapForTestingListModel.mapItems[2].center.latitude, 1);
- testingListModel.clear();
- compare(mapForTestingListModel.mapItems.length, 0);
+ tryCompare(mapForTestingListModel, "mapItemsLength", 3)
+
+ for (var i = 0; i < 3; ++i) {
+ var itemCoord = mapForTestingListModel.mapItems[i].center
+ var index = mapForTestingListModel.itemCoordinates.indexOf(itemCoord)
+ verify(0 <= index && index < 3)
+ }
+
+ testingListModel.remove(0)
+ compare(mapForTestingListModel.mapItems.length, 2)
+
+ for (var i = 0; i < 2; ++i) {
+ itemCoord = mapForTestingListModel.mapItems[i].center
+ index = mapForTestingListModel.itemCoordinates.indexOf(itemCoord)
+ verify(1 <= index && index < 3)
+ }
+
+ testingListModel.append({ lat: 1, lon: 1 })
+ tryCompare(mapForTestingListModel, "mapItemsLength", 3)
+ compare(mapForTestingListModel.mapItems[2].center, QtPositioning.coordinate(1, 1))
+
+ testingListModel.clear()
+ compare(mapForTestingListModel.mapItems.length, 0)
}
function test_routemodel() {
@@ -414,16 +439,16 @@ Item {
compare(mapItemsChangedSpy.count, 0)
routeQuery.numberAlternativeRoutes = 4
routeModel.update();
- compare(mapForTestingRouteModel.mapItems.length, 4)
+ tryCompare(mapForTestingRouteModel, "mapItemsLength", 4)
routeQuery.numberAlternativeRoutes = 3
routeModel.update();
- compare(mapForTestingRouteModel.mapItems.length, 3)
+ tryCompare(mapForTestingRouteModel, "mapItemsLength", 3)
routeModel.reset();
compare(mapForTestingRouteModel.mapItems.length, 0)
routeModel.reset(); // clear empty model
routeQuery.numberAlternativeRoutes = 3
routeModel.update();
- compare(mapForTestingRouteModel.mapItems.length, 3)
+ tryCompare(mapForTestingRouteModel, "mapItemsLength", 3)
mapForTestingRouteModel.addMapItem(externalCircle2)
compare(mapForTestingRouteModel.mapItems.length, 4)
compare(mapForTestingRouteModel.mapItems[3], externalCircle2)
diff --git a/tests/auto/declarative_ui/tst_map_keepgrab.qml b/tests/auto/declarative_ui/tst_map_keepgrab.qml
new file mode 100644
index 00000000..645946c3
--- /dev/null
+++ b/tests/auto/declarative_ui/tst_map_keepgrab.qml
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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.6
+import QtPositioning 5.5
+
+Item {
+ // General-purpose elements for the test:
+ id: page
+ width: 200
+ height: 200
+ Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true }
+
+
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+ contentWidth: flickable.width * 4; contentHeight: flickable.height
+
+ Map {
+ id: map
+ x: flickable.width
+ height: flickable.height
+ width:flickable.width
+ plugin: testPlugin
+ }
+ }
+
+ SignalSpy { id: mapPanStartedSpy; target: map.gesture; signalName: 'panStarted' }
+ SignalSpy { id: mapPanFinishedSpy; target: map.gesture; signalName: 'panFinished' }
+ SignalSpy { id: flickStartedSpy; target: flickable; signalName: 'flickStarted' }
+ SignalSpy { id: flickEndedSpy; target: flickable; signalName: 'flickEnded' }
+ SignalSpy { id: preventStealingChangedSpy; target: map.gesture; signalName: 'preventStealingChanged' }
+
+
+ TestCase {
+ when: windowShown
+ name: "MapKeepGrabAndPreventSteal"
+
+ function initTestCase()
+ {
+ compare(map.gesture.preventStealing, false)
+ }
+
+ function init()
+ {
+ map.gesture.acceptedGestures = MapGestureArea.PanGesture | MapGestureArea.FlickGesture;
+ map.gesture.flickDeceleration = 500
+ map.zoomLevel = 1
+ map.center = QtPositioning.coordinate(50,50)
+ map.gesture.preventStealing = false
+ flickable.contentX = 0
+ flickable.contentY = 0
+ mapPanStartedSpy.clear()
+ mapPanFinishedSpy.clear()
+ flickStartedSpy.clear()
+ flickEndedSpy.clear()
+ preventStealingChangedSpy.clear()
+ }
+
+ function flick()
+ {
+ var i = 0
+ mousePress(flickable, flickable.width - 1, 0)
+ for (i = flickable.width; i > 0; i -= 5) {
+ wait(5)
+ mouseMove(flickable, i, 0, 0, Qt.LeftButton);
+ }
+ mouseRelease(flickable, i, 0)
+ }
+
+ function pan()
+ {
+ var i = 0
+ mousePress(map, 0, 0)
+ for (i = 0; i < flickable.width; i += 5) {
+ wait(5)
+ mouseMove(map, i, 0, 0, Qt.LeftButton);
+ }
+ mouseRelease(map, i, 0)
+ }
+
+ function test_flick()
+ {
+ var center = QtPositioning.coordinate(map.center.latitude,map.center.longitude)
+ flick() //flick flickable
+ tryCompare(flickStartedSpy,"count",1)
+ pan() //pan map
+ tryCompare(flickStartedSpy,"count",2) // both directions
+ tryCompare(flickEndedSpy,"count",1)
+ tryCompare(mapPanStartedSpy,"count", 0)
+ tryCompare(mapPanFinishedSpy,"count", 0)
+ //map should not change
+ verify(center == map.center)
+ }
+
+ function test_map_grab()
+ {
+ var center = QtPositioning.coordinate(map.center.latitude,map.center.longitude)
+ pan() //pan map
+ tryCompare(mapPanStartedSpy,"count",1)
+ tryCompare(mapPanFinishedSpy, "count", 1)
+
+ compare(flickStartedSpy.count, 0)
+ compare(flickEndedSpy.count, 0)
+ //map should change
+ verify(center != map.center)
+ }
+
+ function test_map_preventsteal()
+ {
+ map.gesture.preventStealing = false
+ compare(preventStealingChangedSpy.count, 0)
+ map.gesture.preventStealing = true
+ compare(preventStealingChangedSpy.count, 1)
+
+ var center = QtPositioning.coordinate(map.center.latitude,map.center.longitude)
+ flick() //flick flickable
+ tryCompare(flickStartedSpy,"count",1)
+ pan() //pan map
+ tryCompare(flickStartedSpy,"count",1) // both directions
+ tryCompare(flickEndedSpy,"count",1)
+ tryCompare(mapPanStartedSpy,"count", 1)
+ tryCompare(mapPanFinishedSpy,"count", 1)
+ //map should not change
+ verify(center != map.center)
+ }
+ }
+}
diff --git a/tests/auto/declarative_ui/tst_map_maptype.qml b/tests/auto/declarative_ui/tst_map_maptype.qml
index a20241fc..d96ee60e 100644
--- a/tests/auto/declarative_ui/tst_map_maptype.qml
+++ b/tests/auto/declarative_ui/tst_map_maptype.qml
@@ -33,7 +33,7 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.5
+import QtLocation 5.6
Item{
id: page
diff --git a/tests/auto/declarative_ui/tst_map_mouse.qml b/tests/auto/declarative_ui/tst_map_mouse.qml
index 9db57c1e..fe02f81d 100644
--- a/tests/auto/declarative_ui/tst_map_mouse.qml
+++ b/tests/auto/declarative_ui/tst_map_mouse.qml
@@ -33,9 +33,8 @@
import QtQuick 2.0
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
-import QtLocation.test 5.0
+import QtLocation 5.6
+import QtPositioning 5.5
/*
MouseArea setup for this test case.
@@ -554,10 +553,10 @@ Item {
compare(mouseLowerClickedSpy.count, 0)
compare(mouseOverlapperClickedSpy.count, 0)
mouseUpper.acceptedButtons = Qt.LeftButton | Qt.RightButton
- console.log('TC sending click event to upper mouse area 5,25')
+ // TC sending click event to upper mouse area 5,25
mouseClick(map, 5, 25, Qt.RightButton, Qt.AltModifier)
tryCompare(mouseUpperClickedSpy, "count", 1)
- console.log('TC done and clicked was received')
+ // TC done and clicked was received
//compare(mouseUpperClickedSpy.count, 1)
compare(mouseLowerClickedSpy.count, 0)
compare(mouseOverlapperClickedSpy.count, 0)
diff --git a/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970
index a5f68d5e..f4e57faa 100644
--- a/tests/auto/declarative_ui/tst_map_pinch_and_flick.qml
+++ b/tests/auto/declarative_ui/tst_map_pinch.qml.QTBUG-47970
@@ -31,11 +31,11 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick 2.5
import QtTest 1.0
-import QtLocation 5.3
-import QtPositioning 5.2
-import QtLocation.test 5.0
+import QtLocation 5.5
+import QtPositioning 5.5
+import QtLocation.Test 5.5
Item {
// General-purpose elements for the test:
@@ -44,12 +44,26 @@ Item {
height: 100
Plugin { id: testPlugin; name: "qmlgeo.test.plugin"; allowExperimental: true }
- property variant coordinate1: QtPositioning.coordinate(10, 11)
+ 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: coordinate1;
+ center: coordinate;
zoomLevel: 9;
anchors.fill: page
x:0; y:0
@@ -65,59 +79,49 @@ Item {
map.startPinchPoint2= pinch.point2;
if (rejectPinch)
pinch.accepted = false;
- //console.log('Pinch got started, point1: ' + pinch.point1 + ' point2: ' + pinch.point2 + ' angle: ' + pinch.angle)
- }
- gesture.onPinchUpdated: {
- map.lastPinchEvent = pinch;
- //console.log('Pinch got updated, point1: ' + pinch.point1 + ' point2: ' + pinch.point2 + ' angle: ' + pinch.angle)
}
+ gesture.onPinchUpdated: map.lastPinchEvent = pinch;
+
gesture.onPinchFinished: {
map.lastPinchEvent = pinch;
- map.endPinchPoint1= pinch.point1;
- map.endPinchPoint2= pinch.point2;
+ map.endPinchPoint1 = pinch.point1;
+ map.endPinchPoint2 = pinch.point2;
}
- property real flickStartedLatitude
- property real flickStartedLongitude
- property bool disableFlickOnStarted: false
- property bool disableFlickOnMovementStarted: false
- gesture.onPanStarted: {
- if (disableFlickOnMovementStarted)
- map.gesture.panEnabled = false
- }
- gesture.onFlickStarted: {
- flickStartedLatitude = map.center.latitude
- flickStartedLatitude = map.center.longitude
- if (disableFlickOnStarted)
- map.gesture.panEnabled = false
+ 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: panFinishedSpy; target: map.gesture; signalName: 'panFinished'}
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: flickDecelerationSpy; target: map.gesture; signalName: 'flickDecelerationChanged'}
- SignalSpy {id: flickStartedSpy; target: map.gesture; signalName: 'flickStarted'}
- SignalSpy {id: flickFinishedSpy; target: map.gesture; signalName: 'flickFinished'}
-
- // From QtLocation.test plugin
- PinchGenerator {
- id: pinchGenerator
- anchors.fill: parent
- target: map
- enabled: false
- }
+ SignalSpy {id: mouseAreaTopSpy; target: mouseAreaTop; signalName: 'onPressed'}
+ SignalSpy {id: mouseAreaBottomSpy; target: mouseAreaBottom; signalName: 'onPressed'}
TestCase {
when: windowShown
- name: "Map pinch"
+ name: "MapPinch"
- function clear_data() {
+ 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()
@@ -127,26 +131,25 @@ Item {
pinchActiveSpy.clear()
pinchActiveGesturesSpy.clear()
mapZoomLevelSpy.clear()
- flickDecelerationSpy.clear()
- panFinishedSpy.clear()
- flickStartedSpy.clear()
- flickFinishedSpy.clear()
+ mouseAreaTopSpy.clear()
+ mouseAreaBottomSpy.clear()
}
//see QDeclarativeGeoMapGestureArea::updatePinch()
function calculateZoom(startPinchPoint1,startPinchPoint2,endPinchPoint1,endPinchPoint2,
- width,height, maximumZoomLevelChange, startZoomLevel) {
+ width,height, maximumZoomLevelChange, startZoomLevel)
+ {
var startDistance = Math.sqrt(Math.pow(startPinchPoint2.x - startPinchPoint1.x,2) +
- + Math.pow(startPinchPoint2.y - startPinchPoint1.y,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))
+ + Math.pow(endPinchPoint2.y - endPinchPoint1.y,2))
return 2 * (endDistance - startDistance) * maximumZoomLevelChange /
(width + height) + startZoomLevel;
}
- function test_a_basic_properties() { // a to excecute first
- clear_data()
-
+ function initTestCase()
+ {
+ //test default properties
compare(map.gesture.enabled, true)
map.gesture.enabled = false
compare(gestureEnabledSpy.count, 1)
@@ -157,9 +160,7 @@ Item {
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)
@@ -176,7 +177,6 @@ Item {
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)
@@ -192,160 +192,16 @@ Item {
map.gesture.maximumZoomLevelChange = 2
compare(pinchMaximumZoomLevelChangeSpy.count, 2)
compare (map.gesture.maximumZoomLevelChange, 2)
-
- compare(map.gesture.flickDeceleration, 2500)
- map.gesture.flickDeceleration = 2600
- compare(flickDecelerationSpy.count, 1)
- compare(map.gesture.flickDeceleration, 2600)
- map.gesture.flickDeceleration = 2600
- compare(flickDecelerationSpy.count, 1)
- compare(map.gesture.flickDeceleration, 2600)
- map.gesture.flickDeceleration = 400 // too small
- compare(flickDecelerationSpy.count, 2)
- compare(map.gesture.flickDeceleration, 500) // clipped to min
- map.gesture.flickDeceleration = 11000 // too big
- compare(flickDecelerationSpy.count, 3)
- compare(map.gesture.flickDeceleration, 10000) // clipped to max
}
- function test_a_flick() {
- clear_data()
- var i=0
- //var moveLatitude=0
- // few sanity checks
- map.gesture.activeGestures = MapGestureArea.PanGesture | MapGestureArea.FlickGesture;
- map.gesture.enabled = true
- map.gesture.panEnabled = true
- // to get maximum changes (robust autotest)
- map.gesture.flickDeceleration = 500
- map.zoomLevel = 0
- compare(map.center.latitude, coordinate1.latitude)
- compare(map.center.longitude, coordinate1.longitude)
- // 1. test basic flick down
- clear_data()
- map.center.latitude = 10
- map.center.longitude = 11
- mousePress(map, 0, 50)
- for (i=0; i < 50; i += 5) {
- wait(20)
- mouseMove(map, 0, (50 + i), 0, Qt.LeftButton);
- }
- mouseRelease(map, 0, (50 + i))
-
- // order of signals is: flickStarted, either order: (flickEnded, movementEnded)
- verify(map.center.latitude > 10) // latitude increases we are going 'up/north' (moving mouse down)
- var moveLatitude = map.center.latitude // store lat and check that flick continues
- tryCompare(flickStartedSpy, "count", 1)
-
- tryCompare(panFinishedSpy, "count", 1)
- tryCompare(flickFinishedSpy, "count", 1)
- verify(map.center.latitude > moveLatitude)
- compare(map.center.longitude, 11) // should remain the same
-
- // 2. test basic flick up
- clear_data()
- map.center.latitude = 70
- map.center.longitude = 11
- mousePress(map, 10, 95)
- for (i=45; i > 0; i -= 5) {
- wait(20)
- mouseMove(map, 10, (50 + i), 0, Qt.LeftButton);
- }
- mouseRelease(map, 10, (50 + i))
- verify(map.center.latitude < 70)
- moveLatitude = map.center.latitude // store lat and check that flick continues
- tryCompare(flickStartedSpy, "count", 1)
- tryCompare(panFinishedSpy, "count", 1)
- tryCompare(flickFinishedSpy, "count", 1)
- verify(map.center.latitude < moveLatitude)
- compare(map.center.longitude, 11) // should remain the same
-
- // 3. basic flick diagonal
- clear_data()
- map.center.latitude = 50
- map.center.longitude = 50
- mousePress(map, 0, 0)
- for (i=0; i < 50; i += 5) {
- wait(20)
- mouseMove(map, i, i, 0, Qt.LeftButton);
- }
- mouseRelease(map, i, i)
- verify(map.center.latitude > 50)
- verify(map.center.longitude < 50)
- moveLatitude = map.center.latitude
- var moveLongitude = map.center.longitude
- tryCompare(flickStartedSpy, "count", 1)
- tryCompare(panFinishedSpy, "count", 1)
- tryCompare(flickFinishedSpy, "count", 1)
- verify(map.center.latitude > moveLatitude)
- verify(map.center.longitude < moveLongitude)
- var diagonalFlickResultLatitude = map.center.latitude
- var diagonalFlickResultLongitude = map.center.longitude
- // 4. test flicking while disabled
- clear_data()
- map.gesture.panEnabled = false
- map.center.latitude = 50
- map.center.longitude = 50
- for (i=0; i < 50; i += 5) {
- wait(20)
- mouseMove(map, i, i, 0, Qt.LeftButton);
- }
- mouseRelease(map, i, i)
- compare(flickStartedSpy.count, 0)
- compare(flickFinishedSpy.count, 0)
- compare(panFinishedSpy.count, 0)
- map.gesture.panEnabled = true
-
- // 5. disable during flick: onFlickStarted
- clear_data()
- map.disableFlickOnStarted = true
- map.center.latitude = 50
- map.center.longitude = 50
- mousePress(map, 0, 0)
- for (i=0; i < 50; i += 5) {
- wait(20)
- mouseMove(map, i, i, 0, Qt.LeftButton);
- }
- mouseRelease(map, i, i)
- tryCompare(flickStartedSpy, "count", 1)
- verify(map.center.latitude > 50)
- tryCompare(flickStartedSpy, "count", 1)
- tryCompare(panFinishedSpy, "count", 1)
- tryCompare(flickFinishedSpy, "count", 1)
- // compare that flick was interrupted (less movement than without interrupting)
- verify(diagonalFlickResultLatitude > map.center.latitude)
- verify(diagonalFlickResultLongitude < map.center.longitude)
- map.disableFlickOnStarted = false
- map.gesture.panEnabled = true
-
- // 6. disable during flick: onMovementStarted
- clear_data()
- map.disableFlickOnMovementStarted = true
- map.center.latitude = 50
- map.center.longitude = 50
- mousePress(map, 0, 0)
- for (i=0; i < 50; i += 5) {
- wait(20)
- mouseMove(map, i, i, 0, Qt.LeftButton);
- }
- mouseRelease(map, i, i)
- verify(map.center.latitude === 50)
- verify(map.center.longitude === 50)
- tryCompare(panFinishedSpy, "count", 1)
- // compare that flick was interrupted (less movement than without interrupting)
- verify(diagonalFlickResultLatitude > map.center.latitude)
- verify(diagonalFlickResultLongitude < map.center.longitude)
- map.disableFlickOnMovementStarted = false
- }
- function test_pinch_zoom() {
+ function zoom_in()
+ {
var startZoomLevel = 9
- map.gesture.activeGestures = MapGestureArea.ZoomGesture
map.zoomLevel = startZoomLevel
- clear_data()
-
- // 1. typical zoom in
+ mapZoomLevelSpy.clear()
map.gesture.maximumZoomLevelChange = 2
+
compare(map.gesture.isPinchActive, false)
pinchGenerator.pinch(
Qt.point(0,50), // point1From
@@ -362,10 +218,10 @@ Item {
compare(map.lastPinchEvent.center.y, 50)
compare(map.lastPinchEvent.angle, 0)
verify((map.lastPinchEvent.point1.x > pinchGenerator.startDragDistance())
- && (map.lastPinchEvent.point1.x < 25))
+ && (map.lastPinchEvent.point1.x < 25))
compare(map.lastPinchEvent.point1.y, 50)
verify((map.lastPinchEvent.point2.x > 75)
- && (map.lastPinchEvent.point2.x < 100 - pinchGenerator.startDragDistance()))
+ && (map.lastPinchEvent.point2.x < 100 - pinchGenerator.startDragDistance()))
compare(map.lastPinchEvent.point2.y, 50)
compare(map.lastPinchEvent.accepted, true)
compare(map.lastPinchEvent.pointCount, 2)
@@ -400,32 +256,77 @@ Item {
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)
+ map.endPinchPoint1, map.endPinchPoint2,
+ map.width,map.height,
+ map.gesture.maximumZoomLevelChange,startZoomLevel)
compare(map.zoomLevel, endZoomLevel)
+ }
- // 2. typical zoom out
- clear_data();
- startZoomLevel = 7.8
- map.gesture.maximumZoomLevelChange = 2
+ 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
- pinchGenerator.pinch(Qt.point(50,50), Qt.point(0,50),
- Qt.point(50,50), Qt.point(100,50),
+ 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
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ 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)
+ }
- // 3. zoom in and back out (direction change during same pinch)
- clear_data();
- startZoomLevel = 7.8
+ 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),
@@ -434,31 +335,33 @@ Item {
tryCompare(pinchStartedSpy, "count", 1);
tryCompare(pinchFinishedSpy, "count", 1);
verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ 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
+ }
- // 4. typical zoom in with different change level
- clear_data();
- startZoomLevel = 8
- map.gesture.maximumZoomLevelChange = 4
+ 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);
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
+ map.endPinchPoint1, map.endPinchPoint2,
+ map.width,map.height,
+ map.gesture.maximumZoomLevelChange,startZoomLevel)
compare(map.zoomLevel, endZoomLevel)
+ }
- // 5. typical zoom out with different change level
- clear_data();
- startZoomLevel = 8
+ function test_zoom_out_with_different_change_level()
+ {
+ var startZoomLevel = 8
map.gesture.maximumZoomLevelChange = 1
map.zoomLevel = startZoomLevel
compare (map.gesture.maximumZoomLevelChange, 1)
@@ -466,33 +369,35 @@ Item {
Qt.point(50,50), Qt.point(100,50),
40, 40, 10, 10);
tryCompare(pinchFinishedSpy, "count", 1);
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
+ map.endPinchPoint1, map.endPinchPoint2,
+ map.width,map.height,
+ map.gesture.maximumZoomLevelChange,startZoomLevel)
compare(map.zoomLevel, endZoomLevel)
+ }
- // 6. try to zoom in below minimum zoom level
-
- clear_data()
- startZoomLevel = 8
+ 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) // would go to 6
+ compare(map.zoomLevel, 7)
+ }
- // 7. try to zoom out above maximum zoom level
- clear_data()
+ 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) // would go to 9
+ compare(map.zoomLevel, 8)
+ }
- // 8. pinch when max and min are same
- clear_data()
+ function test_pinch_when_max_and_min_are_same()
+ {
map.maximumZoomLevel = 8
map.minimumZoomLevel = 8
compare(map.maximumZoomLevel, 8)
@@ -502,9 +407,10 @@ Item {
compare(map.zoomLevel, 8)
map.minimumZoomLevel = 1
map.maximumZoomLevel = 20
+ }
- // 9. pinch when max..min is not where map zoomLevel currently is
- clear_data()
+ function test_pinch_when_max_min_is_not_where_map_zoomLevel_currently_is()
+ {
map.gesture.maximumZoomLevelChange = 4
map.minimumZoomLevel = 4
map.maximumZoomLevel = 6
@@ -522,9 +428,10 @@ Item {
compare(map.zoomLevel, 4)
map.minimumZoomLevel = 1
map.maximumZoomLevel = 20
+ }
- // 10. pinch while pinch area is disabled
- clear_data()
+ function test_pinch_while_pinch_area_is_disabled()
+ {
map.zoomLevel = 7.5
map.gesture.enabled = false
map.gesture.maximumZoomLevelChange = 2
@@ -539,11 +446,11 @@ Item {
compare(pinchFinishedSpy.count, 0);
compare(map.zoomLevel, 7.5)
pinchGenerator.stop()
- map.gesture.enabled = true
+ }
- // 11. pinch disabling during pinching
- clear_data()
- startZoomLevel = 7.5
+ 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),
@@ -559,21 +466,22 @@ Item {
verify(pinchupdates > 0)
compare(pinchActiveSpy.count,3)
compare(map.gesture.isPinchActive, false)
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ 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)
- map.gesture.enabled = true
+ }
- // 12. check nuthin happens if no active gestures
- clear_data()
+ 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);
@@ -583,11 +491,11 @@ Item {
compare(pinchStartedSpy.count, 0);
compare(map.zoomLevel, 8.5)
pinchGenerator.stop()
- map.gesture.activeGestures = MapGestureArea.ZoomGesture
+ }
- // 13. manually changing zoom level during active pinch zoom
- clear_data();
- startZoomLevel = 8.5
+ 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),
@@ -599,14 +507,15 @@ Item {
map.zoomLevel = 3 // will get overridden by pinch
tryCompare(pinchFinishedSpy, "count", 1);
verify(pinchUpdatedSpy.count >= 5); // verify 'sane' number of updates received
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ var endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
+ map.endPinchPoint1, map.endPinchPoint2,
+ map.width,map.height,
+ map.gesture.maximumZoomLevelChange,startZoomLevel)
compare(map.zoomLevel, endZoomLevel)
+ }
- // 14. try to zoom below and above plugin's support
- clear_data()
+ 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),
@@ -618,10 +527,11 @@ Item {
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)
- map.zoomLevel = 10
+ }
- // 15. check that pinch accepted works (rejection)
- clear_data()
+ 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),
@@ -631,20 +541,21 @@ Item {
compare(pinchFinishedSpy.count, 0)
compare(map.gesture.isPinchActive, false)
compare(map.zoomLevel, 10)
- startZoomLevel = 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)
- endZoomLevel = calculateZoom( map.startPinchPoint1, map.startPinchPoint2,
- map.endPinchPoint1, map.endPinchPoint2,
- map.width,map.height,
- map.gesture.maximumZoomLevelChange,startZoomLevel)
+ 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)
+ }
- // 16. moving center
- clear_data()
+ 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)
@@ -655,8 +566,10 @@ Item {
// 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))
- // 17. angle between points
- clear_data()
+ }
+
+ 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)
diff --git a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
index 2ed03a91..551517c3 100644
--- a/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
+++ b/tests/auto/geotestplugin/qgeocodingmanagerengine_test.h
@@ -32,7 +32,7 @@
****************************************************************************/
#ifndef QGEOCODINGMANAGERENGINE_TEST_H
-#define QGECODINGMANAGERENGINE_TEST_H
+#define QGEOCODINGMANAGERENGINE_TEST_H
#include <qgeoserviceprovider.h>
#include <qgeocodingmanagerengine.h>
diff --git a/tests/auto/positionplugin/plugin.json b/tests/auto/positionplugin/plugin.json
index c16b7a8d..68acaded 100644
--- a/tests/auto/positionplugin/plugin.json
+++ b/tests/auto/positionplugin/plugin.json
@@ -4,5 +4,6 @@
"Position": true,
"Satellite": false,
"Monitor": false,
- "Priority": 0
+ "Priority": 0,
+ "Testable": true
}
diff --git a/tests/auto/positionplugintest/positionplugintest.pro b/tests/auto/positionplugintest/positionplugintest.pro
index da68f966..58c8076a 100644
--- a/tests/auto/positionplugintest/positionplugintest.pro
+++ b/tests/auto/positionplugintest/positionplugintest.pro
@@ -4,5 +4,7 @@ TARGET=tst_positionplugin
SOURCES += tst_positionplugin.cpp
+CONFIG -= app_bundle
+
QT += positioning testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/positionplugintest/tst_positionplugin.cpp b/tests/auto/positionplugintest/tst_positionplugin.cpp
index aaa1c3a7..4d346183 100644
--- a/tests/auto/positionplugintest/tst_positionplugin.cpp
+++ b/tests/auto/positionplugintest/tst_positionplugin.cpp
@@ -61,8 +61,13 @@ void tst_PositionPlugin::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
qRegisterMetaType<QGeoPositionInfo>();
}
diff --git a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro b/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
index 35581bca..f744bd59 100644
--- a/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
+++ b/tests/auto/qgeoareamonitor/qgeoareamonitor.pro
@@ -9,5 +9,7 @@ HEADERS += logfilepositionsource.h
OTHER_FILES += *.txt
+CONFIG -= app_bundle
+
QT += positioning testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
index 6da752c3..da4827cf 100644
--- a/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
+++ b/tests/auto/qgeoareamonitor/tst_qgeoareamonitor.cpp
@@ -85,8 +85,13 @@ private slots:
/*
* Set custom path since CI doesn't install plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
qRegisterMetaType<QGeoPositionInfo>();
qRegisterMetaType<QGeoAreaMonitorInfo>();
}
diff --git a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
index 17639c06..b4f3a797 100644
--- a/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
+++ b/tests/auto/qgeocameratiles/tst_qgeocameratiles.cpp
@@ -122,7 +122,7 @@ private slots:
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(16);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(32, 32));
ct.setMapType(QGeoMapType(QGeoMapType::StreetMap, "street map", "street map", false, false, 1));
@@ -171,7 +171,7 @@ private slots:
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(16);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(32, 32));
ct.setPluginString("pluginA");
@@ -230,7 +230,7 @@ private slots:
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(16);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(std::ceil(width), std::ceil(height)));
QSet<QGeoTileSpec> tiles;
diff --git a/tests/auto/qgeocodingmanager/qgeocodingmanager.pro b/tests/auto/qgeocodingmanager/qgeocodingmanager.pro
index d39bfd9c..f88113d8 100644
--- a/tests/auto/qgeocodingmanager/qgeocodingmanager.pro
+++ b/tests/auto/qgeocodingmanager/qgeocodingmanager.pro
@@ -7,5 +7,7 @@ HEADERS += ../utils/qlocationtestutils_p.h \
SOURCES += tst_qgeocodingmanager.cpp \
../utils/qlocationtestutils.cpp
+CONFIG -= app_bundle
+
QT += location testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp
index 43269f21..46b89e35 100644
--- a/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp
+++ b/tests/auto/qgeocodingmanager/tst_qgeocodingmanager.cpp
@@ -43,8 +43,13 @@ void tst_QGeoCodingManager::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
tst_QGeoCodingManager::loadGeocodingManager();
}
diff --git a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
index e76e2d2a..5977e82f 100644
--- a/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
+++ b/tests/auto/qgeomapscene/tst_qgeomapscene.cpp
@@ -37,7 +37,7 @@
#include "qgeomapscene_p.h"
#include "qgeocameratiles_p.h"
#include "qgeocameradata_p.h"
-#include "qgeotilecache_p.h"
+#include "qabstractgeotilecache_p.h"
#include <QtPositioning/private/qgeoprojection_p.h>
#include <QtPositioning/private/qdoublevector2d_p.h>
@@ -284,7 +284,7 @@ class tst_QGeoMapScene : public QObject
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(16);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(16,16));
QGeoMapScene mapScene;
@@ -326,7 +326,7 @@ class tst_QGeoMapScene : public QObject
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(tileSize);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(screenWidth,screenHeight));
QGeoMapScene mapGeometry;
@@ -366,7 +366,7 @@ class tst_QGeoMapScene : public QObject
QGeoCameraTiles ct;
ct.setMaximumZoomLevel(8);
ct.setTileSize(tileSize);
- ct.setCamera(camera);
+ ct.setCameraData(camera);
ct.setScreenSize(QSize(screenWidth,screenHeight));
QGeoMapScene mapGeometry;
diff --git a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro b/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
index 0a49168f..79847fec 100644
--- a/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
+++ b/tests/auto/qgeopositioninfosource/qgeopositioninfosource.pro
@@ -10,5 +10,7 @@ SOURCES += ../utils/qlocationtestutils.cpp \
testqgeopositioninfosource.cpp \
tst_qgeopositioninfosource.cpp
+CONFIG -= app_bundle
+
QT += positioning testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
index 5d52127b..88e97bb2 100644
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
+++ b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
@@ -117,8 +117,13 @@ TestQGeoPositionInfoSource::TestQGeoPositionInfoSource(QObject *parent)
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
}
TestQGeoPositionInfoSource *TestQGeoPositionInfoSource::createDefaultSourceTest()
diff --git a/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro
index 4d68b1bd..d6416a87 100644
--- a/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro
+++ b/tests/auto/qgeoroutingmanager/qgeoroutingmanager.pro
@@ -6,5 +6,7 @@ HEADERS += tst_qgeoroutingmanager.h
SOURCES += tst_qgeoroutingmanager.cpp
+CONFIG -= app_bundle
+
QT += location testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp
index a7055e08..7bc84b7f 100644
--- a/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp
+++ b/tests/auto/qgeoroutingmanager/tst_qgeoroutingmanager.cpp
@@ -43,8 +43,13 @@ void tst_QGeoRoutingManager::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
tst_QGeoRoutingManager::loadRoutingManager();
}
diff --git a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
index 1fb72da7..7c0e7ee2 100644
--- a/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
+++ b/tests/auto/qgeosatelliteinfosource/qgeosatelliteinfosource.pro
@@ -11,7 +11,4 @@ HEADERS += testqgeosatelliteinfosource_p.h \
QT += positioning testlib
-# Define whether a satellite source is available. This must match the logic in
-# src/location/location.pro or the test will fail on some platforms.
-qtHaveModule(simulator):DEFINES += SATELLITE_SOURCE_AVAILABLE
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
index c825cdad..d80385c8 100644
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
+++ b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
@@ -46,6 +46,7 @@
#include "../utils/qlocationtestutils_p.h"
Q_DECLARE_METATYPE(QList<QGeoSatelliteInfo>)
+Q_DECLARE_METATYPE(QGeoSatelliteInfoSource::Error)
#define MAX_WAITING_TIME 50000
@@ -90,6 +91,8 @@ protected:
TestQGeoSatelliteInfoSource::TestQGeoSatelliteInfoSource(QObject *parent)
: QObject(parent)
{
+ qRegisterMetaType<QGeoSatelliteInfoSource::Error>();
+
m_testingDefaultSource = false;
}
@@ -167,23 +170,26 @@ void TestQGeoSatelliteInfoSource::createDefaultSource()
{
QObject *parent = new QObject;
QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(parent);
- // Satellite sources are available when SATELLITE_SOURCE_AVAILABLE is defined
-#if defined(SATELLITE_SOURCE_AVAILABLE)
- QVERIFY(source != 0);
-#else
- QVERIFY(source == 0);
-#endif
+
+ // Check that default satellite source is successfully created.
+ if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
+ QVERIFY(source);
+ else
+ QVERIFY(!source);
+
delete parent;
}
void TestQGeoSatelliteInfoSource::createDefaultSource_noParent()
{
QGeoSatelliteInfoSource *source = QGeoSatelliteInfoSource::createDefaultSource(0);
-#if defined(SATELLITE_SOURCE_AVAILABLE)
- QVERIFY(source != 0);
-#else
- QVERIFY(source == 0);
-#endif
+
+ // Check that default satellite source is successfully created.
+ if (!QGeoSatelliteInfoSource::availableSources().isEmpty())
+ QVERIFY(source);
+ else
+ QVERIFY(!source);
+
delete source;
}
@@ -246,10 +252,16 @@ void TestQGeoSatelliteInfoSource::startUpdates_testIntervals()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->setUpdateInterval(7000);
int interval = m_source->updateInterval();
m_source->startUpdates();
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 9500);
for (int i = 0; i < 6; i++) {
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1) && (timeout.count() == 0), (interval*2));
@@ -275,10 +287,15 @@ void TestQGeoSatelliteInfoSource::startUpdates_testIntervalChangesWhileRunning()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->setUpdateInterval(0);
m_source->startUpdates();
m_source->setUpdateInterval(0);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), 7000);
QCOMPARE(timeout.count(), 0);
spyView.clear();
@@ -330,7 +347,13 @@ void TestQGeoSatelliteInfoSource::startUpdates_testDefaultInterval()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->startUpdates();
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
for (int i = 0; i < 3; i++) {
QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (timeout.count() == 0), 7000);
spyView.clear();
@@ -347,9 +370,14 @@ void TestQGeoSatelliteInfoSource::startUpdates_testZeroInterval()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->setUpdateInterval(0);
m_source->startUpdates();
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
for (int i = 0; i < 3; i++) {
QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() > 0 ) && (spyUse.count() > 0) && (timeout.count() == 0), 7000);
spyView.clear();
@@ -365,9 +393,14 @@ void TestQGeoSatelliteInfoSource::startUpdates_moreThanOnce()
SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->setUpdateInterval(0);
m_source->startUpdates();
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->startUpdates(); // check there is no crash
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0), MAX_WAITING_TIME);
@@ -379,16 +412,20 @@ void TestQGeoSatelliteInfoSource::startUpdates_moreThanOnce()
void TestQGeoSatelliteInfoSource::stopUpdates()
{
-
CHECK_SOURCE_VALID;
QSignalSpy spyView(m_source,
SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->setUpdateInterval(10000);
m_source->startUpdates();
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
for (int i = 0; i < 2; i++) {
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 12000);
spyView.clear();
@@ -415,7 +452,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate()
QSignalSpy spy(m_source, SIGNAL(requestTimeout()));
QSignalSpy spyView(m_source,
SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->requestUpdate(timeout);
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
// Geoclue may deliver update instantly if there is a satellite fix
QTRY_VERIFY_WITH_TIMEOUT(!spy.isEmpty() || !spyView.isEmpty(), 10);
}
@@ -436,9 +479,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_validTimeout()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyTimeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(7000);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT(
(spyView.count() == 1) && (spyUse.count() == 1 && (spyTimeout.count()) == 0), 7000);
}
@@ -452,9 +499,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_defaultTimeout()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyTimeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(0);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT(
(spyView.count() == 1) && (spyUse.count() == 1 && (spyTimeout.count()) == 0),
MAX_WAITING_TIME);
@@ -465,8 +516,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_timeoutLessThanMinimumInterval()
CHECK_SOURCE_VALID;
QSignalSpy spyTimeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->requestUpdate(1);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_COMPARE_WITH_TIMEOUT(spyTimeout.count(), 1, 1000);
}
@@ -478,9 +534,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_repeatedCalls()
SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(7000);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
spyView.clear();
spyUse.clear();
@@ -498,8 +558,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCalls()
SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(7000);
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->requestUpdate(7000);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
@@ -515,8 +580,13 @@ void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCallsWithTimeout()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyTimeout(m_source,
SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(0);
+
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->requestUpdate(1);
QTRY_COMPARE_WITH_TIMEOUT(spyTimeout.count(), 0, 7000);
@@ -533,10 +603,14 @@ void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyTimeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->setUpdateInterval(0);
m_source->startUpdates();
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), MAX_WAITING_TIME);
spyView.clear();
spyUse.clear();
@@ -563,9 +637,14 @@ void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy spyTimeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
+
m_source->setUpdateInterval(10000);
m_source->requestUpdate(7000);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->startUpdates();
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0)
@@ -587,9 +666,13 @@ void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(7000);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->setUpdateInterval(0);
m_source->startUpdates();
@@ -612,9 +695,13 @@ void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_SmallInterval(
QSignalSpy spyUse(m_source,
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy timeout(m_source, SIGNAL(requestTimeout()));
+ QSignalSpy errorSpy(m_source, SIGNAL(error(QGeoSatelliteInfoSource::Error)));
m_source->requestUpdate(7000);
+ if (!errorSpy.isEmpty())
+ QSKIP("Error starting satellite updates.");
+
m_source->setUpdateInterval(10000);
m_source->startUpdates();
@@ -657,6 +744,9 @@ void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
m_source->requestUpdate(7000);
+ if (m_source->error() != QGeoSatelliteInfoSource::NoError)
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
}
@@ -673,6 +763,9 @@ void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
m_source->requestUpdate(7000);
+ if (m_source->error() != QGeoSatelliteInfoSource::NoError)
+ QSKIP("Error starting satellite updates.");
+
QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
}
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
index f62bc28c..9efb9dde 100644
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
+++ b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource_p.h
@@ -110,14 +110,6 @@ private slots:
void removeSlotForSatellitesInUseUpdated();
void removeSlotForSatellitesInViewUpdated();
-#ifdef TST_GYPSYMOCK_ENABLED
- // Cases only ran with mock backend
- void updateValues();
- void initGoneBad();
- void badUpdates();
-#endif
-
-
private:
QGeoSatelliteInfoSource *m_source;
bool m_testingDefaultSource;
diff --git a/tests/auto/qgeoserviceprovider/qgeoserviceprovider.pro b/tests/auto/qgeoserviceprovider/qgeoserviceprovider.pro
index 793d7ac5..5dfe2dde 100644
--- a/tests/auto/qgeoserviceprovider/qgeoserviceprovider.pro
+++ b/tests/auto/qgeoserviceprovider/qgeoserviceprovider.pro
@@ -4,4 +4,6 @@ TARGET=tst_qgeoserviceprovider
SOURCES += tst_qgeoserviceprovider.cpp
+CONFIG -= app_bundle
+
QT += testlib location
diff --git a/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp b/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp
index ea9e3d2b..ec6ed698 100644
--- a/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp
+++ b/tests/auto/qgeoserviceprovider/tst_qgeoserviceprovider.cpp
@@ -56,8 +56,13 @@ void tst_QGeoServiceProvider::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
}
void tst_QGeoServiceProvider::tst_availableServiceProvider()
diff --git a/tests/auto/qmlinterface/data/TestPlace.qml b/tests/auto/qmlinterface/data/TestPlace.qml
index 33e54104..e2571cb4 100644
--- a/tests/auto/qmlinterface/data/TestPlace.qml
+++ b/tests/auto/qmlinterface/data/TestPlace.qml
@@ -31,7 +31,7 @@
**
****************************************************************************/
-import QtLocation 5.5
+import QtLocation 5.6
Place {
name: "Test Place"
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
index c6105d82..bbe7b4d8 100644
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
+++ b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/qnmeapositioninfosource_realtime_generic.pro
@@ -18,6 +18,8 @@ SOURCES += ../../utils/qlocationtestutils.cpp \
tst_qnmeapositioninfosource_realtime_generic.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG -= app_bundle
+
# This test relies on a working local QTcpSocket(Server). When the CI is under
# heavy load the socket code cannot establish a connection which leads to flaky
# test results. We make this test insiginficant as there is currently no known
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
index ed1d4783..737483e4 100644
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
+++ b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_realtime_generic/tst_qnmeapositioninfosource_realtime_generic.cpp
@@ -46,8 +46,13 @@ public:
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../../plugins"));
+#endif
}
~tst_QNmeaPositionInfoSource_RealTime_Generic()
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
index f3bd50a0..7c181173 100644
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
+++ b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/qnmeapositioninfosource_simulation_generic.pro
@@ -18,6 +18,8 @@ SOURCES += ../../utils/qlocationtestutils.cpp \
tst_qnmeapositioninfosource_simulation_generic.cpp
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+CONFIG -= app_bundle
+
# This test relies on a working local QTcpSocket(Server). When the CI is under
# heavy load the socket code cannot establish a connection which leads to flaky
# test results. We make this test insiginficant as there is currently no known
diff --git a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
index 1c078e35..0663e31e 100644
--- a/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
+++ b/tests/auto/qnmeapositioninfosource/qnmeapositioninfosource_simulation_generic/tst_qnmeapositioninfosource_simulation_generic.cpp
@@ -44,8 +44,13 @@ public:
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../../plugins"));
+#endif
}
protected:
diff --git a/tests/auto/qplacemanager/qplacemanager.pro b/tests/auto/qplacemanager/qplacemanager.pro
index 2c632a7f..9703ae23 100644
--- a/tests/auto/qplacemanager/qplacemanager.pro
+++ b/tests/auto/qplacemanager/qplacemanager.pro
@@ -4,5 +4,7 @@ TARGET = tst_qplacemanager
SOURCES += tst_qplacemanager.cpp
+CONFIG -= app_bundle
+
QT += location testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qplacemanager/tst_qplacemanager.cpp b/tests/auto/qplacemanager/tst_qplacemanager.cpp
index c932c0ff..bef58b3c 100644
--- a/tests/auto/qplacemanager/tst_qplacemanager.cpp
+++ b/tests/auto/qplacemanager/tst_qplacemanager.cpp
@@ -80,8 +80,13 @@ void tst_QPlaceManager::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
provider = 0;
QStringList providers = QGeoServiceProvider::availableServiceProviders();
diff --git a/tests/auto/qplacemanager_unsupported/qplacemanager_unsupported.pro b/tests/auto/qplacemanager_unsupported/qplacemanager_unsupported.pro
index ec1f5cdb..0069d080 100644
--- a/tests/auto/qplacemanager_unsupported/qplacemanager_unsupported.pro
+++ b/tests/auto/qplacemanager_unsupported/qplacemanager_unsupported.pro
@@ -4,5 +4,7 @@ TARGET = tst_qplacemanager_unsupported
SOURCES += tst_qplacemanager_unsupported.cpp
+CONFIG -= app_bundle
+
QT += location testlib
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp b/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
index 46c2991e..40e56214 100644
--- a/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
+++ b/tests/auto/qplacemanager_unsupported/tst_qplacemanager_unsupported.cpp
@@ -83,8 +83,13 @@ void tst_QPlaceManagerUnsupported::initTestCase()
/*
* Set custom path since CI doesn't install test plugins
*/
+#ifdef Q_OS_WIN
+ QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath() +
+ QStringLiteral("/../../../../plugins"));
+#else
QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()
+ QStringLiteral("/../../../plugins"));
+#endif
m_provider = 0;
m_manager = 0;
diff --git a/tests/plugins/declarativetestplugin/declarativetestplugin.pro b/tests/plugins/declarativetestplugin/declarativetestplugin.pro
index c4c82e2e..a27267d7 100644
--- a/tests/plugins/declarativetestplugin/declarativetestplugin.pro
+++ b/tests/plugins/declarativetestplugin/declarativetestplugin.pro
@@ -1,6 +1,6 @@
CXX_MODULE = location
TARGET = declarative_location_test
-TARGETPATH = QtLocation/test
+TARGETPATH = QtLocation/Test
QT += gui-private qml quick location testlib
@@ -19,7 +19,7 @@ IMPORT_FILES = \
qmldir
load(qml_plugin)
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
+
# must be after load(qml_plugin)
include(../imports.pri)
diff --git a/tests/plugins/declarativetestplugin/locationtest.cpp b/tests/plugins/declarativetestplugin/locationtest.cpp
index a2864d12..cde1d97f 100644
--- a/tests/plugins/declarativetestplugin/locationtest.cpp
+++ b/tests/plugins/declarativetestplugin/locationtest.cpp
@@ -46,15 +46,13 @@ class QLocationDeclarativeTestModule: public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
- virtual void registerTypes(const char* uri) {
- qDebug() << "registerTypes in new test plugin: " << uri;
- if (QLatin1String(uri) == QLatin1String("QtLocation.test")) {
- // This version numbering is not correct. It is just something to get going
- // until the proper versioning scheme of QML plugins in Qt5 is agreed upon.
- qmlRegisterType<QDeclarativePinchGenerator>(uri, 5, 0, "PinchGenerator");
- qmlRegisterType<QDeclarativeLocationTestModel>(uri, 5, 0, "TestModel");
+ virtual void registerTypes(const char* uri)
+ {
+ if (QLatin1String(uri) == QLatin1String("QtLocation.Test")) {
+ qmlRegisterType<QDeclarativePinchGenerator>(uri, 5, 5, "PinchGenerator");
+ qmlRegisterType<QDeclarativeLocationTestModel>(uri, 5, 5, "TestModel");
} else {
- qDebug() << "Unsupported URI given to load location test QML plugin: " << QLatin1String(uri);
+ qWarning() << "Unsupported URI given to load location test QML plugin: " << QLatin1String(uri);
}
}
};
diff --git a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
index 9e1757bc..f0b03746 100644
--- a/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
+++ b/tests/plugins/declarativetestplugin/qdeclarativelocationtestmodel.cpp
@@ -169,8 +169,6 @@ void QDeclarativeLocationTestModel::repopulate()
if (crazyMode_)
datacount = (qAbs(qrand()) % datacount_);
- qDebug() << "generating random content: " << datacount;
-
for (int i = 0; i < datacount; ++i) {
DataObject* dataobject = new DataObject;
dataobject->coordinate_ = QGeoCoordinate(latitude, longitude);
@@ -202,10 +200,9 @@ void QDeclarativeLocationTestModel::scheduleRepopulation()
{
if (!componentCompleted_)
return;
- if (datacount_ <= 0) {
- qDebug() << __FUNCTION__ << "won't schedule model, invalid datacount: " << datacount_;
+
+ if (datacount_ <= 0)
return;
- }
if (timer_.isActive())
timer_.stop();
diff --git a/tests/plugins/declarativetestplugin/qmldir b/tests/plugins/declarativetestplugin/qmldir
index f35dd9c1..c2582ede 100644
--- a/tests/plugins/declarativetestplugin/qmldir
+++ b/tests/plugins/declarativetestplugin/qmldir
@@ -1 +1,3 @@
+module QtLocation.Test
plugin declarative_location_test
+classname QLocationDeclarativeTestModule