From ace03f09f45067be03120a440dbd346f949ec444 Mon Sep 17 00:00:00 2001 From: Natalia Shubina Date: Thu, 3 Nov 2011 16:51:16 +1000 Subject: mapviewer to be working with qml2, new color theme, reading av plugins Change-Id: I0011ee15a34ad707de9c4aa633d1b005ee636da2 Reviewed-by: Juha Vuolle --- examples/declarative/mapviewer/Dialog.qml | 164 ---- examples/declarative/mapviewer/MapComponent.qml | 750 ------------------- examples/declarative/mapviewer/Marker.qml | 129 ---- examples/declarative/mapviewer/Message.qml | 110 --- examples/declarative/mapviewer/RouteDialog.qml | 496 ------------- examples/declarative/mapviewer/TextWithLabel.qml | 84 --- examples/declarative/mapviewer/common/Button.qml | 96 --- examples/declarative/mapviewer/common/Checkbox.qml | 63 -- examples/declarative/mapviewer/common/Fader.qml | 68 -- examples/declarative/mapviewer/common/Menu.qml | 174 ----- .../declarative/mapviewer/common/Optionbutton.qml | 67 -- examples/declarative/mapviewer/common/Slider.qml | 108 --- examples/declarative/mapviewer/common/TitleBar.qml | 86 --- examples/declarative/mapviewer/mapviewer.pro | 29 +- examples/declarative/mapviewer/mapviewer.qml | 652 ---------------- examples/declarative/mapviewer/mapviewer.qrc | 42 -- .../mapviewer/content/components/Button.qml | 99 +++ .../mapviewer/content/components/Checkbox.qml | 63 ++ .../mapviewer/content/components/Fader.qml | 68 ++ .../mapviewer/content/components/Menu.qml | 147 ++++ .../mapviewer/content/components/Optionbutton.qml | 67 ++ .../mapviewer/content/components/Slider.qml | 108 +++ .../mapviewer/content/components/TextWithLabel.qml | 85 +++ .../mapviewer/content/components/TitleBar.qml | 86 +++ .../content/components/style/ButtonStyle.qml | 49 ++ .../content/components/style/HMenuItemStyle.qml | 48 ++ .../content/components/style/VMenuItemStyle.qml | 44 ++ .../mapviewer/mapviewer/content/dialogs/Dialog.qml | 188 +++++ .../mapviewer/content/dialogs/Message.qml | 111 +++ .../mapviewer/content/dialogs/RouteDialog.qml | 496 +++++++++++++ .../mapviewer/content/map/MapBaseComponent.qml | 821 +++++++++++++++++++++ .../mapviewer/content/map/MapComponent.qml | 73 ++ .../mapviewer/mapviewer/content/map/Marker.qml | 129 ++++ .../mapviewer/content/resources/button.png | Bin 0 -> 2143 bytes .../mapviewer/content/resources/button.sci | 5 + .../mapviewer/content/resources/button_hovered.png | Bin 0 -> 2066 bytes .../mapviewer/content/resources/button_pressed.png | Bin 0 -> 2499 bytes .../mapviewer/content/resources/catch.png | Bin 0 -> 907 bytes .../mapviewer/content/resources/checkbox.png | Bin 0 -> 410 bytes .../content/resources/checkbox_selected.png | Bin 0 -> 766 bytes .../mapviewer/content/resources/hmenuItem.png | Bin 0 -> 1246 bytes .../mapviewer/content/resources/hmenuItem.sci | 5 + .../content/resources/hmenuItem_hovered.png | Bin 0 -> 1191 bytes .../content/resources/hmenuItem_pressed.png | Bin 0 -> 1203 bytes .../mapviewer/content/resources/marker.png | Bin 0 -> 2341 bytes .../mapviewer/content/resources/marker_hovered.png | Bin 0 -> 2358 bytes .../content/resources/marker_selected.png | Bin 0 -> 2355 bytes .../mapviewer/content/resources/menuItem.png | Bin 0 -> 1436 bytes .../mapviewer/content/resources/menuItem.sci | 5 + .../content/resources/menuItem_hovered.png | Bin 0 -> 1380 bytes .../content/resources/menuItem_pressed.png | Bin 0 -> 1389 bytes .../mapviewer/mapviewer/content/resources/node.png | Bin 0 -> 432 bytes .../mapviewer/content/resources/node_selected.png | Bin 0 -> 458 bytes .../mapviewer/content/resources/option_button.png | Bin 0 -> 759 bytes .../content/resources/option_button_selected.png | Bin 0 -> 666 bytes .../mapviewer/mapviewer/content/resources/quit.png | Bin 0 -> 2439 bytes .../mapviewer/content/resources/quit_hovered.png | Bin 0 -> 2702 bytes .../mapviewer/content/resources/quit_pressed.png | Bin 0 -> 2396 bytes .../mapviewer/content/resources/scale.png | Bin 0 -> 228 bytes .../mapviewer/content/resources/titlebar.png | Bin 0 -> 1246 bytes .../mapviewer/content/resources/titlebar.sci | 5 + .../mapviewer/content/resources/vmenuItem.png | Bin 0 -> 241 bytes .../mapviewer/content/resources/vmenuItem.sci | 5 + examples/declarative/mapviewer/mapviewer/icon.png | Bin 0 -> 6364 bytes examples/declarative/mapviewer/mapviewer/info.json | 14 + .../declarative/mapviewer/mapviewer/mapviewer.pro | 3 + .../declarative/mapviewer/mapviewer/mapviewer.qml | 602 +++++++++++++++ .../declarative/mapviewer/mapviewer/notions.json | 5 + examples/declarative/mapviewer/mapviewer/qml.pro | 30 + .../declarative/mapviewer/mapviewer/settings.json | 7 + .../mapviewerwrapper/mapviewerwrapper.pro | 32 + .../mapviewerwrapper/mapviewerwrapper.qrc | 58 ++ .../mapviewerwrapper/qmlmapviewerwrapper.cpp | 66 ++ examples/declarative/mapviewer/qmlmapviewer.cpp | 70 -- .../declarative/mapviewer/resources/button.png | Bin 2550 -> 0 bytes .../declarative/mapviewer/resources/button.sci | 5 - .../mapviewer/resources/button_hovered.png | Bin 2572 -> 0 bytes .../mapviewer/resources/button_pressed.png | Bin 2969 -> 0 bytes examples/declarative/mapviewer/resources/catch.png | Bin 1374 -> 0 bytes .../declarative/mapviewer/resources/checkbox.png | Bin 419 -> 0 bytes .../mapviewer/resources/checkbox_selected.png | Bin 493 -> 0 bytes .../declarative/mapviewer/resources/marker.png | Bin 2354 -> 0 bytes .../mapviewer/resources/marker_hovered.png | Bin 2358 -> 0 bytes .../mapviewer/resources/marker_selected.png | Bin 2356 -> 0 bytes .../declarative/mapviewer/resources/menuItem.png | Bin 1436 -> 0 bytes .../declarative/mapviewer/resources/menuItem.sci | 5 - .../mapviewer/resources/menuItem_hovered.png | Bin 1380 -> 0 bytes .../mapviewer/resources/menuItem_pressed.png | Bin 1389 -> 0 bytes examples/declarative/mapviewer/resources/node.png | Bin 433 -> 0 bytes .../mapviewer/resources/node_selected.png | Bin 439 -> 0 bytes .../mapviewer/resources/option_button.png | Bin 408 -> 0 bytes .../mapviewer/resources/option_button_selected.png | Bin 417 -> 0 bytes examples/declarative/mapviewer/resources/quit.png | Bin 2369 -> 0 bytes .../mapviewer/resources/quit_hovered.png | Bin 2224 -> 0 bytes .../mapviewer/resources/quit_pressed.png | Bin 2448 -> 0 bytes examples/declarative/mapviewer/resources/scale.png | Bin 258 -> 0 bytes .../declarative/mapviewer/resources/titlebar.png | Bin 1436 -> 0 bytes .../declarative/mapviewer/resources/titlebar.sci | 5 - 98 files changed, 3526 insertions(+), 3201 deletions(-) delete mode 100644 examples/declarative/mapviewer/Dialog.qml delete mode 100644 examples/declarative/mapviewer/MapComponent.qml delete mode 100644 examples/declarative/mapviewer/Marker.qml delete mode 100644 examples/declarative/mapviewer/Message.qml delete mode 100644 examples/declarative/mapviewer/RouteDialog.qml delete mode 100644 examples/declarative/mapviewer/TextWithLabel.qml delete mode 100644 examples/declarative/mapviewer/common/Button.qml delete mode 100644 examples/declarative/mapviewer/common/Checkbox.qml delete mode 100644 examples/declarative/mapviewer/common/Fader.qml delete mode 100644 examples/declarative/mapviewer/common/Menu.qml delete mode 100644 examples/declarative/mapviewer/common/Optionbutton.qml delete mode 100644 examples/declarative/mapviewer/common/Slider.qml delete mode 100644 examples/declarative/mapviewer/common/TitleBar.qml delete mode 100644 examples/declarative/mapviewer/mapviewer.qml delete mode 100644 examples/declarative/mapviewer/mapviewer.qrc create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Button.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Checkbox.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Fader.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Menu.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Optionbutton.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/Slider.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/TextWithLabel.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/TitleBar.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/style/ButtonStyle.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/style/HMenuItemStyle.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/components/style/VMenuItemStyle.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/dialogs/Dialog.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/dialogs/Message.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/dialogs/RouteDialog.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/map/MapBaseComponent.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/map/MapComponent.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/map/Marker.qml create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/button.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/button.sci create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/button_hovered.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/button_pressed.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/catch.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/checkbox.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/checkbox_selected.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/hmenuItem.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/hmenuItem.sci create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/hmenuItem_hovered.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/hmenuItem_pressed.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/marker.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/marker_hovered.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/marker_selected.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/menuItem.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/menuItem.sci create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/menuItem_hovered.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/menuItem_pressed.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/node.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/node_selected.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/option_button.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/option_button_selected.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/quit.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/quit_hovered.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/quit_pressed.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/scale.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/titlebar.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/titlebar.sci create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/vmenuItem.png create mode 100644 examples/declarative/mapviewer/mapviewer/content/resources/vmenuItem.sci create mode 100644 examples/declarative/mapviewer/mapviewer/icon.png create mode 100644 examples/declarative/mapviewer/mapviewer/info.json create mode 100644 examples/declarative/mapviewer/mapviewer/mapviewer.pro create mode 100644 examples/declarative/mapviewer/mapviewer/mapviewer.qml create mode 100644 examples/declarative/mapviewer/mapviewer/notions.json create mode 100644 examples/declarative/mapviewer/mapviewer/qml.pro create mode 100644 examples/declarative/mapviewer/mapviewer/settings.json create mode 100644 examples/declarative/mapviewer/mapviewerwrapper/mapviewerwrapper.pro create mode 100644 examples/declarative/mapviewer/mapviewerwrapper/mapviewerwrapper.qrc create mode 100644 examples/declarative/mapviewer/mapviewerwrapper/qmlmapviewerwrapper.cpp delete mode 100644 examples/declarative/mapviewer/qmlmapviewer.cpp delete mode 100644 examples/declarative/mapviewer/resources/button.png delete mode 100644 examples/declarative/mapviewer/resources/button.sci delete mode 100644 examples/declarative/mapviewer/resources/button_hovered.png delete mode 100644 examples/declarative/mapviewer/resources/button_pressed.png delete mode 100644 examples/declarative/mapviewer/resources/catch.png delete mode 100644 examples/declarative/mapviewer/resources/checkbox.png delete mode 100644 examples/declarative/mapviewer/resources/checkbox_selected.png delete mode 100644 examples/declarative/mapviewer/resources/marker.png delete mode 100644 examples/declarative/mapviewer/resources/marker_hovered.png delete mode 100644 examples/declarative/mapviewer/resources/marker_selected.png delete mode 100644 examples/declarative/mapviewer/resources/menuItem.png delete mode 100644 examples/declarative/mapviewer/resources/menuItem.sci delete mode 100644 examples/declarative/mapviewer/resources/menuItem_hovered.png delete mode 100644 examples/declarative/mapviewer/resources/menuItem_pressed.png delete mode 100644 examples/declarative/mapviewer/resources/node.png delete mode 100644 examples/declarative/mapviewer/resources/node_selected.png delete mode 100644 examples/declarative/mapviewer/resources/option_button.png delete mode 100644 examples/declarative/mapviewer/resources/option_button_selected.png delete mode 100644 examples/declarative/mapviewer/resources/quit.png delete mode 100644 examples/declarative/mapviewer/resources/quit_hovered.png delete mode 100644 examples/declarative/mapviewer/resources/quit_pressed.png delete mode 100644 examples/declarative/mapviewer/resources/scale.png delete mode 100644 examples/declarative/mapviewer/resources/titlebar.png delete mode 100644 examples/declarative/mapviewer/resources/titlebar.sci diff --git a/examples/declarative/mapviewer/Dialog.qml b/examples/declarative/mapviewer/Dialog.qml deleted file mode 100644 index 00f2d5e5..00000000 --- a/examples/declarative/mapviewer/Dialog.qml +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 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: 30 - - opacity: 0 - - function setModel(objects) - { - dialogModel.clear() - - for (var i=0; i< objects.length; i++){ - dialogModel.append({"labelText": objects[i][0], "inputText": objects[i][1]}) - } - } - - Common.Fader {} - - Rectangle { - id: dialogRectangle - - color: "lightsteelblue" - opacity: parent.opacity - width: parent.width - gap; - height: listview.height + titleBar.height + buttons.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 - onClicked: { dialog.cancelButtonClicked() } - } - - ListModel { - id: dialogModel - } - - Component{ - id: listDelegate - Column { - id: column1 - height: listItemHeight - TextWithLabel { - id: textWithLabel - label: labelText - text: inputText - width: dialogRectangle.width - gap - labelWidth: 75 - - onTextChanged: - { - dialogModel.set(index, {"inputText": text}) - } - } - } - } - - ListView { - id: listview - anchors { - top: titleBar.bottom - topMargin: gap - left: parent.left - leftMargin: gap/2 - } - model: dialogModel - delegate: listDelegate - spacing: gap/2 - interactive: false - Component.onCompleted: { - height = (listItemHeight + gap/2)*length + gap/2 - } - } - - Row { - id: buttons - anchors.top: listview.bottom - anchors.horizontalCenter: parent.horizontalCenter - spacing: gap/3 - height: 32 - Common.Button { - id: buttonClearAll - text: "Clear" - width: 80; height: parent.height - onClicked: { - for (var i = 0; i markers - property int counter: 0 // counter for total amount of markers. Resets to 0 when number of markers = 0 - property Marker currentMarker - - property RouteQuery routeQuery: RouteQuery {} - property RouteModel routeModel: RouteModel { - plugin : map.plugin - query: routeQuery - onStatusChanged:{ - if (status == RouteModel.Ready){ - 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; - onStatusChanged:{ - if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)) map.geocodeFinished() - } - onLocationsChanged: - { - if (count == 1) map.center = get(0).coordinate - } - } - property int lastX : -1 - property int lastY : -1 - - signal mousePressed() // replace with - // signal mousePressed(MouseEvent mouse) - // when QTBUG-14550 is fixed - signal sliderUpdated() - signal coordinatesCaptured(double latitude, double longitude) - signal geocodeFinished() - signal showGeocodeInfo() - signal moveMarker() - signal routeError() - - Component.onCompleted: { - markers = [] - } - - Component { - id: routeDelegate - MapGroup { - MapRoute { - route: path - border.color: routeMouseArea.containsMouse ? "lime" :"red" - border.width: 5 - MapMouseArea { - id: routeMouseArea - - hoverEnabled: true - onPressed : { - routeTimer.start(); - map.state = "" - map.lastX = mouse.x - map.lastY = mouse.y - } - onReleased : { - if (routeTimer.running){ //SHORT PRESS - routeTimer.stop() - map.lastX = -1 - map.lastY = -1 - } - } - onPositionChanged: { - if (routeTimer.running) routeTimer.stop() - if (map.state == "") { - map.lastX = mouse.x - map.lastY = mouse.y - } - } - Timer { - id: routeTimer - interval: longPressDuration; running: false; repeat: false - onTriggered: { //LONG PRESS - map.state = "RoutePopupMenu" - } - } - } - } - MapImage { - source: routeMouseArea.containsMouse ? "resources/node_selected.png" : "resources/node.png" - coordinate:path.path[0] - offset.x: -5 - offset.y: -5 - } - MapImage { - source: routeMouseArea.containsMouse ? "resources/node_selected.png" : "resources/node.png" - coordinate:path.path[path.path.length-1] - offset.x: -5 - offset.y: -5 - } - } - } - - Component { - id: pointDelegate - MapCircle { - radius: 1000 - color: circleMouseArea.containsMouse ? "#8000FF00" : "#80FF0000" - center: location.coordinate - MapMouseArea { - id: circleMouseArea - hoverEnabled: true - onPressed : { - circleTimer.start() - map.state = "" - map.lastX = mouse.x - map.lastY = mouse.y - } - onReleased : { - if (circleTimer.running) {//SHORT PRESS - circleTimer.stop(); - map.lastX = -1 - map.lastY = -1 - } - } - onPositionChanged: { - if (circleTimer.running) circleTimer.stop() - if ((mouse.button == Qt.LeftButton) && (map.state == "")) radius = center.distanceTo(mouse.coordinate) - if (map.state == "") { - map.lastX = mouse.x - map.lastY = mouse.y - } - } - Timer { - id: circleTimer - interval: longPressDuration; running: false; repeat: false - onTriggered: { //LONG PRESS - map.state = "PointPopupMenu" - } - } - } - } - } - - Component { - id: routeInfoDelegate - Row { - spacing: 10 - Text { - id: indexText - text: index + 1 - color: "white" - font.bold: true - font.pixelSize: 12 - } - Text { - text: instruction - color: "white" - height: indexText.height*3 - wrapMode: Text.Wrap - width: textArea.width - indexText.width - distanceText.width - spacing*4 - } - Text { - id: distanceText - text: distance - color: "white" - font.bold: true - font.pixelSize: 12 - } - } - } - - Component{ - id: routeInfoHeader - Item { - width: textArea.width - height: travelTime.height + line.anchors.topMargin + line.height - Text { - id: travelTime - text: routeInfoModel.travelTime - color: "white" - font.bold: true - font.pixelSize: 14 - anchors.left: parent.left - } - Text { - id: distance - text: routeInfoModel.distance - color: "white" - font.bold: true - font.pixelSize: 14 - anchors.right: parent.right - } - Rectangle { - id: line - color: "white" - width: parent.width - height: 2 - anchors.left: parent.left - anchors.topMargin: 1 - anchors.top: distance.bottom - } - } - } - - - ListModel{ - id: routeInfoModel - property string travelTime - property string distance - - function update() { - clear() - if (routeModel.count > 0){ - for (var i=0; i< routeModel.get(0).segments.length; i++){ - append({"instruction": routeModel.get(0).segments[i].maneuver.instructionText, "distance": formatDistance(routeModel.get(0).segments[i].maneuver.distanceToNextInstruction)}) - } - } - travelTime = routeModel.count == 0 ? "" : formatTime(routeModel.get(0).travelTime) - distance = routeModel.count == 0 ? "" : formatDistance(routeModel.get(0).distance) - } - } - - MapObjectView { - model: routeModel - delegate: routeDelegate - } - - MapObjectView { - model: geocodeModel - delegate: pointDelegate - } - - Plugin { - id: defaultPlugin - name : "nokia" - } - - Coordinate { - id: defaultCoordinates - latitude : -27.53 - longitude : 153.088 - } - - Item { - id: infoTab - parent: scale.parent - z: map.z - height: parent.height - 180 - width: parent.width - x: -5 - infoRect.width - y: 60 - visible: (routeInfoModel.count > 0) - Image { - id: catchImage - source: "resources/catch.png" - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - MouseArea { - anchors.fill: parent - onClicked: { - if (infoTab.x == -5) infoTab.x -= infoRect.width - else infoTab.x = -5 - map.state = "" - } - } - } - - Behavior on x { - PropertyAnimation { properties: "x"; duration: 300; easing.type: Easing.InOutQuad } - } - - Rectangle { - id: infoRect - width: parent.width - catchImage.sourceSize.width - height: parent.height - color: "grey" - opacity: 0.75 - radius: 5 - MouseArea { - anchors.fill: parent - hoverEnabled: true - } - Item { - id: textArea - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - width: parent.width -15 - height: parent.height - 20 - ListView { - id: routeInfoView - model: routeInfoModel - delegate: routeInfoDelegate - header: routeInfoHeader - anchors.fill: parent - clip: true - } - } - } - } - - Common.Slider { - id: zoomSlider; - parent: map.parent //todo: remove the line - minimum: map.minimumZoomLevel; - maximum: map.maximumZoomLevel; - opacity: 1 - z: map.z - anchors { - bottom: parent.bottom; - bottomMargin: 50; rightMargin: 5; leftMargin: 5 - left: parent.left - } - width: parent.width - anchors.rightMargin - anchors.leftMargin - value: map.zoomLevel - onValueChanged: { - map.zoomLevel = value - map.sliderUpdated() - } - } - - Item {//scale - id: scale - parent: zoomSlider.parent - z: map.z - opacity: 0.6 - visible: map.zoomLevel == 0 ? false : true - anchors { - bottom: zoomSlider.top; - bottomMargin: 8; - leftMargin: 20 - left: zoomSlider.left - } - Image { - id: scaleImage - source: "resources/scale.png" - anchors.bottom: parent.bottom - anchors.left: parent.left - } - Text { - id: scaleText - color: "black" - horizontalAlignment: Text.AlignHCenter - width: scaleImage.sourceSize.width - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.bottomMargin: 3 - Component.onCompleted: {text = calculateScale()} - } - } - - onCenterChanged:{ - scaleText.text = calculateScale() - } - - Common.Menu { - id: markerMenu - orientation: ListView.Vertical - z: map.z + 2 - opacity: 0 - - itemHeight: 30; - itemWidth: 150 - x: 0 - y: 0 - onClicked: { - map.state = "" - switch (button) { - case 0: {//remove marker - map.removeMarker(currentMarker) - break; - } - case 1: {//move marker - map.moveMarker() - break; - } - case 2: {//show marker's coordinates - map.coordinatesCaptured(currentMarker.coordinate.latitude, currentMarker.coordinate.longitude) - break; - } - case 3: {//calculate route - map.calculateRoute(currentMarker) - break; - } - } - } - } - - Common.Menu { - id: popupMenu - orientation: ListView.Vertical - z: map.z +2 - opacity: 0 - - itemHeight: 30; - itemWidth: 150 - x: 0 - y: 0 - - onClicked: { - switch (button) { - case 0: { //add Marker - addMarker() - break; - } - case 1: {//show coordinates - map.coordinatesCaptured(mouseArea.lastCoordinate.latitude, mouseArea.lastCoordinate.longitude) - break; - } - case 2: { //delete all Markers - map.deleteAllMarkers() - break; - } - } - map.state = "" - } - } - - Common.Menu { - id: routeMenu - orientation: ListView.Vertical - z: map.z +2 - opacity: 0 - - itemHeight: 30; - itemWidth: 150 - x: 0 - y: 0 - - onClicked: { - switch (button) { - case 0: {//delete route - routeModel.clear() - routeInfoModel.update() - break; - } - } - map.state = "" - } - Component.onCompleted: { - setModel(["Delete"]) - } - } - - Common.Menu { - id: pointMenu - orientation: ListView.Vertical - z: map.z +2 - opacity: 0 - - itemHeight: 30; - itemWidth: 150 - x: 0 - y: 0 - - onClicked: { - switch (button) { - case 0: {//point info - map.showGeocodeInfo() - break; - } - case 1: {//delete point - geocodeModel.clear() - break; - } - } - map.state = "" - } - Component.onCompleted: { - setModel(["Info", "Delete"]) - } - } - - onZoomLevelChanged:{ - zoomSlider.value = map.zoomLevel - scaleText.text = map.calculateScale() - } - - MapMouseArea { - id: mouseArea - property Coordinate lastCoordinate: Coordinate { latitude : 0; longitude : 0} - - onPressed : { - mapTimer.start() - map.state = "" - map.lastX = mouse.x - map.lastY = mouse.y - lastCoordinate = mouse.coordinate - map.mousePressed() - } - onReleased : { - if (mapTimer.running) {//SHORT PRESS - mapTimer.stop() - map.lastX = -1 - map.lastY = -1 - } - } - onPositionChanged: { - if (mapTimer.running) mapTimer.stop() - if ((mouse.button == Qt.LeftButton) & (map.state == "")) { - if ((map.lastX != -1) && (map.lastY != -1)) { - var dx = mouse.x - map.lastX - var dy = mouse.y - map.lastY - map.pan(-dx, -dy) - } - map.lastX = mouse.x - map.lastY = mouse.y - } - } - onDoubleClicked: { - map.center = mouse.coordinate - if (mouse.button == Qt.LeftButton){ - map.zoomLevel += 1 - } else if (mouse.button == Qt.RightButton){ - map.zoomLevel -= 1 - } - lastX = -1 - lastY = -1 - } - Timer { - id: mapTimer - interval: longPressDuration; running: false; repeat: false - onTriggered: { //LONG PRESS - if (map.markers.length != 0) popupMenu.setModel(["Set Marker","Coordinates","Delete all markers"]) - else popupMenu.setModel(["Set Marker","Coordinates"]) - - map.state = "PopupMenu" - } - } - } - - Keys.onPressed: { - if ((event.key == Qt.Key_Plus) || (event.key == Qt.Key_VolumeUp)) { - map.zoomLevel += 1 - } else if ((event.key == Qt.Key_Minus) || (event.key == Qt.Key_VolumeDown)){ - map.zoomLevel -= 1 - } - } - - function calculateScale(){ - var coord1, coord2, dist, text - if (map.zoomLevel == 0) { text=""} - else{ - coord1 = map.toCoordinate(Qt.point(0,scale.y)) - coord2 = map.toCoordinate(Qt.point(0+scaleImage.sourceSize.width,scale.y)) - dist = Math.round(coord1.distanceTo(coord2)) - text = formatDistance(dist) - } - return text - } - - function deleteAllMarkers(){ - var count = map.markers.length - for (var i = 0; i 2){ - if (currentMarker == markers[count-2]) array = ["Delete", "Move to", "Coordinates", "Route to next point"] - else array = ["Delete", "Move to", "Coordinates", "Route to next points"] - } - else array = ["Delete", "Move to", "Coordinates", "Route to next point"] - - markerMenu.setModel(array) - map.state = "MarkerPopupMenu" - } - - function calculateRoute(marker){ - routeQuery.clearWaypoints(); - var startPointFound = false - var count = map.markers.length - for (var i = 0; i< count; i++){ - if (startPointFound != true){ - if (markers[i] == marker){ - startPointFound = true - routeQuery.addWaypoint(marker.coordinate) - } - } - else routeQuery.addWaypoint(markers[i].coordinate) - } - routeQuery.travelModes = RouteQuery.CarTravel - routeQuery.routeOptimizations = RouteQuery.ShortestRoute - for (i=0; i<9; i++) { - routeQuery.setFeatureWeight(i, 0) - } - routeModel.update(); - } - - function roundNumber(number, digits) { - var multiple = Math.pow(10, digits); - return Math.round(number * multiple) / multiple; - } - - function formatTime(sec){ - var value = sec - var seconds = value % 60 - value /= 60 - value = (value > 1) ? Math.round(value) : 0 - var minutes = value % 60 - value /= 60 - value = (value > 1) ? Math.round(value) : 0 - var hours = value - if (hours > 0) value = hours + "h:"+ minutes + "m" - else value = minutes + "min" - return value - } - - function formatDistance(meters) - { - var dist = Math.round(meters) - if (dist > 1000 ){ - if (dist > 100000){ - dist = Math.round(dist / 1000) - } - else{ - dist = Math.round(dist / 100) - dist = dist / 10 - } - dist = dist + " km" - } - else{ - dist = dist + " m" - } - return dist - } - - // states of map - states: [ - State { - name: "PopupMenu" - PropertyChanges { target: popupMenu; opacity: 1} - PropertyChanges { target: popupMenu; x: ((map.lastX + popupMenu.width > map.width) ? map.width - popupMenu.width : map.lastX)} - PropertyChanges { target: popupMenu; y: ((map.lastY + popupMenu.height > map.height) ? map.height - popupMenu.height : map.lastY)} - }, - State { - name: "MarkerPopupMenu" - PropertyChanges { target: markerMenu; opacity: 1} - PropertyChanges { target: markerMenu; x: ((currentMarker.lastMouseX + markerMenu.width > map.width) ? map.width - markerMenu.width : currentMarker.lastMouseX )} - PropertyChanges { target: markerMenu; y: ((currentMarker.lastMouseY + markerMenu.height > map.height) ? map.height - markerMenu.height : currentMarker.lastMouseY)} - }, - State { - name: "RoutePopupMenu" - PropertyChanges { target: routeMenu; opacity: 1} - PropertyChanges { target: routeMenu; x: ((map.lastX + routeMenu.width > map.width) ? map.width - routeMenu.width : map.lastX)} - PropertyChanges { target: routeMenu; y: ((map.lastY + routeMenu.height > map.height) ? map.height - routeMenu.height : map.lastY)} - }, - State { - name: "PointPopupMenu" - PropertyChanges { target: pointMenu; opacity: 1} - PropertyChanges { target: pointMenu; x: ((map.lastX + pointMenu.width > map.width) ? map.width - pointMenu.width : map.lastX)} - PropertyChanges { target: pointMenu; y: ((map.lastY + pointMenu.height > map.height) ? map.height - pointMenu.height : map.lastY)} - } - ] -} diff --git a/examples/declarative/mapviewer/Marker.qml b/examples/declarative/mapviewer/Marker.qml deleted file mode 100644 index 063ab6d7..00000000 --- a/examples/declarative/mapviewer/Marker.qml +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0; -import QtLocation 5.0 -import "common" as Common - -MapGroup { //to be used inside MapComponent only - id: marker - property alias coordinate: markerImage.coordinate - property alias lastMouseX: markerMouseArea.lastX - property alias lastMouseY: markerMouseArea.lastY - property alias text: markerIndex.text - - MapImage { - id: markerImage - source: markerMouseArea.pressed ? "resources/marker_selected.png" : "resources/marker.png" //TODO replace with following lane when QTBUG-20096 fixed -// source: markerMouseArea.containsMouse ? (markerMouseArea.pressed ? "resources/marker_selected.png" :"resources/marker_hovered.png") : "resources/marker.png" - coordinate: Coordinate { latitude : 0; longitude : 0 } - offset.x: -13 - offset.y: -32 - - Component.onCompleted: { - coordinate = mouseArea.lastCoordinate - } - - MapMouseArea { - id: markerMouseArea - property int dX: 0 - property int dY: 0 - property int lastX: -1 - property int lastY: -1 - property bool longPress: false - hoverEnabled: true - onPressed: { - ++marker.z - var newX, newY, oldX, oldY - newX = map.toScreenPosition(mouse.coordinate).x - newY = map.toScreenPosition(mouse.coordinate).y - oldX = map.toScreenPosition(markerImage.coordinate).x - oldY = map.toScreenPosition(markerImage.coordinate).y - dX = oldX - newX - dY = oldY - newY - lastX = mouse.x - lastY = mouse.y - - markerTimer.start() - map.currentMarker = marker - map.state = "" - } - onReleased: { - if (markerTimer.running) markerTimer.stop(); - marker.z-- - longPress = false - } - - onPositionChanged: { - var newX, newY - if (markerTimer.running) markerTimer.stop(); - if ((mouse.button == Qt.LeftButton) && (longPress != true)){ - lastX = mouse.x - lastY = mouse.y - newX = map.toScreenPosition(mouse.coordinate).x + dX - newY = map.toScreenPosition(mouse.coordinate).y + dY - markerImage.coordinate = map.toCoordinate(Qt.point(newX,newY)) - } - } - - Timer { - id: markerTimer - interval: map.longPressDuration - running: false - repeat: false - onTriggered: { - markerMouseArea.longPress = true - map.markerLongPress() - } - } - } - } - - MapText { - id: markerIndex - offset.y : -16 - coordinate: markerImage.coordinate - color: "white" - font.bold: true - Component.onCompleted: { - text = map.counter - } - } -} diff --git a/examples/declarative/mapviewer/Message.qml b/examples/declarative/mapviewer/Message.qml deleted file mode 100644 index 5ca70c59..00000000 --- a/examples/declarative/mapviewer/Message.qml +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 -import "common" as Common - -Item { - id: dialog - - anchors.fill: parent - - property alias title: titleBar.text - property alias text: message.text - property int gap: 20 - - signal okButtonClicked - signal cancelButtonClicked - opacity: 0 - - Common.Fader {} - - Rectangle { - id: dialogRectangle - - color: "lightsteelblue" - width: parent.width - gap; - height: titleBar.height + message.height + okButton.height + gap*3 - 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; - onClicked: { dialog.cancelButtonClicked() } - } - - Text { - id: message - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - anchors.top: titleBar.bottom - width: dialogRectangle.width - gap - anchors.topMargin: gap - textFormat: Text.RichText - wrapMode: Text.Wrap - onLinkActivated: { - Qt.openUrlExternally(link) - } - } - - Common.Button { - id: okButton - text: "Ok" - anchors.top: message.bottom - anchors.topMargin: gap - width: 80; height: 32 - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - dialog.okButtonClicked () - } - } - } -} diff --git a/examples/declarative/mapviewer/RouteDialog.qml b/examples/declarative/mapviewer/RouteDialog.qml deleted file mode 100644 index fbd504d2..00000000 --- a/examples/declarative/mapviewer/RouteDialog.qml +++ /dev/null @@ -1,496 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 -import QtLocation 5.0 -import "common" as Common - -Item { - id: dialog - signal goButtonClicked - signal cancelButtonClicked - - anchors.fill: parent - property int gap: 10 - opacity: 0 - - property alias title: titleBar.text - property alias startLatitude: latFrom.text - property alias startLongitude: longFrom.text - property alias endLatitude: latTo.text - property alias endLongitude: longTo.text - property alias startStreet: streetFrom.text - property alias startCity: cityFrom.text - property alias startCountry: countryFrom.text - property alias endStreet: streetTo.text - property alias endCity: cityTo.text - property alias endCountry: countryTo.text - property alias byCoordinates: coord.enabled - property int travelMode: RouteQuery.CarTravel // CarTravel, PedestrianTravel, BicycleTravel, PublicTransitTravel, TruckTravel - property int routeOptimization: RouteQuery.FastestRoute // ShortestRoute, FastestRoute, MostEconomicRoute, MostScenicRoute - property variant features: [] // NoFeature, TollFeature, HighwayFeature, PublicTransitFeature, FerryFeature, TunnelFeature, DirtRoadFeature, ParksFeature, MotorPoolLaneFeature - - Common.Fader {} - - Rectangle { - id: dialogRectangle - color: "lightsteelblue" - opacity: 1 - width: parent.width - gap*2; - height: options.height + gap*4 + buttons.height + titleBar.height + routeOptions.height - - anchors { - top: parent.top - topMargin: 50 - left: parent.left - leftMargin: gap - } - - 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: "Route" - onClicked: { dialog.cancelButtonClicked() } - } - - Column { - id: options - spacing: gap - width: dialogRectangle.width - gap*2 - - anchors { - top: titleBar.bottom - topMargin: gap - left: dialogRectangle.left - leftMargin: gap - } - - states: [ - State { - name: "Address" - PropertyChanges { target: coord; enabled: false } - PropertyChanges { target: address; enabled: true } - } - ] - - -//by coordinates - Row { - id: row1 - spacing: gap - Image { - id: optionButtonCoord - anchors.verticalCenter:parent.verticalCenter - source: coord.enabled ? "resources/option_button_selected.png" : "resources/option_button.png" - MouseArea { - anchors.fill: parent - onClicked: { options.state = "" } - } - } - - Rectangle { - id: coord - color: dialogRectangle.color - border.width: 1 - border.color: enabled ? "black" : "grey" - radius: 5 - width:options.width - optionButtonCoord.width - row1.spacing - height: longTo.y + longTo.height + gap - enabled: true - -//start point - Text { - id: fromLabel; - font.bold: true; - enabled: coord.enabled - anchors { - top: latFrom.top - topMargin:latFrom.height + gap/6 - fromLabel.height/2 - left: parent.left; - leftMargin: gap - } - text: "From" - color: enabled ? "black" : "grey" - } - - TextWithLabel { - id: latFrom - width: parent.width - fromLabel.width - gap*3 - text: "-27.575" - label: "latitude" - enabled: coord.enabled - anchors { - left: fromLabel.right - leftMargin: gap - top: parent.top - topMargin:gap - } - } - - TextWithLabel { - id: longFrom - width: latFrom.width - text: "153.088" - label: "longitude" - enabled: coord.enabled - anchors { - left: latFrom.left - top: latFrom.bottom - topMargin:gap/3 - } - } - -//end point - Text { - id: toLabel; - font.bold: true; - width: fromLabel.width - enabled: coord.enabled - anchors { - top: latTo.top - topMargin:latTo.height + gap/6 - toLabel.height/2 - left: parent.left; - leftMargin: gap; - } - text: "To" - color: enabled ? "black" : "grey" - } - - TextWithLabel { - id: latTo - width: latFrom.width - text: "-27.465" - label: "latitude" - enabled: coord.enabled - anchors { - left: toLabel.right - leftMargin: gap - top: longFrom.bottom - topMargin:gap - } - } - - TextWithLabel { - id: longTo - width: latTo.width - text: "153.023" - label: "longitude" - enabled: coord.enabled - anchors { - left: latTo.left - top: latTo.bottom - topMargin:gap/3 - } - } - } - } - -//by address - Row { - id: row2 - spacing: gap - - Image { - id: optionButtonAddress - source: address.enabled ? "resources/option_button_selected.png" : "resources/option_button.png" - anchors.verticalCenter: parent.verticalCenter - MouseArea { - anchors.fill: parent - onClicked: { options.state = "Address" } - } - } - - Rectangle { - id: address - color: dialogRectangle.color - border.width: 1 - border.color: enabled ? "black" : "grey" - radius: 5 - width:coord.width - height: countryTo.y + countryTo.height + gap - enabled: false - -//start point - Text { - id: fromLabel2; - font.bold: true; - enabled: address.enabled - anchors { - top: cityFrom.top - left: parent.left; - leftMargin: gap - } - text: "From" - color: enabled ? "black" : "grey" - } - - TextWithLabel { - id: streetFrom - width: parent.width - fromLabel2.width - gap*3 - text: "Brandl st" - label: "street" - enabled: address.enabled - anchors { - left: fromLabel2.right - leftMargin: gap - top: parent.top - topMargin:gap - } - } - - TextWithLabel { - id: cityFrom - width: streetFrom.width - text: "Eight Mile Plains" - label: "city" - enabled: address.enabled - anchors { - left: streetFrom.left - top: streetFrom.bottom - topMargin:gap/3 - } - } - - TextWithLabel { - id: countryFrom - width: streetFrom.width - text: "Australia" - label: "country" - enabled: address.enabled - anchors { - left: streetFrom.left - top: cityFrom.bottom - topMargin:gap/3 - } - } - - -//end point - Text { - id: toLabel2; - font.bold: true; - enabled: address.enabled - anchors { - top: cityTo.top - left: parent.left; - leftMargin: gap - } - text: "To" - color: enabled ? "black" : "grey" - } - - TextWithLabel { - id: streetTo - width: parent.width - fromLabel2.width - gap*3 - text: "Brunswick st" - label: "street" - enabled: address.enabled - anchors { - left: fromLabel2.right - leftMargin: gap - top: countryFrom.bottom - topMargin:gap - } - } - - TextWithLabel { - id: cityTo - width: streetTo.width - text: "New Farm" - label: "city" - enabled: address.enabled - anchors { - left: streetTo.left - top: streetTo.bottom - topMargin:gap/3 - } - } - - TextWithLabel { - id: countryTo - width: streetTo.width - text: "Australia" - label: "country" - enabled: address.enabled - anchors { - left: streetTo.left - top: cityTo.bottom - 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: routeOptions.bottom - anchors.topMargin: gap - anchors.horizontalCenter: parent.horizontalCenter - spacing: gap/3 - height: 32 - Common.Button { - text: "Clear" - width: 80; height: parent.height - onClicked: { - if (byCoordinates == true){ - latFrom.text = "" - longFrom.text = "" - latTo.text = "" - longTo.text = "" - } - else { - streetFrom.text = "" - cityFrom.text = "" - countryFrom.text = "" - streetTo.text = "" - cityTo.text = "" - countryTo.text = "" - } - } - } - - Common.Button { - text: "Go!" - width: 80; height: parent.height - onClicked: { - dialog.goButtonClicked () - } - } - } - } -} diff --git a/examples/declarative/mapviewer/TextWithLabel.qml b/examples/declarative/mapviewer/TextWithLabel.qml deleted file mode 100644 index 0b419b9f..00000000 --- a/examples/declarative/mapviewer/TextWithLabel.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 - -Row { - id: textWithLabel - height: inputRectangle.height - - property alias label: label.text - property alias text: inputField.text - property alias labelWidth: label.width - - Text { - id: label; - width:55; - enabled: textWithLabel.enabled - color: enabled ? "black" : "grey" - anchors { - top: parent.top; - topMargin: (inputRectangle.height-height)/2 - } - } - - Rectangle { - id: inputRectangle - width: textWithLabel.width - label.width; height: 30 - color: enabled ? "whitesmoke" : "gainsboro" - border.width: 1 - border.color: enabled ? "black" : "grey" - radius: 5 - TextInput { - id: inputField - focus: true - width: parent.width - anchors.leftMargin - enabled: textWithLabel.enabled - color: enabled ? "black" : "grey" - horizontalAlignment: Text.AlignLeft - - anchors { - left: parent.left; - verticalCenter: parent.verticalCenter; - leftMargin: 5 - } - } - } -} diff --git a/examples/declarative/mapviewer/common/Button.qml b/examples/declarative/mapviewer/common/Button.qml deleted file mode 100644 index d34bec4a..00000000 --- a/examples/declarative/mapviewer/common/Button.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 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/examples/declarative/mapviewer/common/Checkbox.qml b/examples/declarative/mapviewer/common/Checkbox.qml deleted file mode 100644 index cd496478..00000000 --- a/examples/declarative/mapviewer/common/Checkbox.qml +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** 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 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 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/Fader.qml b/examples/declarative/mapviewer/common/Fader.qml deleted file mode 100644 index 2e0dd4bd..00000000 --- a/examples/declarative/mapviewer/common/Fader.qml +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 - -Rectangle { - id: fader - anchors.fill: parent - opacity: 0.7 - color: "darkgrey" - MouseArea { - id: mouseArea - anchors.fill: parent - hoverEnabled: true - } - - Component.onCompleted: { - var globalXY - var root = parent - - if (root != null) { - while (root.parent) root = root.parent - width = root.width; height = root.height; - globalXY = mapFromItem(root, root.x, root.y); - } else { - globalXY = mapFromItem(null, 0, 0); - } - x = globalXY.x; - y = globalXY.y; - } -} diff --git a/examples/declarative/mapviewer/common/Menu.qml b/examples/declarative/mapviewer/common/Menu.qml deleted file mode 100644 index 59e67145..00000000 --- a/examples/declarative/mapviewer/common/Menu.qml +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 - -Item { - id: menu - property int gap: 0 - property int button: -1 - 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 - property bool keepPreviousValue: false - property string nestedMenuSign: "\u25c2" - property string nestedPressedMenuSign: "\u25c0" - - signal clicked - - function setModel(objects) - { - menuModel.clear() - for (var i=0; i< objects.length; i++){ - menuModel.append({"label": objects[i], "enabledItem" : true}) - } - menuView.positionViewAtIndex(0,ListView.Beginning) - } - - 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: enabledItem ? ((index == menuView.currentIndex) ? "crimson" :"white") : "dimgrey" - 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"} - StateChangeScript { - name: "myScript" - script:{ - var str = menuItemText.text - if (str.charAt(0) == menu.nestedMenuSign ) menuItemText.text = menu.nestedPressedMenuSign + str.substring(1, str.length) - else if (str.charAt(str.length -1) == menu.nestedMenuSign ) menuItemText.text = str.substring(0, str.length-1) + menu.nestedPressedMenuSign - } - } - }, - State { - name: "Released" - when: mouseRegion.containsMouse == false - StateChangeScript { - name: "myScript" - script:{ - var str = menuItemText.text - if (str.charAt(0) == menu.nestedPressedMenuSign ) menuItemText.text = menu.nestedMenuSign + str.substring(1, str.length) - else if (str.charAt(str.length-1) == menu.nestedPressedMenuSign ) menuItemText.text = str.substring(0, str.length-1) + menu.nestedMenuSign - } - } - }, - 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 - currentIndex: (menu.keepPreviousValue == false) ? -1 : menu.button - } -} diff --git a/examples/declarative/mapviewer/common/Optionbutton.qml b/examples/declarative/mapviewer/common/Optionbutton.qml deleted file mode 100644 index c4135f56..00000000 --- a/examples/declarative/mapviewer/common/Optionbutton.qml +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** 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 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 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/common/Slider.qml b/examples/declarative/mapviewer/common/Slider.qml deleted file mode 100644 index 8e4675a9..00000000 --- a/examples/declarative/mapviewer/common/Slider.qml +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 - -Item { - id: slider; - height: 40 - property int value // value is read/write. - property real minimum: 0 - property real maximum: 1 - property int xMin: 2 - property int xMax: 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: slider.xMin; - x: slider.xMin + (slider.value - slider.minimum) * slider.xMax / (slider.maximum - slider.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/examples/declarative/mapviewer/common/TitleBar.qml b/examples/declarative/mapviewer/common/TitleBar.qml deleted file mode 100644 index c8bc60c1..00000000 --- a/examples/declarative/mapviewer/common/TitleBar.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 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/examples/declarative/mapviewer/mapviewer.pro b/examples/declarative/mapviewer/mapviewer.pro index 5d931a8e..726c2b35 100644 --- a/examples/declarative/mapviewer/mapviewer.pro +++ b/examples/declarative/mapviewer/mapviewer.pro @@ -1,28 +1,3 @@ -TARGET = qml_location_mapviewer -TEMPLATE=app +TEMPLATE = subdirs +SUBDIRS += mapviewerwrapper -QT += declarative network -SOURCES += qmlmapviewer.cpp - -symbian { - TARGET.CAPABILITY = NetworkServices Location ReadUserData WriteUserData - TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 -} - -RESOURCES += \ - mapviewer.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/qtlocation/declarative/mapviewer -sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.qml *.png *.sci -sources.path = $$[QT_INSTALL_EXAMPLES]/qtlocation/declarative/mapviewer - -INSTALLS += target sources - -OTHER_FILES += \ - mapviewer.qml \ - Dialog.qml \ - MapComponent.qml \ - Marker.qml \ - Message.qml \ - RouteDialog.qml \ - TextWithLabel.qml diff --git a/examples/declarative/mapviewer/mapviewer.qml b/examples/declarative/mapviewer/mapviewer.qml deleted file mode 100644 index 4bd20721..00000000 --- a/examples/declarative/mapviewer/mapviewer.qml +++ /dev/null @@ -1,652 +0,0 @@ -/**************************************************************************** -** -** 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 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 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 2.0 -import QtLocation 5.0 -import "common" as Common - -Item { - anchors.fill: parent - id: page - - Rectangle { - id: backgroundRect - anchors.fill: parent - color: "darkgrey" - z:2 - } - - Common.TitleBar { - id: titleBar; z: mainMenu.z; width: parent.width; height: 40; opacity: 0.9; text: "QML mapviewer example" - onClicked: { Qt.quit() } - } - -//=====================Menus===================== - Common.Menu { - id: mainMenu - itemHeight: 40 - itemWidth: page.width / count - anchors.bottom: parent.bottom - orientation: ListView.Horizontal - z: map.z + 3 - Component.onCompleted: { - setModel(["Options","Settings"]) - } - onClicked: { - switch (button) { - case 0: { - page.state = "Options" - break; - } - case 1: { - page.state = "Settings" - break; - } - } - } - } - - Common.Menu { - id: optionsMenu - orientation: ListView.Vertical - z: mainMenu.z - 1 - Component.onCompleted: { - setModel(["Reverse geocode", "Geocode", "Route"]) - } - itemHeight: 30; - itemWidth: mainMenu.itemWidth - anchors.left: mainMenu.left - y: page.height - - onClicked: { - switch (button) { - case 0: { - page.state = "RevGeocode" - break; - } - case 1: { - page.state = "Geocode" - break; - } - case 2: { - page.state = "Route" - break; - } - } - } - } - - Common.Menu { - id: settingsMenu - orientation: ListView.Vertical - z: mainMenu.z - 1 - Component.onCompleted: { - setModel([ settingsMenu.nestedMenuSign + " Map type", settingsMenu.nestedMenuSign + " Connectivity", " Provider"]) - } - - itemHeight: 30; - itemWidth: mainMenu.itemWidth - y: page.height - anchors.right: mainMenu.right - - onClicked: { - switch (button) { - case 0: { - page.state = "MapType" - break; - } - case 1: { - page.state = "Connectivity" - break; - } - case 2: { - messageDialog.state = "Provider" - page.state = "Message" - break; - } - } - } - } - - Common.Menu { - id: mapTypeMenu - orientation: ListView.Vertical - z: mainMenu.z - 1 - keepPreviousValue: true - opacity: 0 - - itemHeight: 30; - itemWidth: mainMenu.itemWidth*2/3 - anchors.bottom: mainMenu.top - anchors.right: settingsMenu.left - - Component.onCompleted: { - setModel(["Street", "Satellite", "Satellite Night", "Terrain"]) - disableItem(2) // Nokia map engine supports only Street, Satellite and Terrain map types - button = 0 // Nokia plugin's default map type is Map.StreetMap - } - - onClicked: { - page.state = "" - } - - onButtonChanged: { - switch (button) { - case 0: { - map.mapType = Map.StreetMap - break; - } - case 1: { - map.mapType = Map.SatelliteMapDay - break; - } - case 2: { - map.mapType = Map.SatelliteMapNight - break; - } - case 3: { - map.mapType = Map.TerrainMap - break; - } - } - } - } - - Common.Menu { - id: connectivityModeMenu - orientation: ListView.Vertical - z: mainMenu.z - 1 - keepPreviousValue: true - opacity: 0 - - itemHeight: 30; - itemWidth: mainMenu.itemWidth/2 - anchors.bottom: mainMenu.top - anchors.right: settingsMenu.left - - Component.onCompleted: { - setModel(["Offline", "Online", "Hybrid"]) - disableItem(0) // Nokia map engine supports online mode - disableItem(2) - button = 1 - } - - onClicked: { - page.state = "" - } - - onButtonChanged: { - switch (button) { - case 0: { - map.connectivityMode = Map.OfflineMode - break; - } - case 1: { - map.connectivityMode = Map.OnlineMode - break; - } - case 2: { - map.connectivityMode = Map.HybridMode - break; - } - } - } - } - -//=====================Dialogs===================== - Message { - id: messageDialog - z: mainMenu.z + 1 - onOkButtonClicked: { - page.state = "" - } - onCancelButtonClicked: { - page.state = "" - } - - states: [ - State{ - name: "Provider" - PropertyChanges { target: messageDialog; title: "Provider" } - PropertyChanges { target: messageDialog; text: "Nokia OVI map plugin." } - }, - State{ - name: "GeocodeError" - PropertyChanges { target: messageDialog; title: "Geocode Error" } - PropertyChanges { target: messageDialog; text: "Unable to find location for the given point" } - }, - State{ - name: "UnknownGeocodeError" - PropertyChanges { target: messageDialog; title: "Geocode Error" } - PropertyChanges { target: messageDialog; text: "Unsuccessful geocode" } - }, - State{ - name: "AmbiguousGeocode" - PropertyChanges { target: messageDialog; title: "Ambiguous geocode" } - PropertyChanges { target: messageDialog; text: map.geocodeModel.count + " results found for the given address, please specify location" } - }, - State{ - name: "RouteError" - PropertyChanges { target: messageDialog; title: "Route Error" } - 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() } - } - ] - } - -//Route Dialog - RouteDialog { - id: routeDialog - z: mainMenu.z + 1 - - Coordinate { id: endCoordinate } - Coordinate { id: startCoordinate } - Address { id:startAddress } - Address { id:endAddress } - - GeocodeModel { - id: tempGeocodeModel - plugin : map.plugin - property int success: 0 - onStatusChanged:{ - if ((status == GeocodeModel.Ready) && (count == 1)) { - success++ - if (success == 1){ - startCoordinate.latitude = get(0).coordinate.latitude - startCoordinate.longitude = get(0).coordinate.longitude - clear() - query = endAddress - update(); - } - if (success == 2) - { - endCoordinate.latitude = get(0).coordinate.latitude - endCoordinate.longitude = get(0).coordinate.longitude - success = 0 - routeDialog.calculateRoute() - } - } - else if ((status == GeocodeModel.Ready) || (status == GeocodeModel.Error)){ - var st = (success == 0 ) ? "start" : "end" - messageDialog.state = "" - if ((status == GeocodeModel.Ready) && (count == 0 )) messageDialog.state = "UnknownGeocodeError" - else if (status == GeocodeModel.Error) { - messageDialog.state = "GeocodeError" - messageDialog.text = "Unable to find location for the " + st + " point" - } - else if ((status == GeocodeModel.Ready) && (count > 1 )){ - messageDialog.state = "AmbiguousGeocode" - messageDialog.text = count + " results found for the " + st + " point, please specify location" - } - success = 0 - page.state = "Message" - map.routeModel.clearAll() - } - } - } - - onGoButtonClicked: { - var status = true - - messageDialog.state = "" - if (routeDialog.byCoordinates) { - startCoordinate.latitude = routeDialog.startLatitude - startCoordinate.longitude = routeDialog.startLongitude - endCoordinate.latitude = routeDialog.endLatitude - endCoordinate.longitude = routeDialog.endLongitude - - calculateRoute() - } - else { - startAddress.country = routeDialog.startCountry - startAddress.street = routeDialog.startStreet - startAddress.city = routeDialog.startCity - - endAddress.country = routeDialog.endCountry - endAddress.street = routeDialog.endStreet - endAddress.city = routeDialog.endCity - - tempGeocodeModel.query = startAddress - tempGeocodeModel.update(); - } - page.state = "" - } - - onCancelButtonClicked: { - page.state = "" - } - - function calculateRoute(){ - map.routeQuery.clearWaypoints(); - map.center = startCoordinate - map.routeQuery.addWaypoint(startCoordinate) - 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 0) { - console.log('setting the coordinate as locations changed in model.') - map.center = geocodeModel.get(0).coordinate - } - } - } - - -//=====================Map===================== - MapComponent{ - id: map - z : backgroundRect.z + 1 - size.width: parent.width - size.height: parent.height - mainMenu.height - - onMousePressed: { - page.state = "" - } - - MapObjectView { - model: geocodeModel - delegate: Component { - MapCircle { - radius: 10000 - color: "red" - center: location.coordinate - } - } - } - - onSliderUpdated: { - page.state = "" - } - - onCoordinatesCaptured: { - messageDialog.state = "Coordinates" - messageDialog.text = "Latitude: " + roundNumber(latitude,4) + "
Longitude: " + roundNumber(longitude,4); - page.state = "Message" - } - - onGeocodeFinished:{ - var street, district, city, county, state, countryCode, country, latitude, longitude, text - - if (map.geocodeModel.status == GeocodeModel.Ready){ - if (map.geocodeModel.count == 0) messageDialog.state = "UnknownGeocodeError" - else if (map.geocodeModel.count > 1) messageDialog.state = "AmbiguousGeocode" - else messageDialog.state = "LocationInfo"; - } - else if (map.geocodeModel.status == GeocodeModel.Error) messageDialog.state = "GeocodeError" - page.state = "Message" - } - - onShowGeocodeInfo:{ - messageDialog.state = "LocationInfo" - page.state = "Message" - } - - onMoveMarker: { - page.state = "Coordinates" - } - - onRouteError: { - messageDialog.state = "RouteError" - page.state = "Message" - } - } - - function geocodeMessage(){ - var street, district, city, county, state, countryCode, country, postcode, latitude, longitude, text - latitude = map.geocodeModel.get(0).coordinate.latitude - longitude = map.geocodeModel.get(0).coordinate.longitude - street = map.geocodeModel.get(0).address.street - district = map.geocodeModel.get(0).address.district - city = map.geocodeModel.get(0).address.city - county = map.geocodeModel.get(0).address.county - state = map.geocodeModel.get(0).address.state - countryCode = map.geocodeModel.get(0).address.countryCode - country = map.geocodeModel.get(0).address.country - postcode = map.geocodeModel.get(0).address.postcode - - text = "Latitude: " + latitude + "
" - text +="Longitude: " + longitude + "
" + "
" - if (street) text +="Street: "+ street + "
" - if (district) text +="District: "+ district +"
" - if (city) text +="City: "+ city + "
" - if (county) text +="County: "+ county + "
" - if (state) text +="State: "+ state + "
" - if (countryCode) text +="Country code: "+ countryCode + "
" - if (country) text +="Country: "+ country + "
" - if (postcode) text +="Postcode: "+ postcode + "
" - return text - } - -//=====================States of page===================== - states: [ - State { - name: "" - PropertyChanges { target: map; focus: true } - }, - State { - name: "RevGeocode" - PropertyChanges { target: reverseGeocodeDialog; opacity: 1 } - }, - State { - name: "Route" - PropertyChanges { target: routeDialog; opacity: 1 } - }, - State { - name: "Geocode" - PropertyChanges { target: geocodeDialog; opacity: 1 } - }, - State { - name: "Coordinates" - PropertyChanges { target: coordinatesDialog; opacity: 1 } - }, - State { - name: "Message" - PropertyChanges { target: messageDialog; opacity: 1 } - }, - State { - name : "Options" - PropertyChanges { target: optionsMenu; y: page.height - optionsMenu.height - mainMenu.height } - }, - State { - name : "Settings" - PropertyChanges { target: settingsMenu; y: page.height - settingsMenu.height - mainMenu.height } - }, - State { - name : "MapType" - PropertyChanges { target: mapTypeMenu; opacity: 1} - PropertyChanges { target: settingsMenu; y: page.height - settingsMenu.height - mainMenu.height } - }, - State { - name : "Connectivity" - PropertyChanges { target: connectivityModeMenu; opacity: 1} - PropertyChanges { target: settingsMenu; y: page.height - settingsMenu.height - mainMenu.height } - } - ] - -//=====================State-transition animations for page===================== - transitions: [ - Transition { - to: "RevGeocode" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "Route" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "Geocode" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "Coordinates" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "Message" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "" - NumberAnimation { properties: "opacity" ; duration: 500; easing.type: Easing.Linear } - }, - Transition { - to: "Settings" - NumberAnimation { properties: "y" ; duration: 300; easing.type: Easing.Linear } - }, - Transition { - to: "Options" - NumberAnimation { properties: "y" ; duration: 300; easing.type: Easing.Linear } - } - ] -} diff --git a/examples/declarative/mapviewer/mapviewer.qrc b/examples/declarative/mapviewer/mapviewer.qrc deleted file mode 100644 index cc2c671b..00000000 --- a/examples/declarative/mapviewer/mapviewer.qrc +++ /dev/null @@ -1,42 +0,0 @@ - - - mapviewer.qml - Dialog.qml - common/TitleBar.qml - common/Button.qml - common/Slider.qml - common/Menu.qml - resources/button.png - resources/button.sci - resources/quit.png - resources/titlebar.png - resources/titlebar.sci - resources/quit_pressed.png - resources/menuItem.png - resources/menuItem.sci - resources/menuItem_pressed.png - resources/quit_hovered.png - resources/menuItem_hovered.png - resources/button_pressed.png - resources/button_hovered.png - Message.qml - common/Fader.qml - RouteDialog.qml - TextWithLabel.qml - resources/option_button_selected.png - resources/option_button.png - MapComponent.qml - Marker.qml - resources/marker.png - resources/marker_selected.png - resources/marker_hovered.png - resources/node.png - resources/node_selected.png - resources/catch.png - resources/scale.png - resources/checkbox_selected.png - resources/checkbox.png - common/Checkbox.qml - common/Optionbutton.qml - - diff --git a/examples/declarative/mapviewer/mapviewer/content/components/Button.qml b/examples/declarative/mapviewer/mapviewer/content/components/Button.qml new file mode 100644 index 00000000..552313c4 --- /dev/null +++ b/examples/declarative/mapviewer/mapviewer/content/components/Button.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** 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 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 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 2.0 +import "style" + +Item { + id: container + + signal clicked + + property alias text: buttonText.text + property alias color: buttonText.color + property bool checked: false + property ButtonStyle style: ButtonStyle{} + + function disable() { + container.state = "Disabled"; + } + + function enable() { + container.state = ""; + } + + BorderImage { + id: buttonImage + source: style.background + width: parent.width; height: parent.height + style.heightAdjustment; y: style.yAdjustment + } + + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + hoverEnabled: true + onClicked: { container.clicked(); } + } + Text { + id: buttonText + color: checked ? "lawngreen" : "white" + anchors.centerIn: buttonImage; font.bold: true + style: Text.Raised; styleColor: "darkblue" + } + + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: buttonImage; source: style.pressedBackground } + PropertyChanges { target: buttonText; style: Text.Sunken } + }, + State { + name: "Hovered" + when: mouseRegion.containsMouse + PropertyChanges{ target: buttonImage; source: style.disabledBackground } + }, + State { + name: "Disabled" + PropertyChanges{ target: buttonText; color: "silver" } + PropertyChanges{ target: mouseRegion; enabled: false } + } + ] +} diff --git a/examples/declarative/mapviewer/mapviewer/content/components/Checkbox.qml b/examples/declarative/mapviewer/mapviewer/content/components/Checkbox.qml new file mode 100644 index 00000000..99b719f7 --- /dev/null +++ b/examples/declarative/mapviewer/mapviewer/content/components/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 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 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 2.0 + +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/mapviewer/content/components/Fader.qml b/examples/declarative/mapviewer/mapviewer/content/components/Fader.qml new file mode 100644 index 00000000..2e0dd4bd --- /dev/null +++ b/examples/declarative/mapviewer/mapviewer/content/components/Fader.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** 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 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 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 2.0 + +Rectangle { + id: fader + anchors.fill: parent + opacity: 0.7 + color: "darkgrey" + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + } + + Component.onCompleted: { + var globalXY + var root = parent + + if (root != null) { + while (root.parent) root = root.parent + width = root.width; height = root.height; + globalXY = mapFromItem(root, root.x, root.y); + } else { + globalXY = mapFromItem(null, 0, 0); + } + x = globalXY.x; + y = globalXY.y; + } +} diff --git a/examples/declarative/mapviewer/mapviewer/content/components/Menu.qml b/examples/declarative/mapviewer/mapviewer/content/components/Menu.qml new file mode 100644 index 00000000..5f7e27bd --- /dev/null +++ b/examples/declarative/mapviewer/mapviewer/content/components/Menu.qml @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** 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 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 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 2.0 + +Grid { + id: menu + + property bool horizontalOrientation: true + property list