|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qorientationsensor.h" |
|
43 #include "qorientationsensor_p.h" |
|
44 |
|
45 QTM_BEGIN_NAMESPACE |
|
46 |
|
47 IMPLEMENT_READING(QOrientationReading) |
|
48 |
|
49 /*! |
|
50 \class QOrientationReading |
|
51 \ingroup sensors_reading |
|
52 |
|
53 \preliminary |
|
54 \brief The QOrientationReading class represents one reading from the |
|
55 orientation sensor. |
|
56 |
|
57 \section2 QOrientationReading Units |
|
58 The orientation sensor returns the orientation of the device using |
|
59 the pre-defined values found in the QOrientationReading::Orientation |
|
60 enum. |
|
61 */ |
|
62 |
|
63 /*! |
|
64 \enum QOrientationReading::Orientation |
|
65 |
|
66 This enum represents the orientation of the device. |
|
67 |
|
68 The parts of the phone are defined as follows. |
|
69 |
|
70 \code |
|
71 Top |
|
72 |
|
73 |
|
74 ---------- |
|
75 / NOKIA /| |
|
76 /-------- / | |
|
77 // // / |
|
78 // // / |
|
79 Left // Face // / Right |
|
80 // // / |
|
81 // // / |
|
82 /---------/ / |
|
83 / O / / |
|
84 / / / |
|
85 ---------- / |
|
86 |_________!/ |
|
87 |
|
88 |
|
89 Bottom |
|
90 \endcode |
|
91 |
|
92 \value Undefined The orientation is unknown. |
|
93 \value BottomUp The device is upside down. |
|
94 \value BottomDown The device is the right way up. |
|
95 \value LeftUp The device has been rotated clockwise. |
|
96 \value RightUp The device has been rotated counter-clockwise. |
|
97 \value FaceDown The screen is facing down. |
|
98 \value FaceUp The screen is facing up. |
|
99 */ |
|
100 |
|
101 /*! |
|
102 \property QOrientationReading::orientation |
|
103 \brief the orientation of the device. |
|
104 |
|
105 The unit is an enumeration describing the orientation of the screen. |
|
106 \sa {QOrientationReading Units} |
|
107 */ |
|
108 |
|
109 QOrientationReading::Orientation QOrientationReading::orientation() const |
|
110 { |
|
111 return static_cast<QOrientationReading::Orientation>(d->orientation); |
|
112 } |
|
113 |
|
114 /*! |
|
115 Sets the \a orientation for the reading. |
|
116 */ |
|
117 void QOrientationReading::setOrientation(QOrientationReading::Orientation orientation) |
|
118 { |
|
119 d->orientation = orientation; |
|
120 } |
|
121 |
|
122 // ===================================================================== |
|
123 |
|
124 // begin generated code |
|
125 |
|
126 /*! |
|
127 \class QOrientationFilter |
|
128 \ingroup sensors_filter |
|
129 |
|
130 \preliminary |
|
131 \brief The QOrientationFilter class is a convenience wrapper around QSensorFilter. |
|
132 |
|
133 The only difference is that the filter() method features a pointer to QOrientationReading |
|
134 instead of QSensorReading. |
|
135 */ |
|
136 |
|
137 /*! |
|
138 \fn QOrientationFilter::filter(QOrientationReading *reading) |
|
139 |
|
140 Called when \a reading changes. Returns false to prevent the reading from propagating. |
|
141 |
|
142 \sa QSensorFilter::filter() |
|
143 */ |
|
144 |
|
145 const char *QOrientationSensor::type("QOrientationSensor"); |
|
146 |
|
147 /*! |
|
148 \class QOrientationSensor |
|
149 \ingroup sensors_type |
|
150 |
|
151 \preliminary |
|
152 \brief The QOrientationSensor class is a convenience wrapper around QSensor. |
|
153 |
|
154 The only behavioural difference is that this class sets the type properly. |
|
155 |
|
156 This class also features a reading() function that returns a QOrientationReading instead of a QSensorReading. |
|
157 |
|
158 For details about how the sensor works, see \l QOrientationReading. |
|
159 |
|
160 \sa QOrientationReading |
|
161 */ |
|
162 |
|
163 /*! |
|
164 \fn QOrientationSensor::QOrientationSensor(QObject *parent) |
|
165 |
|
166 Construct the sensor as a child of \a parent. |
|
167 */ |
|
168 |
|
169 /*! |
|
170 \fn QOrientationSensor::~QOrientationSensor() |
|
171 |
|
172 Destroy the sensor. Stops the sensor if it has not already been stopped. |
|
173 */ |
|
174 |
|
175 /*! |
|
176 \fn QOrientationSensor::reading() const |
|
177 |
|
178 Returns the reading class for this sensor. |
|
179 |
|
180 \sa QSensor::reading() |
|
181 */ |
|
182 // end generated code |
|
183 |
|
184 #include "moc_qorientationsensor.cpp" |
|
185 QTM_END_NAMESPACE |
|
186 |