diff options
Diffstat (limited to 'basicsuite/sensors')
-rw-r--r-- | basicsuite/sensors/1.png | bin | 33675 -> 0 bytes | |||
-rw-r--r-- | basicsuite/sensors/2.png | bin | 27754 -> 0 bytes | |||
-rw-r--r-- | basicsuite/sensors/3.png | bin | 27841 -> 0 bytes | |||
-rw-r--r-- | basicsuite/sensors/Accelbubble.qml | 137 | ||||
-rw-r--r-- | basicsuite/sensors/Light.qml | 87 | ||||
-rw-r--r-- | basicsuite/sensors/bluebubble.png | bin | 12815 -> 0 bytes | |||
-rw-r--r-- | basicsuite/sensors/description.txt | 3 | ||||
-rw-r--r-- | basicsuite/sensors/exclude.txt | 2 | ||||
-rw-r--r-- | basicsuite/sensors/main.qml | 109 | ||||
-rw-r--r-- | basicsuite/sensors/preview_l.jpg | bin | 43733 -> 0 bytes | |||
-rw-r--r-- | basicsuite/sensors/sensors.pro | 13 | ||||
-rw-r--r-- | basicsuite/sensors/title.txt | 1 |
12 files changed, 0 insertions, 352 deletions
diff --git a/basicsuite/sensors/1.png b/basicsuite/sensors/1.png Binary files differdeleted file mode 100644 index 8dd146b..0000000 --- a/basicsuite/sensors/1.png +++ /dev/null diff --git a/basicsuite/sensors/2.png b/basicsuite/sensors/2.png Binary files differdeleted file mode 100644 index 362abaf..0000000 --- a/basicsuite/sensors/2.png +++ /dev/null diff --git a/basicsuite/sensors/3.png b/basicsuite/sensors/3.png Binary files differdeleted file mode 100644 index c8d3f8c..0000000 --- a/basicsuite/sensors/3.png +++ /dev/null diff --git a/basicsuite/sensors/Accelbubble.qml b/basicsuite/sensors/Accelbubble.qml deleted file mode 100644 index cff693b..0000000 --- a/basicsuite/sensors/Accelbubble.qml +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of the examples of the Qt Enterprise Embedded. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtSensors 5.0 - -Rectangle { - id: area - color: "lightblue" - border.width: 1 - border.color: "darkblue" - property real velocityX: 0 - property real velocityY: 0 - - // Calculate effective rotation - function getRotation() { - var rot = rotation - var newParent = parent - - while (newParent) { - rot += newParent.rotation - newParent = newParent.parent - } - return rot%360 - } - - function updatePosition() { - var actualRotation = getRotation(); - - // Transform accelerometer readings according - // to actual rotation of item - if (actualRotation == 0) { - velocityX -= accel.reading.x - velocityY += accel.reading.y - } else if (actualRotation == 90 || actualRotation == -270) { - velocityX += accel.reading.y - velocityY += accel.reading.x - } else if (actualRotation == 180 || actualRotation == -180) { - velocityX += accel.reading.x - velocityY -= accel.reading.y - } else if (actualRotation == 270 || actualRotation == -90) { - velocityX -= accel.reading.y - velocityY -= accel.reading.x - } else { - console.debug("The screen rotation of the device has to be a multiple of 90 degrees.") - } - - velocityX *= 0.95 - velocityY *= 0.95 - - var newX = bubble.x + velocityX - var newY = bubble.y + velocityY - var right = area.width - bubble.width - var bottom = area.height - bubble.height - - if (newX < 0) { - newX = 0 - velocityX = -velocityX * 0.9 - } - if (newY < 0) { - newY = 0 - velocityY = -velocityY * 0.9 - } - - if (newX > right) { - newX = right - velocityX = -velocityX * 0.9 - } - if (newY > bottom) { - newY = bottom - velocityY = -velocityY * 0.9 - } - - bubble.x = newX - bubble.y = newY - } - - Accelerometer { - id: accel - active:true - } - - Component.onCompleted: timer.running = true - - Timer { - id: timer - interval: 16 - running: false - repeat: true - onTriggered: updatePosition() - } - - Image { - id: bubble - source: "bluebubble.png" - smooth: true - x: parent.width/2 - bubble.width/2 - y: parent.height/2 - bubble.height/2 - } -} diff --git a/basicsuite/sensors/Light.qml b/basicsuite/sensors/Light.qml deleted file mode 100644 index c92dabc..0000000 --- a/basicsuite/sensors/Light.qml +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of the examples of the Qt Enterprise Embedded. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtSensors 5.0 - -Rectangle { - id: bg - Image { - id: avatar - width: parent.width * 0.9 - height: parent.height * 0.9 - fillMode: Image.PreserveAspectFit - anchors.centerIn: parent - } - Text { - id: illuminanceLevel - font.pointSize: 20 - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 60 - } - - AmbientLightSensor { - active: true - onReadingChanged: { - if (reading.lightLevel === AmbientLightReading.Dark) { - avatar.source = "3.png" - bg.color = "#1947A3" - } else if (reading.lightLevel === AmbientLightReading.Twilight - || reading.lightLevel === AmbientLightReading.Light) { - avatar.source = "2.png" - bg.color = "steelblue" - } else if (reading.lightLevel === AmbientLightReading.Bright - || reading.lightLevel === AmbientLightReading.Sunny) { - avatar.source = "1.png" - bg.color = "#FFFF75" - } else { - avatar.text = "Unknown light level" - } - } - } - - LightSensor { - active: true - onReadingChanged: { - illuminanceLevel.text = "Illuminance: " + reading.illuminance.toFixed(2); - } - } -} diff --git a/basicsuite/sensors/bluebubble.png b/basicsuite/sensors/bluebubble.png Binary files differdeleted file mode 100644 index f96126e..0000000 --- a/basicsuite/sensors/bluebubble.png +++ /dev/null diff --git a/basicsuite/sensors/description.txt b/basicsuite/sensors/description.txt deleted file mode 100644 index e306066..0000000 --- a/basicsuite/sensors/description.txt +++ /dev/null @@ -1,3 +0,0 @@ -Demonstrates using the accelerometer and light sensors in a QML application. - -Tilting the device moves the bubble around, based on readings from the accelerometer sensor. For the light sensor, exposing the device to different lighting conditions changes the displayed image. diff --git a/basicsuite/sensors/exclude.txt b/basicsuite/sensors/exclude.txt deleted file mode 100644 index 3945bcb..0000000 --- a/basicsuite/sensors/exclude.txt +++ /dev/null @@ -1,2 +0,0 @@ -all - diff --git a/basicsuite/sensors/main.qml b/basicsuite/sensors/main.qml deleted file mode 100644 index 71af99d..0000000 --- a/basicsuite/sensors/main.qml +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of the examples of the Qt Enterprise Embedded. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.0 -import QtSensors 5.0 -import QtSensors 5.0 as Sensors - -Rectangle { - id: root - anchors.fill: parent - - Component { - id: sensorExample - Rectangle { - id: main - width: root.width - height: root.height - anchors.centerIn: parent - color: "blue" - border.width: 1 - Accelbubble { - id: bubble - width: parent.width / 2 - height: parent.height - } - Light { - anchors.left: bubble.right - width: parent.width / 2 - height: parent.height - } - - } - } - - Component { - id: message - Rectangle { - width: root.width - height: root.height - color: "black" - Text { - font.pixelSize: 80 - width: parent.width * 0.8 - anchors.centerIn: parent - color: "white" - text: "It appears that this device doesn't provide the required sensors!" - wrapMode: Text.WordWrap - } - } - } - - Loader { - id: pageLoader - anchors.centerIn: parent - } - - Component.onCompleted: { - var typesList = Sensors.QmlSensors.sensorTypes(); - var count = 0 - for (var i = 0; i < typesList.length; ++i) { - if (typesList[i] == "QAccelerometer") - count++ - if (typesList[i] == "QLightSensor") - count++ - } - - if (count > 1) - pageLoader.sourceComponent = sensorExample - else - pageLoader.sourceComponent = message - } -} diff --git a/basicsuite/sensors/preview_l.jpg b/basicsuite/sensors/preview_l.jpg Binary files differdeleted file mode 100644 index 9d0d88c..0000000 --- a/basicsuite/sensors/preview_l.jpg +++ /dev/null diff --git a/basicsuite/sensors/sensors.pro b/basicsuite/sensors/sensors.pro deleted file mode 100644 index 0b431b8..0000000 --- a/basicsuite/sensors/sensors.pro +++ /dev/null @@ -1,13 +0,0 @@ -TARGET = sensors - -include(../shared/shared.pri) -b2qtdemo_deploy_defaults() - -content.files = \ - *.qml \ - *.png -content.path = $$DESTPATH - -OTHER_FILES += $${content.files} - -INSTALLS += target content
\ No newline at end of file diff --git a/basicsuite/sensors/title.txt b/basicsuite/sensors/title.txt deleted file mode 100644 index a3a5b97..0000000 --- a/basicsuite/sensors/title.txt +++ /dev/null @@ -1 +0,0 @@ -140. Sensors Demo |