summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/examples.pro2
-rw-r--r--examples/sensor-checker/content/SensorInformationItem.qml83
-rw-r--r--examples/sensor-checker/images/NOTICE.txt6
-rw-r--r--examples/sensor-checker/images/mainmenu.pngbin0 -> 33332 bytes
-rw-r--r--examples/sensor-checker/main.cpp59
-rw-r--r--examples/sensor-checker/main.qml150
-rw-r--r--examples/sensor-checker/sensor-checker-default.qrc7
-rw-r--r--examples/sensor-checker/sensor-checker-tizen.qrc5
-rw-r--r--examples/sensor-checker/sensor-checker.pro27
-rw-r--r--examples/sensor-checker/tizen/qt.conf6
10 files changed, 344 insertions, 1 deletions
diff --git a/examples/examples.pro b/examples/examples.pro
index 48b59a4..1875716 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,3 +1,3 @@
TEMPLATE=subdirs
-SUBDIRS+= touch twitter
+SUBDIRS+= touch twitter sensor-checker
diff --git a/examples/sensor-checker/content/SensorInformationItem.qml b/examples/sensor-checker/content/SensorInformationItem.qml
new file mode 100644
index 0000000..7393921
--- /dev/null
+++ b/examples/sensor-checker/content/SensorInformationItem.qml
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+import QtQuick 2.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Tizen 1.0
+import QtQuick.Controls.Styles.Tizen 1.0
+import QtQuick.Layouts 1.0
+
+Panel {
+ id:root
+ width: parent.width -30
+ height: childrenRect.height
+ x:15
+
+ property alias title: switchLabel.text
+ property alias informationText: compassLabel.text
+ property alias sensorActive: sensorSwitch.checked
+
+ RowLayout {
+ anchors.margins: 10
+ id: switchRow
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+ Label {
+ id: switchLabel
+ color: TizenConfig.colors.foreground
+ text: "Compass"
+ height: 50
+ Layout.fillWidth: true
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ font.family: TizenConfig.fonts.defaultFamily
+ font.pixelSize: parent.height/2
+ fontSizeMode: Text.Fit
+ }
+ Switch {
+ id: sensorSwitch
+ checked: false
+ }
+ }
+ Label {
+ id: compassLabel
+ anchors.margins: 10
+ color: TizenConfig.colors.foreground
+ text: "Sensor inactive"
+ anchors.top: switchRow.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ height: 50
+ Layout.fillWidth: true
+ verticalAlignment: Text.AlignVCenter
+ horizontalAlignment: Text.AlignLeft
+ font.family: TizenConfig.fonts.defaultFamily
+ font.pixelSize: parent.height/2
+ fontSizeMode: Text.Fit
+ }
+}
diff --git a/examples/sensor-checker/images/NOTICE.txt b/examples/sensor-checker/images/NOTICE.txt
new file mode 100644
index 0000000..3939a3a
--- /dev/null
+++ b/examples/sensor-checker/images/NOTICE.txt
@@ -0,0 +1,6 @@
+mainmenu.png icon contains modified Compass Icon from
+
+Artist: Aha-Soft (Available for custom work - http://www.aha-soft.com)
+Iconset: Large Travel Icons (3 icons)
+License: Free for non-commercial use.
+Commercial usage: Not allowed
diff --git a/examples/sensor-checker/images/mainmenu.png b/examples/sensor-checker/images/mainmenu.png
new file mode 100644
index 0000000..a593114
--- /dev/null
+++ b/examples/sensor-checker/images/mainmenu.png
Binary files differ
diff --git a/examples/sensor-checker/main.cpp b/examples/sensor-checker/main.cpp
new file mode 100644
index 0000000..ebc2e85
--- /dev/null
+++ b/examples/sensor-checker/main.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2013 Tomasz Olszak <olszak.tomasz@gmail.com>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+
+ * 1. Redistributions of source code must retain the copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#include <QGuiApplication>
+#include <QQuickWindow>
+#include <QtDebug>
+#include <QtGlobal>
+#include <QQmlApplicationEngine>
+#include <QScreen>
+#include <QQuickItem>
+extern "C" int OspMain(int argc, char *argv[])
+{
+#ifdef Q_OS_TIZEN_SIMULATOR
+ qputenv("QML_BAD_GUI_RENDER_LOOP","1");
+#endif
+ qputenv("QT_QUICK_CONTROLS_STYLE","Tizen");
+ QGuiApplication app(argc,argv);
+
+ QQmlApplicationEngine engine(QUrl("qrc:///main.qml"));
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(engine.rootObjects().at(0));
+ if (window) {
+ window->setIcon(QIcon(":/images/mainmenu.png"));
+ window->screen()->setOrientationUpdateMask(Qt::PortraitOrientation | Qt::LandscapeOrientation |
+ Qt::InvertedPortraitOrientation | Qt::InvertedLandscapeOrientation);
+ window->show();
+ return app.exec();
+ } else {
+ qWarning() << "null window";
+ return -1;
+ }
+}
+
+int main(int argc, char *argv[]) {
+ return OspMain(argc,argv);
+}
diff --git a/examples/sensor-checker/main.qml b/examples/sensor-checker/main.qml
new file mode 100644
index 0000000..e159afe
--- /dev/null
+++ b/examples/sensor-checker/main.qml
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Tomasz Olszak.
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls 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 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.1
+import QtQuick.Controls 1.0
+import QtQuick.Controls.Tizen 1.0
+import QtQuick.Controls.Styles.Tizen 1.0
+import QtQuick.Window 2.0
+import QtQuick.Layouts 1.0
+import QtSensors 5.1
+import "content"
+
+ApplicationWindow {
+ id: appWindow
+ y: 60
+ width: 720
+ height: 1220
+ property real curlValue: 0.05
+
+ Accelerometer {
+ id:accelerometer
+ active: accelerometerItem.sensorActive
+ }
+
+ RotationSensor {
+ id:rotationSensor
+ active: rotationItem.sensorActive
+ }
+ Compass {
+ id: compass
+ active: compassItem.sensorActive
+ }
+ Accelerometer {
+ id: gravitySensor
+ active: gravityItem.sensorActive
+ }
+ Gyroscope {
+ id: gyroscope
+ active: gyroscopeItem.sensorActive
+ }
+ LightSensor {
+ id: lightSensor
+ active: lightSensorItem.sensorActive
+ }
+ Magnetometer {
+ id: magnetometer
+ active: magnetometerItem.sensorActive
+ }
+ ProximitySensor {
+ id: proximitySensor
+ active: proximityItem.sensorActive
+ }
+
+ VisualItemModel {
+ id: sensorItemModel
+ SensorInformationItem {
+ id: rotationItem
+ title: qsTr("Rotation sensor")
+ informationText: rotationSensor.active ? ("x:" + rotationSensor.reading.x + ", y:" + rotationSensor.reading.y + ", z:" + rotationSensor.reading.z) : "Rotation sensor inactive"
+ }
+ SensorInformationItem {
+ id: compassItem
+ title: qsTr("Compass")
+ informationText: compass.active ? ("azimuth:" + compass.reading.azimuth + ", calibrationLevel:" +compass.reading.calibrationLevel) : "Compass inactive"
+ }
+ SensorInformationItem {
+ id: accelerometerItem
+ title: qsTr("Accelerometer")
+ informationText: accelerometer.active ? ("x:" + accelerometer.reading.x + ", y:" + accelerometer.reading.y + ", z:" + accelerometer.reading.z) : "Accelerometer inactive"
+ }
+ SensorInformationItem {
+ id: gravityItem
+ title: qsTr("Gravity Sensor")
+ informationText: gravitySensor.active ? ("x:" + gravitySensor.reading.x + ", y:" + gravitySensor.reading.y + ", z:" + gravitySensor.reading.z) : "Gravity sensor inactive"
+ }
+ SensorInformationItem {
+ id: gyroscopeItem
+ title: qsTr("Gyroscope")
+ informationText: gyroscope.active ? ("x:" + gyroscope.reading.x + ", y:" + gyroscope.reading.y + ", z:" + gyroscope.reading.z) : "Gyroscope inactive"
+ }
+ SensorInformationItem {
+ id: lightSensorItem
+ title: qsTr("Light sensor")
+ informationText: lightSensor.active ? ("illuminance:" + lightSensor.reading.illuminance) : "Light sensor inactive"
+ }
+ SensorInformationItem {
+ id: magnetometerItem
+ title: qsTr("Magnetometer")
+ informationText: magnetometer.active ? ("x:" + magnetometer.reading.x + ", y:" + magnetometer.reading.y + ", z:" + magnetometer.reading.z + ", calibrationLevel:"+magnetometer.reading.calibrationLevel) : "Magnetometer inactive"
+ }
+ SensorInformationItem {
+ id: proximityItem
+ title: qsTr("Proximity sensor")
+ informationText: proximitySensor.active ? ("near:" + proximitySensor.reading.near) : "Proximity sensor inactive"
+ }
+ }
+
+ View {
+ id: content
+ anchors.fill: parent
+
+ titleBar.text: qsTr("Qt Sensor Checker")
+
+ backAction.onTriggered: Qt.quit()
+ ListView {
+ clip: true
+ anchors.fill: parent
+ model: sensorItemModel
+ ScrollDecorator {flickableItem: parent}
+ }
+ }
+
+}
diff --git a/examples/sensor-checker/sensor-checker-default.qrc b/examples/sensor-checker/sensor-checker-default.qrc
new file mode 100644
index 0000000..7e51f44
--- /dev/null
+++ b/examples/sensor-checker/sensor-checker-default.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>content/SensorInformationItem.qml</file>
+ <file>images/mainmenu.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/sensor-checker/sensor-checker-tizen.qrc b/examples/sensor-checker/sensor-checker-tizen.qrc
new file mode 100644
index 0000000..a172726
--- /dev/null
+++ b/examples/sensor-checker/sensor-checker-tizen.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/qt/etc">
+ <file alias="qt.conf">tizen/qt.conf</file>
+ </qresource>
+</RCC>
diff --git a/examples/sensor-checker/sensor-checker.pro b/examples/sensor-checker/sensor-checker.pro
new file mode 100644
index 0000000..43fcc79
--- /dev/null
+++ b/examples/sensor-checker/sensor-checker.pro
@@ -0,0 +1,27 @@
+TEMPLATE=app
+
+tizen {
+ QMAKE_LFLAGS+=-pie -rdynamic
+ TARGET=QtSensorChecker.exe
+} else {
+ TARGET=QtSensorChecker
+}
+
+QT += qml quick
+
+OTHER_FILES += \
+ main.qml \
+ tizen/qt.conf \
+ content/SensorInformationItem.qml
+
+SOURCES += \
+ main.cpp
+
+
+RESOURCES += sensor-checker-default.qrc
+
+tizen: RESOURCES += sensor-checker-tizen.qrc
+
+
+
+
diff --git a/examples/sensor-checker/tizen/qt.conf b/examples/sensor-checker/tizen/qt.conf
new file mode 100644
index 0000000..1020361
--- /dev/null
+++ b/examples/sensor-checker/tizen/qt.conf
@@ -0,0 +1,6 @@
+[Paths]
+Prefix=/opt/usr/apps/QtSensorsC
+Libraries=lib
+Binaries=bin
+Plugins=data/plugins
+Qml2Imports=data/qml