From 4e04cda0e600f4e3bb148956ba631647a5c1fa4c Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Tue, 4 Oct 2011 15:14:01 +1000 Subject: Grue Sensor example Updated, documented as an example. Now with a QML import and a QML app. Fixes: MTMW-85 Change-Id: I06772cf4a07ea0d2ec7bfccda6e8f51b5d866c20 Reviewed-on: http://codereview.qt-project.org/6016 Reviewed-by: Lincoln Ramsay --- examples/sensors/grue/console_app/console_app.pro | 5 + examples/sensors/grue/console_app/main.cpp | 89 ++++++++++++++ examples/sensors/grue/grue.pro | 8 ++ examples/sensors/grue/import/import.pro | 19 +++ examples/sensors/grue/import/main.cpp | 117 ++++++++++++++++++ examples/sensors/grue/import/qmldir | 1 + examples/sensors/grue/import/qsensorsimport.pri | 38 ++++++ examples/sensors/grue/lib/gruesensor.cpp | 137 +++++++++++++++++++++ examples/sensors/grue/lib/gruesensor.h | 79 ++++++++++++ examples/sensors/grue/lib/gruesensor_p.h | 66 ++++++++++ examples/sensors/grue/lib/lib.pro | 17 +++ examples/sensors/grue/plugin/gruesensorimpl.cpp | 135 ++++++++++++++++++++ examples/sensors/grue/plugin/gruesensorimpl.h | 74 +++++++++++ examples/sensors/grue/plugin/main.cpp | 82 +++++++++++++ examples/sensors/grue/plugin/plugin.pro | 20 +++ examples/sensors/grue/qml_app/main.qml | 75 ++++++++++++ examples/sensors/grue/qml_app/qml_app.qmlproject | 20 +++ examples/sensors/grueapp/grueapp.pro | 5 - examples/sensors/grueapp/main.cpp | 89 -------------- examples/sensors/grueplugin/grueplugin.pri | 8 -- examples/sensors/grueplugin/grueplugin.pro | 15 --- examples/sensors/grueplugin/gruesensor.cpp | 143 ---------------------- examples/sensors/grueplugin/gruesensor.h | 79 ------------ examples/sensors/grueplugin/gruesensor_p.h | 66 ---------- examples/sensors/grueplugin/gruesensorimpl.cpp | 135 -------------------- examples/sensors/grueplugin/gruesensorimpl.h | 74 ----------- examples/sensors/grueplugin/main.cpp | 82 ------------- examples/sensors/grueplugin/version.pri | 1 - examples/sensors/sensors.pro | 3 +- 29 files changed, 983 insertions(+), 699 deletions(-) create mode 100644 examples/sensors/grue/console_app/console_app.pro create mode 100644 examples/sensors/grue/console_app/main.cpp create mode 100644 examples/sensors/grue/grue.pro create mode 100644 examples/sensors/grue/import/import.pro create mode 100644 examples/sensors/grue/import/main.cpp create mode 100644 examples/sensors/grue/import/qmldir create mode 100644 examples/sensors/grue/import/qsensorsimport.pri create mode 100644 examples/sensors/grue/lib/gruesensor.cpp create mode 100644 examples/sensors/grue/lib/gruesensor.h create mode 100644 examples/sensors/grue/lib/gruesensor_p.h create mode 100644 examples/sensors/grue/lib/lib.pro create mode 100644 examples/sensors/grue/plugin/gruesensorimpl.cpp create mode 100644 examples/sensors/grue/plugin/gruesensorimpl.h create mode 100644 examples/sensors/grue/plugin/main.cpp create mode 100644 examples/sensors/grue/plugin/plugin.pro create mode 100644 examples/sensors/grue/qml_app/main.qml create mode 100644 examples/sensors/grue/qml_app/qml_app.qmlproject delete mode 100644 examples/sensors/grueapp/grueapp.pro delete mode 100644 examples/sensors/grueapp/main.cpp delete mode 100644 examples/sensors/grueplugin/grueplugin.pri delete mode 100644 examples/sensors/grueplugin/grueplugin.pro delete mode 100644 examples/sensors/grueplugin/gruesensor.cpp delete mode 100644 examples/sensors/grueplugin/gruesensor.h delete mode 100644 examples/sensors/grueplugin/gruesensor_p.h delete mode 100644 examples/sensors/grueplugin/gruesensorimpl.cpp delete mode 100644 examples/sensors/grueplugin/gruesensorimpl.h delete mode 100644 examples/sensors/grueplugin/main.cpp delete mode 100644 examples/sensors/grueplugin/version.pri (limited to 'examples/sensors') diff --git a/examples/sensors/grue/console_app/console_app.pro b/examples/sensors/grue/console_app/console_app.pro new file mode 100644 index 00000000..fefc0157 --- /dev/null +++ b/examples/sensors/grue/console_app/console_app.pro @@ -0,0 +1,5 @@ +TEMPLATE=app +TARGET=detect_grue +QT=core sensors +SOURCES=main.cpp + diff --git a/examples/sensors/grue/console_app/main.cpp b/examples/sensors/grue/console_app/main.cpp new file mode 100644 index 00000000..789e6451 --- /dev/null +++ b/examples/sensors/grue/console_app/main.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 +#include + +class Filter : public QSensorFilter +{ + int lastPercent; +public: + Filter() + : QSensorFilter() + , lastPercent(0) + { + } + + bool filter(QSensorReading *reading) + { + int percent = reading->property("chanceOfBeingEaten").value() * 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 new file mode 100644 index 00000000..5af352bc --- /dev/null +++ b/examples/sensors/grue/grue.pro @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000..fc163b61 --- /dev/null +++ b/examples/sensors/grue/import/import.pro @@ -0,0 +1,19 @@ +TARGET = declarative_grue +TARGETPATH = Grue + +include(qsensorsimport.pri) + +QT = declarative sensors + +DESTDIR = $$QT.sensors.imports/$$TARGETPATH + +INCLUDEPATH += $$PWD/../lib +LIBS += -L$$OUT_PWD/../lib -lgruesensor + +SOURCES = main.cpp + +symbian { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = ALL -TCB +} + diff --git a/examples/sensors/grue/import/main.cpp b/examples/sensors/grue/import/main.cpp new file mode 100644 index 00000000..ec1d4709 --- /dev/null +++ b/examples/sensors/grue/import/main.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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: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 +#include + +#include + +QT_BEGIN_NAMESPACE + +class GrueSensorQmlImport : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +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 (package, major, minor, "GrueSensor"); + qmlRegisterUncreatableType(package, major, minor, "GrueSensorReading", QLatin1String("Cannot create GrueSensorReading")); + } +}; + +QT_END_NAMESPACE + +#include "main.moc" + +Q_EXPORT_PLUGIN2(gruesensorqmlimport, QT_PREPEND_NAMESPACE(GrueSensorQmlImport)); + +/*! + \qmlclass GrueSensor GrueSensor + \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} +*/ + +/*! + \qmlproperty GrueSensorReading Grue1::GrueSensor::reading + Holds the most recent Grue sensor reading. + Please see QSensor::reading for information about this property. +*/ + +/*! + \qmlsignal Grue1::GrueSensor::onReadingChanged() + Called when the reading object changes. + Please see QSensor::readingChanged() for information about this signal. +*/ + +/*! + \qmlclass GrueSensorReading GrueSensorReading + \inqmlmodule Grue 1 + \inherits QtMobility.sensors1::SensorReading + \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/qmldir b/examples/sensors/grue/import/qmldir new file mode 100644 index 00000000..266b7c11 --- /dev/null +++ b/examples/sensors/grue/import/qmldir @@ -0,0 +1 @@ +plugin declarative_grue diff --git a/examples/sensors/grue/import/qsensorsimport.pri b/examples/sensors/grue/import/qsensorsimport.pri new file mode 100644 index 00000000..d5cfeffc --- /dev/null +++ b/examples/sensors/grue/import/qsensorsimport.pri @@ -0,0 +1,38 @@ +load(qt_module) + +symbian:load(qt_plugin) +TEMPLATE = lib +CONFIG += qt plugin + +win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release + +isEmpty(TARGETPATH) { + error("qimportbase.pri: You must provide a TARGETPATH!") +} +isEmpty(TARGET) { + error("qimportbase.pri: You must provide a TARGET!") +} + +QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir +copy2build.input = QMLDIRFILE +copy2build.output = $$QT.sensors.imports/$$TARGETPATH/qmldir +!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS +copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} +copy2build.name = COPY ${QMAKE_FILE_IN} +copy2build.CONFIG += no_link +# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir +copy2build.CONFIG += no_clean +QMAKE_EXTRA_COMPILERS += copy2build + +TARGET = $$qtLibraryTarget($$TARGET) +contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols + +load(qt_targets) + +wince*:LIBS += $$QMAKE_LIBS_GUI + +symbian: { + TARGET.EPOCALLOWDLLDATA=1 + TARGET.CAPABILITY = All -Tcb + load(armcc_warnings) +} diff --git a/examples/sensors/grue/lib/gruesensor.cpp b/examples/sensors/grue/lib/gruesensor.cpp new file mode 100644 index 00000000..da322cb3 --- /dev/null +++ b/examples/sensors/grue/lib/gruesensor.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 1) that a Grue will eat you. + A probability of 1 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. +*/ + +qreal GrueSensorReading::chanceOfBeingEaten() const +{ + return d->chanceOfBeingEaten; +} + +void GrueSensorReading::setChanceOfBeingEaten(qreal 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 new file mode 100644 index 00000000..52b08e95 --- /dev/null +++ b/examples/sensors/grue/lib/gruesensor.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 + +class GrueSensorReadingPrivate; + +class GrueSensorReading : public QSensorReading +{ + Q_OBJECT + Q_PROPERTY(qreal chanceOfBeingEaten READ chanceOfBeingEaten WRITE setChanceOfBeingEaten) + DECLARE_READING(GrueSensorReading) +public: + qreal chanceOfBeingEaten() const; + void setChanceOfBeingEaten(qreal chanceOfBeingEaten); +}; + +// begin generated code + +class GrueFilter : public QSensorFilter +{ +public: + virtual bool filter(GrueSensorReading *reading) = 0; +private: + bool filter(QSensorReading *reading) { return filter(static_cast(reading)); } +}; + +class GrueSensor : public QSensor +{ + Q_OBJECT +public: + explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::type, parent) {} + virtual ~GrueSensor() {} + GrueSensorReading *reading() const { return static_cast(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 new file mode 100644 index 00000000..5eff57e8 --- /dev/null +++ b/examples/sensors/grue/lib/gruesensor_p.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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.0) + { + } + + qreal chanceOfBeingEaten; +}; + +#endif diff --git a/examples/sensors/grue/lib/lib.pro b/examples/sensors/grue/lib/lib.pro new file mode 100644 index 00000000..80bf1365 --- /dev/null +++ b/examples/sensors/grue/lib/lib.pro @@ -0,0 +1,17 @@ +TEMPLATE = lib +TARGET = gruesensor + +QT = core sensors + +HEADERS += gruesensor.h\ + gruesensor_p.h\ + +SOURCES += gruesensor.cpp\ + +DESTDIR=$$QT.sensors.libs + +symbian { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = ALL -TCB +} + diff --git a/examples/sensors/grue/plugin/gruesensorimpl.cpp b/examples/sensors/grue/plugin/gruesensorimpl.cpp new file mode 100644 index 00000000..4a277c91 --- /dev/null +++ b/examples/sensors/grue/plugin/gruesensorimpl.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 +#include + +char const * const gruesensorimpl::id("grue.gruesensor"); + +gruesensorimpl::gruesensorimpl(QSensor *sensor) + : QSensorBackend(sensor) +{ + // 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(&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() +{ + qreal chance = 0.0; + darkTimer->stop(); + + switch (lightSensor->reading()->lightLevel()) { + case QAmbientLightReading::Dark: + // It is dark. You are likely to be eaten by a grue. + chance = 0.1; + 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 + qreal chance = m_reading.chanceOfBeingEaten() + 0.1; + + m_reading.setTimestamp(timer.elapsed()); + m_reading.setChanceOfBeingEaten(chance); + + newReadingAvailable(); + + // No point in using the timer anymore if we've hit 1... you can't get more + // likely to be eaten than 100% + if (chance == 1.0) + darkTimer->stop(); +} + diff --git a/examples/sensors/grue/plugin/gruesensorimpl.h b/examples/sensors/grue/plugin/gruesensorimpl.h new file mode 100644 index 00000000..bddca842 --- /dev/null +++ b/examples/sensors/grue/plugin/gruesensorimpl.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 +#include "gruesensor.h" +#include +#include + +class QTimer; + +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; +}; + +#endif + diff --git a/examples/sensors/grue/plugin/main.cpp b/examples/sensors/grue/plugin/main.cpp new file mode 100644 index 00000000..d471ece3 --- /dev/null +++ b/examples/sensors/grue/plugin/main.cpp @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Mobility Components. +** +** $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 +#include +#include +#include +#include + +class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory +{ + Q_OBJECT + 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; + } +}; + +Q_EXPORT_PLUGIN2(libsensors_grueplugin, GrueSensorPlugin); + +#include "main.moc" + diff --git a/examples/sensors/grue/plugin/plugin.pro b/examples/sensors/grue/plugin/plugin.pro new file mode 100644 index 00000000..fed8460b --- /dev/null +++ b/examples/sensors/grue/plugin/plugin.pro @@ -0,0 +1,20 @@ +TEMPLATE = lib +CONFIG += plugin +TARGET = $$qtLibraryTarget(qtsensors_grue) +PLUGIN_TYPE = sensors + +QT = core sensors + +INCLUDEPATH += $$PWD/../lib +LIBS += -L$$QT.sensors.libs -lgruesensor + +HEADERS += gruesensorimpl.h\ + +SOURCES += gruesensorimpl.cpp\ + main.cpp\ + +symbian { + TARGET.EPOCALLOWDLLDATA = 1 + TARGET.CAPABILITY = ALL -TCB +} + diff --git a/examples/sensors/grue/qml_app/main.qml b/examples/sensors/grue/qml_app/main.qml new file mode 100644 index 00000000..278bf727 --- /dev/null +++ b/examples/sensors/grue/qml_app/main.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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 examples 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 Grue 1.0 + +Item { + width: 200 + height: 300 + + GrueSensor { + id: sensor + active: true + property int lastPercent: 0 + onReadingChanged: { + var percent = Math.floor(reading.chanceOfBeingEaten * 100); + if (percent == 0) { + text.text = "It is light. You are safe from Grues."; + } else if (lastPercent == 0) { + text.text = "It is dark. You are likely to be eaten by a Grue."; + } + if (percent == 100) { + text.text += "You have been eaten by a Grue!"; + sensor.active = false; + } else if (percent) { + text.text += "Your chance of being eaten by a Grue: "+percent+" percent."; + } + lastPercent = percent; + } + } + + Text { + id: text + anchors.fill: parent + 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 + } +} diff --git a/examples/sensors/grue/qml_app/qml_app.qmlproject b/examples/sensors/grue/qml_app/qml_app.qmlproject new file mode 100644 index 00000000..2218c43d --- /dev/null +++ b/examples/sensors/grue/qml_app/qml_app.qmlproject @@ -0,0 +1,20 @@ +/* File generated by Qt Creator, version 2.2.0 */ + +import QmlProject 1.1 + +Project { + mainFile: "main.qml" + + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ "../exampleplugin" ] +} diff --git a/examples/sensors/grueapp/grueapp.pro b/examples/sensors/grueapp/grueapp.pro deleted file mode 100644 index 65d59be1..00000000 --- a/examples/sensors/grueapp/grueapp.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE=app -TARGET=grueapp -QT=core sensors -SOURCES=main.cpp - diff --git a/examples/sensors/grueapp/main.cpp b/examples/sensors/grueapp/main.cpp deleted file mode 100644 index 789e6451..00000000 --- a/examples/sensors/grueapp/main.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 -#include - -class Filter : public QSensorFilter -{ - int lastPercent; -public: - Filter() - : QSensorFilter() - , lastPercent(0) - { - } - - bool filter(QSensorReading *reading) - { - int percent = reading->property("chanceOfBeingEaten").value() * 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/grueplugin/grueplugin.pri b/examples/sensors/grueplugin/grueplugin.pri deleted file mode 100644 index 2cade0f0..00000000 --- a/examples/sensors/grueplugin/grueplugin.pri +++ /dev/null @@ -1,8 +0,0 @@ -HEADERS += gruesensor.h\ - gruesensor_p.h\ - gruesensorimpl.h\ - -SOURCES += gruesensor.cpp\ - gruesensorimpl.cpp\ - main.cpp\ - diff --git a/examples/sensors/grueplugin/grueplugin.pro b/examples/sensors/grueplugin/grueplugin.pro deleted file mode 100644 index 0b39f910..00000000 --- a/examples/sensors/grueplugin/grueplugin.pro +++ /dev/null @@ -1,15 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -TARGET = $$qtLibraryTarget(qtsensors_grueplugin) -PLUGIN_TYPE = sensors - -QT = core sensors - -include(version.pri) -include(grueplugin.pri) - -symbian { - TARGET.EPOCALLOWDLLDATA = 1 - TARGET.CAPABILITY = ALL -TCB -} - diff --git a/examples/sensors/grueplugin/gruesensor.cpp b/examples/sensors/grueplugin/gruesensor.cpp deleted file mode 100644 index c5ee030f..00000000 --- a/examples/sensors/grueplugin/gruesensor.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 - \ingroup sensors_reading - - \preliminary - \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 1) that a Grue will eat you. - A probability of 1 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. -*/ - -qreal GrueSensorReading::chanceOfBeingEaten() const -{ - return d->chanceOfBeingEaten; -} - -void GrueSensorReading::setChanceOfBeingEaten(qreal chanceOfBeingEaten) -{ - d->chanceOfBeingEaten = chanceOfBeingEaten; -} - -// ===================================================================== - -// begin generated code - -/*! - \class GrueFilter - \ingroup sensors_filter - - \preliminary - \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 - \ingroup sensors_type - - \preliminary - \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/grueplugin/gruesensor.h b/examples/sensors/grueplugin/gruesensor.h deleted file mode 100644 index 52b08e95..00000000 --- a/examples/sensors/grueplugin/gruesensor.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 - -class GrueSensorReadingPrivate; - -class GrueSensorReading : public QSensorReading -{ - Q_OBJECT - Q_PROPERTY(qreal chanceOfBeingEaten READ chanceOfBeingEaten WRITE setChanceOfBeingEaten) - DECLARE_READING(GrueSensorReading) -public: - qreal chanceOfBeingEaten() const; - void setChanceOfBeingEaten(qreal chanceOfBeingEaten); -}; - -// begin generated code - -class GrueFilter : public QSensorFilter -{ -public: - virtual bool filter(GrueSensorReading *reading) = 0; -private: - bool filter(QSensorReading *reading) { return filter(static_cast(reading)); } -}; - -class GrueSensor : public QSensor -{ - Q_OBJECT -public: - explicit GrueSensor(QObject *parent = 0) : QSensor(GrueSensor::type, parent) {} - virtual ~GrueSensor() {} - GrueSensorReading *reading() const { return static_cast(QSensor::reading()); } - static char const * const type; -}; -// end generated code - -#endif diff --git a/examples/sensors/grueplugin/gruesensor_p.h b/examples/sensors/grueplugin/gruesensor_p.h deleted file mode 100644 index 5eff57e8..00000000 --- a/examples/sensors/grueplugin/gruesensor_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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.0) - { - } - - qreal chanceOfBeingEaten; -}; - -#endif diff --git a/examples/sensors/grueplugin/gruesensorimpl.cpp b/examples/sensors/grueplugin/gruesensorimpl.cpp deleted file mode 100644 index 4a277c91..00000000 --- a/examples/sensors/grueplugin/gruesensorimpl.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 -#include - -char const * const gruesensorimpl::id("grue.gruesensor"); - -gruesensorimpl::gruesensorimpl(QSensor *sensor) - : QSensorBackend(sensor) -{ - // 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(&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() -{ - qreal chance = 0.0; - darkTimer->stop(); - - switch (lightSensor->reading()->lightLevel()) { - case QAmbientLightReading::Dark: - // It is dark. You are likely to be eaten by a grue. - chance = 0.1; - 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 - qreal chance = m_reading.chanceOfBeingEaten() + 0.1; - - m_reading.setTimestamp(timer.elapsed()); - m_reading.setChanceOfBeingEaten(chance); - - newReadingAvailable(); - - // No point in using the timer anymore if we've hit 1... you can't get more - // likely to be eaten than 100% - if (chance == 1.0) - darkTimer->stop(); -} - diff --git a/examples/sensors/grueplugin/gruesensorimpl.h b/examples/sensors/grueplugin/gruesensorimpl.h deleted file mode 100644 index bddca842..00000000 --- a/examples/sensors/grueplugin/gruesensorimpl.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 -#include "gruesensor.h" -#include -#include - -class QTimer; - -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; -}; - -#endif - diff --git a/examples/sensors/grueplugin/main.cpp b/examples/sensors/grueplugin/main.cpp deleted file mode 100644 index d471ece3..00000000 --- a/examples/sensors/grueplugin/main.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the examples of the Qt Mobility Components. -** -** $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 -#include -#include -#include -#include - -class GrueSensorPlugin : public QObject, public QSensorPluginInterface, public QSensorChangesInterface, public QSensorBackendFactory -{ - Q_OBJECT - 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; - } -}; - -Q_EXPORT_PLUGIN2(libsensors_grueplugin, GrueSensorPlugin); - -#include "main.moc" - diff --git a/examples/sensors/grueplugin/version.pri b/examples/sensors/grueplugin/version.pri deleted file mode 100644 index 6fbe0253..00000000 --- a/examples/sensors/grueplugin/version.pri +++ /dev/null @@ -1 +0,0 @@ -VERSION = 0.1.1 diff --git a/examples/sensors/sensors.pro b/examples/sensors/sensors.pro index 04033fcf..e7ecf2ca 100644 --- a/examples/sensors/sensors.pro +++ b/examples/sensors/sensors.pro @@ -3,8 +3,7 @@ TEMPLATE = subdirs SUBDIRS += \ accel\ cubehouse\ - grueapp\ - grueplugin + grue contains(QT_CONFIG,widgets):SUBDIRS += \ sensor_explorer -- cgit v1.2.3