summaryrefslogtreecommitdiff
authorsandman <sandman>2002-11-21 02:27:43 (UTC)
committer sandman <sandman>2002-11-21 02:27:43 (UTC)
commitba08c640278399f412e66f906283068a099a2f03 (patch) (unidiff)
treeb4237f428c02ba4277561e765a0be51e300032b1
parenta65963a06def8cb064bf7d99ff2776877f5f6315 (diff)
downloadopie-ba08c640278399f412e66f906283068a099a2f03.zip
opie-ba08c640278399f412e66f906283068a099a2f03.tar.gz
opie-ba08c640278399f412e66f906283068a099a2f03.tar.bz2
The light sensor can now be calibrated "reverse" - less backlight in the
dark and more backlight in the light
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/calibration.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp
index aed2bc8..c5377d0 100644
--- a/core/settings/light-and-power/calibration.cpp
+++ b/core/settings/light-and-power/calibration.cpp
@@ -139,8 +139,8 @@ void Calibration::checkPoints ( )
139 m_p [1]. setY ( dy - 1 ); 139 m_p [1]. setY ( dy - 1 );
140 if ( m_p [0]. y ( ) < 0 ) 140 if ( m_p [0]. y ( ) < 0 )
141 m_p [0]. setY ( 0 ); 141 m_p [0]. setY ( 0 );
142 if ( m_p [0]. y ( ) > m_p [1]. y ( )) 142 if ( m_p [0]. y ( ) >= dy )
143 m_p [0]. setY ( m_p [1]. y ( )); 143 m_p [0]. setY ( dy - 1 );
144} 144}
145 145
146 146
@@ -205,8 +205,8 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e )
205 n [m_dragged]. setY ( 0 ); 205 n [m_dragged]. setY ( 0 );
206 if ( n [m_dragged]. y ( ) >= m_scale. height ( )) 206 if ( n [m_dragged]. y ( ) >= m_scale. height ( ))
207 n [m_dragged]. setY ( m_scale. height ( ) - 1 ); 207 n [m_dragged]. setY ( m_scale. height ( ) - 1 );
208 if ( n [0]. y ( ) > n [1]. y ( )) 208 //if ( n [0]. y ( ) > n [1]. y ( ))
209 n [m_dragged]. setY ( n [1 - m_dragged]. y ( )); 209 // n [m_dragged]. setY ( n [1 - m_dragged]. y ( ));
210 210
211 QRect r; 211 QRect r;
212 int ox [2], oy [2], nx [2], ny [2]; 212 int ox [2], oy [2], nx [2], ny [2];
@@ -237,8 +237,8 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e )
237 } 237 }
238 } 238 }
239 if ( r. isValid ( )) { 239 if ( r. isValid ( )) {
240 r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 ); 240 r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 ). normalize ( );
241 r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 ); 241 r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 ). normalize ( );
242 242
243 repaint ( r, false ); 243 repaint ( r, false );
244 } 244 }
@@ -274,7 +274,7 @@ void Calibration::paintEvent ( QPaintEvent *pe )
274 int dy = y1 - y0; 274 int dy = y1 - y0;
275 275
276 // restrict steps to real x and y resolution 276 // restrict steps to real x and y resolution
277 int st = QMIN( QMIN( m_steps, ( dx + 1 )), ( dy + 1 )); 277 int st = QMIN( QMIN( m_steps, ( dx + 1 )), ( QABS( dy ) + 1 ));
278 278
279 QString stepstr = tr( "%1 Steps" ). arg ( st ); 279 QString stepstr = tr( "%1 Steps" ). arg ( st );
280 QRect tr = p. boundingRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD, AlignTop | AlignRight, stepstr ); 280 QRect tr = p. boundingRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD, AlignTop | AlignRight, stepstr );