summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas McGuire <thomas.mcguire.qnx@kdab.com>2012-07-31 12:05:34 +0200
committerLorn Potter <lorn.potter@gmail.com>2012-11-30 00:32:34 +0100
commitf6397fa8d8d5d9128adbf2874057fe925367ecb7 (patch)
tree4abe207142d032c875905facef225dac9e7f56cd
parentc8a5b1494dfa26173eca1ac6ff2cca9ea6b41b85 (diff)
Introduce a QOrientableSensorBase class.
All axes-based sensor and the compass now inherit from this class. It allows adapting the reading values based on the current screen orientation. AxesOrientationMode enum must be replicated in all child classes for it to work in QML. Unfortunetely the blackberry NDK was released to public with this BIC change so the only way to upstream the blackberry sensors plugins in a BC manner is to #ifdef it out on !qnx platforms. Change-Id: I3c49fcc5a116a9ce4f314a95097be637a2e88567 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
-rw-r--r--src/sensors/qaccelerometer.h25
-rw-r--r--src/sensors/qcompass.h26
-rw-r--r--src/sensors/qgyroscope.h25
-rw-r--r--src/sensors/qmagnetometer.h26
-rw-r--r--src/sensors/qorientablesensorbase.cpp227
-rw-r--r--src/sensors/qorientablesensorbase.h102
-rw-r--r--src/sensors/qrotationsensor.h27
-rw-r--r--src/sensors/sensors.pro6
8 files changed, 463 insertions, 1 deletions
diff --git a/src/sensors/qaccelerometer.h b/src/sensors/qaccelerometer.h
index c518734460..bc20935ea1 100644
--- a/src/sensors/qaccelerometer.h
+++ b/src/sensors/qaccelerometer.h
@@ -43,6 +43,7 @@
#define QACCELEROMETER_H
#include "qsensor.h"
+#include "qorientablesensorbase.h"
QTM_BEGIN_NAMESPACE
@@ -77,8 +78,17 @@ private:
class QAccelerometerPrivate;
class Q_SENSORS_EXPORT QAccelerometer : public QSensor
+#if defined(Q_OS_BLACKBERRY)
+, public QOrientableSensorBase
+#endif
{
Q_OBJECT
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
+
Q_ENUMS(AccelerationMode)
Q_PROPERTY(AccelerationMode accelerationMode READ accelerationMode WRITE setAccelerationMode
NOTIFY accelerationModeChanged)
@@ -86,6 +96,15 @@ public:
explicit QAccelerometer(QObject *parent = 0);
virtual ~QAccelerometer();
+#if defined(Q_MOC_RUN) && defined(Q_OS_BLACKBERRY)
+ // Enums must be replicated in child classes to work in QML
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+ Q_ENUMS(AxesOrientationMode)
+#endif
enum AccelerationMode {
Gravity,
User,
@@ -105,7 +124,11 @@ public slots:
signals:
void accelerationModeChanged(AccelerationMode accelerationMode);
-
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#endif
private:
friend class QAccelerometerPrivate;
QAccelerometerPrivate *d_func() const;
diff --git a/src/sensors/qcompass.h b/src/sensors/qcompass.h
index 940042e64f..093b5c36d0 100644
--- a/src/sensors/qcompass.h
+++ b/src/sensors/qcompass.h
@@ -43,6 +43,7 @@
#define QCOMPASS_H
#include "qsensor.h"
+#include "qorientablesensorbase.h"
QTM_BEGIN_NAMESPACE
@@ -71,13 +72,38 @@ private:
};
class Q_SENSORS_EXPORT QCompass : public QSensor
+#if defined(Q_OS_BLACKBERRY)
+, public QOrientableSensorBase
+#endif
{
Q_OBJECT
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
+
public:
+#if defined(Q_MOC_RUN) && defined(Q_OS_BLACKBERRY)
+ // Enums must be replicated in child classes to work in QML
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+ Q_ENUMS(AxesOrientationMode)
+#endif
explicit QCompass(QObject *parent = 0) : QSensor(QCompass::type, parent) {}
virtual ~QCompass() {}
QCompassReading *reading() const { return static_cast<QCompassReading*>(QSensor::reading()); }
static char const * const type;
+
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+Q_SIGNALS:
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#endif
};
QTM_END_NAMESPACE
diff --git a/src/sensors/qgyroscope.h b/src/sensors/qgyroscope.h
index 42318751f5..4b52f0a43a 100644
--- a/src/sensors/qgyroscope.h
+++ b/src/sensors/qgyroscope.h
@@ -43,6 +43,7 @@
#define QGYROSCOPE_H
#include "qsensor.h"
+#include "qorientablesensorbase.h"
QTM_BEGIN_NAMESPACE
@@ -75,13 +76,37 @@ private:
};
class Q_SENSORS_EXPORT QGyroscope : public QSensor
+#if defined(Q_OS_BLACKBERRY)
+, public QOrientableSensorBase
+#endif
{
Q_OBJECT
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
public:
+#if defined(Q_MOC_RUN) && defined(Q_OS_BLACKBERRY)
+ // Enums must be replicated in child classes to work in QML
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+ Q_ENUMS(AxesOrientationMode)
+#endif
explicit QGyroscope(QObject *parent = 0) : QSensor(QGyroscope::type, parent) {}
virtual ~QGyroscope() {}
QGyroscopeReading *reading() const { return static_cast<QGyroscopeReading*>(QSensor::reading()); }
static char const * const type;
+
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+Q_SIGNALS:
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#endif
};
QTM_END_NAMESPACE
diff --git a/src/sensors/qmagnetometer.h b/src/sensors/qmagnetometer.h
index 2bca354759..fbdc99c9f4 100644
--- a/src/sensors/qmagnetometer.h
+++ b/src/sensors/qmagnetometer.h
@@ -43,6 +43,7 @@
#define QMAGNETOMETER_H
#include "qsensor.h"
+#include "qorientablesensorbase.h"
QTM_BEGIN_NAMESPACE
@@ -79,16 +80,41 @@ private:
};
class Q_SENSORS_EXPORT QMagnetometer : public QSensor
+#if defined(Q_OS_BLACKBERRY)
+, public QOrientableSensorBase
+#endif
{
Q_OBJECT
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
+
#ifdef Q_QDOC
Q_PROPERTY(bool returnGeoValues)
#endif
+
public:
+#if defined(Q_MOC_RUN) && defined(Q_OS_BLACKBERRY)
+ // Enums must be replicated in child classes to work in QML
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+ Q_ENUMS(AxesOrientationMode)
+#endif
explicit QMagnetometer(QObject *parent = 0) : QSensor(QMagnetometer::type, parent) {}
virtual ~QMagnetometer() {}
QMagnetometerReading *reading() const { return static_cast<QMagnetometerReading*>(QSensor::reading()); }
static char const * const type;
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+Q_SIGNALS:
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#endif
};
QTM_END_NAMESPACE
diff --git a/src/sensors/qorientablesensorbase.cpp b/src/sensors/qorientablesensorbase.cpp
new file mode 100644
index 0000000000..84eaf55d08
--- /dev/null
+++ b/src/sensors/qorientablesensorbase.cpp
@@ -0,0 +1,227 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qorientablesensorbase.h"
+#include <QObject>
+
+QTM_BEGIN_NAMESPACE
+
+class QOrientableSensorBasePrivate
+{
+public:
+ QOrientableSensorBasePrivate()
+ : axesOrientationMode(QOrientableSensorBase::FixedOrientation),
+ currentOrientation(0),
+ userOrientation(0)
+ {
+ }
+
+ QOrientableSensorBase::AxesOrientationMode axesOrientationMode;
+ int currentOrientation;
+ int userOrientation;
+};
+
+/*!
+ \class QOrientableSensorBase
+ \ingroup sensors_main
+ \inmodule QtSensors
+
+ \brief The QOrientableSensorBase class is the base class for all sensors that react to screen
+ orientation changes.
+
+ All sensors based on this class support changing the reporting of the reading values based
+ on the orientation of the screen. This is controlled by the axesOrientationMode property, which
+ controls how the orientation affects the reading values.
+
+ In the default mode, QOrientableSensorBase::FixedOrientation, the reading values remain
+ unaffected by the orientation. In the QOrientableSensorBase::AutomaticOrientation mode, the reading
+ values are automatically rotated by taking the current screen orientation into account. And
+ finally, in the QOrientableSensorBase::UserOrientation mode, the reading values are rotated
+ according to a user-specified orientation.
+
+ The functionality of this is only available if it is supported by the backend, which can be
+ checked by calling QSensor::isFeatureSupported() with the QSensor::AxesOrientation flag.
+
+ The orientation here is always the screen orientation, not the device orientation. The orientation
+ values range from 0 to 270 degrees. The orientation is applied in clockwise direction.
+ Note that when rotating a device by 90 degrees counter-clockwise, the screen orientation compensates for
+ that by rotating 90 degrees to the right.
+*/
+
+/*!
+ \enum QOrientableSensorBase::AxesOrientationMode
+
+ Describes how reading values are affected by the screen orientation.
+
+ \value FixedOrientation No automatic rotation is applied to the reading values.
+
+ \value AutomaticOrientation The reading values are automatically rotated based on the screen
+ orientation.
+
+ \value UserOrientation The reading values are rotated based on the angle of the userOrientation property.
+
+ \sa QOrientableSensorBase::axesOrientationMode
+*/
+
+/*!
+ Constructs a QOrientableSensorBase.
+ */
+QOrientableSensorBase::QOrientableSensorBase()
+ : d(new QOrientableSensorBasePrivate)
+{
+}
+
+/*!
+ Destroys a QOrientableSensorBase.
+ */
+QOrientableSensorBase::~QOrientableSensorBase()
+{
+ delete d;
+ d = 0;
+}
+
+/*!
+ \property QOrientableSensorBase::axesOrientationMode
+ \brief The mode that affects how the screen orientation changes reading values.
+
+ When set to FixedOrientation, which is the default mode, no automatic rotation is applied to
+ the reading. This is the only mode available for backends that do not support the
+ QSensor::AxesOrientation feature.
+
+ When set to AutomaticOrientation, the reading values are automatically rotated when the
+ screen orientation changes. In effect, the screen orientation is canceled out.
+
+ As an example, assume the device is rotated by 180 degrees and therefore the screen orientation
+ also is rotated by 180 degrees from the native orientation. Without automatic axes orientation,
+ the reading values would now be changed: Both the X and the Y values would be negated, forcing
+ an application developer to manually cancel out the negation in application code. Automatic
+ axes orientation does this automatically, in this mode the X and Y values would be the same as
+ with the default screen orientation.
+
+ This automatic rotation of the axes is handy is some usecases, for example in a bubble level
+ application that measures how level a surface is by looking at the X axis value of an
+ accelerometer. When the device and screen orientation change by 90 degrees, an application
+ developer does not need to change anything, he can continue using the X axis value even though
+ the device is rotated. Without automatic axes orientation, the application developer would need
+ to look at the Y values instead, thereby adding code to the application that reads from a
+ different axis depending on the screen orientation.
+
+ The UserOrientation mode is quite similar to AutomaticOrientation, only that the screen orientation
+ is manually controlled instead of automatically determined. The angle of the userOrientation
+ property is then used for rotating the reading values.
+
+ Since the rotation of the reading values is based on the screen orientation, Z values will never
+ change, as the Z axis is perpendicular to the screen.
+ As screen orientation changes in 90 degree steps, rotating the reading values is also done in
+ steps of 90 degrees.
+*/
+
+void QOrientableSensorBase::setAxesOrientationMode(QOrientableSensorBase::AxesOrientationMode axesOrientationMode)
+{
+ if (d->axesOrientationMode != axesOrientationMode) {
+ d->axesOrientationMode = axesOrientationMode;
+ emit axesOrientationModeChanged(axesOrientationMode);
+ }
+}
+
+QOrientableSensorBase::AxesOrientationMode QOrientableSensorBase::axesOrientationMode() const
+{
+ return d->axesOrientationMode;
+}
+
+/*!
+ \property QOrientableSensorBase::currentOrientation
+ \brief The current orientation that is used for rotating the reading values.
+
+ This might not be the same as the screen orientation. For example, in the FixedOrientation mode,
+ the reading values are not rotated, and therefore the property is 0.
+
+ In the UserOrientation mode, the readings are rotated based on the userOrientation property,
+ and therefore this property is equal to the userOrientation property.
+
+ In the AutomaticOrientation mode, the readings are rotated based on the screen orientation,
+ and therefore this property will be equal to the current screen orientation.
+
+ This property is set by the backend.
+*/
+
+int QOrientableSensorBase::currentOrientation() const
+{
+ return d->currentOrientation;
+}
+
+/*!
+ Sets the current screen orientation to \a currentOrientation. This is to be called from the
+ backend whenever the screen orientation or the userOrientation property changes.
+ */
+void QOrientableSensorBase::setCurrentOrientation(int currentOrientation)
+{
+ if (d->currentOrientation != currentOrientation) {
+ d->currentOrientation = currentOrientation;
+ emit currentOrientationChanged(currentOrientation);
+ }
+}
+
+/*!
+ \property QOrientableSensorBase::userOrientation
+ \brief The angle used for rotating the reading values in the UserOrientation mode.
+
+ When the axesOrientationMode property is set to UserOrientation, the angle for rotating the
+ reading values is taken from this property. In other modes, the property has no effect.
+
+ The default is 0. The only valid values are 0, 90, 180 and 270, as those are the only possible
+ screen orientations.
+*/
+
+void QOrientableSensorBase::setUserOrientation(int userOrientation)
+{
+ if (d->userOrientation != userOrientation) {
+ d->userOrientation = userOrientation;
+ emit userOrientationChanged(userOrientation);
+ }
+}
+
+int QOrientableSensorBase::userOrientation() const
+{
+ return d->userOrientation;
+}
+
+QTM_END_NAMESPACE
diff --git a/src/sensors/qorientablesensorbase.h b/src/sensors/qorientablesensorbase.h
new file mode 100644
index 0000000000..baa9b1d5b0
--- /dev/null
+++ b/src/sensors/qorientablesensorbase.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion <blackberry-qt@qnx.com>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QORIENTABLESENSORBASE_H
+#define QORIENTABLESENSORBASE_H
+
+#include <qmobilityglobal.h>
+
+#if defined(Q_OS_BLACKBERRY)
+
+QTM_BEGIN_NAMESPACE
+
+class QOrientableSensorBasePrivate;
+
+class Q_SENSORS_EXPORT QOrientableSensorBase
+{
+public:
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+
+#ifdef Q_QDOC
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
+
+ QOrientableSensorBase();
+ virtual ~QOrientableSensorBase();
+
+ AxesOrientationMode axesOrientationMode() const;
+ void setAxesOrientationMode(AxesOrientationMode axesOrientationMode);
+
+ int currentOrientation() const;
+ void setCurrentOrientation(int currentOrientation);
+
+ int userOrientation() const;
+ void setUserOrientation(int userOrientation);
+
+protected:
+ // Signals which will be implemented by moc in the subclass
+#ifdef Q_QDOC
+Q_SIGNALS:
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#else
+ virtual void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode) = 0;
+ virtual void currentOrientationChanged(int currentOrientation) = 0;
+ virtual void userOrientationChanged(int userOrientation) = 0;
+#endif
+
+private:
+ QOrientableSensorBasePrivate *d;
+ friend class QOrientableSensorBasePrivate;
+};
+
+QTM_END_NAMESPACE
+
+#endif // Q_OS_BLACKBERRY
+
+#endif // QORIENTABLESENSORBASE_H
diff --git a/src/sensors/qrotationsensor.h b/src/sensors/qrotationsensor.h
index a2e124a2fe..4515832c78 100644
--- a/src/sensors/qrotationsensor.h
+++ b/src/sensors/qrotationsensor.h
@@ -43,6 +43,7 @@
#define QROTATIONSENSOR_H
#include "qsensor.h"
+#include "qorientablesensorbase.h"
QTM_BEGIN_NAMESPACE
@@ -75,16 +76,42 @@ private:
};
class Q_SENSORS_EXPORT QRotationSensor : public QSensor
+#if defined(Q_OS_BLACKBERRY)
+, public QOrientableSensorBase
+#endif
{
Q_OBJECT
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+ Q_PROPERTY(AxesOrientationMode axesOrientationMode READ axesOrientationMode WRITE setAxesOrientationMode NOTIFY axesOrientationModeChanged)
+ Q_PROPERTY(int currentOrientation READ currentOrientation NOTIFY currentOrientationChanged)
+ Q_PROPERTY(int userOrientation READ userOrientation WRITE setUserOrientation NOTIFY userOrientationChanged)
+#endif
+
#ifdef Q_QDOC
Q_PROPERTY(bool hasZ)
#endif
+
public:
+#if defined(Q_MOC_RUN) && defined(Q_OS_BLACKBERRY)
+ // Enums must be replicated in child classes to work in QML
+ enum AxesOrientationMode {
+ FixedOrientation,
+ AutomaticOrientation,
+ UserOrientation
+ };
+ Q_ENUMS(AxesOrientationMode)
+#endif
explicit QRotationSensor(QObject *parent = 0) : QSensor(QRotationSensor::type, parent) {}
virtual ~QRotationSensor() {}
QRotationReading *reading() const { return static_cast<QRotationReading*>(QSensor::reading()); }
static char const * const type;
+
+#if !defined(Q_QDOC) && defined(Q_OS_BLACKBERRY)
+Q_SIGNALS:
+ void axesOrientationModeChanged(AxesOrientationMode axesOrientationMode);
+ void currentOrientationChanged(int currentOrientation);
+ void userOrientationChanged(int userOrientation);
+#endif
};
QTM_END_NAMESPACE
diff --git a/src/sensors/sensors.pro b/src/sensors/sensors.pro
index f9f587991b..971e160229 100644
--- a/src/sensors/sensors.pro
+++ b/src/sensors/sensors.pro
@@ -35,6 +35,9 @@ PUBLIC_HEADERS += \
qsensorbackend.h\
qsensormanager.h\
qsensorplugin.h
+blackberry {
+ PUBLIC_HEADERS += qorientablesensorbase.h
+}
PRIVATE_HEADERS += \
qsensorpluginloader_p.h\
@@ -45,6 +48,9 @@ SOURCES += qsensorbackend.cpp\
qsensorplugin.cpp\
qsensorpluginloader.cpp
+blackberry {
+ SOURCES += qorientablesensorbase.cpp
+}
# 3 files per sensor (including QSensor)
SENSORS=\