diff options
-rw-r--r-- | examples/declarative/mapviewer/Dialog.qml | 2 | ||||
-rw-r--r-- | examples/declarative/mapviewer/MapComponent.qml | 11 | ||||
-rw-r--r-- | examples/declarative/mapviewer/RouteDialog.qml | 98 | ||||
-rw-r--r-- | examples/declarative/mapviewer/common/Checkbox.qml | 63 | ||||
-rw-r--r-- | examples/declarative/mapviewer/common/Optionbutton.qml | 67 | ||||
-rw-r--r-- | examples/declarative/mapviewer/mapviewer.qml | 17 | ||||
-rw-r--r-- | examples/declarative/mapviewer/mapviewer.qrc | 4 | ||||
-rwxr-xr-x | examples/declarative/mapviewer/resources/checkbox.png | bin | 0 -> 419 bytes | |||
-rwxr-xr-x | examples/declarative/mapviewer/resources/checkbox_selected.png | bin | 0 -> 493 bytes | |||
-rw-r--r-- | tests/systemtests/sys_location.qtt | 113 |
10 files changed, 324 insertions, 51 deletions
diff --git a/examples/declarative/mapviewer/Dialog.qml b/examples/declarative/mapviewer/Dialog.qml index ccc3a55c..2a1dc6ec 100644 --- a/examples/declarative/mapviewer/Dialog.qml +++ b/examples/declarative/mapviewer/Dialog.qml @@ -143,7 +143,7 @@ Item { height: 32 Common.Button { id: buttonClearAll - text: "Clear All" + text: "Clear" width: 80; height: parent.height onClicked: { for (var i = 0; i<length; i++){ diff --git a/examples/declarative/mapviewer/MapComponent.qml b/examples/declarative/mapviewer/MapComponent.qml index 41c95e54..85b3bb12 100644 --- a/examples/declarative/mapviewer/MapComponent.qml +++ b/examples/declarative/mapviewer/MapComponent.qml @@ -61,12 +61,17 @@ Map { query: routeQuery onStatusChanged:{ if (status == RouteModel.Ready){ - if (count == 1) { routeInfoModel.update();} + if (count == 1) { routeInfoModel.update()} } else if (status == RouteModel.Error){ + clearAll() map.routeError() } } + function clearAll(){ + clear() + routeInfoModel.update() + } } property GeocodeModel geocodeModel: GeocodeModel { plugin : map.plugin; @@ -286,7 +291,7 @@ Map { Coordinate { id: defaultCoordinates - latitude : -27.575 + latitude : -27.53 longitude : 153.088 } @@ -696,7 +701,7 @@ Map { { var dist = Math.round(meters) if (dist > 1000 ){ - if (dist > 10000){ + if (dist > 100000){ dist = Math.round(dist / 1000) } else{ diff --git a/examples/declarative/mapviewer/RouteDialog.qml b/examples/declarative/mapviewer/RouteDialog.qml index 8901c203..61de99b0 100644 --- a/examples/declarative/mapviewer/RouteDialog.qml +++ b/examples/declarative/mapviewer/RouteDialog.qml @@ -64,8 +64,8 @@ Item { property alias endCountry: countryTo.text property alias byCoordinates: coord.enabled property int travelMode: RouteQuery.CarTravel // CarTravel, PedestrianTravel, BicycleTravel, PublicTransitTravel, TruckTravel - property int routeOptimization: RouteQuery.ShortestRoute // ShortestRoute, FastestRoute, MostEconomicRoute, MostScenicRoute - // TODO NoFeature, TollFeature, HighwayFeature, PublicTransitFeature, FerryFeature, TunnelFeature, DirtRoadFeature, ParksFeature, MotorPoolLaneFeature + property int routeOptimization: RouteQuery.FastestRoute // ShortestRoute, FastestRoute, MostEconomicRoute, MostScenicRoute + property variant features: [] // NoFeature, TollFeature, HighwayFeature, PublicTransitFeature, FerryFeature, TunnelFeature, DirtRoadFeature, ParksFeature, MotorPoolLaneFeature Common.Fader {} @@ -74,7 +74,7 @@ Item { color: "lightsteelblue" opacity: 1 width: parent.width - gap*2; - height: options.height + gap*3 + buttons.height + titleBar.height + height: options.height + gap*4 + buttons.height + titleBar.height + routeOptions.height anchors { top: parent.top @@ -361,14 +361,104 @@ Item { topMargin:gap/3 } } + } + } + } + + Row { + id: routeOptions + anchors.top: options.bottom + anchors.topMargin: gap + anchors.left: parent.left + anchors.leftMargin: gap + width: parent.width - gap + height: checkboxToll.height*2 + gap + spacing: gap + Column {//travel mode + spacing: gap/3 + height: parent.height + width: parent.width/3 - gap + Common.Optionbutton { + id: optionbuttonVehicle + width: parent.width + text: "Vehicle" + selected: true + onClicked: { + travelMode = RouteQuery.CarTravel + optionbuttonPedestrian.selected = false + } + } + Common.Optionbutton { + id: optionbuttonPedestrian + width: parent.width + text: "Pedestrian" + onClicked: { + travelMode = RouteQuery.PedestrianTravel + optionbuttonVehicle.selected = false + } + } + } + + Column {//Optimization + spacing: gap/3 + height: parent.height + width: parent.width/3 - gap + Common.Optionbutton { + id: optionbuttonFastest + width: parent.width + text: "Fastest" + selected: true + onClicked: { + routeOptimization = RouteQuery.FastestRoute + optionbuttonShortest.selected = false + } + } + Common.Optionbutton { + id: optionbuttonShortest + width: parent.width + text: "Shortest" + onClicked: { + routeOptimization = RouteQuery.ShortestRoute + optionbuttonFastest.selected = false + } + } + } + + Column {//Route features + id: routeFeatures + spacing: gap/3 + height: parent.height + width: parent.width/3 - gap + Common.Checkbox { + id: checkboxToll + width: parent.width + text: "Avoid toll roads" + onSelectedChanged: {routeFeatures.updateRouteFeatures()} + } + Common.Checkbox { + id: checkboxHighways + width: parent.width + text: "Avoid highways" + onSelectedChanged: {routeFeatures.updateRouteFeatures()} + } + + function updateRouteFeatures(){ + features = [] + var myArray = new Array() + + if (checkboxToll.selected) myArray.push(RouteQuery.TollFeature) + if (checkboxHighways.selected) myArray.push(RouteQuery.HighwayFeature) + + features = myArray } } } + Row { id: buttons - anchors.top: options.bottom + anchors.top: routeOptions.bottom anchors.topMargin: gap anchors.horizontalCenter: parent.horizontalCenter spacing: gap/3 diff --git a/examples/declarative/mapviewer/common/Checkbox.qml b/examples/declarative/mapviewer/common/Checkbox.qml new file mode 100644 index 00000000..9f9cecc4 --- /dev/null +++ b/examples/declarative/mapviewer/common/Checkbox.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 Nokia Corporation and its Subsidiary(-ies) 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 1.1 + +Item { + id: checkbox + property bool selected: false + property alias text: checkboxText.text + height: checkboxText.height + + Row { + id: checkboxRow + spacing: 3 + anchors.fill: parent + Image { + source: checkbox.selected ? "../resources/checkbox_selected.png" : "../resources/checkbox.png" + } + Text { + id: checkboxText + } + } + MouseArea { + anchors.fill: parent + onClicked: { checkbox.selected = !checkbox.selected } + } +} diff --git a/examples/declarative/mapviewer/common/Optionbutton.qml b/examples/declarative/mapviewer/common/Optionbutton.qml new file mode 100644 index 00000000..47f00c5d --- /dev/null +++ b/examples/declarative/mapviewer/common/Optionbutton.qml @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the 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 Nokia Corporation and its Subsidiary(-ies) 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 1.1 + +Item { + id: optionbutton + property bool selected: false + property alias text: optionbuttonText.text + height: optionbuttonText.height + signal clicked + + Row { + id: optionbuttonRow + spacing: 3 + anchors.fill: parent + Image { + source: optionbutton.selected ? "../resources/option_button_selected.png" : "../resources/option_button.png" + } + Text { + id: optionbuttonText + } + } + MouseArea { + anchors.fill: parent + onClicked: { + optionbutton.selected = true + optionbutton.clicked() + } + } +} diff --git a/examples/declarative/mapviewer/mapviewer.qml b/examples/declarative/mapviewer/mapviewer.qml index 75b19632..8891767a 100644 --- a/examples/declarative/mapviewer/mapviewer.qml +++ b/examples/declarative/mapviewer/mapviewer.qml @@ -273,6 +273,10 @@ Item { PropertyChanges { target: messageDialog; text: "Unable to find a route for the given points"} }, State{ + name: "Coordinates" + PropertyChanges { target: messageDialog; title: "Coordinates" } + }, + State{ name: "LocationInfo" PropertyChanges { target: messageDialog; title: "Location" } PropertyChanges { target: messageDialog; text: geocodeMessage() } @@ -324,9 +328,9 @@ Item { messageDialog.state = "AmbiguousGeocode" messageDialog.text = count + " results found for the " + st + " point, please specify location" } - console.log(" state = " + messageDialog.state) success = 0 page.state = "Message" + map.routeModel.clearAll() } } } @@ -369,6 +373,15 @@ Item { map.routeQuery.addWaypoint(endCoordinate) map.routeQuery.travelModes = routeDialog.travelMode map.routeQuery.routeOptimizations = routeDialog.routeOptimization + + for (var i=0; i<9; i++) { + map.routeQuery.setFeatureWeight(i, 0) + } + + for (var i=0; i<routeDialog.features.length; i++) { + map.routeQuery.setFeatureWeight(routeDialog.features[i], RouteQuery.AvoidFeatureWeight) + } + map.routeModel.update(); } } @@ -500,7 +513,7 @@ Item { } onCoordinatesCaptured: { - messageDialog.title = "Coordinates" + messageDialog.state = "Coordinates" messageDialog.text = "<b>Latitude:</b> " + roundNumber(latitude,4) + "<br/><b>Longitude:</b> " + roundNumber(longitude,4); page.state = "Message" } diff --git a/examples/declarative/mapviewer/mapviewer.qrc b/examples/declarative/mapviewer/mapviewer.qrc index 56b16ea1..cc2c671b 100644 --- a/examples/declarative/mapviewer/mapviewer.qrc +++ b/examples/declarative/mapviewer/mapviewer.qrc @@ -34,5 +34,9 @@ <file>resources/node_selected.png</file> <file>resources/catch.png</file> <file>resources/scale.png</file> + <file>resources/checkbox_selected.png</file> + <file>resources/checkbox.png</file> + <file>common/Checkbox.qml</file> + <file>common/Optionbutton.qml</file> </qresource> </RCC> diff --git a/examples/declarative/mapviewer/resources/checkbox.png b/examples/declarative/mapviewer/resources/checkbox.png Binary files differnew file mode 100755 index 00000000..193eeb3d --- /dev/null +++ b/examples/declarative/mapviewer/resources/checkbox.png diff --git a/examples/declarative/mapviewer/resources/checkbox_selected.png b/examples/declarative/mapviewer/resources/checkbox_selected.png Binary files differnew file mode 100755 index 00000000..fbbf544f --- /dev/null +++ b/examples/declarative/mapviewer/resources/checkbox_selected.png diff --git a/tests/systemtests/sys_location.qtt b/tests/systemtests/sys_location.qtt index 93c99fa4..4a21440f 100644 --- a/tests/systemtests/sys_location.qtt +++ b/tests/systemtests/sys_location.qtt @@ -437,8 +437,6 @@ testcase = { skip( "Nothing tested", SkipAll ); }, - //TESTED_COMPONENT=plugins/declarative/location - // \groups BAT,1.2,QTMOBILITY-796 qml_display_map: function() { @@ -478,14 +476,15 @@ testcase = { | Select Route menu item | | | Make sure that coordinates are *(-27.575,153.088)->(-27.465,153.023)* | | | Press Go button | | - | Wait for message appears on the screen | Verify that distance is *15.901*km | - | Press Ok button | Verify that the route looks correct and does not have strange loops | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *15.9km* | + | Click on the catch | | | Press Options button | | | Select Route menu item | | | Select second option group to enter start and end points as address | | | Use default addresses and Press Go button | | - | Wait for message appears on the screen | Verify that distance is *18.676km* | - | Press Ok button | Verify that the route looks correct and does not have strange loops |' + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *19.6km* |' )); }, @@ -498,21 +497,22 @@ testcase = { | Run the qml_mapviewer application | | | Press Options button | | | Select Route menu item | | - | Selec first option group | | + | Selec coordinate option group | | | Fill in *-27.4709* in From Latitude field | | | Fill in *153.0235* in From Longitude filed | | | Fill in *-33.8689* in To Latitude field | | | Fill in *151.2071* in To Longitude filed | | | Press Go button | | - | Wait for message appears on the screen | Verify that distance is *927.209km* | - | Press Ok button | Verify that the route looks correct and does not have strange loops | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *930km* | + | Click on the catch | | | Press Options button | | | Select Route menu item | | | Selec second option group | | | Press Clear button | | - | Fill in *Moscow* in From City field | | - | Fill in *Russia* in From Country filed | | - | Fill in *Eight Mile Plains* in To City filed | | + | Fill in *Eight Mile Plains* in From City field | | + | Fill in *Australia* in From Country filed | | + | Fill in *Moscow* in To City filed | | | Fill in *Australia* in To Country filed | | | Press Go button | | | Wait for message appears on the screen | Verify that route is not found | @@ -520,14 +520,11 @@ testcase = { | Press Options button | | | Select Route menu item | | | Selec second option group | | - | Press Clear button | | - | Fill in *Eight Mile Plains* in From City field | | - | Fill in *Australia* in From Country filed | | | Fill in *Byron Bay* in To City filed | | | Fill in *Australia* in To Country filed | | | Press Go button | | - | Wait for message appears on the screen | Verify that distance is *151.318km* | - | Press Ok button | Verify that the route looks correct and does not have strange loops |' + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *151km* |' )); }, @@ -559,52 +556,86 @@ testcase = { | Press Go! button | | | Long Press on the first marker | | | Select Route To The Next Points | | - | Wait for message appears on the screen | Verify that distance is *29.491km* | - | Press Ok button | Verify that the route looks correct, goes through all waypoints and does not have strange loops |' + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *29.5km* |' )); }, -/* + // \groups BAT,5.0,MOBILITY-2893,RESEARCH qml_travel_mode: function() { - prompt(twiki('---+++ QML: Travel mode + prompt(twiki('---+++ QML: Travel modes: Vechile Fastest and Pedestrian Fastest Note that internet connection is required for this test case | *Step* | *Verification* | -1. Travel mode: pedestrian. Use qml_mapviewer to test. (55 Bordeaux Street, Eight Mile Plains QLD)->(53 Brandl St, Eight Mile Plains QLD 4113) or (-27.5784,153.0934)->(-27.5798,153.1003) -2. Travel mode: bicycle -3. Travel mode: public transport -4. Travel mode: by truck' + | Run the qml_mapviewer application | | + | Press Options button | | + | Select Route menu item | | + | Selec first option group | | + | Fill in *-27.5789* in From Latitude field | | + | Fill in *153.0919* in From Longitude filed | | + | Fill in *-27.5792* in To Latitude field | | + | Fill in *153.096* in To Longitude filed | | + | Press Go button | | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *2.6km* | + | Click on the catch | | + | Press Options button | | + | Select Route menu item | | + | Select *Pedestrian* option button | | + | Press Go button | | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *1.7km* |' + )); }, // \groups BAT,5.0,MOBILITY-2893,RESEARCH qml_route_feature_type: function() { - prompt(twiki('---+++ QML: Route features + prompt(twiki('---+++ QML: Route features: Avoid Highways and Avoid Tool Roads Note that internet connection is required for this test case | *Step* | *Verification* | -1. Feature type: no feature -2. Feature type: toll -3. Feature type: highway -4. Feature type: public transit -5. Feature type: ferry -6. Feature type: tunnel -7. Feature type: dirt road -8. Feature type: parks -9. Feature type: motor pool lane' + | Run the qml_mapviewer application | | + | Press Options button | | + | Select Route menu item | | + | Selec first option group | | + | Fill in *-27.5013* in From Latitude field | | + | Fill in *153.1002* in From Longitude filed | | + | Fill in *-27.4395* in To Latitude field | | + | Fill in *153.0504* in To Longitude filed | | + | Select *Avoid toll roads* checkbox | | + | Press Go button | | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *18km* | + | Click on the catch | | + | Press Options button | | + | Select *Avoid highways* checkbox | | + | Press Go button | | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *15km* |' + )); }, // \groups BAT,5.0,MOBILITY-2893,RESEARCH qml_route_optimization: function() { - prompt(twiki('---+++ QML: Route optimization + prompt(twiki('---+++ QML: Travel optimization: Vechile Shortest Note that internet connection is required for this test case | *Step* | *Verification* | -1. Route optimization: shortest -2. Route optimization: fastest -3. Route optimization: most economic -4. Route optimization: most scenic' + | Run the qml_mapviewer application | | + | Press Options button | | + | Select Route menu item | | + | Selec first option group | | + | Fill in *-27.5789* in From Latitude field | | + | Fill in *153.0919* in From Longitude filed | | + | Fill in *-27.5792* in To Latitude field | | + | Fill in *153.096* in To Longitude filed | | + | Select *Shortest* option button | | + | Press Go button | | + | Wait for the route appears on the screen | Verify that the route looks correct and does not have strange loops | + | Click on the catch on the left side of the screen | Verify that distance is *2.2km* |' + )); }, -*/ + // \groups BAT,5.0,MOBILITY-2900,RESEARCH qml_geocode_australian_location: function() { |