author | sandman <sandman> | 2002-11-01 18:13:18 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-11-01 18:13:18 (UTC) |
commit | 2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba (patch) (unidiff) | |
tree | f3e6bb8ee6c0d8f2671a63c240d1145e710da82d /core | |
parent | 7b7b760ca3886d5b6562a88b5c2ef8e610b73eb8 (diff) | |
download | opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.zip opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.tar.gz opie-2259e3ab9f2e06a4ee4dbd633c17221a47fdb7ba.tar.bz2 |
- Completly reworked the backlight "preview":
every slider/control that relates to backlight levels, is now switching the
lcd to this level for 2 seconds - after that the backlight switches back to
the standard level (or light sensor control)
- Many bugfixes and usability improvements in light sensor calibration
-rw-r--r-- | core/settings/light-and-power/calibration.cpp | 109 | ||||
-rw-r--r-- | core/settings/light-and-power/calibration.h | 4 | ||||
-rw-r--r-- | core/settings/light-and-power/light-and-power.pro | 4 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 55 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 86 | ||||
-rw-r--r-- | core/settings/light-and-power/main.cpp | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.cpp | 32 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.h | 8 |
8 files changed, 161 insertions, 139 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp index 6a3360f..aed2bc8 100644 --- a/core/settings/light-and-power/calibration.cpp +++ b/core/settings/light-and-power/calibration.cpp | |||
@@ -31,8 +31,11 @@ | |||
31 | #include <qpalette.h> | 31 | #include <qpalette.h> |
32 | #include <qpixmap.h> | ||
32 | 33 | ||
33 | #define BRD 2 | 34 | #define BRD 3 |
34 | 35 | ||
35 | Calibration::Calibration ( QWidget *parent, const char *name, WFlags fl ) | 36 | Calibration::Calibration ( QWidget *parent, const char *name, WFlags fl ) |
36 | : QWidget ( parent, name, fl ) | 37 | : QWidget ( parent, name, fl | WRepaintNoErase ) |
37 | { | 38 | { |
39 | setBackgroundMode ( NoBackground ); | ||
40 | |||
38 | m_scale = QSize ( 256, 256 ); | 41 | m_scale = QSize ( 256, 256 ); |
@@ -123,4 +126,8 @@ void Calibration::checkPoints ( ) | |||
123 | 126 | ||
127 | if ( m_p [1]. x ( ) < 0 ) | ||
128 | m_p [1]. setX ( 0 ); | ||
124 | if ( m_p [1]. x ( ) >= dx ) | 129 | if ( m_p [1]. x ( ) >= dx ) |
125 | m_p [1]. setX ( dx - 1 ); | 130 | m_p [1]. setX ( dx - 1 ); |
131 | if ( m_p [0]. x ( ) < 0 ) | ||
132 | m_p [0]. setX ( 0 ); | ||
126 | if ( m_p [0]. x ( ) > m_p [1]. x ( )) | 133 | if ( m_p [0]. x ( ) > m_p [1]. x ( )) |
@@ -128,4 +135,8 @@ void Calibration::checkPoints ( ) | |||
128 | 135 | ||
136 | if ( m_p [1]. y ( ) < 0 ) | ||
137 | m_p [1]. setY ( 0 ); | ||
129 | if ( m_p [1]. y ( ) >= dy ) | 138 | if ( m_p [1]. y ( ) >= dy ) |
130 | m_p [1]. setY ( dy - 1 ); | 139 | m_p [1]. setY ( dy - 1 ); |
140 | if ( m_p [0]. y ( ) < 0 ) | ||
141 | m_p [0]. setY ( 0 ); | ||
131 | if ( m_p [0]. y ( ) > m_p [1]. y ( )) | 142 | if ( m_p [0]. y ( ) > m_p [1]. y ( )) |
@@ -135,4 +146,4 @@ void Calibration::checkPoints ( ) | |||
135 | 146 | ||
136 | #define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width()) | 147 | #define SCALEX(x) (BRD+(x)*(width()- 2*BRD)/m_scale.width()) |
137 | #define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height()) | 148 | #define SCALEY(y) (BRD+(y)*(height()-2*BRD)/m_scale.height()) |
138 | 149 | ||
@@ -157,4 +168,4 @@ void Calibration::mousePressEvent ( QMouseEvent *e ) | |||
157 | 168 | ||
158 | if (( QABS( e-> x ( ) - x [i] ) <= BRD ) && | 169 | if (( QABS( e-> x ( ) - x [i] ) <= 2 * BRD ) && |
159 | ( QABS( e-> y ( ) - y [i] ) <= BRD )) { | 170 | ( QABS( e-> y ( ) - y [i] ) <= 2 * BRD )) { |
160 | m_dragged = i; | 171 | m_dragged = i; |
@@ -171,3 +182,3 @@ void Calibration::mousePressEvent ( QMouseEvent *e ) | |||
171 | r |= around ( x [m_dragged], y [m_dragged] ); | 182 | r |= around ( x [m_dragged], y [m_dragged] ); |
172 | repaint ( r ); | 183 | repaint ( r, false ); |
173 | } | 184 | } |
@@ -186,6 +197,14 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e ) | |||
186 | 197 | ||
187 | if (( n [0]. x ( ) > n [1]. x ( )) || ( n [m_dragged]. x ( ) < 0 ) || ( n [m_dragged]. x ( ) >= m_scale. width ( ))) | 198 | if ( n [m_dragged]. x ( ) < 0 ) |
188 | n [m_dragged]. setX ( m_p [m_dragged]. x ( )); | 199 | n [m_dragged]. setX ( 0 ); |
189 | if (( n [0]. y ( ) > n [1]. y ( )) || ( n [m_dragged]. y ( ) < 0 ) || ( n [m_dragged]. y ( ) >= m_scale. height ( ))) | 200 | if ( n [m_dragged]. x ( ) >= m_scale. width ( )) |
190 | n [m_dragged]. setY ( m_p [m_dragged]. y ( )); | 201 | n [m_dragged]. setX ( m_scale. width ( ) - 1 ); |
202 | if ( n [0]. x ( ) > n [1]. x ( )) | ||
203 | n [m_dragged]. setX ( n [1 - m_dragged]. x ( )); | ||
204 | if ( n [m_dragged]. y ( ) < 0 ) | ||
205 | n [m_dragged]. setY ( 0 ); | ||
206 | if ( n [m_dragged]. y ( ) >= m_scale. height ( )) | ||
207 | n [m_dragged]. setY ( m_scale. height ( ) - 1 ); | ||
208 | if ( n [0]. y ( ) > n [1]. y ( )) | ||
209 | n [m_dragged]. setY ( n [1 - m_dragged]. y ( )); | ||
191 | 210 | ||
@@ -208,2 +227,4 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e ) | |||
208 | r |= QRect ( 0, oy [0], ox [0] - 0 + 1, 1 ); | 227 | r |= QRect ( 0, oy [0], ox [0] - 0 + 1, 1 ); |
228 | |||
229 | emit startPointChanged ( startPoint ( )); | ||
209 | } | 230 | } |
@@ -212,2 +233,4 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e ) | |||
212 | r |= QRect ( ox [1], oy [1], width ( ) - ox [1], 1 ); | 233 | r |= QRect ( ox [1], oy [1], width ( ) - ox [1], 1 ); |
234 | |||
235 | emit endPointChanged ( endPoint ( )); | ||
213 | } | 236 | } |
@@ -219,3 +242,3 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e ) | |||
219 | 242 | ||
220 | repaint ( r ); | 243 | repaint ( r, false ); |
221 | } | 244 | } |
@@ -235,9 +258,10 @@ void Calibration::mouseReleaseEvent ( QMouseEvent *e ) | |||
235 | 258 | ||
236 | repaint ( around ( x, y )); | 259 | repaint ( around ( x, y ), false ); |
237 | } | 260 | } |
238 | 261 | ||
239 | void Calibration::paintEvent ( QPaintEvent * ) | 262 | void Calibration::paintEvent ( QPaintEvent *pe ) |
240 | { | 263 | { |
241 | QPainter p ( this ); | 264 | QPixmap pix ( size ( )); |
242 | QColorGroup g = colorGroup ( ); | 265 | QPainter p ( &pix, this ); |
266 | QRect cr = pe-> rect ( ); | ||
243 | 267 | ||
@@ -251,4 +275,37 @@ void Calibration::paintEvent ( QPaintEvent * ) | |||
251 | 275 | ||
276 | // restrict steps to real x and y resolution | ||
277 | int st = QMIN( QMIN( m_steps, ( dx + 1 )), ( dy + 1 )); | ||
278 | |||
279 | QString stepstr = tr( "%1 Steps" ). arg ( st ); | ||
280 | QRect tr = p. boundingRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD, AlignTop | AlignRight, stepstr ); | ||
281 | tr. setLeft ( tr. left ( ) - 20 ); | ||
282 | if ( p. hasClipping ( )) | ||
283 | p. setClipRegion ( p. clipRegion ( ) | QRegion ( tr )); | ||
284 | |||
285 | QColorGroup g = colorGroup ( ); | ||
286 | |||
287 | p. fillRect ( cr, g. base ( )); | ||
288 | p. fillRect ( tr, g. base ( )); | ||
289 | |||
252 | int ex = x0, ey = y0; | 290 | int ex = x0, ey = y0; |
253 | 291 | ||
292 | p. setPen ( g. mid ( )); | ||
293 | |||
294 | int gx0 = SCALEX( 0 ); | ||
295 | int gy0 = SCALEY( 0 ); | ||
296 | int gx1 = SCALEX( m_scale. width ( ) - 1 ); | ||
297 | int gy1 = SCALEY( m_scale. height ( ) - 1 ); | ||
298 | |||
299 | int xdiv = QMIN( 4, m_scale. width ( )); | ||
300 | int ydiv = QMIN( 4, m_scale. height ( )); | ||
301 | |||
302 | xdiv = ( gx1 - gx0 + 1 ) / xdiv; | ||
303 | ydiv = ( gy1 - gy0 + 1 ) / ydiv; | ||
304 | |||
305 | for ( int i = gx0 + xdiv; i <= ( gx1 - xdiv ); i += xdiv ) | ||
306 | p. drawLine ( i, gy0, i, gy1 ); | ||
307 | |||
308 | for ( int i = gy0 + ydiv; i <= ( gy1 - ydiv ); i += ydiv ) | ||
309 | p. drawLine ( gx0, i, gx1, i ); | ||
310 | |||
254 | p. setPen ( g. highlight ( )); | 311 | p. setPen ( g. highlight ( )); |
@@ -257,5 +314,5 @@ void Calibration::paintEvent ( QPaintEvent * ) | |||
257 | 314 | ||
258 | for ( int i = 1; i < m_steps; i++ ) { | 315 | for ( int i = 1; i < st; i++ ) { |
259 | int fx = x0 + dx * i / m_steps; | 316 | int fx = x0 + dx * i / st; |
260 | int fy = y0 + dy * i / ( m_steps - 1 ); | 317 | int fy = y0 + dy * i / ( st - 1 ); |
261 | 318 | ||
@@ -267,2 +324,6 @@ void Calibration::paintEvent ( QPaintEvent * ) | |||
267 | } | 324 | } |
325 | if ( st == 1 ) { | ||
326 | p. drawLine ( ex, ey, ex, y1 ); | ||
327 | ey = y1; | ||
328 | } | ||
268 | 329 | ||
@@ -270,7 +331,15 @@ void Calibration::paintEvent ( QPaintEvent * ) | |||
270 | 331 | ||
332 | |||
271 | p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( )); | 333 | p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( )); |
334 | p. drawRect ( around ( x0, y0 )); | ||
272 | p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( )); | 335 | p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( )); |
336 | p. drawRect ( around ( x1, y1 )); | ||
273 | 337 | ||
274 | p. setPen ( g. text ( )); | 338 | p. setPen ( g. text ( )); |
275 | p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps )); | 339 | p. drawText ( tr, AlignTop | AlignRight, stepstr ); |
340 | |||
341 | p. end ( ); | ||
342 | bitBlt ( this, cr. topLeft ( ), &pix, cr ); | ||
343 | if ( !cr. contains ( tr )) | ||
344 | bitBlt ( this, tr. topLeft ( ), &pix, tr ); | ||
276 | } | 345 | } |
diff --git a/core/settings/light-and-power/calibration.h b/core/settings/light-and-power/calibration.h index 2bff69a..ffa63b2 100644 --- a/core/settings/light-and-power/calibration.h +++ b/core/settings/light-and-power/calibration.h | |||
@@ -45,2 +45,6 @@ public: | |||
45 | 45 | ||
46 | signals: | ||
47 | void startPointChanged ( const QPoint & ); | ||
48 | void endPointChanged ( const QPoint & ); | ||
49 | |||
46 | public slots: | 50 | public slots: |
diff --git a/core/settings/light-and-power/light-and-power.pro b/core/settings/light-and-power/light-and-power.pro index c89a26d..80c6631 100644 --- a/core/settings/light-and-power/light-and-power.pro +++ b/core/settings/light-and-power/light-and-power.pro | |||
@@ -1,5 +1,5 @@ | |||
1 | TEMPLATE= app | 1 | TEMPLATE= app |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = settings.h sensor.h calibration.h | 4 | HEADERS = light.h sensor.h calibration.h |
5 | SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp | 5 | SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp |
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index c0ba60b..21377b7 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -28,3 +28,3 @@ | |||
28 | 28 | ||
29 | #include "settings.h" | 29 | #include "light.h" |
30 | 30 | ||
@@ -40,2 +40,3 @@ | |||
40 | #include <qslider.h> | 40 | #include <qslider.h> |
41 | #include <qtimer.h> | ||
41 | #include <qspinbox.h> | 42 | #include <qspinbox.h> |
@@ -50,3 +51,3 @@ using namespace Opie; | |||
50 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 51 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
51 | : LightSettingsBase( parent, name, true, WStyle_ContextHelp ) | 52 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
52 | { | 53 | { |
@@ -65,4 +66,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
65 | // battery spinboxes | 66 | // battery spinboxes |
66 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); | 67 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); |
67 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 68 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); |
68 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 69 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
@@ -72,3 +73,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
72 | 73 | ||
73 | int bright = config. readNumEntry ( "Brightness", 255 ); | 74 | int bright = config. readNumEntry ( "Brightness", 127 ); |
74 | brightness-> setMaxValue ( m_res - 1 ); | 75 | brightness-> setMaxValue ( m_res - 1 ); |
@@ -86,5 +87,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
86 | // ac spinboxes | 87 | // ac spinboxes |
87 | interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 )); | 88 | interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 60 )); |
88 | interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 )); | 89 | interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
89 | interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 90 | interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
90 | 91 | ||
@@ -110,4 +111,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
110 | 111 | ||
112 | m_resettimer = new QTimer ( this ); | ||
113 | connect ( m_resettimer, SIGNAL( timeout ( )), this, SLOT( resetBacklight ( ))); | ||
114 | |||
111 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 115 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
112 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
113 | tabs-> setCurrentPage ( 0 ); | 116 | tabs-> setCurrentPage ( 0 ); |
@@ -115,5 +118,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
115 | else { | 118 | else { |
116 | connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
117 | tabs-> setCurrentPage ( 1 ); | 119 | tabs-> setCurrentPage ( 1 ); |
118 | } | 120 | } |
121 | |||
122 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
123 | connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
119 | } | 124 | } |
@@ -124,3 +129,2 @@ LightSettings::~LightSettings ( ) | |||
124 | 129 | ||
125 | |||
126 | void LightSettings::calibrateSensor ( ) | 130 | void LightSettings::calibrateSensor ( ) |
@@ -128,2 +132,3 @@ void LightSettings::calibrateSensor ( ) | |||
128 | Sensor *s = new Sensor ( m_sensordata, this ); | 132 | Sensor *s = new Sensor ( m_sensordata, this ); |
133 | connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); | ||
129 | s-> showMaximized ( ); | 134 | s-> showMaximized ( ); |
@@ -136,2 +141,3 @@ void LightSettings::calibrateSensorAC ( ) | |||
136 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 141 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
142 | connect ( s, SIGNAL( viewBacklight ( int )), this, SLOT( setBacklight ( int ))); | ||
137 | s-> showMaximized ( ); | 143 | s-> showMaximized ( ); |
@@ -143,14 +149,17 @@ void LightSettings::setBacklight ( int bright ) | |||
143 | { | 149 | { |
150 | if ( bright >= 0 ) | ||
144 | bright = bright * 255 / ( m_res - 1 ); | 151 | bright = bright * 255 / ( m_res - 1 ); |
152 | |||
145 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 153 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
146 | e << bright; | 154 | e << bright; |
155 | |||
156 | if ( bright != -1 ) { | ||
157 | m_resettimer-> stop ( ); | ||
158 | m_resettimer-> start ( 2000, true ); | ||
159 | } | ||
147 | } | 160 | } |
148 | 161 | ||
149 | void LightSettings::reject ( ) | 162 | void LightSettings::resetBacklight ( ) |
150 | { | 163 | { |
151 | { | 164 | setBacklight ( -1 ); |
152 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | ||
153 | e << -1; | ||
154 | } | ||
155 | QDialog::reject ( ); | ||
156 | } | 165 | } |
@@ -202,8 +211,3 @@ void LightSettings::accept ( ) | |||
202 | } | 211 | } |
203 | { | 212 | LightSettingsBase::accept ( ); |
204 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | ||
205 | e << -1; | ||
206 | } | ||
207 | |||
208 | QDialog::accept ( ); | ||
209 | } | 213 | } |
@@ -212,3 +216,6 @@ void LightSettings::done ( int r ) | |||
212 | { | 216 | { |
213 | QDialog::done ( r ); | 217 | m_resettimer-> stop ( ); |
218 | resetBacklight ( ); | ||
219 | |||
220 | LightSettingsBase::done ( r ); | ||
214 | close ( ); | 221 | close ( ); |
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index 04c6726..309b95d 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui | |||
@@ -13,3 +13,3 @@ | |||
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>379</width> | 14 | <width>371</width> |
15 | <height>532</height> | 15 | <height>532</height> |
@@ -1191,86 +1191,2 @@ | |||
1191 | <connection> | 1191 | <connection> |
1192 | <sender>auto_brightness</sender> | ||
1193 | <signal>toggled(bool)</signal> | ||
1194 | <receiver>brightness</receiver> | ||
1195 | <slot>setDisabled(bool)</slot> | ||
1196 | </connection> | ||
1197 | <connection> | ||
1198 | <sender>auto_brightness_ac_3</sender> | ||
1199 | <signal>toggled(bool)</signal> | ||
1200 | <receiver>brightness_ac_3</receiver> | ||
1201 | <slot>setDisabled(bool)</slot> | ||
1202 | </connection> | ||
1203 | <connection> | ||
1204 | <sender>auto_brightness_ac_3</sender> | ||
1205 | <signal>toggled(bool)</signal> | ||
1206 | <receiver>TextLabel1_3_2</receiver> | ||
1207 | <slot>setDisabled(bool)</slot> | ||
1208 | </connection> | ||
1209 | <connection> | ||
1210 | <sender>auto_brightness</sender> | ||
1211 | <signal>toggled(bool)</signal> | ||
1212 | <receiver>TextLabel1_3</receiver> | ||
1213 | <slot>setDisabled(bool)</slot> | ||
1214 | </connection> | ||
1215 | <connection> | ||
1216 | <sender>auto_brightness</sender> | ||
1217 | <signal>toggled(bool)</signal> | ||
1218 | <receiver>interval_dim</receiver> | ||
1219 | <slot>setDisabled(bool)</slot> | ||
1220 | </connection> | ||
1221 | <connection> | ||
1222 | <sender>auto_brightness_ac_3</sender> | ||
1223 | <signal>toggled(bool)</signal> | ||
1224 | <receiver>interval_dim_ac_3</receiver> | ||
1225 | <slot>setDisabled(bool)</slot> | ||
1226 | </connection> | ||
1227 | <connection> | ||
1228 | <sender>auto_brightness</sender> | ||
1229 | <signal>toggled(bool)</signal> | ||
1230 | <receiver>PixmapLabel2</receiver> | ||
1231 | <slot>setDisabled(bool)</slot> | ||
1232 | </connection> | ||
1233 | <connection> | ||
1234 | <sender>auto_brightness</sender> | ||
1235 | <signal>toggled(bool)</signal> | ||
1236 | <receiver>TextLabel4</receiver> | ||
1237 | <slot>setDisabled(bool)</slot> | ||
1238 | </connection> | ||
1239 | <connection> | ||
1240 | <sender>auto_brightness</sender> | ||
1241 | <signal>toggled(bool)</signal> | ||
1242 | <receiver>TextLabel5</receiver> | ||
1243 | <slot>setDisabled(bool)</slot> | ||
1244 | </connection> | ||
1245 | <connection> | ||
1246 | <sender>auto_brightness</sender> | ||
1247 | <signal>toggled(bool)</signal> | ||
1248 | <receiver>PixmapLabel1</receiver> | ||
1249 | <slot>setDisabled(bool)</slot> | ||
1250 | </connection> | ||
1251 | <connection> | ||
1252 | <sender>auto_brightness_ac_3</sender> | ||
1253 | <signal>toggled(bool)</signal> | ||
1254 | <receiver>PixmapLabel2_2_3</receiver> | ||
1255 | <slot>setDisabled(bool)</slot> | ||
1256 | </connection> | ||
1257 | <connection> | ||
1258 | <sender>auto_brightness_ac_3</sender> | ||
1259 | <signal>toggled(bool)</signal> | ||
1260 | <receiver>TextLabel6</receiver> | ||
1261 | <slot>setDisabled(bool)</slot> | ||
1262 | </connection> | ||
1263 | <connection> | ||
1264 | <sender>auto_brightness_ac_3</sender> | ||
1265 | <signal>toggled(bool)</signal> | ||
1266 | <receiver>TextLabel7</receiver> | ||
1267 | <slot>setDisabled(bool)</slot> | ||
1268 | </connection> | ||
1269 | <connection> | ||
1270 | <sender>auto_brightness_ac_3</sender> | ||
1271 | <signal>toggled(bool)</signal> | ||
1272 | <receiver>PixmapLabel1_2_3</receiver> | ||
1273 | <slot>setDisabled(bool)</slot> | ||
1274 | </connection> | ||
1275 | <connection> | ||
1276 | <sender>CalibrateLightSensor</sender> | 1192 | <sender>CalibrateLightSensor</sender> |
diff --git a/core/settings/light-and-power/main.cpp b/core/settings/light-and-power/main.cpp index 051fdec..ecacf69 100644 --- a/core/settings/light-and-power/main.cpp +++ b/core/settings/light-and-power/main.cpp | |||
@@ -20,3 +20,3 @@ | |||
20 | 20 | ||
21 | #include "settings.h" | 21 | #include "light.h" |
22 | 22 | ||
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp index c1df04d..5ca54d4 100644 --- a/core/settings/light-and-power/sensor.cpp +++ b/core/settings/light-and-power/sensor.cpp | |||
@@ -32,2 +32,6 @@ | |||
32 | 32 | ||
33 | #include <opie/odevice.h> | ||
34 | |||
35 | using namespace Opie; | ||
36 | |||
33 | #include "calibration.h" | 37 | #include "calibration.h" |
@@ -55,2 +59,5 @@ Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | |||
55 | 59 | ||
60 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); | ||
61 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); | ||
62 | |||
56 | QVBoxLayout *lay = new QVBoxLayout ( frame ); | 63 | QVBoxLayout *lay = new QVBoxLayout ( frame ); |
@@ -60,7 +67,7 @@ Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | |||
60 | 67 | ||
61 | m_calib-> setScale ( QSize ( 256, 256 )); | 68 | m_calib-> setScale ( QSize ( xscale, yscale )); |
62 | m_calib-> setLineSteps ( steps ); | 69 | m_calib-> setLineSteps ( steps ); |
63 | m_calib-> setInterval ( inter ); | 70 | m_calib-> setInterval ( inter ); |
64 | m_calib-> setStartPoint ( QPoint ( smin, lmax )); | 71 | m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); |
65 | m_calib-> setEndPoint ( QPoint ( smax, lmin )); | 72 | m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); |
66 | 73 | ||
@@ -71,2 +78,5 @@ Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | |||
71 | connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); | 78 | connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); |
79 | |||
80 | connect ( m_calib, SIGNAL( startPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); | ||
81 | connect ( m_calib, SIGNAL( endPointChanged ( const QPoint & )), this, SLOT( pointDrag ( const QPoint & ))); | ||
72 | } | 82 | } |
@@ -75,2 +85,5 @@ void Sensor::accept ( ) | |||
75 | { | 85 | { |
86 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); | ||
87 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); | ||
88 | |||
76 | m_params. clear ( ); | 89 | m_params. clear ( ); |
@@ -78,6 +91,6 @@ void Sensor::accept ( ) | |||
78 | << QString::number ( m_calib-> lineSteps ( )) | 91 | << QString::number ( m_calib-> lineSteps ( )) |
79 | << QString::number ( m_calib-> startPoint ( ). x ( )) | 92 | << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) |
80 | << QString::number ( m_calib-> endPoint ( ). x ( )) | 93 | << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) |
81 | << QString::number ( m_calib-> endPoint ( ). y ( )) | 94 | << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) |
82 | << QString::number ( m_calib-> startPoint ( ). y ( )); | 95 | << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); |
83 | 96 | ||
@@ -85 +98,6 @@ void Sensor::accept ( ) | |||
85 | } | 98 | } |
99 | |||
100 | void Sensor::pointDrag ( const QPoint &p ) | ||
101 | { | ||
102 | emit viewBacklight ( p. y ( )); | ||
103 | } | ||
diff --git a/core/settings/light-and-power/sensor.h b/core/settings/light-and-power/sensor.h index 7a26d81..b484519 100644 --- a/core/settings/light-and-power/sensor.h +++ b/core/settings/light-and-power/sensor.h | |||
@@ -36,2 +36,4 @@ class QStringList; | |||
36 | class Sensor : public SensorBase { | 36 | class Sensor : public SensorBase { |
37 | Q_OBJECT | ||
38 | |||
37 | public: | 39 | public: |
@@ -41,2 +43,8 @@ public: | |||
41 | 43 | ||
44 | signals: | ||
45 | void viewBacklight ( int ); | ||
46 | |||
47 | private slots: | ||
48 | void pointDrag ( const QPoint & ); | ||
49 | |||
42 | private: | 50 | private: |