diff options
Diffstat (limited to 'examples/location/common')
57 files changed, 1492 insertions, 0 deletions
diff --git a/examples/location/common/common.pri b/examples/location/common/common.pri new file mode 100644 index 00000000..30ede711 --- /dev/null +++ b/examples/location/common/common.pri @@ -0,0 +1,37 @@ + +QML_IMPORT_PATH += $$PWD/imports + +RESOURCES += \ + $$PWD/common.qrc + +commonresources.files += $$PWD/resources/* + +qmlcomponents.files += \ + $$PWD/imports/QtLocation/examples/components/TextWithLabel.qml \ + $$PWD/imports/QtLocation/examples/components/Button.qml \ + $$PWD/imports/QtLocation/examples/components/Checkbox.qml \ + $$PWD/imports/QtLocation/examples/components/Fader.qml \ + $$PWD/imports/QtLocation/examples/components/Optionbutton.qml \ + $$PWD/imports/QtLocation/examples/components/Slider.qml \ + $$PWD/imports/QtLocation/examples/components/TitleBar.qml \ + $$PWD/imports/QtLocation/examples/components/ButtonRow.qml \ + $$PWD/imports/QtLocation/examples/components/Menu.qml \ + $$PWD/imports/QtLocation/examples/components/IconButton.qml \ + $$PWD/imports/QtLocation/examples/components/BusyIndicator.qml +OTHER_FILES += $$qmlcomponents.files + +qmlcomponentsstyle.files += \ + $$PWD/imports/QtLocation/examples/components/style/Style.qml \ + $$PWD/imports/QtLocation/examples/components/style/ButtonStyle.qml \ + $$PWD/imports/QtLocation/examples/components/style/HMenuItemStyle.qml \ + $$PWD/imports/QtLocation/examples/components/style/VMenuItemStyle.qml +OTHER_FILES += $$qmlcomponentsstyle.files + +qmldialogs.files += \ + $$PWD/imports/QtLocation/examples/dialogs/Dialog.qml \ + $$PWD/imports/QtLocation/examples/dialogs/InputDialog.qml \ + $$PWD/imports/QtLocation/examples/dialogs/ErrorDialog.qml +OTHER_FILES += $$qmldialogs.files + +qmldir.files += $$PWD/imports/QtLocation/examples/qmldir +OTHER_FILES += $$qmldir.files diff --git a/examples/location/common/common.qrc b/examples/location/common/common.qrc new file mode 100644 index 00000000..bfd79b73 --- /dev/null +++ b/examples/location/common/common.qrc @@ -0,0 +1,59 @@ +<RCC> + <qresource prefix="/"> + <file>imports/QtLocation/examples/qmldir</file> + <file>imports/QtLocation/examples/components/style/ButtonStyle.qml</file> + <file>imports/QtLocation/examples/components/style/HMenuItemStyle.qml</file> + <file>imports/QtLocation/examples/components/style/VMenuItemStyle.qml</file> + <file>imports/QtLocation/examples/components/BusyIndicator.qml</file> + <file>imports/QtLocation/examples/components/Button.qml</file> + <file>imports/QtLocation/examples/components/Checkbox.qml</file> + <file>imports/QtLocation/examples/components/Fader.qml</file> + <file>imports/QtLocation/examples/components/IconButton.qml</file> + <file>imports/QtLocation/examples/components/Menu.qml</file> + <file>imports/QtLocation/examples/components/Optionbutton.qml</file> + <file>imports/QtLocation/examples/components/Slider.qml</file> + <file>imports/QtLocation/examples/components/TextWithLabel.qml</file> + <file>imports/QtLocation/examples/components/TitleBar.qml</file> + <file>imports/QtLocation/examples/dialogs/Dialog.qml</file> + <file>imports/QtLocation/examples/dialogs/InputDialog.qml</file> + <file>imports/QtLocation/examples/dialogs/ErrorDialog.qml</file> + <file>resources/busy.png</file> + <file>resources/button_pressed.png</file> + <file>resources/button.png</file> + <file>resources/catch.png</file> + <file>resources/categories_pressed.png</file> + <file>resources/categories.png</file> + <file>resources/checkbox_selected.png</file> + <file>resources/checkbox.png</file> + <file>resources/cross_hovered.png</file> + <file>resources/cross_pressed.png</file> + <file>resources/cross.png</file> + <file>resources/hmenuItem_pressed.png</file> + <file>resources/hmenuItem.png</file> + <file>resources/left_pressed.png</file> + <file>resources/left.png</file> + <file>resources/marker_hovered.png</file> + <file>resources/marker_selected.png</file> + <file>resources/marker.png</file> + <file>resources/node_selected.png</file> + <file>resources/node.png</file> + <file>resources/option_button_selected.png</file> + <file>resources/option_button.png</file> + <file>resources/pencil_hovered.png</file> + <file>resources/pencil_pressed.png</file> + <file>resources/pencil.png</file> + <file>resources/quit_hovered.png</file> + <file>resources/quit_pressed.png</file> + <file>resources/quit.png</file> + <file>resources/right_pressed.png</file> + <file>resources/right.png</file> + <file>resources/scale_end.png</file> + <file>resources/scale.png</file> + <file>resources/search_pressed.png</file> + <file>resources/search.png</file> + <file>resources/star.png</file> + <file>resources/titlebar.png</file> + <file>resources/titlebar.sci</file> + <file>resources/vmenuItem.png</file> + </qresource> +</RCC> diff --git a/examples/location/common/imports/QtLocation/examples/components/BusyIndicator.qml b/examples/location/common/imports/QtLocation/examples/components/BusyIndicator.qml new file mode 100644 index 00000000..188b3d18 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/BusyIndicator.qml @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +Image { + id: root + + source: "../../../../resources/busy.png" + + RotationAnimation on rotation { + loops: Animation.Infinite + from: 0 + to: 360 + duration: 500 + running: root.visible + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Button.qml b/examples/location/common/imports/QtLocation/examples/components/Button.qml new file mode 100644 index 00000000..e98f8651 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Button.qml @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 alias paintedWidth: buttonText.paintedWidth + property alias paintedHeight: buttonText.paintedHeight + property bool checked: false + property bool enabled: true + property ButtonStyle style: ButtonStyle{} + + width: buttonText.width * 1.2 + height: buttonText.height * 1.2 + + function disable() { + enabled = false; + } + + function enable() { + enabled = true; + } + + BorderImage { + id: buttonImage + source: container.style.background + anchors.fill: parent + } + + MouseArea { + id: mouseRegion + anchors.fill: buttonImage + hoverEnabled: false + onClicked: { container.clicked() } + } + Text { + id: buttonText + color: checked ? container.style.fontcolor_selected : container.style.fontcolor_normal + anchors.centerIn: buttonImage; font.bold: true; font.pixelSize: 14 + style: Text.Normal + anchors.baseline: parent.bottom + anchors.baselineOffset: -6 + } + + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed == true + PropertyChanges { target: buttonImage; source: container.style.pressedBackground } + }, + State { + name: "Hovered" + when: mouseRegion.containsMouse + PropertyChanges{ target: buttonImage; source: container.style.disabledBackground } + }, + State { + name: "Disabled" + when: !enabled + PropertyChanges{ target: buttonText; color: "dimgray" } + PropertyChanges{ target: mouseRegion; enabled: false } + } + ] +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Checkbox.qml b/examples/location/common/imports/QtLocation/examples/components/Checkbox.qml new file mode 100644 index 00000000..d0526797 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Checkbox.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + font.pixelSize: 14 + color: "#242424" + } + } + MouseArea { + anchors.fill: parent + onClicked: { checkbox.selected = !checkbox.selected } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Fader.qml b/examples/location/common/imports/QtLocation/examples/components/Fader.qml new file mode 100644 index 00000000..482bc365 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Fader.qml @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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: false + } + + 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/location/common/imports/QtLocation/examples/components/IconButton.qml b/examples/location/common/imports/QtLocation/examples/components/IconButton.qml new file mode 100644 index 00000000..d426203f --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/IconButton.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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: root + + property url source + property url hoveredSource: source + property url pressedSource: source + + signal clicked + + width: childrenRect.width + height: childrenRect.height + + Image { + id: image + + source: parent.source + height: sourceSize.height + + MouseArea { + id: mouseRegion + hoverEnabled: false + anchors.fill: parent + onClicked: root.clicked() + } + + states: [ + State { + name: "Pressed" + when: mouseRegion.pressed + PropertyChanges { target: image; source: pressedSource } + }, + State { + name: "Hover" + when: mouseRegion.containsMouse + PropertyChanges { target: image; source: hoveredSource } + } + ] + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Menu.qml b/examples/location/common/imports/QtLocation/examples/components/Menu.qml new file mode 100644 index 00000000..0fed3c4a --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Menu.qml @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + enabled: opacity > 0 ? true : false + + property bool horizontalOrientation: true + property list <Button> buttons + width: parent.width + height: horizontalOrientation ? 40 : ((children.length > 0) ? children[0].height * children.length : 0) + spacing: 0 + property string exclusiveButton: "" + property bool exclusive: false + property bool autoWidth: false + opacity: 1 + rows: (horizontalOrientation) ? 1 : children.length + columns: (horizontalOrientation) ? children.length : 1 + signal clicked(string button) + + onChildrenChanged: { + resizeItems() + } + + onExclusiveChanged: { + if (exclusive){ + if (children.length > 0) exclusiveButton = children[0].text + } + else + exclusiveButton = "" + } + + onExclusiveButtonChanged:{ + if (exclusive) { + for (var i = 0; i<children.length; i++){ + if (children[i].text == exclusiveButton){ + children[i].checked = true + break + } + } + } + } + + function addItem(caption) { + var button, myArray + if (horizontalOrientation) + button = Qt.createQmlObject ('import "style"; Button {height: menu.height; onClicked: {menu.itemClicked(text)} style: HMenuItemStyle {}}', menu) + else + button = Qt.createQmlObject ('import "style"; Button {height: 35; width: menu.width; onClicked: {menu.itemClicked(text)} style: VMenuItemStyle {}}', menu) + button.text = caption + + myArray = new Array() + for (var i = 0; i<children.length; i++){ + myArray.push(children[i]) + } + myArray.push(button) + children = myArray + + return button + } + + function deleteItem(caption){ + var myArray + + myArray = new Array() + for (var i = 0; i<children.length; i++){ + if (children[i].text != caption) + myArray.push(children[i]) + } + children = myArray + } + + function clear() { + children = [] + exclusiveButton = "" + } + + function disableItem(caption){ + for (var i = 0; i<children.length; i++){ + if (children[i].text == caption){ + children[i].disable() + break + } + } + } + + function enableItem(caption){ + for (var i = 0; i<children.length; i++){ + if (children[i].text == caption){ + children[i].enable() + break + } + } + } + + function resizeItems(){ + if (horizontalOrientation) { + for (var i = 0; i<children.length; i++) + children[i].width = parent.width/children.length - spacing + } else if (autoWidth) { + if (children.length > 0) { + var maxWidth = children[0].paintedWidth + for (var i = 1; i<children.length; i++){ + if (children[i].paintedWidth > maxWidth) { + maxWidth = children[i].paintedWidth + } + } + menu.width = maxWidth + 20 + } + for (var i = 0; i < children.length; i++) + children[i].width = menu.width; + } + } + + function itemClicked(text){ + if (exclusive && text != exclusiveButton) { + for (var i = 0; i<children.length; i++){ + if (children[i].text == exclusiveButton){ + children[i].checked = false + break + } + } + exclusiveButton = text + } + clicked(text) + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Optionbutton.qml b/examples/location/common/imports/QtLocation/examples/components/Optionbutton.qml new file mode 100644 index 00000000..208301da --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Optionbutton.qml @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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: optionbutton + + signal clicked + + property bool selected: false + property alias text: optionbuttonText.text + property bool toggle: false + + height: optionbuttonText.height + + Row { + id: optionbuttonRow + spacing: 3 + anchors.fill: parent + Image { + source: optionbutton.selected ? "../../../../resources/option_button_selected.png" : "../../../../resources/option_button.png" + } + Text { + id: optionbuttonText + font.pixelSize: 14 + color: "#242424" + } + } + MouseArea { + anchors.fill: parent + onClicked: { + if (toggle) { + if (optionbutton.selected) + optionbutton.selected = false + else + optionbutton.selected = true + } else { + optionbutton.selected = true + } + optionbutton.clicked() + } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/Slider.qml b/examples/location/common/imports/QtLocation/examples/components/Slider.qml new file mode 100644 index 00000000..1a337425 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/Slider.qml @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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: 10 + property real value // value is read/write. + property real minimum: 0 + property real maximum: 1 + property int length: width - handle.width + + Rectangle { + anchors.fill: parent + border.width: 1; + border.color: "lightgrey" + radius: 8 + color: "white" + opacity: 1 + } + + Rectangle { + anchors.left: parent.left + anchors.leftMargin: 4 + anchors.top: parent.top + anchors.topMargin: (parent.height - height)/2 + height: 3 + width: handle.x - x + color: "#1c94fc" + } + + + Rectangle { + id: labelRect + width: label.width + height: label.height + 4 + radius: 4 + smooth: true + color: "white" + border.color: "lightgrey" + anchors.bottom: handle.top + anchors.bottomMargin: 4 + x: Math.max(Math.min(handle.x + (handle.width - width )/2, slider.width - width),0) + visible: mouseRegion.pressed + Text{ + id: label + color: "darkgrey" + text: slider.value.toFixed(2) + width: font.pointSize * 3.5 + anchors.horizontalCenter: labelRect.horizontalCenter + horizontalAlignment: Text.AlignHCenter + anchors.baseline: parent.bottom + anchors.baselineOffset: -6 + font.pixelSize: 14 + } + } + + Rectangle { + id: handle; + smooth: true + width: 26; + y: (slider.height - height)/2; + x: (slider.value - slider.minimum) * slider.length / (slider.maximum - slider.minimum) + + height: width; radius: width/2 + gradient: normalGradient + border.width: 2 + border.color: "white" + + Gradient { + id: normalGradient + GradientStop { position: 0.0; color: "#b0b0b0" } + GradientStop { position: 0.66; color: "#909090" } + GradientStop { position: 1.0; color: "#545454" } + } + + MouseArea { + id: mouseRegion + hoverEnabled: false + anchors.fill: parent; drag.target: parent + drag.axis: Drag.XAxis; drag.minimumX: 0; drag.maximumX: slider.length + onPositionChanged: { slider.value = (slider.maximum - slider.minimum) * handle.x / slider.length + slider.minimum; } + } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/TextWithLabel.qml b/examples/location/common/imports/QtLocation/examples/components/TextWithLabel.qml new file mode 100644 index 00000000..7b4d9aba --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/TextWithLabel.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + property alias font: inputField.font + property alias busy: busyIndicator.visible + + Text { + id: label; + width:65; + enabled: textWithLabel.enabled + color: enabled ? "#242424" : "lightgrey" + anchors.verticalCenter: parent.verticalCenter + + font.pixelSize: 14 + } + + Rectangle { + id: inputRectangle + width: textWithLabel.width - label.width; height: inputField.font.pixelSize * 1.5 + color: enabled ? "white" : "ghostwhite" + + radius: 5 + TextInput { + id: inputField + width: parent.width - anchors.leftMargin + enabled: textWithLabel.enabled + color: enabled ? "#242424" : "lightgrey" + horizontalAlignment: Text.AlignLeft + + anchors { + left: parent.left; + verticalCenter: parent.verticalCenter; + leftMargin: 5 + } + font.pixelSize: 14 + + BusyIndicator { + id: busyIndicator + height: parent.height * 0.8 + width: height + anchors.verticalCenter: parent.verticalCenter + anchors.rightMargin: parent.height * 0.1 + anchors.topMargin: parent.height * 0.1 + anchors.top: parent.top + anchors.right: parent.right + visible: false + } + } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/components/TitleBar.qml b/examples/location/common/imports/QtLocation/examples/components/TitleBar.qml new file mode 100644 index 00000000..0e67fd9a --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/TitleBar.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + property alias font: titleText.font + 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: false + anchors.fill: parent + onClicked: { titleBar.clicked(); } + } + } + + Text { + id: titleText + anchors { + left: parent.left; leftMargin: 10; verticalCenter: parent.verticalCenter + } + elide: Text.ElideLeft + font.bold: true; font.pixelSize: 14; 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/location/common/imports/QtLocation/examples/components/style/ButtonStyle.qml b/examples/location/common/imports/QtLocation/examples/components/style/ButtonStyle.qml new file mode 100644 index 00000000..d93fee11 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/style/ButtonStyle.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +QtObject { + id: buttonStyle + property string background: "../../../../resources/button.png" + property string pressedBackground: "../../../../resources/button_pressed.png" + property string disabledBackground: "../../../../resources/button.png" + property color fontcolor_normal: "white" + property color fontcolor_selected: "#1c94fc" +} diff --git a/examples/location/common/imports/QtLocation/examples/components/style/HMenuItemStyle.qml b/examples/location/common/imports/QtLocation/examples/components/style/HMenuItemStyle.qml new file mode 100644 index 00000000..588fdb39 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/style/HMenuItemStyle.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +ButtonStyle { + background: "../../../../resources/hmenuItem.png" + pressedBackground: "../../../../resources/hmenuItem_pressed.png" + disabledBackground: "../../../../resources/hmenuItem.png" + fontcolor_normal: "#242424" + fontcolor_selected: "#1c94fc" +} diff --git a/examples/location/common/imports/QtLocation/examples/components/style/VMenuItemStyle.qml b/examples/location/common/imports/QtLocation/examples/components/style/VMenuItemStyle.qml new file mode 100644 index 00000000..be7c245d --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/components/style/VMenuItemStyle.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +HMenuItemStyle { + background: "../../../../resources/vmenuItem.png" +} diff --git a/examples/location/common/imports/QtLocation/examples/dialogs/Dialog.qml b/examples/location/common/imports/QtLocation/examples/dialogs/Dialog.qml new file mode 100644 index 00000000..5ed5cfca --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/dialogs/Dialog.qml @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 "../components" + +Item { + id: dialog + + signal goButtonClicked + signal cancelButtonClicked + signal clearButtonClicked + + property alias title: titleBar.text + + property int gap: 10 + property bool showButtons: true + property Item item + + opacity: 0 + anchors.fill: parent + enabled: opacity > 0 ? true : false + + Fader {} + + onItemChanged: { + if (item) + item.parent = dataRect; + } + + Rectangle { + id: dialogRectangle + + property int maximumDialogHeight: { + if (dialog.opacity === 0 || + (Qt.inputMethod.keyboardRectangle.width === 0 && Qt.inputMethod.keyboardRectangle.height === 0)) { + return dialog.height; + } else { + return dialog.mapFromItem(null, Qt.inputMethod.keyboardRectangle.x, Qt.inputMethod.keyboardRectangle.y).y + } + } + property int maximumContentHeight: maximumDialogHeight - titleBar.height - buttons.height - gap*1.5 + + color: "#ECECEC" + opacity: parent.opacity + + height: dataRect.height + titleBar.height + buttons.height + gap*1.5 + y: (maximumDialogHeight - height) / 2 + anchors.left: parent.left + anchors.leftMargin: gap/2 + anchors.right: parent.right + anchors.rightMargin: gap/2 + + radius: 5 + + TitleBar { + id: titleBar; + + height: 40 + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + opacity: 0.9 + onClicked: { + Qt.inputMethod.hide(); + dialog.cancelButtonClicked(); + } + + } + + Rectangle { + id: dataRect + color: "#ECECEC" + radius: 5 + + anchors.top: titleBar.bottom + anchors.left: dialogRectangle.left + anchors.right: dialogRectangle.right + anchors.margins: gap/2 + height: Math.min(dialogRectangle.maximumContentHeight, item ? item.implicitHeight : 0) + + Binding { + target: item + property: "anchors.fill" + value: dataRect + } + Binding { + target: item + property: "anchors.margins" + value: gap/2 + } + } + + Row { + id: buttons + anchors.top: dataRect.bottom + anchors.topMargin: gap/2 + anchors.horizontalCenter: parent.horizontalCenter + spacing: gap/3 + height: 32 + visible: showButtons + Button { + id: buttonClearAll + text: "Clear" + width: 80 + height: parent.height + onClicked: dialog.clearButtonClicked() + } + Button { + id: buttonGo + text: "Go!" + width: 80 + height: parent.height + onClicked: dialog.goButtonClicked() + } + } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml b/examples/location/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml new file mode 100644 index 00000000..f2fc5a25 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/dialogs/ErrorDialog.qml @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 + +Dialog { + id: errorRoot + + property string text + opacity: 0 + showButtons:false + + item: Text { + id: errorText + text: errorRoot.text + } + + onCancelButtonClicked: { + opacity = 0; + } +} diff --git a/examples/location/common/imports/QtLocation/examples/dialogs/InputDialog.qml b/examples/location/common/imports/QtLocation/examples/dialogs/InputDialog.qml new file mode 100644 index 00000000..a905186e --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/dialogs/InputDialog.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia Plc 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 "../components" + +Dialog { + id: dialog + + property alias dialogModel: dialogModel + property alias length: dialogModel.count + + property int listItemHeight: 21 + + onClearButtonClicked: { + for (var i = 0; i < length; ++i) + dialogModel.set(i, { "inputText": "" }); + } + + item: ListView { + id: listview + + model: dialogModel + delegate: listDelegate + spacing: gap/2 + clip: true + snapMode: ListView.SnapToItem + implicitHeight: (listItemHeight + gap/2)*length + gap/2 + interactive: height < implicitHeight + width: parent.width + } + + function setModel(objects) { + dialogModel.clear(); + for (var i = 0; i < objects.length; ++i) { + dialogModel.append({ "labelText": objects[i][0], "inputText": objects[i][1] }); + } + } + + ListModel { + id: dialogModel + } + + Component { + id: listDelegate + + TextWithLabel { + id: textWithLabel + label: labelText + text: inputText + width: parent ? parent.width : 0 + labelWidth: 95 + + onTextChanged: dialogModel.set(index, {"inputText": text}) + } + } +} diff --git a/examples/location/common/imports/QtLocation/examples/qmldir b/examples/location/common/imports/QtLocation/examples/qmldir new file mode 100644 index 00000000..9089f6c0 --- /dev/null +++ b/examples/location/common/imports/QtLocation/examples/qmldir @@ -0,0 +1,13 @@ +BusyIndicator 5.0 components/BusyIndicator.qml +Button 5.0 components/Button.qml +Checkbox 5.0 components/Checkbox.qml +Fader 5.0 components/Fader.qml +IconButton 5.0 components/IconButton.qml +Menu 5.0 components/Menu.qml +Optionbutton 5.0 components/Optionbutton.qml +Slider 5.0 components/Slider.qml +TextWithLabel 5.0 components/TextWithLabel.qml +TitleBar 5.0 components/TitleBar.qml +Dialog 5.0 dialogs/Dialog.qml +ErrorDialog 5.0 dialogs/ErrorDialog.qml +InputDialog 5.0 dialogs/InputDialog.qml diff --git a/examples/location/common/resources/busy.png b/examples/location/common/resources/busy.png Binary files differnew file mode 100755 index 00000000..3cca7dab --- /dev/null +++ b/examples/location/common/resources/busy.png diff --git a/examples/location/common/resources/button.png b/examples/location/common/resources/button.png Binary files differnew file mode 100644 index 00000000..1e3e752c --- /dev/null +++ b/examples/location/common/resources/button.png diff --git a/examples/location/common/resources/button_pressed.png b/examples/location/common/resources/button_pressed.png Binary files differnew file mode 100644 index 00000000..21d9835f --- /dev/null +++ b/examples/location/common/resources/button_pressed.png diff --git a/examples/location/common/resources/catch.png b/examples/location/common/resources/catch.png Binary files differnew file mode 100644 index 00000000..c4fbba40 --- /dev/null +++ b/examples/location/common/resources/catch.png diff --git a/examples/location/common/resources/categories.png b/examples/location/common/resources/categories.png Binary files differnew file mode 100644 index 00000000..d1d82c2e --- /dev/null +++ b/examples/location/common/resources/categories.png diff --git a/examples/location/common/resources/categories_pressed.png b/examples/location/common/resources/categories_pressed.png Binary files differnew file mode 100644 index 00000000..965e0ad7 --- /dev/null +++ b/examples/location/common/resources/categories_pressed.png diff --git a/examples/location/common/resources/checkbox.png b/examples/location/common/resources/checkbox.png Binary files differnew file mode 100644 index 00000000..b9aab540 --- /dev/null +++ b/examples/location/common/resources/checkbox.png diff --git a/examples/location/common/resources/checkbox_selected.png b/examples/location/common/resources/checkbox_selected.png Binary files differnew file mode 100644 index 00000000..28b32f58 --- /dev/null +++ b/examples/location/common/resources/checkbox_selected.png diff --git a/examples/location/common/resources/cross.png b/examples/location/common/resources/cross.png Binary files differnew file mode 100644 index 00000000..835cd91a --- /dev/null +++ b/examples/location/common/resources/cross.png diff --git a/examples/location/common/resources/cross_hovered.png b/examples/location/common/resources/cross_hovered.png Binary files differnew file mode 100644 index 00000000..fdd23d79 --- /dev/null +++ b/examples/location/common/resources/cross_hovered.png diff --git a/examples/location/common/resources/cross_pressed.png b/examples/location/common/resources/cross_pressed.png Binary files differnew file mode 100644 index 00000000..c7a692af --- /dev/null +++ b/examples/location/common/resources/cross_pressed.png diff --git a/examples/location/common/resources/hmenuItem.png b/examples/location/common/resources/hmenuItem.png Binary files differnew file mode 100644 index 00000000..f2461f2d --- /dev/null +++ b/examples/location/common/resources/hmenuItem.png diff --git a/examples/location/common/resources/hmenuItem_pressed.png b/examples/location/common/resources/hmenuItem_pressed.png Binary files differnew file mode 100644 index 00000000..43336d1e --- /dev/null +++ b/examples/location/common/resources/hmenuItem_pressed.png diff --git a/examples/location/common/resources/left.png b/examples/location/common/resources/left.png Binary files differnew file mode 100644 index 00000000..c0efa646 --- /dev/null +++ b/examples/location/common/resources/left.png diff --git a/examples/location/common/resources/left_pressed.png b/examples/location/common/resources/left_pressed.png Binary files differnew file mode 100644 index 00000000..b4fee456 --- /dev/null +++ b/examples/location/common/resources/left_pressed.png diff --git a/examples/location/common/resources/marker.png b/examples/location/common/resources/marker.png Binary files differnew file mode 100644 index 00000000..86ec960e --- /dev/null +++ b/examples/location/common/resources/marker.png diff --git a/examples/location/common/resources/marker_hovered.png b/examples/location/common/resources/marker_hovered.png Binary files differnew file mode 100644 index 00000000..902ae591 --- /dev/null +++ b/examples/location/common/resources/marker_hovered.png diff --git a/examples/location/common/resources/marker_selected.png b/examples/location/common/resources/marker_selected.png Binary files differnew file mode 100644 index 00000000..f4bf8921 --- /dev/null +++ b/examples/location/common/resources/marker_selected.png diff --git a/examples/location/common/resources/node.png b/examples/location/common/resources/node.png Binary files differnew file mode 100644 index 00000000..46e85672 --- /dev/null +++ b/examples/location/common/resources/node.png diff --git a/examples/location/common/resources/node_selected.png b/examples/location/common/resources/node_selected.png Binary files differnew file mode 100644 index 00000000..a967f3cf --- /dev/null +++ b/examples/location/common/resources/node_selected.png diff --git a/examples/location/common/resources/option_button.png b/examples/location/common/resources/option_button.png Binary files differnew file mode 100644 index 00000000..90970424 --- /dev/null +++ b/examples/location/common/resources/option_button.png diff --git a/examples/location/common/resources/option_button_selected.png b/examples/location/common/resources/option_button_selected.png Binary files differnew file mode 100644 index 00000000..f1196286 --- /dev/null +++ b/examples/location/common/resources/option_button_selected.png diff --git a/examples/location/common/resources/pencil.png b/examples/location/common/resources/pencil.png Binary files differnew file mode 100644 index 00000000..a52cff02 --- /dev/null +++ b/examples/location/common/resources/pencil.png diff --git a/examples/location/common/resources/pencil_hovered.png b/examples/location/common/resources/pencil_hovered.png Binary files differnew file mode 100644 index 00000000..55053fc1 --- /dev/null +++ b/examples/location/common/resources/pencil_hovered.png diff --git a/examples/location/common/resources/pencil_pressed.png b/examples/location/common/resources/pencil_pressed.png Binary files differnew file mode 100644 index 00000000..f30f3703 --- /dev/null +++ b/examples/location/common/resources/pencil_pressed.png diff --git a/examples/location/common/resources/quit.png b/examples/location/common/resources/quit.png Binary files differnew file mode 100644 index 00000000..9a5cb8a2 --- /dev/null +++ b/examples/location/common/resources/quit.png diff --git a/examples/location/common/resources/quit_hovered.png b/examples/location/common/resources/quit_hovered.png Binary files differnew file mode 100644 index 00000000..bea8f251 --- /dev/null +++ b/examples/location/common/resources/quit_hovered.png diff --git a/examples/location/common/resources/quit_pressed.png b/examples/location/common/resources/quit_pressed.png Binary files differnew file mode 100644 index 00000000..e69aa111 --- /dev/null +++ b/examples/location/common/resources/quit_pressed.png diff --git a/examples/location/common/resources/right.png b/examples/location/common/resources/right.png Binary files differnew file mode 100644 index 00000000..db343b07 --- /dev/null +++ b/examples/location/common/resources/right.png diff --git a/examples/location/common/resources/right_pressed.png b/examples/location/common/resources/right_pressed.png Binary files differnew file mode 100644 index 00000000..111f386b --- /dev/null +++ b/examples/location/common/resources/right_pressed.png diff --git a/examples/location/common/resources/scale.png b/examples/location/common/resources/scale.png Binary files differnew file mode 100644 index 00000000..6e59ff08 --- /dev/null +++ b/examples/location/common/resources/scale.png diff --git a/examples/location/common/resources/scale_end.png b/examples/location/common/resources/scale_end.png Binary files differnew file mode 100644 index 00000000..5d3a471b --- /dev/null +++ b/examples/location/common/resources/scale_end.png diff --git a/examples/location/common/resources/search.png b/examples/location/common/resources/search.png Binary files differnew file mode 100644 index 00000000..6bad5bd7 --- /dev/null +++ b/examples/location/common/resources/search.png diff --git a/examples/location/common/resources/search_pressed.png b/examples/location/common/resources/search_pressed.png Binary files differnew file mode 100644 index 00000000..23c92fa3 --- /dev/null +++ b/examples/location/common/resources/search_pressed.png diff --git a/examples/location/common/resources/star.png b/examples/location/common/resources/star.png Binary files differnew file mode 100644 index 00000000..93451147 --- /dev/null +++ b/examples/location/common/resources/star.png diff --git a/examples/location/common/resources/titlebar.png b/examples/location/common/resources/titlebar.png Binary files differnew file mode 100644 index 00000000..5b1d09a1 --- /dev/null +++ b/examples/location/common/resources/titlebar.png diff --git a/examples/location/common/resources/titlebar.sci b/examples/location/common/resources/titlebar.sci new file mode 100644 index 00000000..0418d94c --- /dev/null +++ b/examples/location/common/resources/titlebar.sci @@ -0,0 +1,5 @@ +border.left: 10 +border.top: 12 +border.bottom: 12 +border.right: 10 +source: titlebar.png diff --git a/examples/location/common/resources/vmenuItem.png b/examples/location/common/resources/vmenuItem.png Binary files differnew file mode 100644 index 00000000..9e4385e7 --- /dev/null +++ b/examples/location/common/resources/vmenuItem.png |