|
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 "gruesensor.h" |
|
43 #include "gruesensor_p.h" |
|
44 |
|
45 IMPLEMENT_READING(GrueSensorReading) |
|
46 |
|
47 /*! |
|
48 \class GrueSensorReading |
|
49 \ingroup sensors_reading |
|
50 |
|
51 \preliminary |
|
52 \brief The GrueSensorReading class holds readings from the Grue sensor. |
|
53 |
|
54 The Grue Sensor informs you of your chance of being eaten by a Grue. |
|
55 |
|
56 Grues love the dark so as long as your surroundings are relatively light |
|
57 you are safe. |
|
58 */ |
|
59 |
|
60 /*! |
|
61 \property GrueSensorReading::chanceOfBeingEaten |
|
62 \brief holds your chance of being eaten. |
|
63 |
|
64 The value is the probability (from 0 to 1) that a Grue will eat you. |
|
65 A probability of 1 means you will be eaten. The darker it is, the more |
|
66 likely you are to be eaten by a Grue. If you are in a lit room, the |
|
67 probability will be 0. |
|
68 */ |
|
69 |
|
70 qreal GrueSensorReading::chanceOfBeingEaten() const |
|
71 { |
|
72 return d->chanceOfBeingEaten; |
|
73 } |
|
74 |
|
75 void GrueSensorReading::setChanceOfBeingEaten(qreal chanceOfBeingEaten) |
|
76 { |
|
77 d->chanceOfBeingEaten = chanceOfBeingEaten; |
|
78 } |
|
79 |
|
80 // ===================================================================== |
|
81 |
|
82 // begin generated code |
|
83 |
|
84 /*! |
|
85 \class GrueFilter |
|
86 \ingroup sensors_filter |
|
87 |
|
88 \preliminary |
|
89 \brief The GrueFilter class is a convenience wrapper around QSensorFilter. |
|
90 |
|
91 The only difference is that the filter() method features a pointer to GrueSensorReading |
|
92 instead of QSensorReading. |
|
93 */ |
|
94 |
|
95 /*! |
|
96 \fn GrueFilter::filter(GrueSensorReading *reading) |
|
97 |
|
98 Called when \a reading changes. Returns false to prevent the reading from propagating. |
|
99 |
|
100 \sa QSensorFilter::filter() |
|
101 */ |
|
102 |
|
103 const char *GrueSensor::type("GrueSensor"); |
|
104 |
|
105 /*! |
|
106 \class GrueSensor |
|
107 \ingroup sensors_type |
|
108 |
|
109 \preliminary |
|
110 \brief The GrueSensor class is a convenience wrapper around QSensor. |
|
111 |
|
112 The only behavioural difference is that this class sets the type properly. |
|
113 |
|
114 This class also features a reading() function that returns a GrueSensorReading instead of a QSensorReading. |
|
115 |
|
116 For details about how the sensor works, see \l GrueSensorReading. |
|
117 |
|
118 \sa GrueSensorReading |
|
119 */ |
|
120 |
|
121 /*! |
|
122 \fn GrueSensor::GrueSensor(QObject *parent) |
|
123 |
|
124 Construct the sensor as a child of \a parent. |
|
125 */ |
|
126 |
|
127 /*! |
|
128 \fn GrueSensor::~GrueSensor() |
|
129 |
|
130 Destroy the sensor. Stops the sensor if it has not already been stopped. |
|
131 */ |
|
132 |
|
133 /*! |
|
134 \fn GrueSensor::reading() const |
|
135 |
|
136 Returns the reading class for this sensor. |
|
137 |
|
138 \sa QSensor::reading() |
|
139 */ |
|
140 // end generated code |
|
141 |
|
142 #include "moc_gruesensor.cpp" |