summaryrefslogtreecommitdiffstats
path: root/examples/sensors
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sensors')
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/plugin.pro27
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp78
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h64
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.cpp89
-rw-r--r--examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h70
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/Button.qml129
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/Gesture.qml113
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/GestureList.qml131
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/GestureView.qml146
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml156
-rwxr-xr-xexamples/sensors/qmlsensorgestures/qml_app/icon.pngbin0 -> 2298 bytes
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/info.json14
-rw-r--r--examples/sensors/qmlsensorgestures/qml_app/qml_app.qmlproject18
-rw-r--r--examples/sensors/qmlsensorgestures/qmlsensorgestures.pro5
-rw-r--r--examples/sensors/sensors.pro8
15 files changed, 1045 insertions, 3 deletions
diff --git a/examples/sensors/qmlsensorgestures/plugin/plugin.pro b/examples/sensors/qmlsensorgestures/plugin/plugin.pro
new file mode 100644
index 00000000..ab250884
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/plugin.pro
@@ -0,0 +1,27 @@
+TEMPLATE = lib
+CONFIG += plugin
+
+TARGET = qtsensorgestures_counterplugin
+
+QT += sensors
+DESTDIR = $$QT.sensors.plugins/sensorgestures
+
+# Input
+HEADERS += \
+ qcountergestureplugin.h \
+ qcounterrecognizer.h
+SOURCES += \
+ qcountergestureplugin.cpp \
+ qcounterrecognizer.cpp
+
+target.path += $$[QT_INSTALL_PLUGINS]/sensorgestures
+INSTALLS += target
+
+
+
+
+
+
+
+
+
diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp
new file mode 100644
index 00000000..21b819aa
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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;
+}
+
+Q_EXPORT_PLUGIN2(QCounterGestureRecognizer, QCounterGesturePlugin)
+
diff --git a/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h
new file mode 100644
index 00000000..33075f43
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/qcountergestureplugin.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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, QSensorGesturePluginInterface
+{
+ Q_OBJECT
+ 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
new file mode 100644
index 00000000..0856f734
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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
new file mode 100644
index 00000000..5a7464e9
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/plugin/qcounterrecognizer.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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
new file mode 100644
index 00000000..311dd166
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/Button.qml
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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
new file mode 100644
index 00000000..0e41578a
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/Gesture.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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
+ onSelectedGestureChanged: {
+ gesture.enabled = false;
+ gesture.gestureid = gestureList.selectedGesture;
+ 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
new file mode 100644
index 00000000..6edfd4c9
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/GestureList.qml
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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
+
+ ListView {
+ id: gestureList
+ anchors.fill: gestureListRect
+ anchors.margins: 5
+ model: gesture.availableGestures
+ focus: true
+ currentIndex: -1
+ delegate: gestureListDelegate
+ }
+
+ 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
new file mode 100644
index 00000000..324b90e2
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/GestureView.qml
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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: gestureStartStopButton | |
+| ------------------------------ |
+---------------------------------------
+*/
+
+Rectangle {
+ id: gesturerect
+ border.width: 1
+ anchors.margins: 5
+ property alias gestureid: sensorGuesture.gestures
+ property alias gesturetitle: titleText.text
+ property alias enabled: sensorGuesture.enabled
+ property string oldgesture: ""
+ property int count: 0
+
+ SensorGesture {
+ id: sensorGuesture
+ enabled: false
+ onDetected:{
+ if (gesture !== oldgesture)
+ count = 0;
+ valueText.text = gesture + " " + count;
+ oldgesture = gesture;
+ count++;
+ }
+ onEnabledChanged: {
+ valueText.text = ""
+ }
+ }
+
+ 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: 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/GesturesView.qml b/examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml
new file mode 100644
index 00000000..c20caf14
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/GesturesView.qml
@@ -0,0 +1,156 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the 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: ["QtSensors.shake", "QtSensors.SecondCounter"]
+ 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
new file mode 100755
index 00000000..c445bd7f
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/icon.png
Binary files differ
diff --git a/examples/sensors/qmlsensorgestures/qml_app/info.json b/examples/sensors/qmlsensorgestures/qml_app/info.json
new file mode 100644
index 00000000..39a62190
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/info.json
@@ -0,0 +1,14 @@
+{
+ "info-version": "1.0",
+ "dict": {
+ "Category": "application",
+ "Runtime": "qml",
+ "DisplayName": "Gesture",
+ "Subcategory": "utility",
+ "MainQML": "Gesture.qml",
+ "Version": "1.0",
+ "Identifier": "com.nokia.mt.qmlsensorsgesture.demo",
+ "Summary": "QML Sensors Gesture demo",
+ "Author": "Qt"
+ }
+}
diff --git a/examples/sensors/qmlsensorgestures/qml_app/qml_app.qmlproject b/examples/sensors/qmlsensorgestures/qml_app/qml_app.qmlproject
new file mode 100644
index 00000000..90245a62
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qml_app/qml_app.qmlproject
@@ -0,0 +1,18 @@
+import QmlProject 1.1
+
+Project {
+ mainFile: "Gesture.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+ JavaScriptFiles {
+ directory: "."
+ }
+ ImageFiles {
+ directory: "."
+ }
+ /* List of plugin directories passed to QML runtime */
+ // importPaths: [ "../exampleplugin" ]
+}
diff --git a/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro b/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro
new file mode 100644
index 00000000..46b8228d
--- /dev/null
+++ b/examples/sensors/qmlsensorgestures/qmlsensorgestures.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS += plugin
+SUBDIRS += #qml_app
+
diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro
index 50b5fac0..7a79b5f5 100644
--- a/examples/sensors/sensors.pro
+++ b/examples/sensors/sensors.pro
@@ -1,9 +1,11 @@
TEMPLATE = subdirs
SUBDIRS += \
- accel\
+ accel \
grue \
+ qmlsensorgestures
+
+contains(QT_CONFIG,widgets):SUBDIRS += \
+ sensor_explorer \
sensorgestures
-#contains(QT_CONFIG,widgets):SUBDIRS += \
- # sensor_explorer \