summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/settings/light-and-power/calibration.cpp19
-rw-r--r--core/settings/light-and-power/light.cpp24
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui8
-rw-r--r--core/settings/light-and-power/sensor.cpp22
-rw-r--r--core/settings/light-and-power/sensorbase.ui10
5 files changed, 37 insertions, 46 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp
index 307de1f..6a3360f 100644
--- a/core/settings/light-and-power/calibration.cpp
+++ b/core/settings/light-and-power/calibration.cpp
@@ -73,68 +73,68 @@ void Calibration::setLineSteps ( int steps )
73 update ( ); 73 update ( );
74} 74}
75 75
76int Calibration::lineSteps ( ) const 76int Calibration::lineSteps ( ) const
77{ 77{
78 return m_steps; 78 return m_steps;
79} 79}
80 80
81void Calibration::setInterval ( int iv ) 81void Calibration::setInterval ( int iv )
82{ 82{
83 if ( iv < 1 ) 83 if ( iv < 1 )
84 return; 84 return;
85 85
86 m_interval = iv; 86 m_interval = iv;
87 //update ( ); 87 //update ( );
88} 88}
89 89
90int Calibration::interval ( ) const 90int Calibration::interval ( ) const
91{ 91{
92 return m_interval; 92 return m_interval;
93} 93}
94 94
95void Calibration::setStartPoint ( const QPoint &p ) 95void Calibration::setStartPoint ( const QPoint &p )
96{ 96{
97 m_p [0] = p; 97 m_p [0] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
98 checkPoints ( ); 98 checkPoints ( );
99 update ( ); 99 update ( );
100} 100}
101 101
102QPoint Calibration::startPoint ( ) const 102QPoint Calibration::startPoint ( ) const
103{ 103{
104 return m_p [0]; 104 return QPoint ( m_p [0]. x ( ), m_scale. height ( ) - m_p [0]. y ( ) - 1 );
105} 105}
106 106
107void Calibration::setEndPoint ( const QPoint &p ) 107void Calibration::setEndPoint ( const QPoint &p )
108{ 108{
109 m_p [1] = p; 109 m_p [1] = QPoint ( p. x ( ), m_scale. height ( ) - p. y ( ) - 1 );
110 checkPoints ( ); 110 checkPoints ( );
111 update ( ); 111 update ( );
112} 112}
113 113
114QPoint Calibration::endPoint ( ) const 114QPoint Calibration::endPoint ( ) const
115{ 115{
116 return m_p [1]; 116 return QPoint ( m_p [1]. x ( ), m_scale. height ( ) - m_p [1]. y ( ) - 1 );
117} 117}
118 118
119void Calibration::checkPoints ( ) 119void Calibration::checkPoints ( )
120{ 120{
121 int dx = m_scale. width ( ); 121 int dx = m_scale. width ( );
122 int dy = m_scale. height ( ); 122 int dy = m_scale. height ( );
123 123
124 if ( m_p [1]. x ( ) >= dx ) 124 if ( m_p [1]. x ( ) >= dx )
125 m_p [1]. setX ( dx - 1 ); 125 m_p [1]. setX ( dx - 1 );
126 if ( m_p [0]. x ( ) > m_p [1]. x ( )) 126 if ( m_p [0]. x ( ) > m_p [1]. x ( ))
127 m_p [0]. setX ( m_p [1]. x ( )); 127 m_p [0]. setX ( m_p [1]. x ( ));
128 128
129 if ( m_p [1]. y ( ) >= dy ) 129 if ( m_p [1]. y ( ) >= dy )
130 m_p [1]. setY ( dy - 1 ); 130 m_p [1]. setY ( dy - 1 );
131 if ( m_p [0]. y ( ) > m_p [1]. y ( )) 131 if ( m_p [0]. y ( ) > m_p [1]. y ( ))
132 m_p [0]. setY ( m_p [1]. y ( )); 132 m_p [0]. setY ( m_p [1]. y ( ));
133} 133}
134 134
135 135
136#define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width()) 136#define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width())
137#define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height()) 137#define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height())
138 138
139 139
140static QRect around ( int x, int y ) 140static QRect around ( int x, int y )
@@ -183,96 +183,95 @@ void Calibration::mouseMoveEvent ( QMouseEvent *e )
183 n [m_dragged]. setX (( e-> x ( ) - BRD ) * m_scale. width ( ) / ( width ( ) - 2 * BRD )); 183 n [m_dragged]. setX (( e-> x ( ) - BRD ) * m_scale. width ( ) / ( width ( ) - 2 * BRD ));
184 n [m_dragged]. setY (( e-> y ( ) - BRD ) * m_scale. height ( ) / ( height ( ) - 2 * BRD )); 184 n [m_dragged]. setY (( e-> y ( ) - BRD ) * m_scale. height ( ) / ( height ( ) - 2 * BRD ));
185 n [1 - m_dragged] = m_p [1 - m_dragged]; 185 n [1 - m_dragged] = m_p [1 - m_dragged];
186 186
187 if (( n [0]. x ( ) > n [1]. x ( )) || ( n [m_dragged]. x ( ) < 0 ) || ( n [m_dragged]. x ( ) >= m_scale. width ( ))) 187 if (( n [0]. x ( ) > n [1]. x ( )) || ( n [m_dragged]. x ( ) < 0 ) || ( n [m_dragged]. x ( ) >= m_scale. width ( )))
188 n [m_dragged]. setX ( m_p [m_dragged]. x ( )); 188 n [m_dragged]. setX ( m_p [m_dragged]. x ( ));
189 if (( n [0]. y ( ) > n [1]. y ( )) || ( n [m_dragged]. y ( ) < 0 ) || ( n [m_dragged]. y ( ) >= m_scale. height ( ))) 189 if (( n [0]. y ( ) > n [1]. y ( )) || ( n [m_dragged]. y ( ) < 0 ) || ( n [m_dragged]. y ( ) >= m_scale. height ( )))
190 n [m_dragged]. setY ( m_p [m_dragged]. y ( )); 190 n [m_dragged]. setY ( m_p [m_dragged]. y ( ));
191 191
192 QRect r; 192 QRect r;
193 int ox [2], oy [2], nx [2], ny [2]; 193 int ox [2], oy [2], nx [2], ny [2];
194 194
195 for ( int i = 0; i < 2; i++ ) { 195 for ( int i = 0; i < 2; i++ ) {
196 nx [i] = SCALEX( n [i]. x ( )); 196 nx [i] = SCALEX( n [i]. x ( ));
197 ny [i] = SCALEY( n [i]. y ( )); 197 ny [i] = SCALEY( n [i]. y ( ));
198 ox [i] = SCALEX( m_p [i]. x ( )); 198 ox [i] = SCALEX( m_p [i]. x ( ));
199 oy [i] = SCALEY( m_p [i]. y ( )); 199 oy [i] = SCALEY( m_p [i]. y ( ));
200 200
201 if ( n [i] != m_p [i] ){ 201 if ( n [i] != m_p [i] ){
202 r |= around ( nx [i], ny [i] ); 202 r |= around ( nx [i], ny [i] );
203 r |= around ( ox [i], oy [i] ); 203 r |= around ( ox [i], oy [i] );
204 m_p [i] = n [i]; 204 m_p [i] = n [i];
205 205
206 if ( i == 0 ) { 206 if ( i == 0 ) {
207 r |= QRect ( 0, 0, nx [0] - 0 + 1, ny [0] - 0 + 1 ); 207 r |= QRect ( 0, ny [0], nx [0] - 0 + 1, 1 );
208 r |= QRect ( 0, 0, ox [0] - 0 + 1, oy [0] - 0 + 1 ); 208 r |= QRect ( 0, oy [0], ox [0] - 0 + 1, 1 );
209 } 209 }
210 else if ( i == 1 ) { 210 else if ( i == 1 ) {
211 r |= QRect ( nx [1], ny [1], width ( ) - nx [1], height ( ) - ny [1] ); 211 r |= QRect ( nx [1], ny [1], width ( ) - nx [1], 1 );
212 r |= QRect ( ox [1], oy [1], width ( ) - ox [1], height ( ) - oy [1] ); 212 r |= QRect ( ox [1], oy [1], width ( ) - ox [1], 1 );
213 } 213 }
214 } 214 }
215 } 215 }
216 if ( r. isValid ( )) { 216 if ( r. isValid ( )) {
217 r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 ); 217 r |= QRect ( nx [0], ny [0], nx [1] - nx [0] + 1, ny [1] - ny [0] + 1 );
218 r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 ); 218 r |= QRect ( ox [0], oy [0], ox [1] - ox [0] + 1, oy [1] - oy [0] + 1 );
219 219
220 repaint ( r ); 220 repaint ( r );
221 } 221 }
222} 222}
223 223
224void Calibration::mouseReleaseEvent ( QMouseEvent *e ) 224void Calibration::mouseReleaseEvent ( QMouseEvent *e )
225{ 225{
226 if ( e-> button ( ) != LeftButton ) 226 if ( e-> button ( ) != LeftButton )
227 return QWidget::mouseReleaseEvent ( e ); 227 return QWidget::mouseReleaseEvent ( e );
228 228
229 if ( m_dragged < 0 ) 229 if ( m_dragged < 0 )
230 return; 230 return;
231 231
232 int x = SCALEX( m_p [m_dragged]. x ( )); 232 int x = SCALEX( m_p [m_dragged]. x ( ));
233 int y = SCALEY( m_p [m_dragged]. y ( )); 233 int y = SCALEY( m_p [m_dragged]. y ( ));
234 m_dragged = -1; 234 m_dragged = -1;
235 235
236 repaint ( around ( x, y )); 236 repaint ( around ( x, y ));
237} 237}
238 238
239void Calibration::paintEvent ( QPaintEvent * ) 239void Calibration::paintEvent ( QPaintEvent * )
240{ 240{
241 QPainter p ( this ); 241 QPainter p ( this );
242 QColorGroup g = colorGroup ( ); 242 QColorGroup g = colorGroup ( );
243 243
244 int x0 = SCALEX( m_p [0]. x ( )); 244 int x0 = SCALEX( m_p [0]. x ( ));
245 int y0 = SCALEY( m_p [0]. y ( )); 245 int y0 = SCALEY( m_p [0]. y ( ));
246 int x1 = SCALEX( m_p [1]. x ( )); 246 int x1 = SCALEX( m_p [1]. x ( ));
247 int y1 = SCALEY( m_p [1]. y ( )); 247 int y1 = SCALEY( m_p [1]. y ( ));
248 248
249 int dx = x1 - x0; 249 int dx = x1 - x0;
250 int dy = y1 - y0; 250 int dy = y1 - y0;
251 251
252 int ex = x0, ey = y0; 252 int ex = x0, ey = y0;
253 253
254 p. setPen ( g. highlight ( )); 254 p. setPen ( g. highlight ( ));
255 255
256 p. drawLine ( BRD, BRD, ex, BRD ); 256 p. drawLine ( BRD, ey, ex, ey );
257 p. drawLine ( ex, BRD, ex, ey );
258 257
259 for ( int i = 1; i < m_steps; i++ ) { 258 for ( int i = 1; i < m_steps; i++ ) {
260 int fx = x0 + dx * i / m_steps; 259 int fx = x0 + dx * i / m_steps;
261 int fy = y0 + dy * i / ( m_steps - 1 ); 260 int fy = y0 + dy * i / ( m_steps - 1 );
262 261
263 p. drawLine ( ex, ey, fx, ey ); 262 p. drawLine ( ex, ey, fx, ey );
264 p. drawLine ( fx, ey, fx, fy ); 263 p. drawLine ( fx, ey, fx, fy );
265 264
266 ex = fx; 265 ex = fx;
267 ey = fy; 266 ey = fy;
268 } 267 }
269 268
270 p. drawLine ( ex, ey, width ( ) - 1 - BRD, ey ); 269 p. drawLine ( ex, ey, width ( ) - 1 - BRD, ey );
271 270
272 p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( )); 271 p. fillRect ( around ( x0, y0 ), m_dragged == 0 ? g. highlightedText ( ) : g. text ( ));
273 p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( )); 272 p. fillRect ( around ( x1, y1 ), m_dragged == 1 ? g. highlightedText ( ) : g. text ( ));
274 273
275 p. setPen ( g. text ( )); 274 p. setPen ( g. text ( ));
276 p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps )); 275 p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps ));
277} 276}
278 277
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 2ea0356..c0ba60b 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -7,76 +7,60 @@
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "settings.h" 29#include "settings.h"
30 30
31#include <qpe/global.h>
32#include <qpe/fontmanager.h>
33#include <qpe/config.h> 31#include <qpe/config.h>
34#include <qpe/applnk.h>
35#include <qpe/qpeapplication.h> 32#include <qpe/qpeapplication.h>
36#include <qpe/power.h> 33#include <qpe/power.h>
37#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 34#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
38#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
39#endif 36#endif
40 37
41#include <qlabel.h>
42#include <qcheckbox.h> 38#include <qcheckbox.h>
43#include <qradiobutton.h>
44#include <qtabwidget.h> 39#include <qtabwidget.h>
45#include <qslider.h> 40#include <qslider.h>
46#include <qfile.h>
47#include <qtextstream.h>
48#include <qdatastream.h>
49#include <qmessagebox.h>
50#include <qcombobox.h>
51#include <qgroupbox.h>
52#include <qspinbox.h> 41#include <qspinbox.h>
53#include <qpushbutton.h> 42#include <qpushbutton.h>
54#include <qlistbox.h>
55#include <qdir.h>
56#if QT_VERSION >= 300
57#include <qstylefactory.h>
58#endif
59 43
60#include <opie/odevice.h> 44#include <opie/odevice.h>
61 45
62#include "sensor.h" 46#include "sensor.h"
63 47
64using namespace Opie; 48using namespace Opie;
65 49
66LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) 50LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
67 : LightSettingsBase( parent, name, true, WStyle_ContextHelp ) 51 : LightSettingsBase( parent, name, true, WStyle_ContextHelp )
68{ 52{
69 m_res = ODevice::inst ( )-> displayBrightnessResolution ( ); 53 m_res = ODevice::inst ( )-> displayBrightnessResolution ( );
70 54
71 if ( !ODevice::inst ( )-> hasLightSensor ( )) { 55 if ( !ODevice::inst ( )-> hasLightSensor ( )) {
72 auto_brightness-> hide ( ); 56 auto_brightness-> hide ( );
73 CalibrateLightSensor-> hide ( ); 57 CalibrateLightSensor-> hide ( );
74 auto_brightness_ac_3-> hide ( ); 58 auto_brightness_ac_3-> hide ( );
75 CalibrateLightSensorAC-> hide ( ); 59 CalibrateLightSensorAC-> hide ( );
76 } 60 }
77 61
78 Config config ( "apm" ); 62 Config config ( "apm" );
79 config. setGroup ( "Battery" ); 63 config. setGroup ( "Battery" );
80 64
81 // battery spinboxes 65 // battery spinboxes
82 interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 )); 66 interval_dim-> setValue ( config. readNumEntry ( "Dim", 20 ));
@@ -103,52 +87,56 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
103 interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 )); 87 interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 20 ));
104 interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 )); 88 interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 30 ));
105 interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 )); 89 interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 60 ));
106 90
107 // ac check and slider 91 // ac check and slider
108 LcdOffOnly_2_3-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 92 LcdOffOnly_2_3-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
109 93
110 bright = config. readNumEntry ( "Brightness", 255 ); 94 bright = config. readNumEntry ( "Brightness", 255 );
111 brightness_ac_3-> setMaxValue ( m_res - 1 ); 95 brightness_ac_3-> setMaxValue ( m_res - 1 );
112 brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 )); 96 brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 ));
113 brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 )); 97 brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 ));
114 brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 )); 98 brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 ));
115 brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); 99 brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 );
116 100
117 // light sensor 101 // light sensor
118 auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 102 auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
119 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 103 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
120 104
121 // advanced settings 105 // advanced settings
122 config. setGroup ( "Warnings" ); 106 config. setGroup ( "Warnings" );
123 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); 107 warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 );
124 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); 108 lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) );
125 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); 109 criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) );
126 110
127 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) 111 if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) {
128 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 112 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
129 else 113 tabs-> setCurrentPage ( 0 );
114 }
115 else {
130 connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 116 connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
117 tabs-> setCurrentPage ( 1 );
118 }
131} 119}
132 120
133LightSettings::~LightSettings ( ) 121LightSettings::~LightSettings ( )
134{ 122{
135} 123}
136 124
137 125
138void LightSettings::calibrateSensor ( ) 126void LightSettings::calibrateSensor ( )
139{ 127{
140 Sensor *s = new Sensor ( m_sensordata, this ); 128 Sensor *s = new Sensor ( m_sensordata, this );
141 s-> showMaximized ( ); 129 s-> showMaximized ( );
142 s-> exec ( ); 130 s-> exec ( );
143 delete s; 131 delete s;
144} 132}
145 133
146void LightSettings::calibrateSensorAC ( ) 134void LightSettings::calibrateSensorAC ( )
147{ 135{
148 Sensor *s = new Sensor ( m_sensordata_ac, this ); 136 Sensor *s = new Sensor ( m_sensordata_ac, this );
149 s-> showMaximized ( ); 137 s-> showMaximized ( );
150 s-> exec ( ); 138 s-> exec ( );
151 delete s; 139 delete s;
152} 140}
153 141
154void LightSettings::setBacklight ( int bright ) 142void LightSettings::setBacklight ( int bright )
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index 4df6024..04c6726 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -1,76 +1,76 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>LightSettingsBase</class> 2<class>LightSettingsBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>LightSettingsBase</cstring> 7 <cstring>LightSettingsBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>387</width> 14 <width>379</width>
15 <height>532</height> 15 <height>532</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>sizePolicy</name> 19 <name>sizePolicy</name>
20 <sizepolicy> 20 <sizepolicy>
21 <hsizetype>7</hsizetype> 21 <hsizetype>7</hsizetype>
22 <vsizetype>5</vsizetype> 22 <vsizetype>5</vsizetype>
23 </sizepolicy> 23 </sizepolicy>
24 </property> 24 </property>
25 <property stdset="1"> 25 <property stdset="1">
26 <name>caption</name> 26 <name>caption</name>
27 <string>Light and Power Settings</string> 27 <string>Light and Power Settings</string>
28 </property> 28 </property>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>sizeGripEnabled</name> 30 <name>sizeGripEnabled</name>
31 <bool>false</bool> 31 <bool>false</bool>
32 </property> 32 </property>
33 <property> 33 <property>
34 <name>layoutMargin</name> 34 <name>layoutMargin</name>
35 </property> 35 </property>
36 <property> 36 <property>
37 <name>layoutSpacing</name> 37 <name>layoutSpacing</name>
38 </property> 38 </property>
39 <vbox> 39 <vbox>
40 <property stdset="1"> 40 <property stdset="1">
41 <name>margin</name> 41 <name>margin</name>
42 <number>3</number> 42 <number>3</number>
43 </property> 43 </property>
44 <property stdset="1"> 44 <property stdset="1">
45 <name>spacing</name> 45 <name>spacing</name>
46 <number>3</number> 46 <number>3</number>
47 </property> 47 </property>
48 <widget> 48 <widget>
49 <class>QTabWidget</class> 49 <class>QTabWidget</class>
50 <property stdset="1"> 50 <property stdset="1">
51 <name>name</name> 51 <name>name</name>
52 <cstring>TabWidget3</cstring> 52 <cstring>tabs</cstring>
53 </property> 53 </property>
54 <property> 54 <property>
55 <name>layoutMargin</name> 55 <name>layoutMargin</name>
56 </property> 56 </property>
57 <property> 57 <property>
58 <name>layoutSpacing</name> 58 <name>layoutSpacing</name>
59 </property> 59 </property>
60 <widget> 60 <widget>
61 <class>QWidget</class> 61 <class>QWidget</class>
62 <property stdset="1"> 62 <property stdset="1">
63 <name>name</name> 63 <name>name</name>
64 <cstring>tab</cstring> 64 <cstring>tab</cstring>
65 </property> 65 </property>
66 <attribute> 66 <attribute>
67 <name>title</name> 67 <name>title</name>
68 <string>on Battery</string> 68 <string>on Battery</string>
69 </attribute> 69 </attribute>
70 <vbox> 70 <vbox>
71 <property stdset="1"> 71 <property stdset="1">
72 <name>margin</name> 72 <name>margin</name>
73 <number>5</number> 73 <number>5</number>
74 </property> 74 </property>
75 <property stdset="1"> 75 <property stdset="1">
76 <name>spacing</name> 76 <name>spacing</name>
@@ -942,49 +942,49 @@
942 <enum>Vertical</enum> 942 <enum>Vertical</enum>
943 </property> 943 </property>
944 <property stdset="1"> 944 <property stdset="1">
945 <name>sizeType</name> 945 <name>sizeType</name>
946 <enum>Expanding</enum> 946 <enum>Expanding</enum>
947 </property> 947 </property>
948 <property> 948 <property>
949 <name>sizeHint</name> 949 <name>sizeHint</name>
950 <size> 950 <size>
951 <width>20</width> 951 <width>20</width>
952 <height>20</height> 952 <height>20</height>
953 </size> 953 </size>
954 </property> 954 </property>
955 </spacer> 955 </spacer>
956 </vbox> 956 </vbox>
957 </widget> 957 </widget>
958 <widget> 958 <widget>
959 <class>QWidget</class> 959 <class>QWidget</class>
960 <property stdset="1"> 960 <property stdset="1">
961 <name>name</name> 961 <name>name</name>
962 <cstring>tab</cstring> 962 <cstring>tab</cstring>
963 </property> 963 </property>
964 <attribute> 964 <attribute>
965 <name>title</name> 965 <name>title</name>
966 <string>Advanced Settings</string> 966 <string>Warnings</string>
967 </attribute> 967 </attribute>
968 <vbox> 968 <vbox>
969 <property stdset="1"> 969 <property stdset="1">
970 <name>margin</name> 970 <name>margin</name>
971 <number>5</number> 971 <number>5</number>
972 </property> 972 </property>
973 <property stdset="1"> 973 <property stdset="1">
974 <name>spacing</name> 974 <name>spacing</name>
975 <number>3</number> 975 <number>3</number>
976 </property> 976 </property>
977 <widget> 977 <widget>
978 <class>QGroupBox</class> 978 <class>QGroupBox</class>
979 <property stdset="1"> 979 <property stdset="1">
980 <name>name</name> 980 <name>name</name>
981 <cstring>GroupBox5</cstring> 981 <cstring>GroupBox5</cstring>
982 </property> 982 </property>
983 <property stdset="1"> 983 <property stdset="1">
984 <name>title</name> 984 <name>title</name>
985 <string>Warnings</string> 985 <string>Warnings</string>
986 </property> 986 </property>
987 <property> 987 <property>
988 <name>layoutMargin</name> 988 <name>layoutMargin</name>
989 </property> 989 </property>
990 <property> 990 <property>
@@ -1274,37 +1274,37 @@
1274 </connection> 1274 </connection>
1275 <connection> 1275 <connection>
1276 <sender>CalibrateLightSensor</sender> 1276 <sender>CalibrateLightSensor</sender>
1277 <signal>clicked()</signal> 1277 <signal>clicked()</signal>
1278 <receiver>LightSettingsBase</receiver> 1278 <receiver>LightSettingsBase</receiver>
1279 <slot>calibrateSensor()</slot> 1279 <slot>calibrateSensor()</slot>
1280 </connection> 1280 </connection>
1281 <connection> 1281 <connection>
1282 <sender>CalibrateLightSensorAC</sender> 1282 <sender>CalibrateLightSensorAC</sender>
1283 <signal>clicked()</signal> 1283 <signal>clicked()</signal>
1284 <receiver>LightSettingsBase</receiver> 1284 <receiver>LightSettingsBase</receiver>
1285 <slot>calibrateSensorAC()</slot> 1285 <slot>calibrateSensorAC()</slot>
1286 </connection> 1286 </connection>
1287 <slot access="public">calibrateSensor()</slot> 1287 <slot access="public">calibrateSensor()</slot>
1288 <slot access="public">calibrateSensorAC()</slot> 1288 <slot access="public">calibrateSensorAC()</slot>
1289</connections> 1289</connections>
1290<tabstops> 1290<tabstops>
1291 <tabstop>interval_dim</tabstop> 1291 <tabstop>interval_dim</tabstop>
1292 <tabstop>interval_lightoff</tabstop> 1292 <tabstop>interval_lightoff</tabstop>
1293 <tabstop>interval_suspend</tabstop> 1293 <tabstop>interval_suspend</tabstop>
1294 <tabstop>LcdOffOnly</tabstop> 1294 <tabstop>LcdOffOnly</tabstop>
1295 <tabstop>brightness</tabstop> 1295 <tabstop>brightness</tabstop>
1296 <tabstop>auto_brightness</tabstop> 1296 <tabstop>auto_brightness</tabstop>
1297 <tabstop>CalibrateLightSensor</tabstop> 1297 <tabstop>CalibrateLightSensor</tabstop>
1298 <tabstop>TabWidget3</tabstop> 1298 <tabstop>tabs</tabstop>
1299 <tabstop>interval_lightoff_ac_3</tabstop> 1299 <tabstop>interval_lightoff_ac_3</tabstop>
1300 <tabstop>interval_suspend_ac_3</tabstop> 1300 <tabstop>interval_suspend_ac_3</tabstop>
1301 <tabstop>interval_dim_ac_3</tabstop> 1301 <tabstop>interval_dim_ac_3</tabstop>
1302 <tabstop>LcdOffOnly_2_3</tabstop> 1302 <tabstop>LcdOffOnly_2_3</tabstop>
1303 <tabstop>brightness_ac_3</tabstop> 1303 <tabstop>brightness_ac_3</tabstop>
1304 <tabstop>auto_brightness_ac_3</tabstop> 1304 <tabstop>auto_brightness_ac_3</tabstop>
1305 <tabstop>CalibrateLightSensorAC</tabstop> 1305 <tabstop>CalibrateLightSensorAC</tabstop>
1306 <tabstop>lowSpinBox</tabstop> 1306 <tabstop>lowSpinBox</tabstop>
1307 <tabstop>warnintervalBox</tabstop> 1307 <tabstop>warnintervalBox</tabstop>
1308 <tabstop>criticalSpinBox</tabstop> 1308 <tabstop>criticalSpinBox</tabstop>
1309</tabstops> 1309</tabstops>
1310</UI> 1310</UI>
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp
index ddd71d6..c1df04d 100644
--- a/core/settings/light-and-power/sensor.cpp
+++ b/core/settings/light-and-power/sensor.cpp
@@ -15,71 +15,71 @@
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28#include <qframe.h> 28#include <qframe.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qspinbox.h> 31#include <qspinbox.h>
32 32
33#include "calibration.h" 33#include "calibration.h"
34#include "sensor.h" 34#include "sensor.h"
35 35
36Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name ) 36Sensor::Sensor ( QStringList &params, QWidget *parent, const char *name )
37 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) 37 : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params )
38{ 38{
39 int steps = 5; 39 int steps = 12;
40 int inter = 5; 40 int inter = 2;
41 41
42 int smin = 0; 42 int smin = 40;
43 int smax = 255; 43 int smax = 215;
44 int lmin = 0; 44 int lmin = 1;
45 int lmax = 255; 45 int lmax = 255;
46 46
47 switch ( params. count ( )) { 47 switch ( params. count ( )) {
48 case 6: lmax = params [5]. toInt ( ); 48 case 6: lmax = params [5]. toInt ( );
49 case 5: lmin = params [4]. toInt ( ); 49 case 5: lmin = params [4]. toInt ( );
50 case 4: smax = params [3]. toInt ( ); 50 case 4: smax = params [3]. toInt ( );
51 case 3: smin = params [2]. toInt ( ); 51 case 3: smin = params [2]. toInt ( );
52 case 2: steps = params [1]. toInt ( ); 52 case 2: steps = params [1]. toInt ( );
53 case 1: inter = params [0]. toInt ( ); 53 case 1: inter = params [0]. toInt ( ) / 1000;
54 } 54 }
55 55
56 QVBoxLayout *lay = new QVBoxLayout ( frame ); 56 QVBoxLayout *lay = new QVBoxLayout ( frame );
57 lay-> setMargin ( 2 ); 57 lay-> setMargin ( 2 );
58 m_calib = new Calibration ( frame ); 58 m_calib = new Calibration ( frame );
59 lay-> add ( m_calib ); 59 lay-> add ( m_calib );
60 60
61 m_calib-> setScale ( QSize ( 256, 256 )); 61 m_calib-> setScale ( QSize ( 256, 256 ));
62 m_calib-> setLineSteps ( steps ); 62 m_calib-> setLineSteps ( steps );
63 m_calib-> setInterval ( inter ); 63 m_calib-> setInterval ( inter );
64 m_calib-> setStartPoint ( QPoint ( smin, lmin )); 64 m_calib-> setStartPoint ( QPoint ( smin, lmax ));
65 m_calib-> setEndPoint ( QPoint ( smax, lmax )); 65 m_calib-> setEndPoint ( QPoint ( smax, lmin ));
66 66
67 interval-> setValue ( inter ); 67 interval-> setValue ( inter );
68 linesteps-> setValue ( steps ); 68 linesteps-> setValue ( steps );
69 69
70 connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); 70 connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int )));
71 connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); 71 connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int )));
72} 72}
73 73
74void Sensor::accept ( ) 74void Sensor::accept ( )
75{ 75{
76 m_params. clear ( ); 76 m_params. clear ( );
77 m_params << QString::number ( m_calib-> interval ( )) 77 m_params << QString::number ( m_calib-> interval ( ) * 1000 )
78 << QString::number ( m_calib-> lineSteps ( )) 78 << QString::number ( m_calib-> lineSteps ( ))
79 << QString::number ( m_calib-> startPoint ( ). x ( )) 79 << QString::number ( m_calib-> startPoint ( ). x ( ))
80 << QString::number ( m_calib-> endPoint ( ). x ( )) 80 << QString::number ( m_calib-> endPoint ( ). x ( ))
81 << QString::number ( m_calib-> startPoint ( ). y ( )) 81 << QString::number ( m_calib-> endPoint ( ). y ( ))
82 << QString::number ( m_calib-> endPoint ( ). y ( )); 82 << QString::number ( m_calib-> startPoint ( ). y ( ));
83 83
84 QDialog::accept ( ); 84 QDialog::accept ( );
85} 85}
diff --git a/core/settings/light-and-power/sensorbase.ui b/core/settings/light-and-power/sensorbase.ui
index 98fce88..64b9a27 100644
--- a/core/settings/light-and-power/sensorbase.ui
+++ b/core/settings/light-and-power/sensorbase.ui
@@ -1,38 +1,38 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>SensorBase</class> 2<class>SensorBase</class>
3<widget> 3<widget>
4 <class>QDialog</class> 4 <class>QDialog</class>
5 <property stdset="1"> 5 <property stdset="1">
6 <name>name</name> 6 <name>name</name>
7 <cstring>SensorBase</cstring> 7 <cstring>SensorBase</cstring>
8 </property> 8 </property>
9 <property stdset="1"> 9 <property stdset="1">
10 <name>geometry</name> 10 <name>geometry</name>
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>293</width> 14 <width>289</width>
15 <height>443</height> 15 <height>443</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
19 <name>caption</name> 19 <name>caption</name>
20 <string>Sensor Calibration</string> 20 <string>Sensor Calibration</string>
21 </property> 21 </property>
22 <property> 22 <property>
23 <name>layoutMargin</name> 23 <name>layoutMargin</name>
24 </property> 24 </property>
25 <property> 25 <property>
26 <name>layoutSpacing</name> 26 <name>layoutSpacing</name>
27 </property> 27 </property>
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>3</number> 31 <number>3</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
35 <number>3</number> 35 <number>3</number>
36 </property> 36 </property>
37 <widget> 37 <widget>
38 <class>QLayoutWidget</class> 38 <class>QLayoutWidget</class>
@@ -759,53 +759,57 @@
759 </property> 759 </property>
760 <widget> 760 <widget>
761 <class>QLabel</class> 761 <class>QLabel</class>
762 <property stdset="1"> 762 <property stdset="1">
763 <name>name</name> 763 <name>name</name>
764 <cstring>TextLabel4</cstring> 764 <cstring>TextLabel4</cstring>
765 </property> 765 </property>
766 <property stdset="1"> 766 <property stdset="1">
767 <name>text</name> 767 <name>text</name>
768 <string>Steps</string> 768 <string>Steps</string>
769 </property> 769 </property>
770 </widget> 770 </widget>
771 <widget> 771 <widget>
772 <class>QSlider</class> 772 <class>QSlider</class>
773 <property stdset="1"> 773 <property stdset="1">
774 <name>name</name> 774 <name>name</name>
775 <cstring>linesteps</cstring> 775 <cstring>linesteps</cstring>
776 </property> 776 </property>
777 <property stdset="1"> 777 <property stdset="1">
778 <name>minValue</name> 778 <name>minValue</name>
779 <number>2</number> 779 <number>2</number>
780 </property> 780 </property>
781 <property stdset="1"> 781 <property stdset="1">
782 <name>maxValue</name> 782 <name>maxValue</name>
783 <number>127</number> 783 <number>63</number>
784 </property> 784 </property>
785 <property stdset="1"> 785 <property stdset="1">
786 <name>lineStep</name> 786 <name>lineStep</name>
787 <number>10</number> 787 <number>5</number>
788 </property>
789 <property stdset="1">
790 <name>pageStep</name>
791 <number>5</number>
788 </property> 792 </property>
789 <property stdset="1"> 793 <property stdset="1">
790 <name>orientation</name> 794 <name>orientation</name>
791 <enum>Horizontal</enum> 795 <enum>Horizontal</enum>
792 </property> 796 </property>
793 <property stdset="1"> 797 <property stdset="1">
794 <name>tickmarks</name> 798 <name>tickmarks</name>
795 <enum>Right</enum> 799 <enum>Right</enum>
796 </property> 800 </property>
797 </widget> 801 </widget>
798 </hbox> 802 </hbox>
799 </widget> 803 </widget>
800 <widget> 804 <widget>
801 <class>QLayoutWidget</class> 805 <class>QLayoutWidget</class>
802 <property stdset="1"> 806 <property stdset="1">
803 <name>name</name> 807 <name>name</name>
804 <cstring>Layout28</cstring> 808 <cstring>Layout28</cstring>
805 </property> 809 </property>
806 <property> 810 <property>
807 <name>layoutSpacing</name> 811 <name>layoutSpacing</name>
808 </property> 812 </property>
809 <hbox> 813 <hbox>
810 <property stdset="1"> 814 <property stdset="1">
811 <name>margin</name> 815 <name>margin</name>