diff options
Diffstat (limited to 'examples/sensors')
135 files changed, 0 insertions, 6985 deletions
diff --git a/examples/sensors/accel/accel.pro b/examples/sensors/accel/accel.pro deleted file mode 100644 index 86303eca..00000000 --- a/examples/sensors/accel/accel.pro +++ /dev/null @@ -1,7 +0,0 @@ -TEMPLATE=app -TARGET=accel - -QT=core sensors - -SOURCES=main.cpp - diff --git a/examples/sensors/accel/main.cpp b/examples/sensors/accel/main.cpp deleted file mode 100644 index 012c8c61..00000000 --- a/examples/sensors/accel/main.cpp +++ /dev/null @@ -1,77 +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$ -** -****************************************************************************/ - -#include <QtCore> -#include <qaccelerometer.h> - -QAccelerometer *accelerometer; - -class AccelerometerFilter : public QAccelerometerFilter -{ -public: - bool filter(QAccelerometerReading *reading) - { - qDebug() << "acceleration: " - << QString().sprintf("%0.2f %0.2f %0.2f", - reading->x(), - reading->y(), - reading->z()); - return false; // don't store the reading in the sensor - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QAccelerometer sensor; - accelerometer = &sensor; - AccelerometerFilter filter; - sensor.addFilter(&filter); - sensor.start(); - - if (!sensor.isActive()) { - qWarning("Accelerometer didn't start!"); - return 1; - } - - return app.exec(); -} - diff --git a/examples/sensors/accelbubble/accelbubble.pro b/examples/sensors/accelbubble/accelbubble.pro deleted file mode 100644 index feeec685..00000000 --- a/examples/sensors/accelbubble/accelbubble.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = aux - -app.files = \ - info.json \ - main.qml \ - icon.png \ - images - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.accelbubble - INSTALLS = app -} - diff --git a/examples/sensors/accelbubble/icon.png b/examples/sensors/accelbubble/icon.png Binary files differdeleted file mode 100644 index d74f1111..00000000 --- a/examples/sensors/accelbubble/icon.png +++ /dev/null diff --git a/examples/sensors/accelbubble/images/Bluebubble2.png b/examples/sensors/accelbubble/images/Bluebubble2.png Binary files differdeleted file mode 100644 index f96126eb..00000000 --- a/examples/sensors/accelbubble/images/Bluebubble2.png +++ /dev/null diff --git a/examples/sensors/accelbubble/info.json b/examples/sensors/accelbubble/info.json deleted file mode 100644 index 9a2ed709..00000000 --- a/examples/sensors/accelbubble/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "Accel Bubble", - "Subcategory": "utility", - "MainQML": "main.qml", - "Version": "1.0", - "Identifier": "com.nokia.mt.accelbubble", - "Summary": "QtSensors Accel Bubble", - "Author": "Qt" - } -} diff --git a/examples/sensors/accelbubble/main.qml b/examples/sensors/accelbubble/main.qml deleted file mode 100644 index 487ee3f5..00000000 --- a/examples/sensors/accelbubble/main.qml +++ /dev/null @@ -1,132 +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 QtQuick 2.0 -//! [0] -import QtMobility.sensors 1.2 -//! [0] - - -Rectangle { - width: 360 - height: 360 - id: mainPage - -//! [1] - Accelerometer { - id: accel -//! [1] -//! [3] - active:true -//! [3] - property real accelY; - property real accelX; - } - -//! [2] - Timer { - interval: 500; running: true; repeat: true - - property real xdiff; - property real ydiff; - - onTriggered: { - xdiff = accel.reading.x - accel.accelX; - ydiff = accel.reading.y - accel.accelY; - - if (Math.abs(xdiff) > 0.3) { - accel.accelX = -accel.reading.x - } - if (Math.abs(ydiff) > 0.3) { - accel.accelY = accel.reading.y - } - } - } -//! [2] - - Image { - id: bubble - source: "images/Bluebubble2.png" - property real centerX: parent.width / 2 - property real centerY: parent.height / 2; - property real bubbleCenter: bubble.width / 2 - - function calX() { - var newX = centerX + accel.accelX / -1 * centerX - - if ((newX - bubbleCenter) < 0) { - return 0 - } - else if ((newX + bubbleCenter) > parent.width) { - return parent.width - 2 * bubbleCenter - } - return newX - bubbleCenter; - } - x: calX(); - - function calY() { - var newY = centerY + accel.accelY / -1 * centerY - - if ((newY - bubbleCenter) < 0) { - return 0 - } - else if ((newY + bubbleCenter) > parent.height) { - return parent.height - 2 * bubbleCenter - } - return newY - bubbleCenter; - } - y: calY(); - - smooth: true - - Behavior on y { - SmoothedAnimation { - easing.type: Easing.Linear - duration: 2500 - } - } - Behavior on x { - SmoothedAnimation { - easing.type: Easing.Linear - duration: 2500 - } - } - } -} diff --git a/examples/sensors/cubehouse/Cube.qml b/examples/sensors/cubehouse/Cube.qml deleted file mode 100644 index c174b8fe..00000000 --- a/examples/sensors/cubehouse/Cube.qml +++ /dev/null @@ -1,81 +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 QtQuick 2.0 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 - -Cube { - objectName: "cube" - - transform: [ - Rotation3D { - angle: 45.0 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 45.0 - axis: Qt.vector3d(0, 0, 1) - }, - Rotation3D { - id: yRT - angle: 0 - axis: Qt.vector3d(0, -1, 0) - } - ] - - SequentialAnimation { - running: true - loops: Animation.Infinite - NumberAnimation { - target: yRT - property: "angle" - from: 0 - to: 360 - duration: 1000 - } - } - - effect: Effect { - color: "#aaca00" - texture: "images/qtlogo.png" - decal: true - } -} diff --git a/examples/sensors/cubehouse/Cubehouse.qml b/examples/sensors/cubehouse/Cubehouse.qml deleted file mode 100644 index 5a1b91f8..00000000 --- a/examples/sensors/cubehouse/Cubehouse.qml +++ /dev/null @@ -1,113 +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 QtQuick 2.0 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 - -//! [0] -import QtMobility.sensors 1.3 -//! [0] - -import "." - -Item { - id: mainWindow - width: 320 - height: 480 - - Viewport { - id: view - anchors.top: parent.top - width: parent.width - height: parent.height - fillColor: "darkblue" - objectName: "cube viewport" - camera: Camera { eye: Qt.vector3d(0, 3, 1.6 * room.scale - 4)} - - Room{ - id: room - scale: 7.0 - } - - function rotateY(y) - { - room.rotateY(y); - } - - function rotateX(x) - { - room.rotateX(x); - } - } - -//! [1] - Accelerometer { - id: accel - active: true - dataRate: 20 -//! [1] - -//! [2] - property double pitch: 0.0 - property double roll: 0.0 -//! [2] - -//! [3] - onReadingChanged: { - pitch = -(Math.atan2(reading.x, Math.sqrt(reading.y * reading.y + reading.z * reading.z)) * 180) / Math.PI; - roll = (Math.atan2(reading.y, Math.sqrt(reading.x * reading.x + reading.z * reading.z)) * 180) / Math.PI; - } - } -//! [3] - - - //Timer to read out the x and y rotation of the TiltSensor -//! [4] - Timer { - interval: 50; running: true; repeat: true - - onTriggered: { - view.rotateY(accel.pitch); - view.rotateX(accel.roll); - } - } -//! [4] -} diff --git a/examples/sensors/cubehouse/Room.qml b/examples/sensors/cubehouse/Room.qml deleted file mode 100644 index 43af3b12..00000000 --- a/examples/sensors/cubehouse/Room.qml +++ /dev/null @@ -1,288 +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 QtQuick 2.0 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import "." - -Item3D{ - id: room - property double scale: 1.0 - property bool yspin: false - property bool xspin: false - property int yrot: 0 - property int xrot: 0 - property double distanceCorrection: 3.7 - - transform: [ - Rotation3D { - id: yRT - angle: 0 - axis: Qt.vector3d(0, -1, 0) - }, - Rotation3D { - id: xRT - angle: 0 - axis: Qt.vector3d(-1, 0, 0) - } - ] - - SequentialAnimation { - running: yspin - NumberAnimation { - target: yRT - property: "angle" - to: yrot - easing.type:"Linear" - duration: 50 - } - onCompleted: yspin = false - } - - SequentialAnimation { - running: xspin - NumberAnimation { - target: xRT - property: "angle" - to: xrot - easing.type:"Linear" - duration: 50 - } - onCompleted: xspin = false - } - - function rotateY(y) - { - room.yrot=y; - room.yspin = true; - } - - function rotateX(x) - { - room.xrot=x; - room.xspin = true; - } - - Quad { - id: frontWall - scale: room.scale - effect: Effect { - texture: "images/wall.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -frontWall.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 0 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 0 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Quad { - id: ground - scale: room.scale - effect: Effect { - texture: "images/ground.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -ground.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Quad { - id: leftWall - scale: room.scale - effect: Effect { - texture: "images/wall.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -leftWall.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: 0 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Quad { - id: rightWall - scale: room.scale - effect: Effect { - texture: "images/wall.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -rightWall.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: 180 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Quad { - id: roof - scale: room.scale - effect: Effect { - texture: "images/roof.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -roof.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: -90 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 90 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Quad { - id: backWall - scale: room.scale - effect: Effect { - texture: "images/wall.jpg" - } - transform: [ - Translation3D { - translate: Qt.vector3d(0, -backWall.scale + room.distanceCorrection, 0) - }, - Rotation3D { - angle: -90 - axis: Qt.vector3d(1, 0, 0) - }, - Rotation3D { - angle: 0 - axis: Qt.vector3d(0, 1, 0) - }, - Rotation3D { - angle: 0 - axis: Qt.vector3d(0, 0, 1) - } - ] - } - - Cube { - id: cube - scale: 0.5 - - transform: [ - Translation3D { - translate: Qt.vector3d(0.0, 0.0, 0.0) - } - ] - } - - Table { - scale: 0.025 - transform: [ - Translation3D { - translate: Qt.vector3d(0, -7 + room.distanceCorrection, 0) - } - ] - } - - Teapot { - scale: 0.5 - - effect: Effect { - color: "#ffffaa" - decal: true - } - - transform: [ - Translation3D { - translate: Qt.vector3d(0.0, -4.50 + room.distanceCorrection, 0.0) - } - ] - } -} diff --git a/examples/sensors/cubehouse/Table.qml b/examples/sensors/cubehouse/Table.qml deleted file mode 100644 index 683d28de..00000000 --- a/examples/sensors/cubehouse/Table.qml +++ /dev/null @@ -1,50 +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 QtQuick 2.0 -import Qt3D 1.0 -import Qt3D.Shapes 1.0 -import "." - -Item3D { - id: table - scale: 1 - mesh: Mesh { source: "mesh/table.3ds" } -} diff --git a/examples/sensors/cubehouse/cubehouse.pro b/examples/sensors/cubehouse/cubehouse.pro deleted file mode 100644 index 075ec4ef..00000000 --- a/examples/sensors/cubehouse/cubehouse.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = aux - -app.files = \ - Cube.qml \ - Cubehouse.qml \ - Room.qml \ - Table.qml \ - icon.png \ - images \ - info.json \ - mesh - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.cubehouse - INSTALLS = app -} - diff --git a/examples/sensors/cubehouse/icon.png b/examples/sensors/cubehouse/icon.png Binary files differdeleted file mode 100644 index 193ad561..00000000 --- a/examples/sensors/cubehouse/icon.png +++ /dev/null diff --git a/examples/sensors/cubehouse/images/ground.jpg b/examples/sensors/cubehouse/images/ground.jpg Binary files differdeleted file mode 100644 index 2664b99e..00000000 --- a/examples/sensors/cubehouse/images/ground.jpg +++ /dev/null diff --git a/examples/sensors/cubehouse/images/qtlogo.png b/examples/sensors/cubehouse/images/qtlogo.png Binary files differdeleted file mode 100644 index 7d3e97eb..00000000 --- a/examples/sensors/cubehouse/images/qtlogo.png +++ /dev/null diff --git a/examples/sensors/cubehouse/images/roof.jpg b/examples/sensors/cubehouse/images/roof.jpg Binary files differdeleted file mode 100644 index 53a35d64..00000000 --- a/examples/sensors/cubehouse/images/roof.jpg +++ /dev/null diff --git a/examples/sensors/cubehouse/images/wall.jpg b/examples/sensors/cubehouse/images/wall.jpg Binary files differdeleted file mode 100644 index 7c56e23f..00000000 --- a/examples/sensors/cubehouse/images/wall.jpg +++ /dev/null diff --git a/examples/sensors/cubehouse/info.json b/examples/sensors/cubehouse/info.json deleted file mode 100644 index 39e39a8b..00000000 --- a/examples/sensors/cubehouse/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "Cubehouse", - "Subcategory": "utility", - "MainQML": "Cubehouse.qml", - "Version": "1.0", - "Identifier": "com.nokia.mt.cubehouse", - "Summary": "Cubehouse using Accelerometer", - "Author": "Qt" - } -} diff --git a/examples/sensors/cubehouse/mesh/table.3ds b/examples/sensors/cubehouse/mesh/table.3ds Binary files differdeleted file mode 100644 index 3e576bd1..00000000 --- a/examples/sensors/cubehouse/mesh/table.3ds +++ /dev/null diff --git a/examples/sensors/grue/console_app/console_app.pro b/examples/sensors/grue/console_app/console_app.pro deleted file mode 100644 index 33d43176..00000000 --- a/examples/sensors/grue/console_app/console_app.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE=app -TARGET=detect_grue -CONFIG += console -QT=core sensors -SOURCES=main.cpp - diff --git a/examples/sensors/grue/console_app/main.cpp b/examples/sensors/grue/console_app/main.cpp deleted file mode 100644 index dc62e4de..00000000 --- a/examples/sensors/grue/console_app/main.cpp +++ /dev/null @@ -1,89 +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$ -** -****************************************************************************/ - -#include <QtCore> -#include <qsensor.h> - -class Filter : public QSensorFilter -{ - int lastPercent; -public: - Filter() - : QSensorFilter() - , lastPercent(0) - { - } - - bool filter(QSensorReading *reading) - { - int percent = reading->property("chanceOfBeingEaten").value<qreal>() * 100; - if (percent == 0) { - qDebug() << "It is light. You are safe from Grues."; - } else if (lastPercent == 0) { - qDebug() << "It is dark. You are likely to be eaten by a Grue."; - } - if (percent == 100) { - qDebug() << "You have been eaten by a Grue!"; - QCoreApplication::instance()->quit(); - } else if (percent) - qDebug() << "Your chance of being eaten by a Grue:" << percent << "percent."; - lastPercent = percent; - return false; - } -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - QSensor sensor("GrueSensor"); - - Filter filter; - sensor.addFilter(&filter); - sensor.start(); - - if (!sensor.isActive()) { - qWarning("The Grue sensor didn't start. You're on your own!"); - return 1; - } - - return app.exec(); -} - diff --git a/examples/sensors/grue/grue.pro b/examples/sensors/grue/grue.pro deleted file mode 100644 index 0405286d..00000000 --- a/examples/sensors/grue/grue.pro +++ /dev/null @@ -1,8 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += lib plugin console_app -SUBDIRS += import qml_app - -plugin.depends = lib -import.depends = lib - diff --git a/examples/sensors/grue/import/import.pro b/examples/sensors/grue/import/import.pro deleted file mode 100644 index 753e1ef8..00000000 --- a/examples/sensors/grue/import/import.pro +++ /dev/null @@ -1,33 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin - -TARGET = $$qtLibraryTarget(declarative_grue) -TARGETPATH = Grue - -QT = core gui qml sensors - -INCLUDEPATH += $$PWD/../lib -LIBS += -L$$OUT_PWD/../lib -lgruesensor - -SOURCES = main.cpp - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX):DESTPATH=$$EXAMPLES_PREFIX/com.nokia.mt.grue/imports/Grue -else:DESTPATH=$$[QT_INSTALL_IMPORTS]/Grue - -target.path=$$DESTPATH -INSTALLS += target - -qmldir.files=$$PWD/qmldir -qmldir.path=$$DESTPATH -INSTALLS += qmldir - -OTHER_FILES += \ - plugin.json qmldir - -!isEmpty(EXAMPLES_PREFIX) { - QMAKE_LFLAGS += -Wl,-rpath,$$EXAMPLES_PREFIX/com.nokia.mt.grue/lib - DEFINES += "BUNDLED_PLUGIN=\\\"$$EXAMPLES_PREFIX/com.nokia.mt.grue/plugins/sensors/libqtsensors_grue.so\\\"" -} - diff --git a/examples/sensors/grue/import/main.cpp b/examples/sensors/grue/import/main.cpp deleted file mode 100644 index 6c327032..00000000 --- a/examples/sensors/grue/import/main.cpp +++ /dev/null @@ -1,142 +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$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> - -#include <gruesensor.h> -#include <QDebug> - -#ifdef BUNDLED_PLUGIN -#include <QPluginLoader> -#include <QSensorPluginInterface> -#endif - -QT_BEGIN_NAMESPACE - -class GrueSensorQmlImport : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json") -public: - virtual void registerTypes(const char *uri) - { - char const * const package = "Grue"; - if (QLatin1String(uri) != QLatin1String(package)) return; - int major; - int minor; - - // Register the 1.0 interfaces - major = 1; - minor = 0; - qmlRegisterType <GrueSensor >(package, major, minor, "GrueSensor"); - qmlRegisterUncreatableType<GrueSensorReading>(package, major, minor, "GrueSensorReading", QLatin1String("Cannot create GrueSensorReading")); - } - -#ifdef BUNDLED_PLUGIN - GrueSensorQmlImport() - { - // For now, this is getting called after Sensors has loaded - // Ensure that a change later does not break this by forcing - // sensors to load now - (void)QSensor::sensorTypes(); - - // Load the bundled sensor plugin - QPluginLoader loader(QString::fromLocal8Bit(BUNDLED_PLUGIN)); - QObject *instance = loader.instance(); - m_changes = qobject_cast<QSensorChangesInterface*>(instance); - if (m_changes) { - QSensor *sensor = new QSensor(QByteArray(), this); - connect(sensor, SIGNAL(availableSensorsChanged()), this, SLOT(sensorsChanged())); - m_changes->sensorsChanged(); - } - QSensorPluginInterface *plugin = qobject_cast<QSensorPluginInterface*>(instance); - if (plugin) { - plugin->registerSensors(); - } - } - -private slots: - void sensorsChanged() - { - m_changes->sensorsChanged(); - } - -private: - QSensorChangesInterface *m_changes; -#endif -}; - -QT_END_NAMESPACE - -#include "main.moc" - -/* - \qmlclass GrueSensor GrueSensor - \inherits QtMobility.sensors1::Sensor - \inqmlmodule Grue 1 - \brief The GrueSensor element reports on your chance of being eaten by a Grue. - - The GrueSensor element reports on your chance of being eaten by a Grue. - - This element wraps the GrueSensor class. Please see the documentation for - GrueSensor for details. - - \sa {QtMobility.sensors QML Limitations} -*/ - -/* - \qmlclass GrueSensorReading GrueSensorReading - \inherits QtMobility.sensors1::SensorReading - \inqmlmodule Grue 1 - \brief The GrueSensorReading element holds the most recent GrueSensor reading. - - The GrueSensorReading element holds the most recent GrueSensor reading. - - This element wraps the GrueSensorReading class. Please see the documentation for - GrueSensorReading for details. - - This element cannot be directly created. -*/ - -/* - \qmlproperty qreal Grue1::GrueSensorReading::chanceOfBeingEaten - Please see GrueSensorReading::chanceOfBeingEaten for information about this property. -*/ diff --git a/examples/sensors/grue/import/plugin.json b/examples/sensors/grue/import/plugin.json deleted file mode 100644 index 0967ef42..00000000 --- a/examples/sensors/grue/import/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/sensors/grue/import/qmldir b/examples/sensors/grue/import/qmldir deleted file mode 100644 index 266b7c11..00000000 --- a/examples/sensors/grue/import/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin declarative_grue diff --git a/examples/sensors/grue/lib/gruesensor.cpp b/examples/sensors/grue/lib/gruesensor.cpp deleted file mode 100644 index b1f00ede..00000000 --- a/examples/sensors/grue/lib/gruesensor.cpp +++ /dev/null @@ -1,137 +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$ -** -****************************************************************************/ - -#include "gruesensor.h" -#include "gruesensor_p.h" - -IMPLEMENT_READING(GrueSensorReading) - -/* - \class GrueSensorReading - - \brief The GrueSensorReading class holds readings from the Grue sensor. - - The Grue Sensor informs you of your chance of being eaten by a Grue. - - Grues love the dark so as long as your surroundings are relatively light - you are safe. However the more time you spend in the dark, the higher - your chances are of being eaten by a Grue. -*/ - -/* - \property GrueSensorReading::chanceOfBeingEaten - \brief holds your chance of being eaten. - - The value is the probability (from 0 to 100) that a Grue will eat you. - A probability of 100 means you are currently being eaten. The darker - it is, the more likely you are to be eaten by a Grue. The longer you - stay in a dark area, the more likely you are to be eaten by a Grue. - If you are in a lit room, the probability will be 0 as Grues fear light. -*/ - -int GrueSensorReading::chanceOfBeingEaten() const -{ - return d->chanceOfBeingEaten; -} - -void GrueSensorReading::setChanceOfBeingEaten(int chanceOfBeingEaten) -{ - d->chanceOfBeingEaten = chanceOfBeingEaten; -} - -// ===================================================================== - -// begin generated code - -/* - \class GrueFilter - - \brief The GrueFilter class is a convenience wrapper around QSensorFilter. - - The only difference is that the filter() method features a pointer to GrueSensorReading - instead of QSensorReading. -*/ - -/* - \fn GrueFilter::filter(GrueSensorReading *reading) - - Called when \a reading changes. Returns false to prevent the reading from propagating. - - \sa QSensorFilter::filter() -*/ - -char const * const GrueSensor::type("GrueSensor"); - -/* - \class GrueSensor - - \brief The GrueSensor class is a convenience wrapper around QSensor. - - The only behavioural difference is that this class sets the type properly. - - This class also features a reading() function that returns a GrueSensorReading instead of a QSensorReading. - - For details about how the sensor works, see \l GrueSensorReading. - - \sa GrueSensorReading -*/ - -/* - \fn GrueSensor::GrueSensor(QObject *parent) - - Construct the sensor as a child of \a parent. -*/ - -/* - \fn GrueSensor::~GrueSensor() - - Destroy the sensor. Stops the sensor if it has not already been stopped. -*/ - -/* - \fn GrueSensor::reading() const - - Returns the reading class for this sensor. - - \sa QSensor::reading() -*/ -// end generated code - -#include "moc_gruesensor.cpp" diff --git a/examples/sensors/grue/lib/gruesensor.h b/examples/sensors/grue/lib/gruesensor.h deleted file mode 100644 index 8088988d..00000000 --- a/examples/sensors/grue/lib/gruesensor.h +++ /dev/null @@ -1,85 +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$ -** -****************************************************************************/ - -#ifndef GRUESENSOR_H -#define GRUESENSOR_H - -#include <qsensor.h> - -class GrueSensorReadingPrivate; - -#if defined(QT_BUILD_GRUE_LIB) -# define Q_GRUE_EXPORT Q_DECL_EXPORT -#else -# define Q_GRUE_EXPORT Q_DECL_IMPORT -#endif - -class Q_GRUE_EXPORT GrueSensorReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(int chanceOfBeingEaten READ chanceOfBeingEaten WRITE setChanceOfBeingEaten) - DECLARE_READING(GrueSensorReading) -public: - int chanceOfBeingEaten() const; - void setChanceOfBeingEaten(int chanceOfBeingEaten); -}; - -// begin generated code - -class Q_GRUE_EXPORT GrueFilter : public QSensorFilter -{ -public: - virtual bool filter(GrueSensorReading *reading) = 0; -private: - bool filter(QSensorReading *reading) { return filter(static_cast<GrueSensorReading*>(reading)); } -}; - -class Q_GRUE_EXPORT GrueSensor : public QSensor -{ - Q_OBJECT -public: - explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::type, parent) {} - virtual ~GrueSensor() {} - GrueSensorReading *reading() const { return static_cast<GrueSensorReading*>(QSensor::reading()); } - static char const * const type; -}; -// end generated code - -#endif diff --git a/examples/sensors/grue/lib/gruesensor_p.h b/examples/sensors/grue/lib/gruesensor_p.h deleted file mode 100644 index 4996e868..00000000 --- a/examples/sensors/grue/lib/gruesensor_p.h +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -#ifndef GRUESENSOR_P_H -#define GRUESENSOR_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -class GrueSensorReadingPrivate -{ -public: - GrueSensorReadingPrivate() - : chanceOfBeingEaten(-1) - { - } - - int chanceOfBeingEaten; -}; - -#endif diff --git a/examples/sensors/grue/lib/lib.pro b/examples/sensors/grue/lib/lib.pro deleted file mode 100644 index e048e607..00000000 --- a/examples/sensors/grue/lib/lib.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = lib -TARGET = gruesensor - -# avoid going to release/debug subdirectory -win32:DESTDIR = $$OUT_PWD - -DEFINES *= QT_BUILD_GRUE_LIB -QT = core sensors - -HEADERS += gruesensor.h\ - gruesensor_p.h\ - -SOURCES += gruesensor.cpp\ - -target.path=$$[QT_INSTALL_LIBS] -INSTALLS += target - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - target.path = $$EXAMPLES_PREFIX/com.nokia.mt.grue/lib - remove_so.commands = "rm $(INSTALL_ROOT)$${target.path}/lib$${TARGET}.so" - remove_so.CONFIG = no_path - remove_so.depends = install_target - INSTALLS += remove_so -} - diff --git a/examples/sensors/grue/plugin/gruesensorimpl.cpp b/examples/sensors/grue/plugin/gruesensorimpl.cpp deleted file mode 100644 index e7152a67..00000000 --- a/examples/sensors/grue/plugin/gruesensorimpl.cpp +++ /dev/null @@ -1,140 +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$ -** -****************************************************************************/ - -#include "gruesensorimpl.h" -#include <QDebug> -#include <QTimer> - -char const * const gruesensorimpl::id("grue.gruesensor"); - -gruesensorimpl::gruesensorimpl(QSensor *sensor) - : QSensorBackend(sensor) - , lightLevel(QAmbientLightReading::Undefined) -{ - // We need a light sensor - lightSensor = new QAmbientLightSensor(this); - connect(lightSensor, SIGNAL(readingChanged()), this, SLOT(lightChanged())); - lightSensor->connectToBackend(); - - // We need a timer - darkTimer = new QTimer(this); - darkTimer->setInterval(1000); - connect(darkTimer, SIGNAL(timeout()), this, SLOT(increaseChance())); - - // We use this as our timestamp source - timer.start(); - -//! [setReading] - // Register our reading instance - setReading<GrueSensorReading>(&m_reading); -//! [setReading] - -//! [metadata] - // Supply metadata - // We can run as fast as the light sensor does - setDataRates(lightSensor); - // Only one output range, 0 to 1 in .1 increments - addOutputRange(0, 1, 0.1); - setDescription(QLatin1String("Grue Sensor")); -//! [metadata] -} - -void gruesensorimpl::start() -{ -//! [start] - lightSensor->setDataRate(sensor()->dataRate()); - lightSensor->start(); - // If the light sensor doesn't work we don't work either - if (!lightSensor->isActive()) - sensorStopped(); - if (lightSensor->isBusy()) - sensorBusy(); -//! [start] -} - -void gruesensorimpl::stop() -{ - lightSensor->stop(); -} - -void gruesensorimpl::lightChanged() -{ - if (lightLevel == lightSensor->reading()->lightLevel()) - return; - - lightLevel = lightSensor->reading()->lightLevel(); - - int chance = 0; - darkTimer->stop(); - - switch (lightSensor->reading()->lightLevel()) { - case QAmbientLightReading::Dark: - // It is dark. You are likely to be eaten by a grue. - chance = 10; - darkTimer->start(); - break; - default: - break; - } - - // Only send an update if the value has changed. - if (chance != m_reading.chanceOfBeingEaten() || m_reading.timestamp() == 0) { - m_reading.setTimestamp(timer.elapsed()); - m_reading.setChanceOfBeingEaten(chance); - newReadingAvailable(); - } -} - -void gruesensorimpl::increaseChance() -{ - // The longer you stay in the dark, the higher your chance of being eaten - int chance = m_reading.chanceOfBeingEaten() + 10; - - m_reading.setTimestamp(timer.elapsed()); - m_reading.setChanceOfBeingEaten(chance); - - newReadingAvailable(); - - // No point in using the timer anymore if we've hit 100... you can't get more - // likely to be eaten than 100% - if (chance >= 100) - darkTimer->stop(); -} - diff --git a/examples/sensors/grue/plugin/gruesensorimpl.h b/examples/sensors/grue/plugin/gruesensorimpl.h deleted file mode 100644 index ed89711d..00000000 --- a/examples/sensors/grue/plugin/gruesensorimpl.h +++ /dev/null @@ -1,77 +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$ -** -****************************************************************************/ - -#ifndef GRUESENSORIMPL_H -#define GRUESENSORIMPL_H - -#include <qsensorbackend.h> -#include "gruesensor.h" -#include <qambientlightsensor.h> -#include <QTime> - -QT_BEGIN_NAMESPACE -class QTimer; -QT_END_NAMESPACE - -class gruesensorimpl : public QSensorBackend -{ - Q_OBJECT -public: - static char const * const id; - - gruesensorimpl(QSensor *sensor); - - void start(); - void stop(); - -private Q_SLOTS: - void lightChanged(); - void increaseChance(); - -private: - GrueSensorReading m_reading; - QAmbientLightSensor *lightSensor; - QTimer *darkTimer; - QTime timer; - QAmbientLightReading::LightLevel lightLevel; -}; - -#endif - diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp deleted file mode 100644 index 36aec298..00000000 --- a/examples/sensors/grue/plugin/main.cpp +++ /dev/null @@ -1,81 +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$ -** -****************************************************************************/ - -#include "gruesensorimpl.h" -#include <qsensorplugin.h> -#include <qsensorbackend.h> -#include <qsensormanager.h> -#include <QFile> -#include <QDebug> - -class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "com.nokia.Qt.QSensorPluginInterface/1.0" FILE "plugin.json") - Q_INTERFACES(QSensorPluginInterface QSensorChangesInterface) -public: - void registerSensors() - { - qDebug() << "loaded the grue plugin"; - } - - void sensorsChanged() - { - if (!QSensor::defaultSensorForType(QAmbientLightSensor::type).isEmpty()) { - // There is a light sensor available. Register the backend - if (!QSensorManager::isBackendRegistered(GrueSensor::type, gruesensorimpl::id)) - QSensorManager::registerBackend(GrueSensor::type, gruesensorimpl::id, this); - } else { - if (QSensorManager::isBackendRegistered(GrueSensor::type, gruesensorimpl::id)) - QSensorManager::unregisterBackend(GrueSensor::type, gruesensorimpl::id); - } - } - - QSensorBackend *createBackend(QSensor *sensor) - { - if (sensor->identifier() == gruesensorimpl::id) - return new gruesensorimpl(sensor); - - return 0; - } -}; - -#include "main.moc" - diff --git a/examples/sensors/grue/plugin/plugin.json b/examples/sensors/grue/plugin/plugin.json deleted file mode 100644 index 8a55b3ae..00000000 --- a/examples/sensors/grue/plugin/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "notused" ] } diff --git a/examples/sensors/grue/plugin/plugin.pro b/examples/sensors/grue/plugin/plugin.pro deleted file mode 100644 index 32e127f1..00000000 --- a/examples/sensors/grue/plugin/plugin.pro +++ /dev/null @@ -1,27 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -TARGET = $$qtLibraryTarget(qtsensors_grue) -PLUGIN_TYPE = sensors - -QT = core sensors - -INCLUDEPATH += $$PWD/../lib -LIBS += -L$$OUT_PWD/../lib -lgruesensor - -HEADERS += gruesensorimpl.h\ - -SOURCES += gruesensorimpl.cpp\ - main.cpp\ - -target.path=$$[QT_INSTALL_PLUGINS]/sensors -INSTALLS += target - -OTHER_FILES += \ - plugin.json - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - target.path = $$EXAMPLES_PREFIX/com.nokia.mt.grue/plugins/sensors -} - diff --git a/examples/sensors/grue/qml_app/grue.png b/examples/sensors/grue/qml_app/grue.png Binary files differdeleted file mode 100644 index f0b070b4..00000000 --- a/examples/sensors/grue/qml_app/grue.png +++ /dev/null diff --git a/examples/sensors/grue/qml_app/grue.xcf b/examples/sensors/grue/qml_app/grue.xcf Binary files differdeleted file mode 100644 index 2837ed7e..00000000 --- a/examples/sensors/grue/qml_app/grue.xcf +++ /dev/null diff --git a/examples/sensors/grue/qml_app/icon.png b/examples/sensors/grue/qml_app/icon.png Binary files differdeleted file mode 100644 index f3f038c7..00000000 --- a/examples/sensors/grue/qml_app/icon.png +++ /dev/null diff --git a/examples/sensors/grue/qml_app/icon.xcf b/examples/sensors/grue/qml_app/icon.xcf Binary files differdeleted file mode 100644 index 8416c49f..00000000 --- a/examples/sensors/grue/qml_app/icon.xcf +++ /dev/null diff --git a/examples/sensors/grue/qml_app/info.json b/examples/sensors/grue/qml_app/info.json deleted file mode 100644 index 2e14fc79..00000000 --- a/examples/sensors/grue/qml_app/info.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "DisplayName": "Grue Sensor", - "Identifier": "com.nokia.mt.grue", - "Runtime": "qml", - "MainQML": "main.qml", - "Version": "1.0.0", - "Category": "application", - "Summary": "The Grue sensor identifies your chance of being eaten by a Grue." - } -} diff --git a/examples/sensors/grue/qml_app/main.qml b/examples/sensors/grue/qml_app/main.qml deleted file mode 100644 index 05d267c7..00000000 --- a/examples/sensors/grue/qml_app/main.qml +++ /dev/null @@ -1,95 +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 QtQuick 2.0 -import QtMobility.sensors 1.3 -import Grue 1.0 - -Rectangle { - width: 240 - height: 320 - color: "black" - - GrueSensor { - id: sensor - active: true - onReadingChanged: { - var percent = reading.chanceOfBeingEaten; - var thetext = ""; - var theopacity = 0; - if (percent === 0) { - thetext = "It is light. You are safe from Grues."; - } - else if (percent === 100) { - thetext = "You have been eaten by a Grue!"; - sensor.active = false; - theopacity = 1; - } - else if (percent > 0) { - thetext = "It is dark. You are likely to be eaten by a Grue. " - + "Your chance of being eaten by a Grue: "+percent+" percent."; - theopacity = 0.05 + (percent * 0.001); - } - text.font.pixelSize = 30; - text.text = "<p>" + thetext + "</p>"; - grueimg.opacity = theopacity; - } - } - - Text { - id: text - anchors.top: parent.top - anchors.topMargin: 20 - anchors.left: parent.left - anchors.right: parent.right - text: "I can't tell if you're going to be eaten by a Grue or not. You're on your own!" - wrapMode: Text.WordWrap - font.pixelSize: 50 - color: "white" - } - - Image { - id: grueimg - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - source: "grue.png" - opacity: 0 - } -} diff --git a/examples/sensors/grue/qml_app/qml_app.pro b/examples/sensors/grue/qml_app/qml_app.pro deleted file mode 100644 index c017dcc4..00000000 --- a/examples/sensors/grue/qml_app/qml_app.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = aux - -app.files = \ - icon.png \ - info.json \ - main.qml \ - grue.png - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.grue - INSTALLS = app -} - diff --git a/examples/sensors/maze/Congratulation.qml b/examples/sensors/maze/Congratulation.qml deleted file mode 100644 index b08ef1ae..00000000 --- a/examples/sensors/maze/Congratulation.qml +++ /dev/null @@ -1,61 +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 - -//Import the javascript functions for this game -import "lib.js" as Lib - -//Implementation of the Congratulation control -Item { - x: Lib.cellDimension - y: Lib.cellDimension - width: Lib.cellDimension * (Lib.dimension - 2) - height: Lib.cellDimension * (Lib.dimension - 2) - - //Containing a animated gif image - AnimatedImage { - id: img - anchors.fill: parent - visible: true - source: "images/congratulations.gif" - } -} diff --git a/examples/sensors/maze/LabyrinthSquare.qml b/examples/sensors/maze/LabyrinthSquare.qml deleted file mode 100644 index 27ca84da..00000000 --- a/examples/sensors/maze/LabyrinthSquare.qml +++ /dev/null @@ -1,80 +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 - -//Import the javascript functions for this game -import "lib.js" as Lib - -//Implementation of the Labyrinth square control. -Rectangle { - id: sq - x: 0 - y: 0 - width: Lib.cellDimension - height: Lib.cellDimension - color: "white" - property int val: 0 - property AnimatedImage picture: img - - //Dependend of its position and the labyrinth value a square can be the start, cheese, empty or a wall - AnimatedImage { - id: img - anchors.fill: parent - source: "" - } - - function updateImage() - { - if (sq.val == -1) - sq.picture.source = "images/start.png"; - else if (sq.val == 3) - sq.picture.source = "images/cheese.png"; - else if (sq.val == 4){ - sq.picture.source = "images/cheeseeating.gif"; - sq.picture.playing = true; - } - else if (sq.val == 1) - sq.picture.source = "images/01.png"; - else - sq.picture.source = "images/00.png"; - } -} diff --git a/examples/sensors/maze/Maze.qml b/examples/sensors/maze/Maze.qml deleted file mode 100644 index f52c00f2..00000000 --- a/examples/sensors/maze/Maze.qml +++ /dev/null @@ -1,294 +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$ -** -****************************************************************************/ - -/* Layout - mainWnd - / -------------------------------/ gameRect -| / -|-----------------------------/ -||---------------------------| -||||M| || -||| \ || -||| mouseCtrl || -||| || -||| || -||| Labyrinth || -||| || -||| || -||| cheeseSquare || -||| \ || -||| |C||| -||---------------------------| -|----------------------------- -| -|----------------------------- -|| || | -|----------------------------- -| \ \ -| \ timePlayingLabel -| newGameButton ------------------------------- - -*/ -//Import the declarative plugins -import QtQuick 2.0 -import "components" - -//! [0] -import QtSensors 5.0 -//! [0] - -//Import the javascript functions for this game -import "lib.js" as Lib - -ApplicationWindow { - id: mainWnd - - property Mouse mouseCtrl; - property LabyrinthSquare cheeseSquare; - property Congratulation congratulation; - - Rectangle { - id: gameRect - x: (mainWnd.width - width) / 2 - y: 25 - width: Lib.dimension * Lib.cellDimension - height: Lib.dimension * Lib.cellDimension - color: "transparent" - border.width: 2 - - //timer for starting the labyrinth game - Timer { - id: startTimer - interval: 50; running: true; repeat: false - onTriggered: { - - //reset game time - timePlayingLabel.text = "--"; - Lib.sec = 0.0; - Lib.createLabyrinth(); - - //create labyrinth elements (only at the first time) - var needloadcomponent = false; - if (Lib.objectArray === null){ - needloadcomponent = true; - Lib.objectArray = new Array(Lib.dimension * Lib.dimension); - } - var idx = 0; - for (var y = 0; y < Lib.dimension; y++ ){ - for (var x = 0; x < Lib.dimension; x++ ){ - var component = null; - - //create labyrinth components (only at the first time) - if (needloadcomponent){ - component = Qt.createComponent("LabyrinthSquare.qml"); - if (component.status == Component.Ready) { - var square = component.createObject(parent); - square.x = x * square.width; - square.y = y * square.height; - square.val = Lib.labyrinth[x][y]; - square.updateImage(); - Lib.objectArray[idx] = square; - if (x == (Lib.dimension - 1) && y == (Lib.dimension - 1)){ - cheeseSquare = square; - var component1 = Qt.createComponent("Congratulation.qml"); - if (component1.status == Component.Ready) { - congratulation = component1.createObject(parent); - congratulation.visible = false; - } - } - } - } - else{ - Lib.objectArray[idx].val = Lib.labyrinth[x][y]; - Lib.objectArray[idx].updateImage(); - if (x == (Lib.dimension - 1) && y == (Lib.dimension - 1)){ - cheeseSquare = Lib.objectArray[idx]; - congratulation.visible = false; - } - } - idx++; - } - } - - //Lib.printLab(); //this is for debug. Labyrinth will be printed out in the console - - //Create the mouse control (only at the first time) - if (mouseCtrl === null){ - var component = Qt.createComponent("Mouse.qml"); - if (component.status == Component.Ready) { - mouseCtrl = component.createObject(parent); - } - } - mouseCtrl.x = 0; - mouseCtrl.y = 0; - newGameButton.enabled = true; - - //Start the Tilt reader timer - tiltTimer.running = true; - tiltSensor.calibrate(); - } - } - } - -//! [1] - TiltSensor{ - id: tiltSensor - unit: TiltSensor.Degrees - enabled: true - accuracy: 5.0 - } -//! [1] - - //Timer to read out the x and y rotation of the TiltSensor - Timer { - id: tiltTimer - interval: 50; running: false; repeat: true - -//! [2] - onTriggered: { - if (!tiltSensor.enabled) - tiltSensor.enabled = true; -//! [2] - - if (mouseCtrl === null) - return; - - //check if already solved - if (Lib.won !== true){ - Lib.sec += 0.05; - timePlayingLabel.text = Math.floor(Lib.sec) + " seconds"; - - //check if we can move the mouse - var xval = -1; - var yval = -1; - -//! [3] - var xstep = 0; - if (tiltSensor.yRotation > 0) - xstep = 1; - else if (tiltSensor.yRotation < 0) - xstep = -1; - var ystep = 0; - if (tiltSensor.xRotation > 0) - ystep = 1; - else if (tiltSensor.xRotation < 0) - ystep = -1; -//! [3] - - if (xstep < 0){ - if (mouseCtrl.x > 0){ - if (Lib.canMove(mouseCtrl.x + xstep, mouseCtrl.y)){ - xval = mouseCtrl.x + xstep; - } - } - } - else if (xstep > 0){ - if (mouseCtrl.x < (Lib.cellDimension * (Lib.dimension - 1))){ - if (Lib.canMove(mouseCtrl.x + xstep, mouseCtrl.y)){ - xval = mouseCtrl.x + xstep; - } - } - } - if (ystep < 0){ - if (mouseCtrl.y > 0){ - if (Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)){ - yval = mouseCtrl.y + ystep; - } - } - } - else if (ystep > 0){ - if (mouseCtrl.y < (Lib.cellDimension * (Lib.dimension - 1))){ - if (Lib.canMove(mouseCtrl.x, mouseCtrl.y + ystep)){ - yval = mouseCtrl.y + ystep; - } - } - } - if (xval >= 0 && yval >= 0) - mouseCtrl.move(xval, yval); - - //move the mouse in the allwed position - else{ - if (xval >= 0){ - mouseCtrl.move(xval, mouseCtrl.y); - } - if (yval >= 0){ - mouseCtrl.move(mouseCtrl.x, yval); - } - } - } - else{ - - //game won, stop the tilt meter - mainWnd.cheeseSquare.val = 4; - mainWnd.cheeseSquare.updateImage(); - mainWnd.congratulation.visible = true; - newGameButton.enabled = true; - tiltTimer.running = false; - } - } - } - - //Button to start a new Game - Button{ - id: newGameButton - anchors.left: gameRect.left - anchors.top: gameRect.bottom - anchors.topMargin: 5 - height: 30 - width: 100 - text: "new game" - enabled: false; - onClicked: { - newGameButton.enabled = false; - startTimer.start(); - } - } - - //Label to print out the game time - Text{ - id: timePlayingLabel - anchors.right: gameRect.right - anchors.top: gameRect.bottom - anchors.topMargin: 5 - } -} - diff --git a/examples/sensors/maze/Mouse.qml b/examples/sensors/maze/Mouse.qml deleted file mode 100644 index 9786d96d..00000000 --- a/examples/sensors/maze/Mouse.qml +++ /dev/null @@ -1,116 +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 - -//Import the javascript functions for this game -import "lib.js" as Lib - -//Implementation of the Mouse control. -Item { - id: mouse - x: 0 - y: 0 - width: Lib.cellDimension - height: Lib.cellDimension - state: 'right' - - AnimatedImage { - id: img - anchors.fill: parent - visible: true - } - - //for different moves we have different gif animations - states: [ - State { - name: "up" - PropertyChanges { target: img; source: "images/mouse_up.gif" } - }, - State { - name: "down" - PropertyChanges { target: img; source: "images/mouse_down.gif" } - }, - State { - name: "left" - PropertyChanges { target: img; source: "images/mouse_left.gif" } - }, - State { - name: "right" - PropertyChanges { target: img; source: "images/mouse_right.gif" } - }, - - State { - name: "rightup" - PropertyChanges { target: img; source: "images/mouse_rightup.gif" } - }, - State { - name: "rightdown" - PropertyChanges { target: img; source: "images/mouse_rightdown.gif" } - }, - State { - name: "leftup" - PropertyChanges { target: img; source: "images/mouse_leftup.gif" } - }, - State { - name: "leftdown" - PropertyChanges { target: img; source: "images/mouse_leftdown.gif" } - } - - ] - - //Function for moving the mouse - function move(newx, newy) - { - var newstatus = ""; - if (mouse.x < newx) - newstatus += "right"; - else if (mouse.x > newx) - newstatus += "left"; - if (mouse.y < newy) - newstatus += "down"; - else if (mouse.y > newy) - newstatus += "up"; - mouse.state = newstatus; - mouse.x = newx; - mouse.y = newy; - } -} diff --git a/examples/sensors/maze/components/ApplicationWindow.qml b/examples/sensors/maze/components/ApplicationWindow.qml deleted file mode 100644 index cab5e94c..00000000 --- a/examples/sensors/maze/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/maze/components/Button.qml b/examples/sensors/maze/components/Button.qml deleted file mode 100644 index 537a8bce..00000000 --- a/examples/sensors/maze/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/maze/components/images/button_background_disabled.png b/examples/sensors/maze/components/images/button_background_disabled.png Binary files differdeleted file mode 100644 index 62a00b9a..00000000 --- a/examples/sensors/maze/components/images/button_background_disabled.png +++ /dev/null diff --git a/examples/sensors/maze/components/images/button_background_normal.png b/examples/sensors/maze/components/images/button_background_normal.png Binary files differdeleted file mode 100644 index 1fecad5b..00000000 --- a/examples/sensors/maze/components/images/button_background_normal.png +++ /dev/null diff --git a/examples/sensors/maze/components/images/button_background_pressed.png b/examples/sensors/maze/components/images/button_background_pressed.png Binary files differdeleted file mode 100644 index 149529e1..00000000 --- a/examples/sensors/maze/components/images/button_background_pressed.png +++ /dev/null diff --git a/examples/sensors/maze/icon.png b/examples/sensors/maze/icon.png Binary files differdeleted file mode 100644 index 1e7ff8d8..00000000 --- a/examples/sensors/maze/icon.png +++ /dev/null diff --git a/examples/sensors/maze/images/00.png b/examples/sensors/maze/images/00.png Binary files differdeleted file mode 100644 index ab29a622..00000000 --- a/examples/sensors/maze/images/00.png +++ /dev/null diff --git a/examples/sensors/maze/images/01.png b/examples/sensors/maze/images/01.png Binary files differdeleted file mode 100644 index 0e70d1b2..00000000 --- a/examples/sensors/maze/images/01.png +++ /dev/null diff --git a/examples/sensors/maze/images/cheese.png b/examples/sensors/maze/images/cheese.png Binary files differdeleted file mode 100644 index ecef4503..00000000 --- a/examples/sensors/maze/images/cheese.png +++ /dev/null diff --git a/examples/sensors/maze/images/cheeseeating.gif b/examples/sensors/maze/images/cheeseeating.gif Binary files differdeleted file mode 100644 index 6b2cb47f..00000000 --- a/examples/sensors/maze/images/cheeseeating.gif +++ /dev/null diff --git a/examples/sensors/maze/images/congratulations.gif b/examples/sensors/maze/images/congratulations.gif Binary files differdeleted file mode 100644 index 70204176..00000000 --- a/examples/sensors/maze/images/congratulations.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_down.gif b/examples/sensors/maze/images/mouse_down.gif Binary files differdeleted file mode 100644 index 5491c18f..00000000 --- a/examples/sensors/maze/images/mouse_down.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_left.gif b/examples/sensors/maze/images/mouse_left.gif Binary files differdeleted file mode 100644 index 265d2bab..00000000 --- a/examples/sensors/maze/images/mouse_left.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_leftdown.gif b/examples/sensors/maze/images/mouse_leftdown.gif Binary files differdeleted file mode 100644 index bdcd708f..00000000 --- a/examples/sensors/maze/images/mouse_leftdown.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_leftup.gif b/examples/sensors/maze/images/mouse_leftup.gif Binary files differdeleted file mode 100644 index a8b1e8f6..00000000 --- a/examples/sensors/maze/images/mouse_leftup.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_right.gif b/examples/sensors/maze/images/mouse_right.gif Binary files differdeleted file mode 100644 index a95d02cc..00000000 --- a/examples/sensors/maze/images/mouse_right.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_rightdown.gif b/examples/sensors/maze/images/mouse_rightdown.gif Binary files differdeleted file mode 100644 index 00bc3e18..00000000 --- a/examples/sensors/maze/images/mouse_rightdown.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_rightup.gif b/examples/sensors/maze/images/mouse_rightup.gif Binary files differdeleted file mode 100644 index e0153eb4..00000000 --- a/examples/sensors/maze/images/mouse_rightup.gif +++ /dev/null diff --git a/examples/sensors/maze/images/mouse_up.gif b/examples/sensors/maze/images/mouse_up.gif Binary files differdeleted file mode 100644 index 19220ebe..00000000 --- a/examples/sensors/maze/images/mouse_up.gif +++ /dev/null diff --git a/examples/sensors/maze/images/start.png b/examples/sensors/maze/images/start.png Binary files differdeleted file mode 100644 index 698c0b1c..00000000 --- a/examples/sensors/maze/images/start.png +++ /dev/null diff --git a/examples/sensors/maze/info.json b/examples/sensors/maze/info.json deleted file mode 100644 index 3aa2369c..00000000 --- a/examples/sensors/maze/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "Maze", - "Subcategory": "utility", - "MainQML": "Maze.qml", - "Version": "1.0.0", - "Identifier": "com.nokia.mt.maze", - "Summary": "Labyrinth game using TiltSensor", - "Author": "Qt" - } -} diff --git a/examples/sensors/maze/lib.js b/examples/sensors/maze/lib.js deleted file mode 100644 index fccce18f..00000000 --- a/examples/sensors/maze/lib.js +++ /dev/null @@ -1,264 +0,0 @@ -//global variables -var labyrinth = null; -var dimension = 24; -var cellDimension = 13; -var won; -var objectArray = null; -var sec = 0.0 - -//Allocate labyrinth arrays and create labyrinth and way reflected in the labyrinth array -function createLabyrinth() -{ - won = false; - //create the labyrinth matrix - labyrinth = null; - labyrinth = new Array(dimension); - for (var x = 0; x < dimension; x++ ){ - labyrinth[x] = new Array(dimension); - for (var y = 0; y < dimension; y++ ){ - labyrinth[x][y] = 0; - } - } - createWay(); - createLab(); -} - -//Create a way where the mouse can reach the cheese -function createWay() -{ - //Create rnd way to have at least one solution - //A way square is marked as a 2 in the labyrinth array - var x = 0; - var y = 0; - var ox = x; - var oy = y; - labyrinth[0][0] = 2; - while (x < dimension && y < dimension){ - var rnd = Math.floor(Math.random()*5); - if (Math.floor(Math.random()*2) == 1){ - if (rnd == 0) x--; - if (rnd >= 1) x++; - if (x < 0) x++; - if (x >= dimension){ - x = ox; - break; - } - } - else { - if (rnd == 0) y--; - if (rnd >= 1) y++; - if (y < 0) y++; - if (y >= dimension){ - y = oy; - break; - } - } - - /*avoid to have [2]2| - |2|2|*/ - if (x < (dimension - 1) && y < (dimension - 1)){ - if (labyrinth[x + 1][y] == 2 - && labyrinth[x][y + 1] == 2 - && labyrinth[x + 1][y + 1] == 2){ - y = oy; - x = ox; - continue; - } - } - /*avoid to have |2[2] - |2|2|*/ - if (x > 0 && y < (dimension - 1)){ - if (labyrinth[x - 1][y] == 2 - && labyrinth[x][y + 1] == 2 - && labyrinth[x - 1][y + 1] == 2){ - y = oy; - x = ox; - continue; - } - } - /*avoid to have |2|2| - [2]2|*/ - if (x < (dimension - 1) && y > 0){ - if (labyrinth[x + 1][y] == 2 - && labyrinth[x][y - 1] == 2 - && labyrinth[x + 1][y - 1] == 2){ - y = oy; - x = ox; - continue; - } - } - /*avoid to have |2|2| - |2[2]*/ - if (x > 0 && y > 0){ - if (labyrinth[x - 1][y] == 2 - && labyrinth[x][y - 1] == 2 - && labyrinth[x - 1][y - 1] == 2){ - y = oy; - x = ox; - continue; - } - } - - labyrinth[x][y] = 2; - ox = x; - oy = y; - } - //finish way - while (x < (dimension - 1)){ - labyrinth[x][y] = 2; - x++; - } - while (y < (dimension - 1)){ - labyrinth[x][y] = 2; - y++; - } -} - -//Create the labyrinth with rnd values -function createLab() -{ - //A wall square is marked as a 1 in the labyrinth array - //Not a wall square is marked as a 0 in the labyrinth array - //The Cheese square is marked as a 3 in the labyrinth array - //The start is marked as a -1 in the labyrinth array - for (var x = 0; x < dimension; x++ ){ - var rnd = 0; - for (var y = 0; y < dimension; y++){ - //But don't overwrite the way - if (labyrinth[x][y] != 2){ - var rnd = Math.floor(Math.random()*2); - var xy = 0; - var xxy = 0; - var xyy = 0; - var xxyy = 0; - - if (x > 0 && y > 0){ - xy = labyrinth[x - 1][y - 1]; - if (xy == 2) - xy = 0; - - xyy = labyrinth[x - 1][y]; - if (xyy == 2) - xyy = 0; - - xxy = labyrinth[x][y - 1]; - if (xxy == 2) - xxy = 0; - - xxyy = rnd; - if (xxyy == 2) - xxyy = 0; - - //avoid to have to many |0|1| or |1|0| [xy ][xxy ] - // |1[0] |0[1] [xyy ][xxyy] - if (xyy == xxy && xy == xxyy && xy != xxy){ - if (rnd == 1) - rnd = 0; - else rnd = 1; - } - - //avoid to have to many |1|1| or |0|0| - // |1[1] |0[0] - if (xy == xxy && xxy == xxyy && xxyy == xyy){ - if (rnd == 1) - rnd = 0; - else rnd = 1; - } - } - else if (x == 0 && y > 0){ - xy = labyrinth[x][y - 1]; - if (xy == 2) - xy = 0; - - xyy = rnd; - if (xyy == 2) - xyy = 0; - - xxy = labyrinth[x + 1][y - 1]; - if (xxy == 2) - xxy = 0; - - xxyy = labyrinth[x + 1][y]; - if (xxyy == 2) - xxyy = 0; - - //avoid to have to many |1|1| or |0|0| - // |1[1] |0[0] - if (xy == xxy && xxy == xxyy && xxyy == xyy){ - if (rnd == 1) - rnd = 0; - else rnd = 1; - } - - //avoid to have to many |0|1| or |1|0| [xy ][xxy ] - // |1[0] |0[1] [xyy ][xxyy] - if (xyy == xxy && xy == xxyy && xy != xxy){ - if (rnd == 1) - rnd = 0; - else rnd = 1; - } - } - labyrinth[x][y] = rnd; - } - - } - } - //set start and end - labyrinth[0][0] = -1; - labyrinth[0][1] = 0; - labyrinth[1][0] = 0; - labyrinth[1][1] = 0; - - labyrinth[dimension - 2][dimension - 2] = 0; - labyrinth[dimension - 2][dimension - 1] = 0; - labyrinth[dimension - 1][dimension - 2] = 0; - labyrinth[dimension - 1][dimension - 1] = 3; -} - -//Function that checks if the mouse can be moved in x and y -function canMove(x, y) -{ - //Check if movement is allowed - var xcenter = x + (cellDimension / 2); - var ycenter = y + (cellDimension / 2); - //try to get the index - var idx = Math.floor(xcenter / cellDimension); - var idy = Math.floor(ycenter / cellDimension); - var dx = xcenter - (idx * cellDimension + ( cellDimension / 2 )); - var dy = ycenter - (idy * cellDimension + ( cellDimension / 2 )); - - if (dx > 0){ - if (labyrinth[idx + 1][idy] == 1) - return false; - } - if (dx < 0){ - if (labyrinth[idx - 1][idy] == 1) - return false; - } - if (dy > 0){ - if (labyrinth[idx][idy + 1] == 1) - return false; - } - if (dy < 0){ - if (labyrinth[idx][idy - 1] == 1) - return false; - } - //check if won - if (idx == (dimension - 1) && idy == (dimension - 1)) - won = true; - return true; -} - -//Function that prints out the labyrith array values in the console -function printLab() -{ - //for debug purposes print out lab n console - var iy = 0; - for (var y = 0; y < dimension; y++ ){ - var line = ""; - for (var x = 0; x < dimension; x++ ){ - line += labyrinth[x][y]; - } - console.log(line); - } -} diff --git a/examples/sensors/maze/maze.pro b/examples/sensors/maze/maze.pro deleted file mode 100644 index cb3b9aaa..00000000 --- a/examples/sensors/maze/maze.pro +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = aux - -app.files = \ - Congratulation.qml \ - Maze.qml \ - components \ - images \ - lib.js \ - LabyrinthSquare.qml \ - Mouse.qml \ - icon.png \ - info.json - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.maze - INSTALLS = app -} - diff --git a/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml b/examples/sensors/qmlqtsensors/components/ApplicationWindow.qml deleted file mode 100644 index cab5e94c..00000000 --- a/examples/sensors/qmlqtsensors/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/qmlqtsensors/components/Button.qml b/examples/sensors/qmlqtsensors/components/Button.qml deleted file mode 100644 index 537a8bce..00000000 --- a/examples/sensors/qmlqtsensors/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/qmlqtsensors/components/images/button_background_disabled.png b/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png Binary files differdeleted file mode 100644 index 62a00b9a..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_disabled.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png b/examples/sensors/qmlqtsensors/components/images/button_background_normal.png Binary files differdeleted file mode 100644 index 1fecad5b..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_normal.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png b/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png Binary files differdeleted file mode 100644 index 149529e1..00000000 --- a/examples/sensors/qmlqtsensors/components/images/button_background_pressed.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/icon.png b/examples/sensors/qmlqtsensors/icon.png Binary files differdeleted file mode 100644 index d3243c5b..00000000 --- a/examples/sensors/qmlqtsensors/icon.png +++ /dev/null diff --git a/examples/sensors/qmlqtsensors/info.json b/examples/sensors/qmlqtsensors/info.json deleted file mode 100644 index d76c3002..00000000 --- a/examples/sensors/qmlqtsensors/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "QML QtSensors", - "Subcategory": "utility", - "MainQML": "main.qml", - "Version": "1.0.0", - "Identifier": "com.nokia.mt.qmlqtsensors", - "Summary": "QML Qt Sensors demo", - "Author": "Qt" - } -} diff --git a/examples/sensors/qmlqtsensors/main.qml b/examples/sensors/qmlqtsensors/main.qml deleted file mode 100644 index 44be63aa..00000000 --- a/examples/sensors/qmlqtsensors/main.qml +++ /dev/null @@ -1,493 +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$ -** -****************************************************************************/ - -/* Layout - mainWnd - / ---------------------------------------------------------------------------------- -|-------------------------------------------------------------------------------- -|| labelTitle | -|-------------------------------------------------------------------------------- -|-------------------------------------------------------------------------------- <---- tiltLine -|-------------------------------------------------------------------------------- -|| labelTilt | -|-------------------------------------------------------------------------------- -| / accuracyRect / speedRect -|-------------------------------------------||----------------------------------| -|| Accuracy <----- textAccuracy || Speed <-----textSpeed | -|| value <- textAccuracyValue || value <- textSpeedValue | -|| ----------------- ------------------ || --------------- ---------------- | -|| | accuracyLower | | accuracyHigher | || | speedLower | | speedHigher | | -|| ----------------- ------------------ || --------------- ---------------- | -|------------------------------------------ ||----------------------------------| -| ----------- -| |Calibrate| <------------------ calibrate -| ----------- -| --------- -| |Degree | <-------------------- useRadian X Rotation: 0 <------------------ xrottext -| --------- -| --------- -| |Start | <-------------------- tiltStart Y Rotation: 0 <------------------ yrottext -| --------- -|-------------------------------------------------------------------------------- <---- ambientlightLine -|-------------------------------------------------------------------------------- -|| labelAmbientLight | -|-------------------------------------------------------------------------------- -| --------- -| |Start | <-------------------- ablStart Ambient light: - <--------------- abltext -| --------- -|-------------------------------------------------------------------------------- <---- proximityLine -|-------------------------------------------------------------------------------- -|| labelProximityLight | -|-------------------------------------------------------------------------------- -| --------- -| |Start | <-------------------- proxiStart Proximity: - <--------------- proxitext -| --------- ------------------------------------------------------------------------------- -*/ - -//Import the declarative plugins -import QtQuick 2.0 -import "components" - -//! [0] -import QtSensors 5.0 -//! [0] - -ApplicationWindow { - id: appWnd - - Rectangle { - id: mainWnd - x: 0 - y: 0 - width: 320 - height: 480 - color: "transparent" - - property int accuracy: 1 - property string speed: "Slow" - - Text { - id: labelTitle - anchors.top: mainWnd.top - anchors.topMargin: 25 - anchors.left: mainWnd.left - anchors.right: mainWnd.right - - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 30 - font.bold: true - text: "QML QtSensors" - } - - //Tile region - - Rectangle { - id: tiltLine - anchors.top: labelTitle.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - anchors.right: mainWnd.right - anchors.rightMargin: 5 - border.width: 1 - height: 1 - border.color: "#888888" - } - - Text { - id: labelTilt - anchors.top: tiltLine.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.right: mainWnd.right - - horizontalAlignment: Text.AlignHCenter - font.bold: true - text: "TiltSensor" - } - -//! [1] - TiltSensor { - id: tilt - unit: TiltSensor.Degrees - enabled: false - accuracy: 1.0 - speed: TiltSensor.Slow - } -//! [1] - - Rectangle{ - id: accuracyRect - anchors.top: labelTilt.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - anchors.right: mainWnd.right - anchors.rightMargin: mainWnd.width / 2 - height: 110 - color: "transparent" - - Text{ - id: textAccuracy - anchors.top: accuracyRect.top - anchors.left: accuracyRect.left - text: "Accuracy" - font.bold: true - } - - Text{ - id: textAccuracyValue - anchors.top: textAccuracy.bottom - anchors.topMargin: 5 - anchors.left: accuracyHigher.left - anchors.right: accuracyHigher.right - text: mainWnd.accuracy - verticalAlignment: Text.AlignVCenter - } - - Button{ - id: accuracyLower - anchors.top: textAccuracyValue.bottom - anchors.left: accuracyRect.left - height: 30 - width: 40 - text: "-" - - onClicked:{ - if (mainWnd.accuracy > 1){ - mainWnd.accuracy--; - tilt.accuracy = mainWnd.accuracy; - } - } - } - - Button{ - id: accuracyHigher - anchors.top: textAccuracyValue.bottom - anchors.left: accuracyLower.right - height: 30 - width: 40 - text: "+" - - onClicked:{ - if (mainWnd.accuracy < 10){ - mainWnd.accuracy++; - tilt.accuracy = mainWnd.accuracy; - } - } - } - } - - Rectangle{ - id: speedRect - anchors.top: labelTilt.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: mainWnd.width / 2 - anchors.right: mainWnd.right - anchors.rightMargin: 5 - height: 110 - color: "transparent" - - Text{ - id: textSpeed - anchors.top: speedRect.top - anchors.left: speedRect.left - text: "Speed" - font.bold: true - } - - Text{ - id: textSpeedValue - anchors.top: textSpeed.bottom - anchors.topMargin: 5 - anchors.left: speedLower.left - anchors.right: speedHigher.right - text: mainWnd.speed - verticalAlignment: Text.AlignVCenter - } - - Button{ - id: speedLower - anchors.top: textSpeedValue.bottom - anchors.left: speedRect.left - height: 30 - width: 40 - text: "-" - - onClicked:{ - if (tilt.speed === TiltSensor.Fast) { - mainWnd.speed = "Medium"; - tilt.speed = TiltSensor.Medium; - } - else if (tilt.speed === TiltSensor.Medium) { - mainWnd.speed = "Slow"; - tilt.speed = TiltSensor.Slow; - } - } - } - - Button{ - id: speedHigher - anchors.top: textSpeedValue.bottom - anchors.left: speedLower.right - height: 30 - width: 40 - text: "+" - - onClicked:{ - if (tilt.speed === TiltSensor.Slow) { - mainWnd.speed = "Medium"; - tilt.speed = TiltSensor.Medium; - } - else if (tilt.speed === TiltSensor.Medium) { - mainWnd.speed = "Fast"; - tilt.speed = TiltSensor.Fast; - } - } - } - } - - Button{ - id: calibrate - anchors.left: mainWnd.left - anchors.leftMargin: 5 - anchors.top: accuracyRect.bottom - height: 30 - width: 80 - text: "Calibrate" - - onClicked:{ - tilt.calibrate(); - } - } - - Button{ - id: useRadian - anchors.top: calibrate.bottom - anchors.left: mainWnd.left - anchors.leftMargin: 5 - height: 30 - width: 80 - text: (tilt !== null ? tilt.unit === TiltSensor.Radians ? "Degree" : "Radians" : "Degree") - - onClicked:{ - tilt.unit = (useRadian.text === "Radians" ? TiltSensor.Radians : TiltSensor.Degrees); - } - } - - Button{ - id: tiltStart - anchors.top: useRadian.bottom - anchors.left: mainWnd.left - anchors.leftMargin: 5 - height: 30 - width: 80 - text: tilt.enabled ? "Stop" : "Start" - - onClicked:{ -//! [2] - tilt.enabled = (tiltStart.text === "Start" ? true: false); -//! [2] - } - } - - Text { - id: xrottext - anchors.right: mainWnd.right - anchors.rightMargin: 5 - anchors.left: useRadian.right - anchors.leftMargin: 15 - anchors.top: useRadian.top - anchors.bottom: useRadian.bottom - verticalAlignment: Text.AlignVCenter -//! [3] - text: "X Rotation: " + tilt.xRotation + (tilt.unit === TiltSensor.Radians ? " rad" : "°") -//! [3] - } - - Text { - id: yrottext - anchors.right: mainWnd.right - anchors.rightMargin: 5 - anchors.left: tiltStart.right - anchors.leftMargin: 15 - anchors.top: tiltStart.top - anchors.bottom: tiltStart.bottom - verticalAlignment: Text.AlignVCenter -//! [4] - text: "Y Rotation: " + tilt.yRotation + (tilt.unit === TiltSensor.Radians ? " rad" : "°") -//! [4] - } - - //Ambient Light region - - Rectangle { - id: ambientlightLine - anchors.top: tiltStart.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - anchors.right: mainWnd.right - anchors.rightMargin: 5 - border.width: 1 - height: 1 - border.color: "#888888" - } - - Text { - id: labelAmbientLight - anchors.top: ambientlightLine.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.right: mainWnd.right - - horizontalAlignment: Text.AlignHCenter - font.bold: true - text: "AmbientLightSensor" - } - - AmbientLightSensor { - id: ambientlight - enabled: false -//! [5] - onLightLevelChanged:{ - if (ambientlight.lightLevel == AmbientLightSensor.Unknown) - ambientlighttext.text = "Ambient light: Unknown"; - else if (ambientlight.lightLevel == AmbientLightSensor.Dark) - ambientlighttext.text = "Ambient light: Dark"; - else if (ambientlight.lightLevel == AmbientLightSensor.Twilight) - ambientlighttext.text = "Ambient light: Twilight"; - else if (ambientlight.lightLevel == AmbientLightSensor.Light) - ambientlighttext.text = "Ambient light: Light"; - else if (ambientlight.lightLevel == AmbientLightSensor.Bright) - ambientlighttext.text = "Ambient light: Bright"; - else if (ambientlight.lightLevel == AmbientLightSensor.Sunny) - ambientlighttext.text = "Ambient light: Sunny"; - } -//! [5] - } - - Button{ - id: ambientlightStart - anchors.top: labelAmbientLight.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - height: 30 - width: 80 - text: ambientlight.enabled ? "Stop" : "Start" - - onClicked:{ - ambientlight.enabled = (ambientlightStart.text === "Start" ? true: false); - } - } - - Text { - id: ambientlighttext - anchors.left: ambientlightStart.right - anchors.leftMargin: 15 - anchors.top: ambientlightStart.top - anchors.bottom: ambientlightStart.bottom - verticalAlignment: Text.AlignVCenter - text: "Ambient light: -" - } - - //Proximity region - - Rectangle { - id: proximityLine - anchors.top: ambientlightStart.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - anchors.right: mainWnd.right - anchors.rightMargin: 5 - border.width: 1 - height: 1 - border.color: "#888888" - } - - Text { - id: labelProximityLight - anchors.top: proximityLine.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.right: mainWnd.right - horizontalAlignment: Text.AlignHCenter - font.bold: true - text: "ProximitySensor" - } - - ProximitySensor { - id: proxi - enabled: false - } - - Button{ - id: proxiStart - anchors.top: labelProximityLight.bottom - anchors.topMargin: 5 - anchors.left: mainWnd.left - anchors.leftMargin: 5 - height: 30 - width: 80 - text: proxi.enabled ? "Stop" : "Start" - - onClicked:{ - proxi.enabled = (proxiStart.text === "Start" ? true: false); - } - } - - Text { - id: proxitext - anchors.left: proxiStart.right - anchors.leftMargin: 15 - anchors.top: proxiStart.top - anchors.bottom: proxiStart.bottom - verticalAlignment: Text.AlignVCenter -//! [6] - text: "Proximity: " + (proxi.near ? "near" : "far") -//! [6] - } - } -} diff --git a/examples/sensors/qmlqtsensors/qmlqtsensors.pro b/examples/sensors/qmlqtsensors/qmlqtsensors.pro deleted file mode 100644 index 9ecebd9a..00000000 --- a/examples/sensors/qmlqtsensors/qmlqtsensors.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = aux - -app.files = \ - info.json \ - main.qml \ - icon.png \ - components - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.qmlqtsensors - INSTALLS = app -} - diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.json b/examples/sensors/qmlsensorgestures/plugin/plugin.json deleted file mode 100644 index 8a55b3ae..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{ "Keys": [ "notused" ] } diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.pro b/examples/sensors/qmlsensorgestures/plugin/plugin.pro deleted file mode 100644 index 2003e910..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/plugin.pro +++ /dev/null @@ -1,21 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin - -TARGET = qtsensorgestures_counterplugin - -QT += sensors -DESTDIR = $$QT.sensors.plugins/sensorgestures - -HEADERS += \ - qcountergestureplugin.h \ - qcounterrecognizer.h -SOURCES += \ - qcountergestureplugin.cpp \ - qcounterrecognizer.cpp - -target.path += $$[QT_INSTALL_PLUGINS]/sensorgestures -INSTALLS += target - -OTHER_FILES += \ - plugin.json - diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp deleted file mode 100644 index 1fda1879..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp +++ /dev/null @@ -1,75 +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$ -** -****************************************************************************/ - -#include <QtPlugin> -#include <QStringList> -#include <QObject> - -#include "qcountergestureplugin.h" -#include <qsensorgestureplugininterface.h> -#include <qsensorgesturemanager.h> -#include "qcounterrecognizer.h" - - -QCounterGesturePlugin::QCounterGesturePlugin() -{ -} - -QCounterGesturePlugin::~QCounterGesturePlugin() -{ -} - -QStringList QCounterGesturePlugin::supportedIds() const -{ - QStringList list; - list << "QtSensors.SecondCounter"; - return list; -} - - -QList <QSensorGestureRecognizer *> QCounterGesturePlugin::createRecognizers() -{ - QList <QSensorGestureRecognizer *> recognizers; - - QSensorGestureRecognizer *sRec = new QCounterGestureRecognizer(this); - recognizers.append(sRec); - - return recognizers; -} diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h deleted file mode 100644 index 4755f96e..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -#ifndef QCOUNTERGESTUREPLUGIN_H -#define QCOUNTERGESTUREPLUGIN_H - -#include <QObject> -#include <QStringList> - -#include <qsensorgestureplugininterface.h> - -class QCounterGesturePlugin : public QObject, public QSensorGesturePluginInterface -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "com.Nokia.QSensorGesturePluginInterface" FILE "plugin.json") - Q_INTERFACES(QSensorGesturePluginInterface) - -public: - explicit QCounterGesturePlugin(); - ~QCounterGesturePlugin(); - - QList <QSensorGestureRecognizer *> createRecognizers(); - - QStringList gestureSignals() const; - QStringList supportedIds() const; - QString name() const { return "CounterGestures"; } -}; - -#endif // QCOUNTERGESTUREPLUGIN_H diff --git a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.cpp b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.cpp deleted file mode 100644 index 03319e81..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.cpp +++ /dev/null @@ -1,89 +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$ -** -****************************************************************************/ - -#include <QDebug> -#include <QTimer> - -#include "qcounterrecognizer.h" - -QCounterGestureRecognizer::QCounterGestureRecognizer(QObject *parent) - : QSensorGestureRecognizer(parent) -{ -} - -QCounterGestureRecognizer::~QCounterGestureRecognizer() -{ - -} - -void QCounterGestureRecognizer::create() -{ - connect(&_timer,SIGNAL(timeout()),this,SLOT(timeout())); - _timer.setInterval(1000); -} - -bool QCounterGestureRecognizer::start() -{ - Q_EMIT detected(id()); - _timer.start(); - return _timer.isActive(); -} - -bool QCounterGestureRecognizer::stop() -{ - _timer.stop(); - return true; -} - - -bool QCounterGestureRecognizer::isActive() -{ - return _timer.isActive(); -} - -QString QCounterGestureRecognizer::id() const -{ - return QString("QtSensors.SecondCounter"); -} - -void QCounterGestureRecognizer::timeout() -{ - Q_EMIT detected(id()); -} diff --git a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h deleted file mode 100644 index 37c16eb1..00000000 --- a/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h +++ /dev/null @@ -1,70 +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$ -** -****************************************************************************/ - -#ifndef QCOUNTERGESTURERECOGNIZER_H -#define QCOUNTERGESTURERECOGNIZER_H - -#include <QDebug> -#include <QtCore/QTimer> -#include <qsensorgesturerecognizer.h> - -class QCounterGestureRecognizer : public QSensorGestureRecognizer -{ - Q_OBJECT -public: - - QCounterGestureRecognizer(QObject *parent = 0); - ~QCounterGestureRecognizer(); - - void create(); - - QString id() const; - bool start(); - bool stop(); - bool isActive(); - -private slots: - void timeout(); - -private: - QTimer _timer; -}; - -#endif // QCOUNTERGESTURERECOGNIZER_H diff --git a/examples/sensors/qmlsensorgestures/qml_app/Button.qml b/examples/sensors/qmlsensorgestures/qml_app/Button.qml deleted file mode 100644 index 23fc0f66..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/Button.qml +++ /dev/null @@ -1,129 +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 - -//Implementation of the Button control. -Item { - id: button - width: 30 - height: 30 - property alias buttonText: innerText.text; - property color color: "white" - property color hoverColor: "#aaaaaa" - property color pressColor: "slategray" - property int fontSize: 10 - property int borderWidth: 1 - property int borderRadius: 2 - scale: state === "Pressed" ? 0.96 : 1.0 - onEnabledChanged: state = "" - signal clicked - - //define a scale animation - Behavior on scale { - NumberAnimation { - duration: 100 - easing.type: Easing.InOutQuad - } - } - - //Rectangle to draw the button - Rectangle { - id: rectangleButton - anchors.fill: parent - radius: borderRadius - color: button.enabled ? button.color : "grey" - border.width: borderWidth - border.color: "black" - - Text { - id: innerText - font.pointSize: fontSize - anchors.centerIn: parent - } - } - - //change the color of the button in differen button states - states: [ - State { - name: "Hovering" - PropertyChanges { - target: rectangleButton - color: hoverColor - } - }, - State { - name: "Pressed" - PropertyChanges { - target: rectangleButton - color: pressColor - } - } - ] - - //define transmission for the states - transitions: [ - Transition { - from: ""; to: "Hovering" - ColorAnimation { duration: 200 } - }, - Transition { - from: "*"; to: "Pressed" - ColorAnimation { duration: 10 } - } - ] - - //Mouse area to react on click events - MouseArea { - hoverEnabled: true - anchors.fill: button - onEntered: { button.state='Hovering'} - onExited: { button.state=''} - onClicked: { button.clicked();} - onPressed: { button.state="Pressed" } - onReleased: { - if (containsMouse) - button.state="Hovering"; - else - button.state=""; - } - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/Gesture.qml b/examples/sensors/qmlsensorgestures/qml_app/Gesture.qml deleted file mode 100644 index 2982c097..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/Gesture.qml +++ /dev/null @@ -1,115 +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 -import QtSensors 5.0 - -/* Layout --------------------------------------------------- -| ---------------------------------------------- | -| | | | -| | | | -| | | | -| | gestureList | | -| | | | -| | | | -| | | | -| | | | -| | | | -| | | | -| | | | -| | | | -| ---------------------------------------------- | -| ---------------------------------------------- | -| | | | -| | gesture | | -| | | | -| | | | -| ---------------------------------------------- | -| ---------------------------------------------- | -| | | | -| | gestures | | -| | | | -| | | | -| ---------------------------------------------- | --------------------------------------------------- -*/ - -Rectangle { - id: viewArea - width: 320 - height: 480 - color: '#d6d6d6' - - GestureList { - id: gestureList - parent: viewArea - anchors.left: viewArea.left - anchors.top: viewArea.top - anchors.right: viewArea.right - height: viewArea.height / 2 -//! [3] - onSelectedGestureChanged: { - gesture.enabled = false; - gesture.gestureid = gestureList.selectedGesture; -//! [3] - gesture.gesturetitle = gestureList.selectedGesture; - } - } - - GestureView { - id: gesture - parent: viewArea - anchors.left: viewArea.left - anchors.top: gestureList.bottom - anchors.right: viewArea.right - height: 100 - } - - GesturesView { - id: gestures - parent: viewArea - anchors.left: viewArea.left - anchors.top: gesture.bottom - anchors.right: viewArea.right - height: 100 - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/GestureList.qml b/examples/sensors/qmlsensorgestures/qml_app/GestureList.qml deleted file mode 100644 index c9b1f094..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/GestureList.qml +++ /dev/null @@ -1,132 +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 -import QtSensors 5.0 - -/* Layout - gesturerect - / ----------------------------------------/ -|-------------------------------------| -|| labelGesture || -|-------------------------------------| -|-------------------------------------| -|| |<---- gestureListRect -|| || -|| || -|| gestureList || -|| || -|| || -|| || -|| || -|| || -|| || -|-------------------------------------| -*/ - -Rectangle { - id: gesturerect - border.width: 1 - anchors.margins: 5 - - property string selectedGesture: ""; - signal selectedGestureChanged(); - - SensorGesture { - id: gesture - } - - Text { - id: labelGesture - anchors.top: gesturerect.top - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 30 - font.bold: true - text: "Gestures" - } - - Rectangle { - id: gestureListRect - border.width: 1 - anchors.top: labelGesture.bottom - anchors.left: gesturerect.left - anchors.right: gesturerect.right - anchors.bottom: gesturerect.bottom - anchors.margins: 5 - -//! [4] - ListView { - id: gestureList - anchors.fill: gestureListRect - anchors.margins: 5 - model: gesture.availableGestures - focus: true - currentIndex: -1 - delegate: gestureListDelegate - } -//! [4] - Component { - id: gestureListDelegate - - Rectangle { - width: gestureList.width - height: itemText.height - color: (index === gestureList.currentIndex ? "#999933" : "#FFFFFF") - - Text { - id: itemText - text: model.modelData - } - MouseArea { - anchors.fill: parent - onClicked: { - gestureList.currentIndex = index; - selectedGesture = model.modelData; - selectedGestureChanged(); - } - } - } - } - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/GestureView.qml b/examples/sensors/qmlsensorgestures/qml_app/GestureView.qml deleted file mode 100644 index 07a9a5cc..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/GestureView.qml +++ /dev/null @@ -1,153 +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 - -//! [0] -import QtSensors 5.0 -//! [0] - -/* Layout - gesturerect - / ----------------------------------------/ -| ----------------------------------- | -| | id: titleText | | -| ----------------------------------- | -| | -| | -| ----------------------------------- | -| | id: detectionText | | -| ----------------------------------- | -| | -| | -| | -| ----------------------------------- | -| | id: valueText | | -| ----------------------------------- | -| | -| | -| | -| ------------------------------ | -| | id: gestureStartStopButton | | -| ------------------------------ | ---------------------------------------- -*/ - -Rectangle { - id: gesturerect - border.width: 1 - anchors.margins: 5 -//! [2] - property alias gestureid: sensorGesture.gestures -//! [2] - property alias gesturetitle: titleText.text - property alias enabled: sensorGesture.enabled - property string oldgesture: "" - property int count: 0 - -//! [1] - SensorGesture { - id: sensorGesture - enabled: false - onDetected:{ - if (gesture !== oldgesture) - count = 0; - valueText.text = gesture + " " + count; - oldgesture = gesture; - count++; - } - onEnabledChanged: { - valueText.text = "" - } - } -//! [1] - - Text { - id: titleText - anchors.top: gesturerect.top - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 20 - font.bold: true - text: "" - } - - Text { - id: detectionText - anchors.top: titleText.bottom - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 15 - text: "detection:" - } - - Text { - id: valueText - anchors.top: detectionText.bottom - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 15 - text: ("") - visible: sensorGesture.enabled - } - - Button{ - id: gestureStartStopButton - anchors.left: gesturerect.left - anchors.bottom: gesturerect.bottom - height: 30 - width: 100 - buttonText: (sensorGesture.enabled ? "Stop" : "Start") - enabled: true; - onClicked: { - if (gestureStartStopButton.buttonText === "Start") { - sensorGesture.enabled = true; - } - else { - sensorGesture.enabled = false; - } - } - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml b/examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml deleted file mode 100644 index 23924cad..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml +++ /dev/null @@ -1,156 +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 -import QtSensors 5.0 - -/* Layout - gesturerect - / ----------------------------------------/ -| ----------------------------------- | -| | id: titleText | | -| ----------------------------------- | -| | -| | -| ----------------------------------- | -| | id: detectionText | | -| ----------------------------------- | -| | -| | -| | -| ----------------- ----------------- | -| | id: valueText | | id: valueText1| | -| ----------------- ----------------- | -| | -| | -| | -| ------------------------------ | -| | id: gestureStartStopButton | | -| ------------------------------ | ---------------------------------------- -*/ - -Rectangle { - id: gesturerect - border.width: 1 - anchors.margins: 5 - property alias enabled: sensorGuesture.enabled - property int count: 0 - property int count1: 0 - - SensorGesture { - id: sensorGuesture - enabled: true - gestures: availableGestures - onDetected:{ - if (gesture === "QtSensors.shake") - gesturerect.count++; - else - gesturerect.count1++; - } - onEnabledChanged: { - gesturerect.count = 0; - gesturerect.count1 = 0; - } - } - - Text { - id: titleText - anchors.top: gesturerect.top - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 20 - font.bold: true - text: "templates gestures" - } - - Text { - id: detectionText - anchors.top: titleText.bottom - anchors.left: gesturerect.left - anchors.right: gesturerect.right - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 15 - text: "shake : SecondCounter" - } - - Text { - id: valueText - anchors.top: detectionText.bottom - anchors.left: gesturerect.left - width: gesturerect.width / 2 - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 15 - text: gesturerect.count - visible: sensorGuesture.enabled - } - - Text { - id: valueText1 - anchors.top: detectionText.bottom - anchors.right: gesturerect.right - width: gesturerect.width / 2 - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 15 - text: gesturerect.count1 - visible: sensorGuesture.enabled - } - - Button{ - id: gestureStartStopButton - anchors.left: gesturerect.left - anchors.bottom: gesturerect.bottom - height: 30 - width: 100 - buttonText: (sensorGuesture.enabled ? "Stop" : "Start") - enabled: true; - onClicked: { - if (gestureStartStopButton.buttonText === "Start") { - sensorGuesture.enabled = true; - } - else { - sensorGuesture.enabled = false; - } - } - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/icon.png b/examples/sensors/qmlsensorgestures/qml_app/icon.png Binary files differdeleted file mode 100644 index c445bd7f..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/icon.png +++ /dev/null diff --git a/examples/sensors/qmlsensorgestures/qml_app/info.json b/examples/sensors/qmlsensorgestures/qml_app/info.json deleted file mode 100644 index 063caaa0..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/info.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "Category": "application", - "Runtime": "qml", - "DisplayName": "Gesture", - "Subcategory": "utility", - "MainQML": "Gesture.qml", - "Version": "1.0", - "Identifier": "com.nokia.mt.qmlsensorsgesture", - "Summary": "QML Sensors Gesture demo", - "Author": "Qt" - } -} diff --git a/examples/sensors/qmlsensorgestures/qml_app/qml_app.pro b/examples/sensors/qmlsensorgestures/qml_app/qml_app.pro deleted file mode 100644 index 6ad9a8bf..00000000 --- a/examples/sensors/qmlsensorgestures/qml_app/qml_app.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = aux - -app.files = \ - Button.qml \ - GestureList.qml \ - GesturesView.qml \ - info.json \ - Gesture.qml \ - GestureView.qml \ - icon.png - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.qmlsensorgestures - INSTALLS = app -} - diff --git a/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro b/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro deleted file mode 100644 index 01677c19..00000000 --- a/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += plugin -SUBDIRS += qml_app - diff --git a/examples/sensors/sensor_explorer/import/explorer.cpp b/examples/sensors/sensor_explorer/import/explorer.cpp deleted file mode 100644 index 0c296192..00000000 --- a/examples/sensors/sensor_explorer/import/explorer.cpp +++ /dev/null @@ -1,143 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#include "explorer.h" -#include <QtCore/QDebug> -#include <qsensor.h> -#include <QMetaObject> -#include <QMetaProperty> - -QT_BEGIN_NAMESPACE - -/* - \class QSensorExplorer - \brief The QSensorExplorer element provides an easy access for reading all avalaible sensors installed on the system. -*/ - -/* - Construct a QSensorExplorer object with parent \a parent -*/ -QSensorExplorer::QSensorExplorer(QObject* parent) - : QObject(parent) - , _selectedSensorItem(0) -{ - loadSensors(); -} - -/* - Destructor of a QSensorExplorer -*/ -QSensorExplorer::~QSensorExplorer() -{ -} - -/* - Load all available sensors and store it in a list. -*/ -void QSensorExplorer::loadSensors() -{ - //! [0] - _availableSensors.clear(); - - foreach (const QByteArray &type, QSensor::sensorTypes()) { - qDebug() << "Found type" << type; - foreach (const QByteArray &identifier, QSensor::sensorsForType(type)) { - qDebug() << "Found identifier" << identifier; - // Don't put in sensors we can't connect to - QSensor* sensor = new QSensor(type, this); - sensor->setIdentifier(identifier); - if (!sensor->connectToBackend()) { - qDebug() << "Couldn't connect to" << identifier; - continue; - } - - qDebug() << "Adding identifier" << identifier; - _availableSensors.append(new QSensorItem(sensor, this)); - } - } - emit availableSensorsChanged(); - //! [0] -} - -/* - \fn QSensorExplorer::availableSensorsChanged() - Notifies the client if the list of the available sensors was changed -*/ - -/* - \property QSensorExplorer::availableSensors - Returns a list of all available sensor. -*/ -QQmlListProperty<QSensorItem> QSensorExplorer::availableSensors() -{ - return QQmlListProperty<QSensorItem>(this,_availableSensors); -} - -/* - \fn QSensorExplorer::selectedSensorItemChanged() - Notifies the client if the selected sensor has been changed -*/ - -/* - \property QSensorExplorer::selectedSensorItem - Returns the current selected sensor item. -*/ -QSensorItem* QSensorExplorer::selectedSensorItem() -{ - return _selectedSensorItem; -} - -/* - \fn QSensorExplorer::setSelectedSensorItem(QSensorItem* selitem) - Sets the QSensorItem \a selitem as the current selected QSensorItem. -*/ -void QSensorExplorer::setSelectedSensorItem(QSensorItem* selitem) -{ - if (selitem && _selectedSensorItem != selitem) { - if (_selectedSensorItem) - _selectedSensorItem->unSelect(); - _selectedSensorItem = selitem; - _selectedSensorItem->select(); - emit selectedSensorItemChanged(); - } -} - -QT_END_NAMESPACE diff --git a/examples/sensors/sensor_explorer/import/explorer.h b/examples/sensors/sensor_explorer/import/explorer.h deleted file mode 100644 index f8806b6f..00000000 --- a/examples/sensors/sensor_explorer/import/explorer.h +++ /dev/null @@ -1,79 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#ifndef QSEONSOREXPLORER_H -#define QSEONSOREXPLORER_H - -#include <QtQml/qqml.h> -#include <QtQml/QQmlListProperty> -#include "sensoritem.h" - -QT_BEGIN_NAMESPACE - -class QSensorExplorer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QQmlListProperty<QSensorItem> availableSensors READ availableSensors NOTIFY availableSensorsChanged) - Q_PROPERTY(QSensorItem* selectedSensorItem READ selectedSensorItem WRITE setSelectedSensorItem NOTIFY selectedSensorItemChanged) -public: - QSensorExplorer(QObject* parent = 0); - virtual ~QSensorExplorer(); - -private: - QQmlListProperty<QSensorItem> availableSensors(); - void loadSensors(); - void setSelectedSensorItem(QSensorItem* selitem); - QSensorItem* selectedSensorItem(); - -Q_SIGNALS: - void availableSensorsChanged(); - void selectedSensorItemChanged(); - -private: - QList<QSensorItem*> _availableSensors; - QSensorItem* _selectedSensorItem; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QSensorExplorer) - -#endif // QSEONSOREXPLORER_H diff --git a/examples/sensors/sensor_explorer/import/import.pro b/examples/sensors/sensor_explorer/import/import.pro deleted file mode 100644 index 1f97b67e..00000000 --- a/examples/sensors/sensor_explorer/import/import.pro +++ /dev/null @@ -1,25 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin - -TARGET = $$qtLibraryTarget(declarative_explorer) -TARGETPATH = Explorer - -QT += qml sensors - -SOURCES = main.cpp explorer.cpp sensoritem.cpp propertyinfo.cpp -HEADERS = explorer.h sensoritem.h propertyinfo.h - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX):DESTPATH=$$EXAMPLES_PREFIX/com.nokia.mt.sensor_explorer/imports/Explorer -else:DESTPATH=$$[QT_INSTALL_IMPORTS]/Explorer - -target.path=$$DESTPATH -INSTALLS += target - -qmldir.files=$$PWD/qmldir -qmldir.path=$$DESTPATH -INSTALLS += qmldir - -OTHER_FILES += \ - plugin.json qmldir diff --git a/examples/sensors/sensor_explorer/import/main.cpp b/examples/sensors/sensor_explorer/import/main.cpp deleted file mode 100644 index e0b3ad99..00000000 --- a/examples/sensors/sensor_explorer/import/main.cpp +++ /dev/null @@ -1,66 +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$ -** -****************************************************************************/ - -#include <QtQml/qqmlextensionplugin.h> -#include <QtQml/qqml.h> -#include "explorer.h" -#include <QtCore/QDebug> - -QT_BEGIN_NAMESPACE - -class SensorExplorerDeclarativeModule : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json") -public: - virtual void registerTypes(const char *uri) - { - qDebug() << "SensorExplorerDeclarativeModule::registerTypes(const char *uri)"; - - Q_ASSERT(QLatin1String(uri) == QLatin1String("Explorer")); - qmlRegisterType<QSensorExplorer>(uri, 1, 0, "SensorExplorer"); - qmlRegisterType<QSensorItem>(uri, 1, 0, "SensorItem"); - qmlRegisterType<QPropertyInfo>(uri, 1, 0, "PropertyInfo"); - } -}; - -QT_END_NAMESPACE - -#include "main.moc" diff --git a/examples/sensors/sensor_explorer/import/plugin.json b/examples/sensors/sensor_explorer/import/plugin.json deleted file mode 100644 index 0967ef42..00000000 --- a/examples/sensors/sensor_explorer/import/plugin.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/examples/sensors/sensor_explorer/import/propertyinfo.cpp b/examples/sensors/sensor_explorer/import/propertyinfo.cpp deleted file mode 100644 index 0360e0d2..00000000 --- a/examples/sensors/sensor_explorer/import/propertyinfo.cpp +++ /dev/null @@ -1,140 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#include "sensoritem.h" -#include <QtCore/QDebug> -#include <QtSensors> - -QT_BEGIN_NAMESPACE - -/* - \class QPropertyInfo - \brief The QPropertyInfo element provides an easy access for reading and writing the property values. -*/ - -/* - Construct a QPropertyInfo object with parent \a parent -*/ -QPropertyInfo::QPropertyInfo(QObject* parent) - : QObject(parent) - , _index(0) - , _isWriteable(false) - , _name("") - , _typeName("") - , _value("") -{} - -/* - Construct a QPropertyInfo object with parent \a parent, property name \a name, property index \a index, - property write access \a writeable, property type \a typeName and property value \a value -*/ -QPropertyInfo::QPropertyInfo(const QString& name, int index, bool writeable, const QString& typeName, const QString& value, QObject* parent) - : QObject(parent) - , _index(index) - , _isWriteable(writeable) - , _name(name) - , _typeName(typeName) - , _value(value) -{} - -/* - \property QPropertyInfo::name - Returns the name of the property -*/ -QString QPropertyInfo::name() -{ - return _name; -} - -/* - \property QPropertyInfo::typeName - Returns the type of the property -*/ -QString QPropertyInfo::typeName() -{ - return _typeName; -} - -/* - \property QPropertyInfo::value - Returns the current value of the property -*/ -QString QPropertyInfo::value() -{ - return _value; -} - -/* - \fn void QPropertyInfo::valueChanged() - Signal that notifies the client if the property value was changed. -*/ - -/* - \fn QPropertyInfo::setValue(const QString& value) - Sets the value \a value of the property -*/ -void QPropertyInfo::setValue(const QString& value) -{ - if (value != _value){ - _value = value; - emit valueChanged(); - } -} - -/* - \fn QPropertyInfo::index() - Returns the meta-data index of the property -*/ -int QPropertyInfo::index() -{ - return _index; -} - -/* - \property QPropertyInfo::isWriteable - Returns true if the property is writeable false if property is read only -*/ -bool QPropertyInfo::isWriteable() -{ - return _isWriteable; -} - -QT_END_NAMESPACE diff --git a/examples/sensors/sensor_explorer/import/propertyinfo.h b/examples/sensors/sensor_explorer/import/propertyinfo.h deleted file mode 100644 index dd8eecf0..00000000 --- a/examples/sensors/sensor_explorer/import/propertyinfo.h +++ /dev/null @@ -1,83 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#ifndef QPROPERTYINFO_H -#define QPROPERTYINFO_H - -#include <QtQml/qqml.h> -#include <QtCore/QString> - -QT_BEGIN_NAMESPACE - -class QPropertyInfo : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(QString typeName READ typeName CONSTANT) - Q_PROPERTY(QString value READ value NOTIFY valueChanged) - Q_PROPERTY(bool isWriteable READ isWriteable CONSTANT) - -public: - QPropertyInfo(QObject* parent = 0); - QPropertyInfo(const QString& name, int index, bool writeable, const QString& typeName, const QString& value, QObject* parent=0); - QString name(); - QString typeName(); - QString value(); - void setValue(const QString& value); - int index(); - bool isWriteable(); - -Q_SIGNALS: - void valueChanged(); - -private: - int _index; - bool _isWriteable; - QString _name; - QString _typeName; - QString _value; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QPropertyInfo) - -#endif // QPROPERTYINFO_H diff --git a/examples/sensors/sensor_explorer/import/qmldir b/examples/sensors/sensor_explorer/import/qmldir deleted file mode 100644 index 60d8f883..00000000 --- a/examples/sensors/sensor_explorer/import/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin declarative_explorer diff --git a/examples/sensors/sensor_explorer/import/sensoritem.cpp b/examples/sensors/sensor_explorer/import/sensoritem.cpp deleted file mode 100644 index 68dccf46..00000000 --- a/examples/sensors/sensor_explorer/import/sensoritem.cpp +++ /dev/null @@ -1,322 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#include "sensoritem.h" -#include <QtCore/QDebug> -#include <QtSensors> - -QT_BEGIN_NAMESPACE - -/* - \class QSensorItem - \brief The QSensorItem element provides information about the meta-datas from a sensors installed on the system. -*/ - -/* - Construct a QSensorItem object with parent \a parent -*/ -QSensorItem::QSensorItem(QObject* parent) - : QObject(parent) - , _qsensor(0) -{ -} - -/* - Construct a QSensorItem object with QSensor \a sensor and parent \a parent -*/ -QSensorItem::QSensorItem(QSensor* sensor, QObject* parent) - : QObject(parent) - , _qsensor(sensor) -{ -} - -/* - Destructor of a QSensorItem -*/ -QSensorItem::~QSensorItem() -{ -} - -/* - \fn QSensorItem::startChanged() - Notifies the client if the sensors has changed its start active status -*/ - -/* - \property QSensorItem::start - This property starts or stops the sensor -*/ -bool QSensorItem::start() -{ - return (_qsensor ? _qsensor->isActive() : false); -} - -void QSensorItem::setStart(bool run) -{ - if (_qsensor) - _qsensor->setActive(run); -} - -/* - \property QSensorItem::id - Returns the sensor id of the sensor item -*/ -QString QSensorItem::id() -{ - return (_qsensor ? _qsensor->identifier() : ""); -} - -/* - Set the new value \a val to the QPropertyInfo object \a property -*/ -void QSensorItem::changePropertyValue(QPropertyInfo* property, const QString& val) -{ - if (_qsensor && _sensorProperties.contains(property)){ - if ( _qsensor->setProperty(property->name().toLatin1().constData(), QVariant(val))) - updateSensorPropertyValues(); - else - qWarning() << "new property value couldn't be set"; - } -} - -/* - Reading the meta-datas and activates the sensor. -*/ -void QSensorItem::select() -{ - if (_sensorProperties.isEmpty()) { - // Probe the reading using Qt's meta-object facilities - //Read properties from reader - QSensorReading *reading = _qsensor->reading(); - const QMetaObject *mo = reading->metaObject(); - int firstProperty = QSensorReading::staticMetaObject.propertyOffset(); - - for (int i = firstProperty; i < mo->propertyCount(); ++i) { - QString typeName = QLatin1String(mo->property(i).typeName()); - int crap = typeName.lastIndexOf("::"); - if (crap != -1) - typeName = typeName.mid(crap + 2); - - QPropertyInfo* pi = new QPropertyInfo(mo->property(i).name() - , i - , isWriteable(mo->property(i).name()) - , typeName - , "-" - , this); - _readerProperties.append(pi); - } - - //Read properties from sensor - const QMetaObject *mo1 = _qsensor->metaObject(); - firstProperty = QSensorReading::staticMetaObject.propertyOffset(); - - for (int i = firstProperty; i < mo1->propertyCount(); ++i) { - QString propertyname = mo1->property(i).name(); - if (ignoreProperty(propertyname)) - continue; - - QString typeName = QLatin1String(mo1->property(i).typeName()); - int crap = typeName.lastIndexOf("::"); - if (crap != -1) - typeName = typeName.mid(crap + 2); - - QPropertyInfo* pi = new QPropertyInfo(propertyname - , i - , isWriteable(propertyname) - , typeName - , "-" - , this); - _sensorProperties.append(pi); - } - updateSensorPropertyValues(); - connect(_qsensor, SIGNAL(readingChanged()), this, SLOT(sensorReadingChanged())); - } - connect(_qsensor, SIGNAL(activeChanged()), SIGNAL(startChanged())); -} - -/* - Unselect the sensor by stopping the sensor. -*/ -void QSensorItem::unSelect() -{ - _qsensor->stop(); - disconnect(_qsensor, SIGNAL(activeChanged()), this , SIGNAL(startChanged())); -} - -/* - Updates the property values from QSensor -*/ -void QSensorItem::updateSensorPropertyValues() -{ - if (_qsensor){ - const QMetaObject *mo = _qsensor->metaObject(); - for (int i = 0; i < _sensorProperties.count(); i++){ - QVariant val = mo->property(_sensorProperties[i]->index()).read(_qsensor); - _sensorProperties[i]->setValue(convertValue(_sensorProperties[i]->typeName(), val)); - } - } -} - -/* - \fn QSensorItem::propertiesChanged() - Notifies the client if the list of the properties was changed -*/ - -/* - Updates the property values from the QSensorReader -*/ -void QSensorItem::sensorReadingChanged() -{ - QSensorReading *reading = _qsensor->reading(); - const QMetaObject *mo = reading->metaObject(); - for (int i = 0; i < _readerProperties.count(); i++){ - QVariant val = mo->property(_readerProperties[i]->index()).read(reading); - _readerProperties[i]->setValue(convertValue(_readerProperties[i]->typeName(), val)); - } -} - -/* - Returns true if the property with the name \a propertyname should be ignored -*/ -bool QSensorItem::ignoreProperty(const QString& propertyname) -{ - if (propertyname == "reading" || - propertyname == "active" || - propertyname == "sensorid" || - propertyname == "connectedToBackend" || - propertyname == "busy") - return true; - - return false; -} - -/* - Returns true if the property with the name \a propertyname is writeable -*/ -bool QSensorItem::isWriteable(const QString& propertyname) -{ - if (_qsensor){ - const QMetaObject *mo = _qsensor->metaObject(); - int propertyindex = mo->indexOfProperty(propertyname.toLocal8Bit().constData()); - if (propertyindex >= 0){ - QMetaProperty prop = mo->property(propertyindex); - return prop.isWritable(); - } - else { - QSensorReading *reading = _qsensor->reading(); - const QMetaObject *moreader = reading->metaObject(); - propertyindex = moreader->indexOfProperty(propertyname.toLocal8Bit().constData()); - if (propertyindex >= 0){ - QMetaProperty prop = mo->property(propertyindex); - return prop.isWritable(); - } - } - } - - return false; -} - -/* - Convert the variant \a val dependend on the type \a type and returns the converted value as a QString -*/ -QString QSensorItem::convertValue(const QString& type, const QVariant& val) -{ - if (type == "LightLevel"){ - switch (val.toInt()) { - case 1: return "Dark"; - case 2: return "Twilight"; - case 3: return "Light"; - case 4: return "Bright"; - case 5: return "Sunny"; - default: return "Undefined"; - } - } - else if (type == "Orientation"){ - switch (val.toInt()) { - case 1: return "TopUp"; - case 2: return "TopDown"; - case 3: return "LeftUp"; - case 4: return "RightUp"; - case 5: return "FaceUp"; - case 6: return "FaceDown"; - default: return "Undefined"; - } - } - else if (type == "qrangelist"){ - qrangelist rangelist = val.value<qrangelist>(); - QStringList ranges; - foreach (const qrange &r, rangelist) { - if (r.first == r.second) - ranges << QString("%1 Hz").arg(r.first); - else - ranges << QString("%1-%2 Hz").arg(r.first).arg(r.second); - } - if (ranges.count() > 0) - return ranges.join(", "); - return "-"; - } - else if (type == "qoutputrangelist") { - qoutputrangelist rangelist = val.value<qoutputrangelist>(); - QStringList ranges; - foreach (const qoutputrange &r, rangelist) { - ranges << QString("(%1, %2) += %3").arg(r.minimum).arg(r.maximum).arg(r.accuracy); - } - if (ranges.count() > 0) - return ranges.join(", "); - return "-"; - } - - return val.toString(); -} - -/* - \property QSensorItem::properties - Returns a list of all properties from the sensor -*/ -QQmlListProperty<QPropertyInfo> QSensorItem::properties() -{ - _properties.clear(); - _properties.append(_sensorProperties); - _properties.append(_readerProperties); - return QQmlListProperty<QPropertyInfo> (this, _properties); -} - -QT_END_NAMESPACE diff --git a/examples/sensors/sensor_explorer/import/sensoritem.h b/examples/sensors/sensor_explorer/import/sensoritem.h deleted file mode 100644 index 09313676..00000000 --- a/examples/sensors/sensor_explorer/import/sensoritem.h +++ /dev/null @@ -1,96 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -#ifndef QSENSORITEM_H -#define QSENSORITEM_H - -#include <QtQml/qqml.h> -#include <QtCore/QString> -#include "propertyinfo.h" - -QT_BEGIN_NAMESPACE - -class QSensor; -class QSensorItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool start READ start WRITE setStart NOTIFY startChanged) - Q_PROPERTY(QString id READ id CONSTANT) - Q_PROPERTY(QQmlListProperty<QPropertyInfo> properties READ properties NOTIFY propertiesChanged) -public: - QSensorItem(QObject* parent = 0); - QSensorItem(QSensor* sensor, QObject* parent = 0); - virtual ~QSensorItem(); - -public slots: - void select(); - void unSelect(); - void changePropertyValue(QPropertyInfo* property, const QString& val); - -private slots: - void sensorReadingChanged(); - -private: - QString id(); - bool start(); - void setStart(bool run); - QQmlListProperty<QPropertyInfo> properties(); - QString convertValue(const QString& type, const QVariant& val); - bool isWriteable(const QString& propertyname); - bool ignoreProperty(const QString& propertyname); - void updateSensorPropertyValues(); - -Q_SIGNALS: - void propertiesChanged(); - void startChanged(); - -private: - QSensor* _qsensor; - QList<QPropertyInfo*> _properties; - QList<QPropertyInfo*> _readerProperties; - QList<QPropertyInfo*> _sensorProperties; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QSensorItem) - -#endif // QSENSORITEM_H 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 Binary files differdeleted file mode 100644 index 62a00b9a..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_disabled.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 1fecad5b..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_normal.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 149529e1..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/images/button_background_pressed.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index 98bc601f..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_disabled.png +++ /dev/null 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 Binary files differdeleted file mode 100644 index b90b50cd..00000000 --- a/examples/sensors/sensor_explorer/qml_app/components/images/textfield_background_normal.png +++ /dev/null diff --git a/examples/sensors/sensor_explorer/qml_app/icon.png b/examples/sensors/sensor_explorer/qml_app/icon.png Binary files differdeleted file mode 100644 index c48b6095..00000000 --- a/examples/sensors/sensor_explorer/qml_app/icon.png +++ /dev/null diff --git a/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png b/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png Binary files differdeleted file mode 100644 index def234f1..00000000 --- a/examples/sensors/sensor_explorer/qml_app/images/listitem_select.png +++ /dev/null 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 ce7e0c37..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": "Sensors Explorer", - "Subcategory": "utility", - "MainQML": "main.qml", - "Version": "1.0.0", - "Identifier": "com.nokia.mt.sensor_explorer", - "Summary": "QML Sensors 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.pro b/examples/sensors/sensor_explorer/qml_app/qml_app.pro deleted file mode 100644 index ded6634f..00000000 --- a/examples/sensors/sensor_explorer/qml_app/qml_app.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = aux - -app.files = \ - PropertyList.qml \ - components \ - images \ - info.json \ - SensorList.qml \ - icon.png \ - main.qml - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.sensor_explorer - INSTALLS = app -} - diff --git a/examples/sensors/sensor_explorer/sensor_explorer.pro b/examples/sensors/sensor_explorer/sensor_explorer.pro deleted file mode 100644 index 759e9307..00000000 --- a/examples/sensors/sensor_explorer/sensor_explorer.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS = \ - import \ - qml_app diff --git a/examples/sensors/sensorgestures/gesture.png b/examples/sensors/sensorgestures/gesture.png Binary files differdeleted file mode 100644 index 707d5c4e..00000000 --- a/examples/sensors/sensorgestures/gesture.png +++ /dev/null diff --git a/examples/sensors/sensorgestures/main.cpp b/examples/sensors/sensorgestures/main.cpp deleted file mode 100644 index 49594d4e..00000000 --- a/examples/sensors/sensorgestures/main.cpp +++ /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$ -** -****************************************************************************/ - -#include <QtWidgets/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - MainWindow w; - w.show(); - - return a.exec(); -} diff --git a/examples/sensors/sensorgestures/mainwindow.cpp b/examples/sensors/sensorgestures/mainwindow.cpp deleted file mode 100644 index 9dd8a611..00000000 --- a/examples/sensors/sensorgestures/mainwindow.cpp +++ /dev/null @@ -1,168 +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$ -** -****************************************************************************/ - -#include <QtCore/QDebug> -#include <QtWidgets/QTreeWidget> - -#include "mainwindow.h" -#include "ui_mainwindow.h" - -#include <qsensorgesture.h> -#include <qsensorgesturemanager.h> - -MainWindow::MainWindow(QWidget *parent) - : QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); - //! [0] - - QSensorGestureManager manager; - - Q_FOREACH (const QString &gesture, manager.gestureIds()) { - - QTreeWidgetItem *gestureId = new QTreeWidgetItem(ui->treeWidget); - QStringList recognizerSignals = manager.recognizerSignals(gesture); - gestureId->setText(0,gesture); - - for (int i = 0; i < recognizerSignals.count(); i++) { - QTreeWidgetItem *oneSignal = new QTreeWidgetItem(gestureId); - oneSignal->setText(0,recognizerSignals.at(i)); - } - ui->treeWidget->insertTopLevelItem(0,gestureId); - } - //! [0] - - - ui->textEdit->setReadOnly(true); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -void MainWindow::detectedShake(const QString &name) -{ - QString str = "<font size=+2><B>"+name+"</b></font><br>"; - ui->textEdit->insertHtml(str); - ui->textEdit->ensureCursorVisible(); -} - -void MainWindow::on_pushButton_clicked() -{ - ui->textEdit->clear(); -} - -void MainWindow::onShake() -{ - QString str = "<font size=+2><B>onShake()</b></font><br>"; - ui->textEdit->insertHtml(str); - ui->textEdit->ensureCursorVisible(); -} - -void MainWindow::on_startPushButton_clicked() -{ - if (ui->treeWidget->currentItem() == 0) - return; - QString currentRecognizer; - - if (ui->treeWidget->currentItem()->childCount() == 0) { - currentRecognizer = ui->treeWidget->currentItem()->parent()->text(0); - } else { - currentRecognizer = ui->treeWidget->currentItem()->text(0); - } - - if (recognizerMap.contains(currentRecognizer)) - return; - //! [1] - QSensorGestureManager manager; - QSensorGesture *thisGesture = new QSensorGesture(QStringList() << currentRecognizer, this); - - if (currentRecognizer.contains("QtSensors.shake")) { - connect(thisGesture,SIGNAL(shake()), - this,SLOT(onShake())); - } - - connect(thisGesture,SIGNAL(detected(QString)), - this,SLOT(detectedShake(QString))); - thisGesture->startDetection(); - - //! [1] - - recognizerMap.insert(currentRecognizer,thisGesture); - - QString str = QString("<font size=+2><B>Started %1</b></font><br>").arg(currentRecognizer); - ui->textEdit->insertHtml(str); - ui->textEdit->ensureCursorVisible(); -} - -void MainWindow::on_stopPushButton_clicked() -{ - if (ui->treeWidget->currentItem() == 0) - return; - QString currentRecognizer; - - if (ui->treeWidget->currentItem()->childCount() == 0) { - currentRecognizer = ui->treeWidget->currentItem()->parent()->text(0); - } else { - currentRecognizer = ui->treeWidget->currentItem()->text(0); - } - - if (!recognizerMap.contains(currentRecognizer)) - return; - //! [2] - - recognizerMap[currentRecognizer]->stopDetection(); - - if (currentRecognizer == "QtSensors.shake") { - disconnect(recognizerMap[currentRecognizer],SIGNAL(shake()), - this,SLOT(onShake())); - } - disconnect(recognizerMap[currentRecognizer],SIGNAL(detected(QString)), - this,SLOT(detectedShake(QString))); - //! [2] - - recognizerMap.take(currentRecognizer); - - QString str = QString("<font size=+2><B>Stopped %1</b></font><br>").arg(currentRecognizer); - ui->textEdit->insertHtml(str); - ui->textEdit->ensureCursorVisible(); -} diff --git a/examples/sensors/sensorgestures/mainwindow.h b/examples/sensors/sensorgestures/mainwindow.h deleted file mode 100644 index 1e38f1be..00000000 --- a/examples/sensors/sensorgestures/mainwindow.h +++ /dev/null @@ -1,76 +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$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QtWidgets/QMainWindow> -#include <qsensorgesture.h> -QT_BEGIN_NAMESPACE -namespace Ui { - class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = 0); - ~MainWindow(); - -private: - Ui::MainWindow *ui; - QMap <QString, QSensorGesture *> recognizerMap; - -private slots: - void detectedShake(const QString&); - void onShake(); - - void on_pushButton_clicked(); - - void on_startPushButton_clicked(); - void on_stopPushButton_clicked(); -}; - - -QT_END_NAMESPACE - -#endif // MAINWINDOW_H diff --git a/examples/sensors/sensorgestures/mainwindow.ui b/examples/sensors/sensorgestures/mainwindow.ui deleted file mode 100644 index baccf98c..00000000 --- a/examples/sensors/sensorgestures/mainwindow.ui +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>423</width> - <height>474</height> - </rect> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralWidget"> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" colspan="2"> - <widget class="QTreeWidget" name="treeWidget"> - <column> - <property name="text"> - <string>Gesture Recognizer Id</string> - </property> - </column> - </widget> - </item> - <item row="1" column="0"> - <widget class="QPushButton" name="startPushButton"> - <property name="text"> - <string>Start</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="stopPushButton"> - <property name="text"> - <string>Stop</string> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <widget class="QTextEdit" name="textEdit"> - <property name="html"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;"> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string> - </property> - </widget> - </item> - <item row="3" column="0"> - <widget class="QPushButton" name="pushButton"> - <property name="text"> - <string>Clear</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QMenuBar" name="menuBar"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>423</width> - <height>22</height> - </rect> - </property> - </widget> - <widget class="QToolBar" name="mainToolBar"> - <attribute name="toolBarArea"> - <enum>TopToolBarArea</enum> - </attribute> - <attribute name="toolBarBreak"> - <bool>false</bool> - </attribute> - </widget> - <widget class="QStatusBar" name="statusBar"/> - </widget> - <layoutdefault spacing="6" margin="11"/> - <resources/> - <connections/> -</ui> diff --git a/examples/sensors/sensorgestures/sensorgestures.pro b/examples/sensors/sensorgestures/sensorgestures.pro deleted file mode 100644 index 295db944..00000000 --- a/examples/sensors/sensorgestures/sensorgestures.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = app -TARGET = gesture -QT += core gui sensors widgets - -SOURCES += main.cpp\ - mainwindow.cpp - -HEADERS += mainwindow.h - -FORMS += mainwindow.ui - -OTHER_FILES += \ - gesture.png diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro deleted file mode 100644 index 807203f2..00000000 --- a/examples/sensors/sensors.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - accel \ - accelbubble \ - cubehouse \ - grue \ - maze \ - qmlqtsensors \ - qmlsensorgestures \ - sensor_explorer \ - shakeit - -!isEmpty(QT.widgets.name):SUBDIRS += \ - sensorgestures - diff --git a/examples/sensors/shakeit/audio/loopy2a_mono.wav b/examples/sensors/shakeit/audio/loopy2a_mono.wav Binary files differdeleted file mode 100644 index 7d76cb65..00000000 --- a/examples/sensors/shakeit/audio/loopy2a_mono.wav +++ /dev/null diff --git a/examples/sensors/shakeit/audio/phone.wav b/examples/sensors/shakeit/audio/phone.wav Binary files differdeleted file mode 100644 index 884e9ac2..00000000 --- a/examples/sensors/shakeit/audio/phone.wav +++ /dev/null diff --git a/examples/sensors/shakeit/icon.png b/examples/sensors/shakeit/icon.png Binary files differdeleted file mode 100644 index d8f21546..00000000 --- a/examples/sensors/shakeit/icon.png +++ /dev/null diff --git a/examples/sensors/shakeit/images/triangle.png b/examples/sensors/shakeit/images/triangle.png Binary files differdeleted file mode 100644 index f366537e..00000000 --- a/examples/sensors/shakeit/images/triangle.png +++ /dev/null diff --git a/examples/sensors/shakeit/images/triangle2.png b/examples/sensors/shakeit/images/triangle2.png Binary files differdeleted file mode 100644 index 9318d5a3..00000000 --- a/examples/sensors/shakeit/images/triangle2.png +++ /dev/null diff --git a/examples/sensors/shakeit/images/triangle3.png b/examples/sensors/shakeit/images/triangle3.png Binary files differdeleted file mode 100644 index 4cc5ccda..00000000 --- a/examples/sensors/shakeit/images/triangle3.png +++ /dev/null diff --git a/examples/sensors/shakeit/info.json b/examples/sensors/shakeit/info.json deleted file mode 100644 index 1895469b..00000000 --- a/examples/sensors/shakeit/info.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "info-version": "1.0", - "dict": { - "DisplayName": "ShakeIt!", - "Identifier": "com.nokia.mt.shakeit", - "Runtime": "qml", - "MainQML": "shakeit.qml", - "Version": "1.0.0", - "Category": "application", - "Subcategory": "utility", - "Summary": "ShakeIt demonstrates the Qt5 QtSensor Gestures API" - } -} diff --git a/examples/sensors/shakeit/shakeit.pro b/examples/sensors/shakeit/shakeit.pro deleted file mode 100644 index 5c715418..00000000 --- a/examples/sensors/shakeit/shakeit.pro +++ /dev/null @@ -1,16 +0,0 @@ -TEMPLATE = aux - -app.files = \ - info.json \ - shakeit.qml \ - icon.png \ - audio \ - images - -MT_SYSROOT=$$(MT_SYSROOT) -!isEmpty(MT_SYSROOT):EXAMPLES_PREFIX=/opt/mt/applications -!isEmpty(EXAMPLES_PREFIX) { - app.path = $$EXAMPLES_PREFIX/com.nokia.mt.shakeit - INSTALLS = app -} - diff --git a/examples/sensors/shakeit/shakeit.qml b/examples/sensors/shakeit/shakeit.qml deleted file mode 100644 index e2a2254c..00000000 --- a/examples/sensors/shakeit/shakeit.qml +++ /dev/null @@ -1,324 +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:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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$ -** -****************************************************************************/ - -import QtQuick 2.0 -//! [0] -import QtSensors 5.0 -//! [0] -//import QtMultimedia 4.0 -import Qt.multimediakit 4.0 - - - -Rectangle { - id: window - - state: "default" - - Audio { - id :phone - source: "audio/phone.wav" //mono - } - Audio { - id :loopy2a_mono - source: "audio/loopy2a_mono.wav" //mono - } - - Text { - id: label - text: qsTr("Shake to rotate triangles") - y: parent.height / 4 - anchors.horizontalCenter: parent.horizontalCenter - } - Image { - id: triangle1 - smooth: true - source: "images/triangle.png" - x: parent.width / 2 - (triangle1.width / 2) - y: parent.height / 2 - (triangle1.height); - Behavior on x { SmoothedAnimation { velocity: 200 } } - Behavior on y { SmoothedAnimation { velocity: 200 } } - transform: Rotation { - id: myRot - } - } - Image { - id: triangle2 - smooth: true - source: "images/triangle2.png" - x: parent.width / 2 - (triangle1.width + triangle2.width / 2) - y: parent.height / 2 + (triangle2.height / 2); - Behavior on x { SmoothedAnimation { velocity: 200 } } - Behavior on y { SmoothedAnimation { velocity: 200 } } - } - Image { - id: triangle3 - smooth: true - source: "images/triangle3.png" - x: parent.width / 2 + (triangle1.width / 2) - y: parent.height / 2 + (triangle3.height / 2); - - Behavior on x { SmoothedAnimation { velocity: 200 } } - Behavior on y { SmoothedAnimation { velocity: 200 } } - } - - states: [ - State { - name: "rotated" - PropertyChanges { target: triangle1; rotation: 180 } - PropertyChanges { target: triangle2; rotation: 90 } - PropertyChanges { target: triangle3; rotation: 270 } - }, - State { - name: "default" - PropertyChanges { target: triangle1; rotation: 0; - x: parent.width / 2 - (triangle1.width / 2) - y: parent.height / 2 - (triangle1.height); - } - PropertyChanges { target: triangle2; rotation: 0; - x: parent.width / 2 - (triangle1.width + triangle2.width / 2) - y: parent.height / 2 + (triangle2.height / 2); - } - PropertyChanges { target: triangle3; rotation: 0; - x: parent.width / 2 + (triangle1.width / 2) - y: parent.height / 2 + (triangle3.height / 2); - } - }, - State { - name: "whipped" - PropertyChanges { target: triangle1; rotation: 0; x:0; } - PropertyChanges { target: triangle2; rotation: 0; x:0; y:triangle1.x + triangle1.height; } - PropertyChanges { target: triangle3; rotation: 0; x:0; - y: triangle2.y + triangle2.height; } - }, - State { - name: "twistedR" - PropertyChanges { target: triangle1; rotation: 270; - x:window.width - triangle1.width; - } - PropertyChanges { target: triangle2; rotation: 180; - x:window.width - triangle2.width; - } - PropertyChanges { target: triangle3; rotation: 90; - x:window.width - triangle3.width; - y:triangle2.y + triangle2.height; - } - }, - State { - name: "twistedL" - PropertyChanges { target: triangle1; rotation: 270; - x:0; - } - PropertyChanges { target: triangle2; rotation: 180; - x:0; - } - PropertyChanges { target: triangle3; rotation: 90; - x:0; - y:triangle2.y + triangle2.height; - } - }, - State { - name: "covered" - PropertyChanges { target: triangle1; rotation: 0; - x: window.width / 3 - triangle1.width / 2; - y: window.height - triangle1.height; - } - PropertyChanges { target: triangle2; rotation: 0; - x: window.width / 2 - triangle2.width / 2; // middle - y: window.height - triangle2.height; - } - PropertyChanges { target: triangle3; rotation: 0; - x: (window.width / 3 + window.width / 3) - triangle3.width / 2; - y: window.height - triangle3.height; - } - }, - State { - name: "hovered" - PropertyChanges { target: triangle1; rotation: 90; - x: window.width / 3 - triangle1.width / 2; - y: triangle1.height; - } - PropertyChanges { target: triangle2; rotation: 270; - x: window.width / 2 - triangle2.width / 2; // middle - y: triangle2.height; - } - PropertyChanges { target: triangle3; rotation: 195; - x: (window.width / 3 + window.width / 3) - triangle3.width / 2; - y: triangle3.height - } - }, - State { - name :"slammed" - PropertyChanges { target: triangle1; rotation: 0; - x: 0; - y: 0 + 30 - } - PropertyChanges { target: triangle2; rotation: 0; - x: window.width - triangle2.width; - y: 0 + 30 - ;} - PropertyChanges { target: triangle3; rotation: 0; - x: window.width / 2 - triangle3.width / 2; - y:window.height - triangle3.height; - } - }, - State { - name: "doubletapped" - PropertyChanges { target: triangle1; rotation: 114; - transformOrigin: Item.BottomLeft - } - PropertyChanges { target: triangle2; rotation: 120; - transformOrigin: Item.BottomLeft - } - } - ] - - - transitions: [ - Transition { - - ParallelAnimation { - NumberAnimation { properties: "x,y"; easing.type: Easing.OutBounce;duration: 2000; } - RotationAnimation { id: t1Rotation; target: triangle1; duration: 1000; - direction: RotationAnimation.Clockwise } - RotationAnimation { id: t2Rotation; target: triangle2; duration: 2000; - direction: RotationAnimation.Counterclockwise } - RotationAnimation { id: t3Rotation; target: triangle3; duration: 2000; - direction: RotationAnimation.Clockwise } - } - - }, Transition { - to: "slammed" - SequentialAnimation { - NumberAnimation { properties: "x"; easing.type: Easing.OutBounce;duration: 500; } - - } - }, Transition { - to: "doubletapped" - SequentialAnimation { - PropertyAction { target: triangle1; property: "transformOrigin" } - PropertyAction { target: triangle2; property: "transformOrigin" } - NumberAnimation { target: triangle1; properties: "rotation"; easing.type: Easing.OutBounce;duration: 500; } - NumberAnimation { target: triangle2; properties: "rotation"; easing.type: Easing.OutBounce;duration: 1500; } - } - }, Transition { - from: "doubletapped" - SequentialAnimation { - NumberAnimation { properties: "rotation"; easing.type: Easing.OutBounce;duration: 1500; } - PropertyAction { target: triangle1; property: "transformOrigin" } - PropertyAction { target: triangle2; property: "transformOrigin" } - } - } - ] - -//! [1] - SensorGesture { -//! [1] - id: sensorGesture -//! [3] - enabled: true -//! [3] -//! [2] - gestures : ["QtSensors.shake", "QtSensors.whip", "QtSensors.twist", "QtSensors.cover", - "QtSensors.hover", "QtSensors.turnover", "QtSensors.pickup", "QtSensors.slam" , "QtSensors.doubletap"] -//! [2] -//! [4] - onDetected:{ - console.debug(gesture) - label.text = gesture - - if (gesture == "shake") { - window.state == "rotated" ? window.state = "default" : window.state = "rotated" - timer.start() - } - if (gesture == "whip") { - window.state == "whipped" ? window.state = "default" : window.state = "whipped" - timer.start() - } - if (gesture == "twistRight") { - window.state == "twistedR" ? window.state = "default" : window.state = "twistedR" - timer.start() - } - if (gesture == "twistLeft") { - window.state == "twistedL" ? window.state = "default" : window.state = "twistedL" - timer.start() - } - if (gesture == "cover") { - window.state == "covered" ? window.state = "default" : window.state = "covered" - timer.start() - } - if (gesture == "hover") { - window.state == "hovered" ? window.state = "default" : window.state = "hovered" - timer.start() - } - if (gesture == "turnover") { - window.state = "default" - loopy2a_mono.play(); - timer.start() - } - if (gesture == "pickup") { - window.state = "default" - phone.play() - timer.start() - } - if (gesture == "slam") { - window.state == "slammed" ? window.state = "default" : window.state = "slammed" - timer.start() - } - if (gesture == "doubletap") { - window.state == "doubletapped" ? window.state = "default" : window.state = "doubletapped" - timer.start() - } - } -//! [4] - } - Timer { - id: timer - running: false - repeat: false - interval: 3000 - onTriggered: { - console.log("timer triggered") - window.state = "default" - label.text = "Try another gesture" - } - } -} |