From 8d2a6e427067027769e1f3c6322ae06620146396 Mon Sep 17 00:00:00 2001 From: Wolfgang Beck Date: Fri, 3 Feb 2012 14:31:49 +1000 Subject: Update Examples for SDK team Change-Id: Ib81ebf326a1ee4330a268c8d57934e3d77ea68bb Reviewed-by: Lincoln Ramsay --- examples/sensors/sensor_explorer/PropertyList.qml | 130 ++++++++++++++ examples/sensors/sensor_explorer/SensorList.qml | 149 ++++++++++++++++ .../components/ApplicationWindow.qml | 51 ++++++ .../sensors/sensor_explorer/components/Button.qml | 75 ++++++++ .../sensor_explorer/components/TextField.qml | 109 ++++++++++++ .../images/button_background_disabled.png | Bin 0 -> 579 bytes .../components/images/button_background_normal.png | Bin 0 -> 901 bytes .../images/button_background_pressed.png | Bin 0 -> 334 bytes .../images/textfield_background_disabled.png | Bin 0 -> 936 bytes .../images/textfield_background_normal.png | Bin 0 -> 767 bytes examples/sensors/sensor_explorer/icon.png | Bin 0 -> 2205 bytes .../sensor_explorer/images/listitem_select.png | Bin 0 -> 156 bytes examples/sensors/sensor_explorer/info.json | 15 ++ examples/sensors/sensor_explorer/main.qml | 196 +++++++++++++++++++++ examples/sensors/sensor_explorer/notions.json | 5 + examples/sensors/sensor_explorer/qml.pro | 19 ++ .../sensor_explorer/qml_app/PropertyList.qml | 130 -------------- .../sensors/sensor_explorer/qml_app/SensorList.qml | 149 ---------------- .../qml_app/components/ApplicationWindow.qml | 51 ------ .../sensor_explorer/qml_app/components/Button.qml | 75 -------- .../qml_app/components/TextField.qml | 109 ------------ .../images/button_background_disabled.png | Bin 579 -> 0 bytes .../components/images/button_background_normal.png | Bin 901 -> 0 bytes .../images/button_background_pressed.png | Bin 334 -> 0 bytes .../images/textfield_background_disabled.png | Bin 936 -> 0 bytes .../images/textfield_background_normal.png | Bin 767 -> 0 bytes examples/sensors/sensor_explorer/qml_app/icon.png | Bin 2205 -> 0 bytes .../qml_app/images/listitem_select.png | Bin 156 -> 0 bytes examples/sensors/sensor_explorer/qml_app/info.json | 15 -- examples/sensors/sensor_explorer/qml_app/main.qml | 196 --------------------- .../sensor_explorer/qml_app/qml_app.qmlproject | 18 -- .../sensors/sensor_explorer/sensor_explorer.pro | 6 +- .../sensors/sensor_explorer/sensor_explorer.qdoc | 95 ---------- examples/sensors/sensor_explorer/settings.json | 7 + 34 files changed, 760 insertions(+), 840 deletions(-) create mode 100644 examples/sensors/sensor_explorer/PropertyList.qml create mode 100644 examples/sensors/sensor_explorer/SensorList.qml create mode 100644 examples/sensors/sensor_explorer/components/ApplicationWindow.qml create mode 100644 examples/sensors/sensor_explorer/components/Button.qml create mode 100644 examples/sensors/sensor_explorer/components/TextField.qml create mode 100644 examples/sensors/sensor_explorer/components/images/button_background_disabled.png create mode 100644 examples/sensors/sensor_explorer/components/images/button_background_normal.png create mode 100644 examples/sensors/sensor_explorer/components/images/button_background_pressed.png create mode 100644 examples/sensors/sensor_explorer/components/images/textfield_background_disabled.png create mode 100644 examples/sensors/sensor_explorer/components/images/textfield_background_normal.png create mode 100755 examples/sensors/sensor_explorer/icon.png create mode 100644 examples/sensors/sensor_explorer/images/listitem_select.png create mode 100644 examples/sensors/sensor_explorer/info.json create mode 100644 examples/sensors/sensor_explorer/main.qml create mode 100644 examples/sensors/sensor_explorer/notions.json create mode 100644 examples/sensors/sensor_explorer/qml.pro delete mode 100644 examples/sensors/sensor_explorer/qml_app/PropertyList.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/SensorList.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/Button.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/TextField.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png delete mode 100755 examples/sensors/sensor_explorer/qml_app/icon.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/images/listitem_select.png delete mode 100644 examples/sensors/sensor_explorer/qml_app/info.json delete mode 100644 examples/sensors/sensor_explorer/qml_app/main.qml delete mode 100644 examples/sensors/sensor_explorer/qml_app/qml_app.qmlproject delete mode 100644 examples/sensors/sensor_explorer/sensor_explorer.qdoc create mode 100644 examples/sensors/sensor_explorer/settings.json (limited to 'examples/sensors/sensor_explorer') diff --git a/examples/sensors/sensor_explorer/PropertyList.qml b/examples/sensors/sensor_explorer/PropertyList.qml new file mode 100644 index 00000000..ba956fba --- /dev/null +++ b/examples/sensors/sensor_explorer/PropertyList.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 +import Explorer 1.0 + +Rectangle { + id: controlrect + anchors.margins: 5 + color: "transparent" + + property PropertyInfo selectedItem: null; + signal selectedItemChanged(); + property alias listmodel: itemList.model + + onListmodelChanged: { + itemList.currentIndex = -1; + selectedItem = null; + selectedItemChanged(); + } + + Rectangle { + id: itemListRect + anchors.fill: parent + color: "transparent" + + ListView { + id: itemList + anchors.fill: itemListRect + anchors.leftMargin: 5 + anchors.rightMargin: 5 + focus: true + currentIndex: -1 + delegate: itemListDelegate + clip: true + + Rectangle { + id: scrollbar + anchors.right: itemList.right + y: itemList.visibleArea.yPosition * itemList.height + width: 2 + height: itemList.visibleArea.heightRatio * itemList.height + color: "black" + } + } + + Component { + id: itemListDelegate + + Rectangle { + width: itemList.width + height: itemNameText.font.pixelSize + 3 + color: "transparent" + + Image { + id: backgroundImage + anchors.fill: parent + source: "images/listitem_select.png" + visible: itemList.currentIndex === index + } + + Text { + id: itemNameText + text: model.modelData.name + font.pixelSize: 15 + color: (itemList.currentIndex === index ? "#1c94ff" : "black") + } + + Text { + id: itemValueText + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 5 + font.pixelSize: 15 + horizontalAlignment: Text.AlignRight + text: model.modelData.value + color: (itemList.currentIndex === index ? "#1c94ff" : "black") + } + + MouseArea { + anchors.fill: parent + + onClicked: { + itemList.currentIndex = index; + selectedItem = model.modelData; + selectedItemChanged(); + } + } + } + } + } +} diff --git a/examples/sensors/sensor_explorer/SensorList.qml b/examples/sensors/sensor_explorer/SensorList.qml new file mode 100644 index 00000000..f95572b3 --- /dev/null +++ b/examples/sensors/sensor_explorer/SensorList.qml @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 +import Explorer 1.0 + +Rectangle { + id: controlrect + anchors.margins: 5 + color: "transparent" + + property SensorItem selectedItem: null; + signal selectedItemChanged(); + property alias title: labelTitle.text + property alias listmodel: itemList.model + + onListmodelChanged: { + itemList.currentIndex = -1; + selectedItem = null; + selectedItemChanged(); + } + + Text { + id: labelTitle + anchors.top: controlrect.top + anchors.left: controlrect.left + anchors.right: controlrect.right + horizontalAlignment: Text.AlignHCenter + font.pixelSize: 30 + font.bold: true + text: "" + } + + Rectangle { + id: titleLine + anchors.top: labelTitle.bottom + anchors.left: controlrect.left + anchors.right: controlrect.right + height: 1 + border.width: 1 + border.color: "#999999" + } + + Rectangle { + id: itemListRect + anchors.top: titleLine.bottom + anchors.left: controlrect.left + anchors.right: controlrect.right + anchors.bottom: controlrect.bottom + color: "transparent" + + ListView { + id: itemList + anchors.fill: itemListRect + anchors.leftMargin: 5 + anchors.rightMargin: 5 + focus: true + currentIndex: -1 + delegate: itemListDelegate + clip: true + + Rectangle { + id: scrollbar + anchors.right: itemList.right + y: itemList.visibleArea.yPosition * itemList.height + width: 2 + height: itemList.visibleArea.heightRatio * itemList.height + color: "black" + } + } + + Component { + id: itemListDelegate + + Rectangle { + width: itemList.width + height: 30 + color: "transparent" + + Image { + id: backgroundImage + anchors.fill: parent + source: "images/listitem_select.png" + visible: itemList.currentIndex === index + } + + Text { + id: itemText + height: 30 + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: 5 + text: model.modelData.id + color: (itemList.currentIndex === index ? "#1c94ff" : "black") + verticalAlignment: Text.AlignVCenter + font.pixelSize: 15 + } + + MouseArea { + anchors.fill: parent + + onClicked: { + itemList.currentIndex = index; + selectedItem = model.modelData; + selectedItemChanged(); + } + } + } + } + } +} diff --git a/examples/sensors/sensor_explorer/components/ApplicationWindow.qml b/examples/sensors/sensor_explorer/components/ApplicationWindow.qml new file mode 100644 index 00000000..cab5e94c --- /dev/null +++ b/examples/sensors/sensor_explorer/components/ApplicationWindow.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 + +Rectangle { + id: appWnd + x: 0 + y: 0 + width: 320 + height: 480 + color: "#ececec" +} diff --git a/examples/sensors/sensor_explorer/components/Button.qml b/examples/sensors/sensor_explorer/components/Button.qml new file mode 100644 index 00000000..537a8bce --- /dev/null +++ b/examples/sensors/sensor_explorer/components/Button.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 + +//Implementation of the Button control. +Item { + id: button + width: 30 + height: 100 + property alias text: innerText.text + signal clicked + + Image { + id: backgroundImage + anchors.fill: parent + source: (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") + } + + Text { + id: innerText + anchors.centerIn: parent + color: "white" + font.bold: true + } + + //Mouse area to react on click events + MouseArea { + anchors.fill: button + onClicked: { button.clicked();} + onPressed: { + backgroundImage.source = "images/button_background_pressed.png" } + onReleased: { + backgroundImage.source = (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") + } + } +} diff --git a/examples/sensors/sensor_explorer/components/TextField.qml b/examples/sensors/sensor_explorer/components/TextField.qml new file mode 100644 index 00000000..c1feaf21 --- /dev/null +++ b/examples/sensors/sensor_explorer/components/TextField.qml @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 + +Item { + id: textInputFrame + property alias text: textInput.text + signal accepted + + resources: [ + Component{ + id: cursorA + Rectangle { + id: cursor_rect + width: 2 + height: 20 + color: "#1c94ff" + visible: textInput.cursorVisible + + PropertyAnimation on opacity { + easing.type: Easing.OutSine + loops: Animation.Infinite + from: 0 + to: 1.0 + duration: 750 + } + } + } + ] + + Image { + id: backgroundImage + anchors.fill: parent + source: (textInputFrame.enabled ? "images/textfield_background_normal.png" : "images/textfield_background_disabled.png") + } + + TextInput { + id: textInput + anchors.fill: parent + anchors.topMargin: 5 + anchors.leftMargin: 5 + anchors.rightMargin: 5 + activeFocusOnPress: false + + cursorDelegate: cursorA + + onEnabledChanged: { + textInput.focus = false; + } + + onAccepted: { + textInputFrame.accepted(); + } + + MouseArea { + anchors.fill: parent + + onClicked: { + if (!textInput.activeFocus) { + textInput.forceActiveFocus() + textInput.openSoftwareInputPanel(); + } else { + textInput.focus = false; + } + } + + onPressAndHold: textInput.closeSoftwareInputPanel(); + } + } +} diff --git a/examples/sensors/sensor_explorer/components/images/button_background_disabled.png b/examples/sensors/sensor_explorer/components/images/button_background_disabled.png new file mode 100644 index 00000000..62a00b9a Binary files /dev/null and b/examples/sensors/sensor_explorer/components/images/button_background_disabled.png differ diff --git a/examples/sensors/sensor_explorer/components/images/button_background_normal.png b/examples/sensors/sensor_explorer/components/images/button_background_normal.png new file mode 100644 index 00000000..1fecad5b Binary files /dev/null and b/examples/sensors/sensor_explorer/components/images/button_background_normal.png differ diff --git a/examples/sensors/sensor_explorer/components/images/button_background_pressed.png b/examples/sensors/sensor_explorer/components/images/button_background_pressed.png new file mode 100644 index 00000000..149529e1 Binary files /dev/null and b/examples/sensors/sensor_explorer/components/images/button_background_pressed.png differ diff --git a/examples/sensors/sensor_explorer/components/images/textfield_background_disabled.png b/examples/sensors/sensor_explorer/components/images/textfield_background_disabled.png new file mode 100644 index 00000000..98bc601f Binary files /dev/null and b/examples/sensors/sensor_explorer/components/images/textfield_background_disabled.png differ diff --git a/examples/sensors/sensor_explorer/components/images/textfield_background_normal.png b/examples/sensors/sensor_explorer/components/images/textfield_background_normal.png new file mode 100644 index 00000000..b90b50cd Binary files /dev/null and b/examples/sensors/sensor_explorer/components/images/textfield_background_normal.png differ diff --git a/examples/sensors/sensor_explorer/icon.png b/examples/sensors/sensor_explorer/icon.png new file mode 100755 index 00000000..c48b6095 Binary files /dev/null and b/examples/sensors/sensor_explorer/icon.png differ diff --git a/examples/sensors/sensor_explorer/images/listitem_select.png b/examples/sensors/sensor_explorer/images/listitem_select.png new file mode 100644 index 00000000..def234f1 Binary files /dev/null and b/examples/sensors/sensor_explorer/images/listitem_select.png differ diff --git a/examples/sensors/sensor_explorer/info.json b/examples/sensors/sensor_explorer/info.json new file mode 100644 index 00000000..95b56fe5 --- /dev/null +++ b/examples/sensors/sensor_explorer/info.json @@ -0,0 +1,15 @@ +{ + "info-version": "1.0", + "dict": { + "Category": "application", + "Runtime": "qml", + "DisplayName": "Sensors Explorer", + "Subcategory": "utility", + "MainQML": "main.qml", + "Version": "1.0.0", + "Identifier": "com.nokia.mt.sensorexplorer", + "Summary": "QML Sensors Explorer demo", + "Author": "Qt" + } +} + diff --git a/examples/sensors/sensor_explorer/main.qml b/examples/sensors/sensor_explorer/main.qml new file mode 100644 index 00000000..88641604 --- /dev/null +++ b/examples/sensors/sensor_explorer/main.qml @@ -0,0 +1,196 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the QtSensors module 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 the declarative plugins +import QtQuick 2.0 +import "components" + +//! [0] +import Explorer 1.0 +//! [0] + +ApplicationWindow { + id: mainWnd + +//! [1] + SensorExplorer { + id: explorer + } +//! [1] + + SensorList { + id: sensorList + anchors.top: parent.top + anchors.topMargin: 20 + anchors.left: parent.left + anchors.right: parent.right + height: 170 + title: "sensor explorer" + +//! [2] + listmodel: explorer.availableSensors +//! [2] + + onSelectedItemChanged: { + explorer.selectedSensorItem = sensorList.selectedItem; + startstopButton.text=(explorer.selectedSensorItem !== null ? + (explorer.selectedSensorItem.start === true ? "Stop" : "Start") : "Start") + if (sensorList.selectedItem !== null) + +//! [3] + propertyList.listmodel = sensorList.selectedItem.properties; +//! [3] + } + } + + Rectangle { + id: listSplitLine + anchors.top: sensorList.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 5 + anchors.rightMargin: 5 + height: 1 + border.width: 1 + border.color: "#999999" + } + + PropertyList { + id: propertyList + anchors.top: listSplitLine.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: listPropertyEndLine.top + anchors.bottomMargin: 5 + + onSelectedItemChanged: { + textfield.enabled = (propertyList.selectedItem === null ? + false : propertyList.selectedItem.isWriteable); + } + } + + Rectangle { + id: listPropertyEndLine + anchors.bottom: startstopButton.top + anchors.bottomMargin: 5 + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 5 + anchors.rightMargin: 5 + height: 1 + border.width: 1 + border.color: "#999999" + } + + + Button { + id: startstopButton + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.margins: 5 + text: (explorer.selectedSensorItem !== null ? + (explorer.selectedSensorItem.start === true ? "Stop" : "Start") : "Start") + enabled: true + height: 30 + width: 80 + + onClicked: { + if (explorer.selectedSensorItem !== null) { +//! [5] + if (text === "Start") { + explorer.selectedSensorItem.start = true; + text = "Stop"; + } + else { + explorer.selectedSensorItem.start = false; + text = "Start"; + } +//! [5] + } + + textfield.text = ""; + } + } + + TextField { + id: textfield + anchors.top: parent.bottom + anchors.topMargin: -35 + anchors.left: startstopButton.right + anchors.right: parent.right + anchors.margins: 5 + height: 30 + enabled: false + + onEnabledChanged: { + if (!textfield.enabled) { + textfield.closeSoftwareInputPanel(); + textfield.anchors.top= parent.bottom; + textfield.anchors.topMargin= -35; + textfield.text = ""; + } + } + + onFocusChanged: { + if (textfield.focus) { + textfield.anchors.top= sensorList.bottom + textfield.anchors.topMargin= -15 + } + else { + textfield.closeSoftwareInputPanel(); + textfield.anchors.top= parent.bottom; + textfield.anchors.topMargin= -35; + } + } + + onAccepted: { + + if (explorer.selectedSensorItem !== null + && propertyList.selectedItem !== null) { +//! [4] + explorer.selectedSensorItem.changePropertyValue(propertyList.selectedItem, textfield.text); +//! [4] + propertyList.focus=true; + } + textfield.text = ""; + } + } +} + diff --git a/examples/sensors/sensor_explorer/notions.json b/examples/sensors/sensor_explorer/notions.json new file mode 100644 index 00000000..95d05191 --- /dev/null +++ b/examples/sensors/sensor_explorer/notions.json @@ -0,0 +1,5 @@ +{ + "notion-file-version": 1, + "capabilities": [ + ] +} diff --git a/examples/sensors/sensor_explorer/qml.pro b/examples/sensors/sensor_explorer/qml.pro new file mode 100644 index 00000000..71022cd5 --- /dev/null +++ b/examples/sensors/sensor_explorer/qml.pro @@ -0,0 +1,19 @@ +TEMPLATE = aux + +app.files = \ + info.json \ + notions.json \ + settings.json \ + main.qml \ + PropertyList.qml \ + SensorList.qml \ + icon.png \ + components \ + images + +!isEmpty(EXAMPLES_PREFIX) { + TARGET_DIR = $$EXAMPLES_PREFIX/com.nokia.mt.sensorexplorer + app.path = $$TARGET_DIR + INSTALLS = app +} + diff --git a/examples/sensors/sensor_explorer/qml_app/PropertyList.qml b/examples/sensors/sensor_explorer/qml_app/PropertyList.qml deleted file mode 100644 index ba956fba..00000000 --- a/examples/sensors/sensor_explorer/qml_app/PropertyList.qml +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 -import Explorer 1.0 - -Rectangle { - id: controlrect - anchors.margins: 5 - color: "transparent" - - property PropertyInfo selectedItem: null; - signal selectedItemChanged(); - property alias listmodel: itemList.model - - onListmodelChanged: { - itemList.currentIndex = -1; - selectedItem = null; - selectedItemChanged(); - } - - Rectangle { - id: itemListRect - anchors.fill: parent - color: "transparent" - - ListView { - id: itemList - anchors.fill: itemListRect - anchors.leftMargin: 5 - anchors.rightMargin: 5 - focus: true - currentIndex: -1 - delegate: itemListDelegate - clip: true - - Rectangle { - id: scrollbar - anchors.right: itemList.right - y: itemList.visibleArea.yPosition * itemList.height - width: 2 - height: itemList.visibleArea.heightRatio * itemList.height - color: "black" - } - } - - Component { - id: itemListDelegate - - Rectangle { - width: itemList.width - height: itemNameText.font.pixelSize + 3 - color: "transparent" - - Image { - id: backgroundImage - anchors.fill: parent - source: "images/listitem_select.png" - visible: itemList.currentIndex === index - } - - Text { - id: itemNameText - text: model.modelData.name - font.pixelSize: 15 - color: (itemList.currentIndex === index ? "#1c94ff" : "black") - } - - Text { - id: itemValueText - anchors.left: parent.left - anchors.right: parent.right - anchors.rightMargin: 5 - font.pixelSize: 15 - horizontalAlignment: Text.AlignRight - text: model.modelData.value - color: (itemList.currentIndex === index ? "#1c94ff" : "black") - } - - MouseArea { - anchors.fill: parent - - onClicked: { - itemList.currentIndex = index; - selectedItem = model.modelData; - selectedItemChanged(); - } - } - } - } - } -} diff --git a/examples/sensors/sensor_explorer/qml_app/SensorList.qml b/examples/sensors/sensor_explorer/qml_app/SensorList.qml deleted file mode 100644 index f95572b3..00000000 --- a/examples/sensors/sensor_explorer/qml_app/SensorList.qml +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 -import Explorer 1.0 - -Rectangle { - id: controlrect - anchors.margins: 5 - color: "transparent" - - property SensorItem selectedItem: null; - signal selectedItemChanged(); - property alias title: labelTitle.text - property alias listmodel: itemList.model - - onListmodelChanged: { - itemList.currentIndex = -1; - selectedItem = null; - selectedItemChanged(); - } - - Text { - id: labelTitle - anchors.top: controlrect.top - anchors.left: controlrect.left - anchors.right: controlrect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 30 - font.bold: true - text: "" - } - - Rectangle { - id: titleLine - anchors.top: labelTitle.bottom - anchors.left: controlrect.left - anchors.right: controlrect.right - height: 1 - border.width: 1 - border.color: "#999999" - } - - Rectangle { - id: itemListRect - anchors.top: titleLine.bottom - anchors.left: controlrect.left - anchors.right: controlrect.right - anchors.bottom: controlrect.bottom - color: "transparent" - - ListView { - id: itemList - anchors.fill: itemListRect - anchors.leftMargin: 5 - anchors.rightMargin: 5 - focus: true - currentIndex: -1 - delegate: itemListDelegate - clip: true - - Rectangle { - id: scrollbar - anchors.right: itemList.right - y: itemList.visibleArea.yPosition * itemList.height - width: 2 - height: itemList.visibleArea.heightRatio * itemList.height - color: "black" - } - } - - Component { - id: itemListDelegate - - Rectangle { - width: itemList.width - height: 30 - color: "transparent" - - Image { - id: backgroundImage - anchors.fill: parent - source: "images/listitem_select.png" - visible: itemList.currentIndex === index - } - - Text { - id: itemText - height: 30 - anchors.top: parent.top - anchors.left: parent.left - anchors.leftMargin: 5 - text: model.modelData.id - color: (itemList.currentIndex === index ? "#1c94ff" : "black") - verticalAlignment: Text.AlignVCenter - font.pixelSize: 15 - } - - MouseArea { - anchors.fill: parent - - onClicked: { - itemList.currentIndex = index; - selectedItem = model.modelData; - selectedItemChanged(); - } - } - } - } - } -} diff --git a/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml b/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml deleted file mode 100644 index cab5e94c..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/ApplicationWindow.qml +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 - -Rectangle { - id: appWnd - x: 0 - y: 0 - width: 320 - height: 480 - color: "#ececec" -} diff --git a/examples/sensors/sensor_explorer/qml_app/components/Button.qml b/examples/sensors/sensor_explorer/qml_app/components/Button.qml deleted file mode 100644 index 537a8bce..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/Button.qml +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 - -//Implementation of the Button control. -Item { - id: button - width: 30 - height: 100 - property alias text: innerText.text - signal clicked - - Image { - id: backgroundImage - anchors.fill: parent - source: (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") - } - - Text { - id: innerText - anchors.centerIn: parent - color: "white" - font.bold: true - } - - //Mouse area to react on click events - MouseArea { - anchors.fill: button - onClicked: { button.clicked();} - onPressed: { - backgroundImage.source = "images/button_background_pressed.png" } - onReleased: { - backgroundImage.source = (button.enabled ? "images/button_background_normal.png" : "images/button_background_disabled.png") - } - } -} diff --git a/examples/sensors/sensor_explorer/qml_app/components/TextField.qml b/examples/sensors/sensor_explorer/qml_app/components/TextField.qml deleted file mode 100644 index c1feaf21..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/TextField.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 - -Item { - id: textInputFrame - property alias text: textInput.text - signal accepted - - resources: [ - Component{ - id: cursorA - Rectangle { - id: cursor_rect - width: 2 - height: 20 - color: "#1c94ff" - visible: textInput.cursorVisible - - PropertyAnimation on opacity { - easing.type: Easing.OutSine - loops: Animation.Infinite - from: 0 - to: 1.0 - duration: 750 - } - } - } - ] - - Image { - id: backgroundImage - anchors.fill: parent - source: (textInputFrame.enabled ? "images/textfield_background_normal.png" : "images/textfield_background_disabled.png") - } - - TextInput { - id: textInput - anchors.fill: parent - anchors.topMargin: 5 - anchors.leftMargin: 5 - anchors.rightMargin: 5 - activeFocusOnPress: false - - cursorDelegate: cursorA - - onEnabledChanged: { - textInput.focus = false; - } - - onAccepted: { - textInputFrame.accepted(); - } - - MouseArea { - anchors.fill: parent - - onClicked: { - if (!textInput.activeFocus) { - textInput.forceActiveFocus() - textInput.openSoftwareInputPanel(); - } else { - textInput.focus = false; - } - } - - onPressAndHold: textInput.closeSoftwareInputPanel(); - } - } -} diff --git a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png deleted file mode 100644 index 62a00b9a..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png deleted file mode 100644 index 1fecad5b..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png b/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png deleted file mode 100644 index 149529e1..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png deleted file mode 100644 index 98bc601f..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png b/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png deleted file mode 100644 index b90b50cd..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/icon.png b/examples/sensors/sensor_explorer/qml_app/icon.png deleted file mode 100755 index c48b6095..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/icon.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png b/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png deleted file mode 100644 index def234f1..00000000 Binary files a/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png and /dev/null differ diff --git a/examples/sensors/sensor_explorer/qml_app/info.json b/examples/sensors/sensor_explorer/qml_app/info.json deleted file mode 100644 index 3f1feb43..00000000 --- a/examples/sensors/sensor_explorer/qml_app/info.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "Sensor Explorer", - "Subcategory": "utility", - "MainQML": "main.qml", - "Version": "1.0", - "Identifier": "com.nokia.mt.sensorexplorer.demo", - "Summary": "QML Sensor Explorer demo", - "Author": "Qt" - } -} - diff --git a/examples/sensors/sensor_explorer/qml_app/main.qml b/examples/sensors/sensor_explorer/qml_app/main.qml deleted file mode 100644 index 88641604..00000000 --- a/examples/sensors/sensor_explorer/qml_app/main.qml +++ /dev/null @@ -1,196 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the QtSensors module 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 the declarative plugins -import QtQuick 2.0 -import "components" - -//! [0] -import Explorer 1.0 -//! [0] - -ApplicationWindow { - id: mainWnd - -//! [1] - SensorExplorer { - id: explorer - } -//! [1] - - SensorList { - id: sensorList - anchors.top: parent.top - anchors.topMargin: 20 - anchors.left: parent.left - anchors.right: parent.right - height: 170 - title: "sensor explorer" - -//! [2] - listmodel: explorer.availableSensors -//! [2] - - onSelectedItemChanged: { - explorer.selectedSensorItem = sensorList.selectedItem; - startstopButton.text=(explorer.selectedSensorItem !== null ? - (explorer.selectedSensorItem.start === true ? "Stop" : "Start") : "Start") - if (sensorList.selectedItem !== null) - -//! [3] - propertyList.listmodel = sensorList.selectedItem.properties; -//! [3] - } - } - - Rectangle { - id: listSplitLine - anchors.top: sensorList.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 5 - anchors.rightMargin: 5 - height: 1 - border.width: 1 - border.color: "#999999" - } - - PropertyList { - id: propertyList - anchors.top: listSplitLine.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: listPropertyEndLine.top - anchors.bottomMargin: 5 - - onSelectedItemChanged: { - textfield.enabled = (propertyList.selectedItem === null ? - false : propertyList.selectedItem.isWriteable); - } - } - - Rectangle { - id: listPropertyEndLine - anchors.bottom: startstopButton.top - anchors.bottomMargin: 5 - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 5 - anchors.rightMargin: 5 - height: 1 - border.width: 1 - border.color: "#999999" - } - - - Button { - id: startstopButton - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.margins: 5 - text: (explorer.selectedSensorItem !== null ? - (explorer.selectedSensorItem.start === true ? "Stop" : "Start") : "Start") - enabled: true - height: 30 - width: 80 - - onClicked: { - if (explorer.selectedSensorItem !== null) { -//! [5] - if (text === "Start") { - explorer.selectedSensorItem.start = true; - text = "Stop"; - } - else { - explorer.selectedSensorItem.start = false; - text = "Start"; - } -//! [5] - } - - textfield.text = ""; - } - } - - TextField { - id: textfield - anchors.top: parent.bottom - anchors.topMargin: -35 - anchors.left: startstopButton.right - anchors.right: parent.right - anchors.margins: 5 - height: 30 - enabled: false - - onEnabledChanged: { - if (!textfield.enabled) { - textfield.closeSoftwareInputPanel(); - textfield.anchors.top= parent.bottom; - textfield.anchors.topMargin= -35; - textfield.text = ""; - } - } - - onFocusChanged: { - if (textfield.focus) { - textfield.anchors.top= sensorList.bottom - textfield.anchors.topMargin= -15 - } - else { - textfield.closeSoftwareInputPanel(); - textfield.anchors.top= parent.bottom; - textfield.anchors.topMargin= -35; - } - } - - onAccepted: { - - if (explorer.selectedSensorItem !== null - && propertyList.selectedItem !== null) { -//! [4] - explorer.selectedSensorItem.changePropertyValue(propertyList.selectedItem, textfield.text); -//! [4] - propertyList.focus=true; - } - textfield.text = ""; - } - } -} - diff --git a/examples/sensors/sensor_explorer/qml_app/qml_app.qmlproject b/examples/sensors/sensor_explorer/qml_app/qml_app.qmlproject deleted file mode 100644 index 51457fa6..00000000 --- a/examples/sensors/sensor_explorer/qml_app/qml_app.qmlproject +++ /dev/null @@ -1,18 +0,0 @@ -import QmlProject 1.1 - -Project { - mainFile: "main.qml" - - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "./images" - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ "../exampleplugin" ] -} diff --git a/examples/sensors/sensor_explorer/sensor_explorer.pro b/examples/sensors/sensor_explorer/sensor_explorer.pro index caa66808..85ba45ef 100644 --- a/examples/sensors/sensor_explorer/sensor_explorer.pro +++ b/examples/sensors/sensor_explorer/sensor_explorer.pro @@ -1,4 +1,6 @@ TEMPLATE = subdirs +CONFIG += ordered -SUBDIRS += import #qml_app - +SUBDIRS = \ + import \ + qml.pro diff --git a/examples/sensors/sensor_explorer/sensor_explorer.qdoc b/examples/sensors/sensor_explorer/sensor_explorer.qdoc deleted file mode 100644 index 003429f7..00000000 --- a/examples/sensors/sensor_explorer/sensor_explorer.qdoc +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the documentation of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:FDL$ -** GNU Free Documentation License -** Alternatively, this file may be used under the terms of the GNU Free -** Documentation License version 1.3 as published by the Free Software -** Foundation and appearing in the file included in the packaging of -** this file. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms -** and conditions contained in a signed written agreement between you -** and Nokia. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page sensor_explorer.html - \title Sensor Explorer example - \ingroup qtsensors-examples - \brief The Sensor Explorer example demonstrates how to read the meta-data of available sensors. - \image sensorexplorer.jpg - -\section1 Overview - This example contains 2 projects. - - A \l{Sensor Explorer QML Import} to make the sensors and their meta-data available to a QML application. - - A \l{Sensor Explorer QML Application} that represents the \l{Sensor Explorer QML Import} information to the user interface. -*/ - - -/*! - \example sensors/sensor_explorer/import - \title Sensor Explorer QML Import - \brief The Sensor Explorer QML import exports the QSensorExplorer, QPropertyInfo and the QSensorItem class as a QML element. - - This example creates the \e {Explorer 1.0} import. - - \sa {Sensor Explorer Example} -*/ - -/*! - \example sensors/sensor_explorer/qml_app - \title Sensor Explorer QML Application - \brief The Sensor Explorer QML application demonstrates use of the Explorer 1.0 import QML elements. - - This is a pure QML application that can be run from Qt Creator or directly using the - \c qmlscene binary. You should install the other projects before trying to run - this example or it will not be able to find its dependencies. - - \code - qmlscene main.qml - \endcode - - \sa {Sensor Explorer Example} - -\section1 Overview - To write a QML application that will use the Explorer QML element you need to do the following steps: - - Import the Explorer 1.0 declarative plugin: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 0 - - Create a SensorExplorer QML item: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 1 - - You can retrieve a list of all available sensors using the SensorExplorer: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 2 - - To retrieve the properties of a SensorItem use: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 3 - - Changing a property value can be done like: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 4 - - Starting and stoping a sesnor can be done like: - - \snippet ../examples/sensors/sensor_explorer/qml_app/main.qml 5 -*/ diff --git a/examples/sensors/sensor_explorer/settings.json b/examples/sensors/sensor_explorer/settings.json new file mode 100644 index 00000000..a7db3876 --- /dev/null +++ b/examples/sensors/sensor_explorer/settings.json @@ -0,0 +1,7 @@ +{ + "version": "1.0.0", + "identifier": "com.nokia.mt.sensorexplorer", + "label": "QML Sensor Explorer demo", + "settings": [ + ] +} -- cgit v1.2.3