-rw-r--r-- | core/settings/light-and-power/calibration.cpp | 278 | ||||
-rw-r--r-- | core/settings/light-and-power/calibration.h | 71 | ||||
-rw-r--r-- | core/settings/light-and-power/light-and-power.pro | 6 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 194 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 189 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.cpp | 85 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.h | 47 | ||||
-rw-r--r-- | core/settings/light-and-power/sensorbase.ui | 870 | ||||
-rw-r--r-- | core/settings/light-and-power/settings.h | 59 |
9 files changed, 1576 insertions, 223 deletions
diff --git a/core/settings/light-and-power/calibration.cpp b/core/settings/light-and-power/calibration.cpp new file mode 100644 index 0000000..307de1f --- a/dev/null +++ b/core/settings/light-and-power/calibration.cpp | |||
@@ -0,0 +1,278 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | #include "calibration.h" | ||
29 | |||
30 | #include <qpainter.h> | ||
31 | #include <qpalette.h> | ||
32 | |||
33 | #define BRD 2 | ||
34 | |||
35 | Calibration::Calibration ( QWidget *parent, const char *name, WFlags fl ) | ||
36 | : QWidget ( parent, name, fl ) | ||
37 | { | ||
38 | m_scale = QSize ( 256, 256 ); | ||
39 | m_steps = 5; | ||
40 | m_dragged = -1; | ||
41 | m_interval = 5; | ||
42 | |||
43 | m_p [0] = QPoint ( 0, 0 ); | ||
44 | m_p [1] = QPoint ( 255, 255 ); | ||
45 | } | ||
46 | |||
47 | Calibration::~Calibration ( ) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | void Calibration::setScale ( const QSize &s ) | ||
52 | { | ||
53 | if ( s. width ( ) < 1 || s. height ( ) < 1 ) | ||
54 | return; | ||
55 | |||
56 | m_scale = s; | ||
57 | checkPoints ( ); | ||
58 | |||
59 | update ( ); | ||
60 | } | ||
61 | |||
62 | QSize Calibration::scale ( ) const | ||
63 | { | ||
64 | return m_scale; | ||
65 | } | ||
66 | |||
67 | void Calibration::setLineSteps ( int steps ) | ||
68 | { | ||
69 | if ( m_steps < 2 ) | ||
70 | return; | ||
71 | |||
72 | m_steps = steps; | ||
73 | update ( ); | ||
74 | } | ||
75 | |||
76 | int Calibration::lineSteps ( ) const | ||
77 | { | ||
78 | return m_steps; | ||
79 | } | ||
80 | |||
81 | void Calibration::setInterval ( int iv ) | ||
82 | { | ||
83 | if ( iv < 1 ) | ||
84 | return; | ||
85 | |||
86 | m_interval = iv; | ||
87 | //update ( ); | ||
88 | } | ||
89 | |||
90 | int Calibration::interval ( ) const | ||
91 | { | ||
92 | return m_interval; | ||
93 | } | ||
94 | |||
95 | void Calibration::setStartPoint ( const QPoint &p ) | ||
96 | { | ||
97 | m_p [0] = p; | ||
98 | checkPoints ( ); | ||
99 | update ( ); | ||
100 | } | ||
101 | |||
102 | QPoint Calibration::startPoint ( ) const | ||
103 | { | ||
104 | return m_p [0]; | ||
105 | } | ||
106 | |||
107 | void Calibration::setEndPoint ( const QPoint &p ) | ||
108 | { | ||
109 | m_p [1] = p; | ||
110 | checkPoints ( ); | ||
111 | update ( ); | ||
112 | } | ||
113 | |||
114 | QPoint Calibration::endPoint ( ) const | ||
115 | { | ||
116 | return m_p [1]; | ||
117 | } | ||
118 | |||
119 | void Calibration::checkPoints ( ) | ||
120 | { | ||
121 | int dx = m_scale. width ( ); | ||
122 | int dy = m_scale. height ( ); | ||
123 | |||
124 | if ( m_p [1]. x ( ) >= dx ) | ||
125 | m_p [1]. setX ( dx - 1 ); | ||
126 | if ( m_p [0]. x ( ) > m_p [1]. x ( )) | ||
127 | m_p [0]. setX ( m_p [1]. x ( )); | ||
128 | |||
129 | if ( m_p [1]. y ( ) >= dy ) | ||
130 | m_p [1]. setY ( dy - 1 ); | ||
131 | if ( m_p [0]. y ( ) > m_p [1]. y ( )) | ||
132 | m_p [0]. setY ( m_p [1]. y ( )); | ||
133 | } | ||
134 | |||
135 | |||
136 | #define SCALEX(x) (BRD+x*(width()- 2*BRD)/m_scale.width()) | ||
137 | #define SCALEY(y) (BRD+y*(height()-2*BRD)/m_scale.height()) | ||
138 | |||
139 | |||
140 | static QRect around ( int x, int y ) | ||
141 | { | ||
142 | return QRect ( x - BRD, y - BRD, 2 * BRD + 1, 2 * BRD + 1 ); | ||
143 | } | ||
144 | |||
145 | void Calibration::mousePressEvent ( QMouseEvent *e ) | ||
146 | { | ||
147 | if ( e-> button ( ) != LeftButton ) | ||
148 | return QWidget::mousePressEvent ( e ); | ||
149 | |||
150 | int olddragged = m_dragged; | ||
151 | int x [2], y [2]; | ||
152 | |||
153 | m_dragged = -1; | ||
154 | for ( int i = 0; i < 2; i++ ) { | ||
155 | x [i] = SCALEX( m_p [i]. x ( )); | ||
156 | y [i] = SCALEY( m_p [i]. y ( )); | ||
157 | |||
158 | if (( QABS( e-> x ( ) - x [i] ) <= BRD ) && | ||
159 | ( QABS( e-> y ( ) - y [i] ) <= BRD )) { | ||
160 | m_dragged = i; | ||
161 | break; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | if ( m_dragged != olddragged ) { | ||
166 | QRect r; | ||
167 | |||
168 | if ( olddragged >= 0 ) | ||
169 | r |= around ( x [olddragged], y [olddragged] ); | ||
170 | if ( m_dragged >= 0 ) | ||
171 | r |= around ( x [m_dragged], y [m_dragged] ); | ||
172 | repaint ( r ); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | void Calibration::mouseMoveEvent ( QMouseEvent *e ) | ||
177 | { | ||
178 | if ( m_dragged < 0 ) | ||
179 | return; | ||
180 | |||
181 | QPoint n [2]; | ||
182 | |||
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 )); | ||
185 | n [1 - m_dragged] = m_p [1 - m_dragged]; | ||
186 | |||
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 ( )); | ||
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 ( )); | ||
191 | |||
192 | QRect r; | ||
193 | int ox [2], oy [2], nx [2], ny [2]; | ||
194 | |||
195 | for ( int i = 0; i < 2; i++ ) { | ||
196 | nx [i] = SCALEX( n [i]. x ( )); | ||
197 | ny [i] = SCALEY( n [i]. y ( )); | ||
198 | ox [i] = SCALEX( m_p [i]. x ( )); | ||
199 | oy [i] = SCALEY( m_p [i]. y ( )); | ||
200 | |||
201 | if ( n [i] != m_p [i] ){ | ||
202 | r |= around ( nx [i], ny [i] ); | ||
203 | r |= around ( ox [i], oy [i] ); | ||
204 | m_p [i] = n [i]; | ||
205 | |||
206 | if ( i == 0 ) { | ||
207 | r |= QRect ( 0, 0, nx [0] - 0 + 1, ny [0] - 0 + 1 ); | ||
208 | r |= QRect ( 0, 0, ox [0] - 0 + 1, oy [0] - 0 + 1 ); | ||
209 | } | ||
210 | else if ( i == 1 ) { | ||
211 | r |= QRect ( nx [1], ny [1], width ( ) - nx [1], height ( ) - ny [1] ); | ||
212 | r |= QRect ( ox [1], oy [1], width ( ) - ox [1], height ( ) - oy [1] ); | ||
213 | } | ||
214 | } | ||
215 | } | ||
216 | if ( r. isValid ( )) { | ||
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 ); | ||
219 | |||
220 | repaint ( r ); | ||
221 | } | ||
222 | } | ||
223 | |||
224 | void Calibration::mouseReleaseEvent ( QMouseEvent *e ) | ||
225 | { | ||
226 | if ( e-> button ( ) != LeftButton ) | ||
227 | return QWidget::mouseReleaseEvent ( e ); | ||
228 | |||
229 | if ( m_dragged < 0 ) | ||
230 | return; | ||
231 | |||
232 | int x = SCALEX( m_p [m_dragged]. x ( )); | ||
233 | int y = SCALEY( m_p [m_dragged]. y ( )); | ||
234 | m_dragged = -1; | ||
235 | |||
236 | repaint ( around ( x, y )); | ||
237 | } | ||
238 | |||
239 | void Calibration::paintEvent ( QPaintEvent * ) | ||
240 | { | ||
241 | QPainter p ( this ); | ||
242 | QColorGroup g = colorGroup ( ); | ||
243 | |||
244 | int x0 = SCALEX( m_p [0]. x ( )); | ||
245 | int y0 = SCALEY( m_p [0]. y ( )); | ||
246 | int x1 = SCALEX( m_p [1]. x ( )); | ||
247 | int y1 = SCALEY( m_p [1]. y ( )); | ||
248 | |||
249 | int dx = x1 - x0; | ||
250 | int dy = y1 - y0; | ||
251 | |||
252 | int ex = x0, ey = y0; | ||
253 | |||
254 | p. setPen ( g. highlight ( )); | ||
255 | |||
256 | p. drawLine ( BRD, BRD, ex, BRD ); | ||
257 | p. drawLine ( ex, BRD, ex, ey ); | ||
258 | |||
259 | for ( int i = 1; i < m_steps; i++ ) { | ||
260 | int fx = x0 + dx * i / m_steps; | ||
261 | int fy = y0 + dy * i / ( m_steps - 1 ); | ||
262 | |||
263 | p. drawLine ( ex, ey, fx, ey ); | ||
264 | p. drawLine ( fx, ey, fx, fy ); | ||
265 | |||
266 | ex = fx; | ||
267 | ey = fy; | ||
268 | } | ||
269 | |||
270 | p. drawLine ( ex, ey, width ( ) - 1 - BRD, ey ); | ||
271 | |||
272 | 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 ( )); | ||
274 | |||
275 | p. setPen ( g. text ( )); | ||
276 | p. drawText ( QRect ( BRD, BRD, width ( ) - 2*BRD, height() - 2*BRD ), AlignTop | AlignRight, tr( "%1 Steps" ). arg ( m_steps )); | ||
277 | } | ||
278 | |||
diff --git a/core/settings/light-and-power/calibration.h b/core/settings/light-and-power/calibration.h new file mode 100644 index 0000000..2bff69a --- a/dev/null +++ b/core/settings/light-and-power/calibration.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | #ifndef __CALIBRATION_H__ | ||
29 | #define __CALIBRATION_H__ | ||
30 | |||
31 | #include <qwidget.h> | ||
32 | |||
33 | class Calibration : public QWidget { | ||
34 | Q_OBJECT | ||
35 | |||
36 | public: | ||
37 | Calibration ( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); | ||
38 | virtual ~Calibration ( ); | ||
39 | |||
40 | QSize scale ( ) const; | ||
41 | int lineSteps ( ) const; | ||
42 | int interval ( ) const; | ||
43 | QPoint startPoint ( ) const; | ||
44 | QPoint endPoint ( ) const; | ||
45 | |||
46 | public slots: | ||
47 | void setScale ( const QSize &s ); | ||
48 | void setLineSteps ( int step ); | ||
49 | void setInterval ( int iv ); | ||
50 | void setStartPoint ( const QPoint &p ); | ||
51 | void setEndPoint ( const QPoint &p ); | ||
52 | |||
53 | protected: | ||
54 | virtual void paintEvent ( QPaintEvent * ); | ||
55 | virtual void mousePressEvent ( QMouseEvent * ); | ||
56 | virtual void mouseMoveEvent ( QMouseEvent * ); | ||
57 | virtual void mouseReleaseEvent ( QMouseEvent * ); | ||
58 | |||
59 | void checkPoints ( ); | ||
60 | |||
61 | private: | ||
62 | QSize m_scale; | ||
63 | QPoint m_p [2]; | ||
64 | int m_dragged; | ||
65 | int m_steps; | ||
66 | int m_interval; | ||
67 | }; | ||
68 | |||
69 | #endif | ||
70 | |||
71 | |||
diff --git a/core/settings/light-and-power/light-and-power.pro b/core/settings/light-and-power/light-and-power.pro index 43395bf..c89a26d 100644 --- a/core/settings/light-and-power/light-and-power.pro +++ b/core/settings/light-and-power/light-and-power.pro | |||
@@ -3,5 +3,5 @@ CONFIG += qt warn_on release | |||
3 | DESTDIR = $(OPIEDIR)/bin | 3 | DESTDIR = $(OPIEDIR)/bin |
4 | HEADERS = settings.h | 4 | HEADERS = settings.h sensor.h calibration.h |
5 | SOURCES = light.cpp main.cpp | 5 | SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp |
6 | INTERFACES= lightsettingsbase.ui | 6 | INTERFACES= lightsettingsbase.ui sensorbase.ui |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 572f8ea..2ea0356 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -1,22 +1,28 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the OPIE Project |
3 | ** | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | ** This file is part of Qtopia Environment. | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This file is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : or (at your option) any later version. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ** | 18 | ..}^=.= = ; Public License for more details. |
19 | **********************************************************************/ | 19 | ++= -. .` .: |
20 | 20 | : = ...= . :.=- You should have received a copy of the GNU | |
21 | // redone by Maximilian Reiss <harlekin@handhelds.org> | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
22 | 28 | ||
@@ -55,2 +61,4 @@ | |||
55 | 61 | ||
62 | #include "sensor.h" | ||
63 | |||
56 | using namespace Opie; | 64 | using namespace Opie; |
@@ -58,12 +66,7 @@ using namespace Opie; | |||
58 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 66 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
59 | : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) | 67 | : LightSettingsBase( parent, name, true, WStyle_ContextHelp ) |
60 | { | 68 | { |
61 | int res = ODevice::inst ( )-> displayBrightnessResolution ( ); | 69 | m_res = ODevice::inst ( )-> displayBrightnessResolution ( ); |
62 | 70 | ||
63 | if ( ODevice::inst()->hasLightSensor() ) { | 71 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
64 | // Not supported yet - hide until implemented | ||
65 | CalibrateLightSensor->setEnabled( false ); | ||
66 | CalibrateLightSensorAC->setEnabled( false ); | ||
67 | } else { | ||
68 | // if ipaq no need to show the sensor box | ||
69 | auto_brightness->hide(); | 72 | auto_brightness->hide(); |
@@ -85,13 +88,15 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
85 | 88 | ||
86 | initbright = config. readNumEntry ( "Brightness", 255 ); | 89 | int bright = config. readNumEntry ( "Brightness", 255 ); |
87 | brightness-> setMaxValue ( res - 1 ); | 90 | brightness-> setMaxValue ( m_res - 1 ); |
88 | brightness-> setTickInterval ( QMAX( 1, res / 16 )); | 91 | brightness-> setTickInterval ( QMAX( 1, m_res / 16 )); |
89 | brightness-> setLineStep ( QMAX( 1, res / 16 )); | 92 | brightness-> setLineStep ( QMAX( 1, m_res / 16 )); |
90 | brightness-> setPageStep ( QMAX( 1, res / 16 )); | 93 | brightness-> setPageStep ( QMAX( 1, m_res / 16 )); |
91 | brightness-> setValue (( initbright * ( res - 1 ) + 127 ) / 255 ); | 94 | brightness-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); |
92 | 95 | ||
93 | // light sensor | 96 | // light sensor |
94 | auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); | 97 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
98 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | ||
95 | 99 | ||
96 | config.setGroup( "AC" ); | 100 | config.setGroup( "AC" ); |
101 | |||
97 | // ac spinboxes | 102 | // ac spinboxes |
@@ -104,17 +109,12 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
104 | 109 | ||
105 | initbright_ac = config. readNumEntry ( "Brightness", 255 ); | 110 | bright = config. readNumEntry ( "Brightness", 255 ); |
106 | brightness_ac_3-> setMaxValue ( res - 1 ); | 111 | brightness_ac_3-> setMaxValue ( m_res - 1 ); |
107 | brightness_ac_3-> setTickInterval ( QMAX( 1, res / 16 )); | 112 | brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 )); |
108 | brightness_ac_3-> setLineStep ( QMAX( 1, res / 16 )); | 113 | brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 )); |
109 | brightness_ac_3-> setPageStep ( QMAX( 1, res / 16 )); | 114 | brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 )); |
110 | brightness_ac_3-> setValue (( initbright_ac * ( res - 1 ) + 127 ) / 255 ); | 115 | brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); |
111 | 116 | ||
112 | // light sensor | 117 | // light sensor |
113 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensor",0) != 0 ); | 118 | auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
114 | 119 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | |
115 | |||
116 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | ||
117 | //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); | ||
118 | //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; | ||
119 | //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); | ||
120 | 120 | ||
@@ -126,15 +126,32 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
126 | 126 | ||
127 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); | 127 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) |
128 | connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); | 128 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); |
129 | else | ||
130 | connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | ||
129 | } | 131 | } |
130 | 132 | ||
131 | LightSettings::~LightSettings() { | 133 | LightSettings::~LightSettings ( ) |
134 | { | ||
135 | } | ||
136 | |||
137 | |||
138 | void LightSettings::calibrateSensor ( ) | ||
139 | { | ||
140 | Sensor *s = new Sensor ( m_sensordata, this ); | ||
141 | s-> showMaximized ( ); | ||
142 | s-> exec ( ); | ||
143 | delete s; | ||
132 | } | 144 | } |
133 | 145 | ||
134 | void LightSettings::slotSliderTicks( int steps ) { | 146 | void LightSettings::calibrateSensorAC ( ) |
135 | // LightMinValueSlider->setTickInterval( steps ); | 147 | { |
148 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | ||
149 | s-> showMaximized ( ); | ||
150 | s-> exec ( ); | ||
151 | delete s; | ||
136 | } | 152 | } |
137 | 153 | ||
138 | static void set_fl(int bright) | 154 | void LightSettings::setBacklight ( int bright ) |
139 | { | 155 | { |
156 | bright = bright * 255 / ( m_res - 1 ); | ||
140 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 157 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
@@ -145,3 +162,6 @@ void LightSettings::reject() | |||
145 | { | 162 | { |
146 | set_fl(initbright); | 163 | { |
164 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | ||
165 | e << -1; | ||
166 | } | ||
147 | QDialog::reject(); | 167 | QDialog::reject(); |
@@ -151,29 +171,11 @@ void LightSettings::accept() | |||
151 | { | 171 | { |
152 | if ( qApp->focusWidget() ) { | ||
153 | qApp->focusWidget()->clearFocus(); | ||
154 | } | ||
155 | |||
156 | applyBrightness(); | ||
157 | |||
158 | // bat | ||
159 | int i_dim = interval_dim->value(); | ||
160 | int i_lightoff = interval_lightoff->value(); | ||
161 | int i_suspend = interval_suspend->value(); | ||
162 | |||
163 | // ac | ||
164 | int i_dim_ac = interval_dim_ac_3->value(); | ||
165 | int i_lightoff_ac = interval_lightoff_ac_3->value(); | ||
166 | int i_suspend_ac = interval_suspend_ac_3->value(); | ||
167 | |||
168 | Config config( "apm" ); | 172 | Config config( "apm" ); |
169 | 173 | ||
170 | config.setGroup( "Battery" ); | ||
171 | |||
172 | // bat | 174 | // bat |
175 | config. setGroup ( "Battery" ); | ||
173 | config.writeEntry( "LcdOffOnly", LcdOffOnly->isChecked() ); | 176 | config.writeEntry( "LcdOffOnly", LcdOffOnly->isChecked() ); |
174 | config.writeEntry( "Dim", i_dim ); | 177 | config. writeEntry ( "Dim", interval_dim-> value ( )); |
175 | config.writeEntry( "LightOff", i_lightoff ); | 178 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); |
176 | config.writeEntry( "Suspend", i_suspend ); | 179 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); |
177 | config.writeEntry( "Brightness", | 180 | config. writeEntry ( "Brightness", brightness-> value ( ) * 255 / ( m_res - 1 ) ); |
178 | ( brightness->value() ) * 255 / brightness->maxValue() ); | ||
179 | 181 | ||
@@ -182,8 +184,6 @@ void LightSettings::accept() | |||
182 | config.writeEntry( "LcdOffOnly", LcdOffOnly_2_3->isChecked() ); | 184 | config.writeEntry( "LcdOffOnly", LcdOffOnly_2_3->isChecked() ); |
183 | config.writeEntry( "Dim", i_dim_ac ); | 185 | config. writeEntry ( "Dim", interval_dim_ac_3-> value ( )); |
184 | config.writeEntry( "LightOff", i_lightoff_ac ); | 186 | config. writeEntry ( "LightOff", interval_lightoff_ac_3-> value ( )); |
185 | config.writeEntry( "Suspend", i_suspend_ac ); | 187 | config. writeEntry ( "Suspend", interval_suspend_ac_3-> value ( )); |
186 | config.writeEntry( "Brightness", | 188 | config. writeEntry ( "Brightness", brightness_ac_3-> value ( ) * 255 / ( m_res - 1 )); |
187 | ( brightness_ac_3->value()) * 255 / brightness_ac_3->maxValue() ); | ||
188 | |||
189 | 189 | ||
@@ -193,10 +193,8 @@ void LightSettings::accept() | |||
193 | config.writeEntry( "LightSensor", auto_brightness->isChecked() ); | 193 | config.writeEntry( "LightSensor", auto_brightness->isChecked() ); |
194 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); | ||
194 | config.setGroup( "AC" ); | 195 | config.setGroup( "AC" ); |
195 | config.writeEntry( "LightSensor", auto_brightness_ac_3->isChecked() ); | 196 | config.writeEntry( "LightSensor", auto_brightness_ac_3->isChecked() ); |
196 | //config.writeEntry( "Steps", LightStepSpin->value() ); | 197 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); |
197 | //onfig.writeEntry( "MinValue", LightMinValueSlider->value() ); | ||
198 | //config.writeEntry( "Shift", LightShiftSpin->value() ); | ||
199 | } | 198 | } |
200 | 199 | ||
201 | |||
202 | // advanced | 200 | // advanced |
@@ -208,2 +206,3 @@ void LightSettings::accept() | |||
208 | 206 | ||
207 | // notify the launcher | ||
209 | { | 208 | { |
@@ -223,19 +222,2 @@ void LightSettings::accept() | |||
223 | 222 | ||
224 | void LightSettings::applyBrightness() | ||
225 | { | ||
226 | if ( PowerStatusManager::readStatus().acStatus() != PowerStatus::Online ) { | ||
227 | int bright = ( brightness->value() ) * 255 / brightness->maxValue(); | ||
228 | set_fl(bright); | ||
229 | } | ||
230 | } | ||
231 | |||
232 | void LightSettings::applyBrightnessAC() | ||
233 | { | ||
234 | // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting | ||
235 | if ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ) { | ||
236 | int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); | ||
237 | set_fl(bright); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | void LightSettings::done(int r) | 223 | void LightSettings::done(int r) |
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index f41e5a6..4df6024 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>399</width> | 14 | <width>387</width> |
15 | <height>532</height> | 15 | <height>532</height> |
@@ -72,3 +72,3 @@ | |||
72 | <name>margin</name> | 72 | <name>margin</name> |
73 | <number>3</number> | 73 | <number>5</number> |
74 | </property> | 74 | </property> |
@@ -98,23 +98,2 @@ | |||
98 | </property> | 98 | </property> |
99 | <vbox> | ||
100 | <property stdset="1"> | ||
101 | <name>margin</name> | ||
102 | <number>3</number> | ||
103 | </property> | ||
104 | <property stdset="1"> | ||
105 | <name>spacing</name> | ||
106 | <number>3</number> | ||
107 | </property> | ||
108 | <widget> | ||
109 | <class>QLayoutWidget</class> | ||
110 | <property stdset="1"> | ||
111 | <name>name</name> | ||
112 | <cstring>Layout11</cstring> | ||
113 | </property> | ||
114 | <property> | ||
115 | <name>layoutMargin</name> | ||
116 | </property> | ||
117 | <property> | ||
118 | <name>layoutSpacing</name> | ||
119 | </property> | ||
120 | <grid> | 99 | <grid> |
@@ -122,3 +101,3 @@ | |||
122 | <name>margin</name> | 101 | <name>margin</name> |
123 | <number>3</number> | 102 | <number>5</number> |
124 | </property> | 103 | </property> |
@@ -166,2 +145,9 @@ | |||
166 | <property stdset="1"> | 145 | <property stdset="1"> |
146 | <name>sizePolicy</name> | ||
147 | <sizepolicy> | ||
148 | <hsizetype>3</hsizetype> | ||
149 | <vsizetype>1</vsizetype> | ||
150 | </sizepolicy> | ||
151 | </property> | ||
152 | <property stdset="1"> | ||
167 | <name>text</name> | 153 | <name>text</name> |
@@ -179,3 +165,3 @@ | |||
179 | <sizepolicy> | 165 | <sizepolicy> |
180 | <hsizetype>7</hsizetype> | 166 | <hsizetype>3</hsizetype> |
181 | <vsizetype>1</vsizetype> | 167 | <vsizetype>1</vsizetype> |
@@ -257,2 +243,9 @@ | |||
257 | <property stdset="1"> | 243 | <property stdset="1"> |
244 | <name>sizePolicy</name> | ||
245 | <sizepolicy> | ||
246 | <hsizetype>3</hsizetype> | ||
247 | <vsizetype>1</vsizetype> | ||
248 | </sizepolicy> | ||
249 | </property> | ||
250 | <property stdset="1"> | ||
258 | <name>text</name> | 251 | <name>text</name> |
@@ -261,5 +254,3 @@ | |||
261 | </widget> | 254 | </widget> |
262 | </grid> | 255 | <widget row="3" column="0" rowspan="1" colspan="2" > |
263 | </widget> | ||
264 | <widget> | ||
265 | <class>QCheckBox</class> | 256 | <class>QCheckBox</class> |
@@ -270,2 +261,9 @@ | |||
270 | <property stdset="1"> | 261 | <property stdset="1"> |
262 | <name>sizePolicy</name> | ||
263 | <sizepolicy> | ||
264 | <hsizetype>7</hsizetype> | ||
265 | <vsizetype>0</vsizetype> | ||
266 | </sizepolicy> | ||
267 | </property> | ||
268 | <property stdset="1"> | ||
271 | <name>text</name> | 269 | <name>text</name> |
@@ -274,3 +272,3 @@ | |||
274 | </widget> | 272 | </widget> |
275 | </vbox> | 273 | </grid> |
276 | </widget> | 274 | </widget> |
@@ -295,3 +293,3 @@ | |||
295 | <name>margin</name> | 293 | <name>margin</name> |
296 | <number>3</number> | 294 | <number>5</number> |
297 | </property> | 295 | </property> |
@@ -346,2 +344,5 @@ | |||
346 | </property> | 344 | </property> |
345 | <property> | ||
346 | <name>layoutSpacing</name> | ||
347 | </property> | ||
347 | <hbox> | 348 | <hbox> |
@@ -353,3 +354,3 @@ | |||
353 | <name>spacing</name> | 354 | <name>spacing</name> |
354 | <number>6</number> | 355 | <number>3</number> |
355 | </property> | 356 | </property> |
@@ -436,2 +437,5 @@ | |||
436 | </property> | 437 | </property> |
438 | <property> | ||
439 | <name>layoutSpacing</name> | ||
440 | </property> | ||
437 | <hbox> | 441 | <hbox> |
@@ -443,3 +447,3 @@ | |||
443 | <name>spacing</name> | 447 | <name>spacing</name> |
444 | <number>6</number> | 448 | <number>3</number> |
445 | </property> | 449 | </property> |
@@ -515,3 +519,3 @@ | |||
515 | <name>margin</name> | 519 | <name>margin</name> |
516 | <number>3</number> | 520 | <number>5</number> |
517 | </property> | 521 | </property> |
@@ -541,23 +545,2 @@ | |||
541 | </property> | 545 | </property> |
542 | <vbox> | ||
543 | <property stdset="1"> | ||
544 | <name>margin</name> | ||
545 | <number>3</number> | ||
546 | </property> | ||
547 | <property stdset="1"> | ||
548 | <name>spacing</name> | ||
549 | <number>3</number> | ||
550 | </property> | ||
551 | <widget> | ||
552 | <class>QLayoutWidget</class> | ||
553 | <property stdset="1"> | ||
554 | <name>name</name> | ||
555 | <cstring>Layout14</cstring> | ||
556 | </property> | ||
557 | <property> | ||
558 | <name>layoutMargin</name> | ||
559 | </property> | ||
560 | <property> | ||
561 | <name>layoutSpacing</name> | ||
562 | </property> | ||
563 | <grid> | 546 | <grid> |
@@ -565,3 +548,3 @@ | |||
565 | <name>margin</name> | 548 | <name>margin</name> |
566 | <number>3</number> | 549 | <number>5</number> |
567 | </property> | 550 | </property> |
@@ -611,3 +594,3 @@ | |||
611 | <sizepolicy> | 594 | <sizepolicy> |
612 | <hsizetype>7</hsizetype> | 595 | <hsizetype>3</hsizetype> |
613 | <vsizetype>1</vsizetype> | 596 | <vsizetype>1</vsizetype> |
@@ -658,2 +641,9 @@ | |||
658 | <property stdset="1"> | 641 | <property stdset="1"> |
642 | <name>sizePolicy</name> | ||
643 | <sizepolicy> | ||
644 | <hsizetype>3</hsizetype> | ||
645 | <vsizetype>1</vsizetype> | ||
646 | </sizepolicy> | ||
647 | </property> | ||
648 | <property stdset="1"> | ||
659 | <name>text</name> | 649 | <name>text</name> |
@@ -700,2 +690,9 @@ | |||
700 | <property stdset="1"> | 690 | <property stdset="1"> |
691 | <name>sizePolicy</name> | ||
692 | <sizepolicy> | ||
693 | <hsizetype>3</hsizetype> | ||
694 | <vsizetype>1</vsizetype> | ||
695 | </sizepolicy> | ||
696 | </property> | ||
697 | <property stdset="1"> | ||
701 | <name>text</name> | 698 | <name>text</name> |
@@ -704,5 +701,3 @@ | |||
704 | </widget> | 701 | </widget> |
705 | </grid> | 702 | <widget row="3" column="0" rowspan="1" colspan="2" > |
706 | </widget> | ||
707 | <widget> | ||
708 | <class>QCheckBox</class> | 703 | <class>QCheckBox</class> |
@@ -713,2 +708,9 @@ | |||
713 | <property stdset="1"> | 708 | <property stdset="1"> |
709 | <name>sizePolicy</name> | ||
710 | <sizepolicy> | ||
711 | <hsizetype>7</hsizetype> | ||
712 | <vsizetype>0</vsizetype> | ||
713 | </sizepolicy> | ||
714 | </property> | ||
715 | <property stdset="1"> | ||
714 | <name>text</name> | 716 | <name>text</name> |
@@ -717,3 +719,3 @@ | |||
717 | </widget> | 719 | </widget> |
718 | </vbox> | 720 | </grid> |
719 | </widget> | 721 | </widget> |
@@ -738,3 +740,3 @@ | |||
738 | <name>margin</name> | 740 | <name>margin</name> |
739 | <number>3</number> | 741 | <number>5</number> |
740 | </property> | 742 | </property> |
@@ -793,2 +795,5 @@ | |||
793 | </property> | 795 | </property> |
796 | <property> | ||
797 | <name>layoutSpacing</name> | ||
798 | </property> | ||
794 | <hbox> | 799 | <hbox> |
@@ -800,3 +805,3 @@ | |||
800 | <name>spacing</name> | 805 | <name>spacing</name> |
801 | <number>6</number> | 806 | <number>3</number> |
802 | </property> | 807 | </property> |
@@ -883,2 +888,5 @@ | |||
883 | </property> | 888 | </property> |
889 | <property> | ||
890 | <name>layoutSpacing</name> | ||
891 | </property> | ||
884 | <hbox> | 892 | <hbox> |
@@ -890,3 +898,3 @@ | |||
890 | <name>spacing</name> | 898 | <name>spacing</name> |
891 | <number>6</number> | 899 | <number>3</number> |
892 | </property> | 900 | </property> |
@@ -962,3 +970,3 @@ | |||
962 | <name>margin</name> | 970 | <name>margin</name> |
963 | <number>3</number> | 971 | <number>5</number> |
964 | </property> | 972 | </property> |
@@ -984,23 +992,2 @@ | |||
984 | </property> | 992 | </property> |
985 | <vbox> | ||
986 | <property stdset="1"> | ||
987 | <name>margin</name> | ||
988 | <number>3</number> | ||
989 | </property> | ||
990 | <property stdset="1"> | ||
991 | <name>spacing</name> | ||
992 | <number>3</number> | ||
993 | </property> | ||
994 | <widget> | ||
995 | <class>QLayoutWidget</class> | ||
996 | <property stdset="1"> | ||
997 | <name>name</name> | ||
998 | <cstring>Layout18</cstring> | ||
999 | </property> | ||
1000 | <property> | ||
1001 | <name>layoutMargin</name> | ||
1002 | </property> | ||
1003 | <property> | ||
1004 | <name>layoutSpacing</name> | ||
1005 | </property> | ||
1006 | <grid> | 993 | <grid> |
@@ -1008,3 +995,3 @@ | |||
1008 | <name>margin</name> | 995 | <name>margin</name> |
1009 | <number>3</number> | 996 | <number>5</number> |
1010 | </property> | 997 | </property> |
@@ -1023,3 +1010,3 @@ | |||
1023 | <sizepolicy> | 1010 | <sizepolicy> |
1024 | <hsizetype>7</hsizetype> | 1011 | <hsizetype>3</hsizetype> |
1025 | <vsizetype>5</vsizetype> | 1012 | <vsizetype>5</vsizetype> |
@@ -1050,2 +1037,6 @@ | |||
1050 | <property stdset="1"> | 1037 | <property stdset="1"> |
1038 | <name>buttonSymbols</name> | ||
1039 | <enum>PlusMinus</enum> | ||
1040 | </property> | ||
1041 | <property stdset="1"> | ||
1051 | <name>maxValue</name> | 1042 | <name>maxValue</name> |
@@ -1073,2 +1064,6 @@ | |||
1073 | <property stdset="1"> | 1064 | <property stdset="1"> |
1065 | <name>buttonSymbols</name> | ||
1066 | <enum>PlusMinus</enum> | ||
1067 | </property> | ||
1068 | <property stdset="1"> | ||
1074 | <name>maxValue</name> | 1069 | <name>maxValue</name> |
@@ -1100,2 +1095,6 @@ | |||
1100 | <property stdset="1"> | 1095 | <property stdset="1"> |
1096 | <name>buttonSymbols</name> | ||
1097 | <enum>PlusMinus</enum> | ||
1098 | </property> | ||
1099 | <property stdset="1"> | ||
1101 | <name>maxValue</name> | 1100 | <name>maxValue</name> |
@@ -1150,4 +1149,2 @@ | |||
1150 | </widget> | 1149 | </widget> |
1151 | </vbox> | ||
1152 | </widget> | ||
1153 | <spacer> | 1150 | <spacer> |
@@ -1277,2 +1274,16 @@ | |||
1277 | </connection> | 1274 | </connection> |
1275 | <connection> | ||
1276 | <sender>CalibrateLightSensor</sender> | ||
1277 | <signal>clicked()</signal> | ||
1278 | <receiver>LightSettingsBase</receiver> | ||
1279 | <slot>calibrateSensor()</slot> | ||
1280 | </connection> | ||
1281 | <connection> | ||
1282 | <sender>CalibrateLightSensorAC</sender> | ||
1283 | <signal>clicked()</signal> | ||
1284 | <receiver>LightSettingsBase</receiver> | ||
1285 | <slot>calibrateSensorAC()</slot> | ||
1286 | </connection> | ||
1287 | <slot access="public">calibrateSensor()</slot> | ||
1288 | <slot access="public">calibrateSensorAC()</slot> | ||
1278 | </connections> | 1289 | </connections> |
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp new file mode 100644 index 0000000..ddd71d6 --- a/dev/null +++ b/core/settings/light-and-power/sensor.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | #include <qframe.h> | ||
29 | #include <qlayout.h> | ||
30 | #include <qslider.h> | ||
31 | #include <qspinbox.h> | ||
32 | |||
33 | #include "calibration.h" | ||
34 | #include "sensor.h" | ||
35 | |||
36 | Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | ||
37 | : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) | ||
38 | { | ||
39 | int steps = 5; | ||
40 | int inter = 5; | ||
41 | |||
42 | int smin = 0; | ||
43 | int smax = 255; | ||
44 | int lmin = 0; | ||
45 | int lmax = 255; | ||
46 | |||
47 | switch ( params. count ( )) { | ||
48 | case 6: lmax = params [5]. toInt ( ); | ||
49 | case 5: lmin = params [4]. toInt ( ); | ||
50 | case 4: smax = params [3]. toInt ( ); | ||
51 | case 3: smin = params [2]. toInt ( ); | ||
52 | case 2: steps = params [1]. toInt ( ); | ||
53 | case 1: inter = params [0]. toInt ( ); | ||
54 | } | ||
55 | |||
56 | QVBoxLayout *lay = new QVBoxLayout ( frame ); | ||
57 | lay-> setMargin ( 2 ); | ||
58 | m_calib = new Calibration ( frame ); | ||
59 | lay-> add ( m_calib ); | ||
60 | |||
61 | m_calib-> setScale ( QSize ( 256, 256 )); | ||
62 | m_calib-> setLineSteps ( steps ); | ||
63 | m_calib-> setInterval ( inter ); | ||
64 | m_calib-> setStartPoint ( QPoint ( smin, lmin )); | ||
65 | m_calib-> setEndPoint ( QPoint ( smax, lmax )); | ||
66 | |||
67 | interval-> setValue ( inter ); | ||
68 | linesteps-> setValue ( steps ); | ||
69 | |||
70 | connect ( interval, SIGNAL( valueChanged ( int )), m_calib, SLOT( setInterval ( int ))); | ||
71 | connect ( linesteps, SIGNAL( valueChanged ( int )), m_calib, SLOT( setLineSteps ( int ))); | ||
72 | } | ||
73 | |||
74 | void Sensor::accept ( ) | ||
75 | { | ||
76 | m_params. clear ( ); | ||
77 | m_params << QString::number ( m_calib-> interval ( )) | ||
78 | << QString::number ( m_calib-> lineSteps ( )) | ||
79 | << QString::number ( m_calib-> startPoint ( ). x ( )) | ||
80 | << QString::number ( m_calib-> endPoint ( ). x ( )) | ||
81 | << QString::number ( m_calib-> startPoint ( ). y ( )) | ||
82 | << QString::number ( m_calib-> endPoint ( ). y ( )); | ||
83 | |||
84 | QDialog::accept ( ); | ||
85 | } | ||
diff --git a/core/settings/light-and-power/sensor.h b/core/settings/light-and-power/sensor.h new file mode 100644 index 0000000..7a26d81 --- a/dev/null +++ b/core/settings/light-and-power/sensor.h | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of the OPIE Project | ||
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | ||
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | ||
5 | .>+-= | ||
6 | _;:, .> :=|. This file is free software; you can | ||
7 | .> <`_, > . <= redistribute it and/or modify it under | ||
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
9 | .="- .-=="i, .._ License as published by the Free Software | ||
10 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
11 | ._= =} : or (at your option) any later version. | ||
12 | .%`+i> _;_. | ||
13 | .i_,=:_. -<s. This file is distributed in the hope that | ||
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
15 | : .. .:, . . . without even the implied warranty of | ||
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | ||
18 | ..}^=.= = ; Public License for more details. | ||
19 | ++= -. .` .: | ||
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | #ifndef __SENSOR_H__ | ||
29 | #define __SENSOR_H__ | ||
30 | |||
31 | #include "sensorbase.h" | ||
32 | |||
33 | class Calibration; | ||
34 | class QStringList; | ||
35 | |||
36 | class Sensor : public SensorBase { | ||
37 | public: | ||
38 | Sensor ( QStringList ¶ms, QWidget *parent = 0, const char *name = 0 ); | ||
39 | |||
40 | virtual void accept ( ); | ||
41 | |||
42 | private: | ||
43 | QStringList &m_params; | ||
44 | Calibration *m_calib; | ||
45 | }; | ||
46 | |||
47 | #endif \ No newline at end of file | ||
diff --git a/core/settings/light-and-power/sensorbase.ui b/core/settings/light-and-power/sensorbase.ui new file mode 100644 index 0000000..98fce88 --- a/dev/null +++ b/core/settings/light-and-power/sensorbase.ui | |||
@@ -0,0 +1,870 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>SensorBase</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>SensorBase</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>293</width> | ||
15 | <height>443</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Sensor Calibration</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>3</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>3</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QLayoutWidget</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>Layout21</cstring> | ||
42 | </property> | ||
43 | <property> | ||
44 | <name>layoutSpacing</name> | ||
45 | </property> | ||
46 | <grid> | ||
47 | <property stdset="1"> | ||
48 | <name>margin</name> | ||
49 | <number>0</number> | ||
50 | </property> | ||
51 | <property stdset="1"> | ||
52 | <name>spacing</name> | ||
53 | <number>2</number> | ||
54 | </property> | ||
55 | <widget row="0" column="0" > | ||
56 | <class>QLayoutWidget</class> | ||
57 | <property stdset="1"> | ||
58 | <name>name</name> | ||
59 | <cstring>Layout20</cstring> | ||
60 | </property> | ||
61 | <property> | ||
62 | <name>layoutSpacing</name> | ||
63 | </property> | ||
64 | <vbox> | ||
65 | <property stdset="1"> | ||
66 | <name>margin</name> | ||
67 | <number>0</number> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>spacing</name> | ||
71 | <number>3</number> | ||
72 | </property> | ||
73 | <widget> | ||
74 | <class>QLabel</class> | ||
75 | <property stdset="1"> | ||
76 | <name>name</name> | ||
77 | <cstring>PixmapLabel1</cstring> | ||
78 | </property> | ||
79 | <property stdset="1"> | ||
80 | <name>pixmap</name> | ||
81 | <pixmap>image0</pixmap> | ||
82 | </property> | ||
83 | <property stdset="1"> | ||
84 | <name>scaledContents</name> | ||
85 | <bool>false</bool> | ||
86 | </property> | ||
87 | </widget> | ||
88 | <widget> | ||
89 | <class>QLabel</class> | ||
90 | <property stdset="1"> | ||
91 | <name>name</name> | ||
92 | <cstring>TextLabel5</cstring> | ||
93 | </property> | ||
94 | <property stdset="1"> | ||
95 | <name>text</name> | ||
96 | <string>Full</string> | ||
97 | </property> | ||
98 | </widget> | ||
99 | <spacer> | ||
100 | <property> | ||
101 | <name>name</name> | ||
102 | <cstring>Spacer2</cstring> | ||
103 | </property> | ||
104 | <property stdset="1"> | ||
105 | <name>orientation</name> | ||
106 | <enum>Vertical</enum> | ||
107 | </property> | ||
108 | <property stdset="1"> | ||
109 | <name>sizeType</name> | ||
110 | <enum>Expanding</enum> | ||
111 | </property> | ||
112 | <property> | ||
113 | <name>sizeHint</name> | ||
114 | <size> | ||
115 | <width>20</width> | ||
116 | <height>20</height> | ||
117 | </size> | ||
118 | </property> | ||
119 | </spacer> | ||
120 | <widget> | ||
121 | <class>QLabel</class> | ||
122 | <property stdset="1"> | ||
123 | <name>name</name> | ||
124 | <cstring>TextLabel4_3</cstring> | ||
125 | </property> | ||
126 | <property stdset="1"> | ||
127 | <name>text</name> | ||
128 | <string>Off</string> | ||
129 | </property> | ||
130 | </widget> | ||
131 | <widget> | ||
132 | <class>QLabel</class> | ||
133 | <property stdset="1"> | ||
134 | <name>name</name> | ||
135 | <cstring>PixmapLabel2</cstring> | ||
136 | </property> | ||
137 | <property stdset="1"> | ||
138 | <name>pixmap</name> | ||
139 | <pixmap>image1</pixmap> | ||
140 | </property> | ||
141 | <property stdset="1"> | ||
142 | <name>scaledContents</name> | ||
143 | <bool>false</bool> | ||
144 | </property> | ||
145 | </widget> | ||
146 | </vbox> | ||
147 | </widget> | ||
148 | <widget row="0" column="1" > | ||
149 | <class>QFrame</class> | ||
150 | <property stdset="1"> | ||
151 | <name>name</name> | ||
152 | <cstring>frame</cstring> | ||
153 | </property> | ||
154 | <property stdset="1"> | ||
155 | <name>frameShape</name> | ||
156 | <enum>StyledPanel</enum> | ||
157 | </property> | ||
158 | <property stdset="1"> | ||
159 | <name>frameShadow</name> | ||
160 | <enum>Sunken</enum> | ||
161 | </property> | ||
162 | </widget> | ||
163 | <widget row="1" column="1" > | ||
164 | <class>QLayoutWidget</class> | ||
165 | <property stdset="1"> | ||
166 | <name>name</name> | ||
167 | <cstring>Layout16</cstring> | ||
168 | </property> | ||
169 | <property> | ||
170 | <name>layoutSpacing</name> | ||
171 | </property> | ||
172 | <hbox> | ||
173 | <property stdset="1"> | ||
174 | <name>margin</name> | ||
175 | <number>0</number> | ||
176 | </property> | ||
177 | <property stdset="1"> | ||
178 | <name>spacing</name> | ||
179 | <number>3</number> | ||
180 | </property> | ||
181 | <widget> | ||
182 | <class>QLabel</class> | ||
183 | <property stdset="1"> | ||
184 | <name>name</name> | ||
185 | <cstring>TextLabel3_2_2</cstring> | ||
186 | </property> | ||
187 | <property stdset="1"> | ||
188 | <name>sizePolicy</name> | ||
189 | <sizepolicy> | ||
190 | <hsizetype>0</hsizetype> | ||
191 | <vsizetype>0</vsizetype> | ||
192 | </sizepolicy> | ||
193 | </property> | ||
194 | <property stdset="1"> | ||
195 | <name>minimumSize</name> | ||
196 | <size> | ||
197 | <width>14</width> | ||
198 | <height>14</height> | ||
199 | </size> | ||
200 | </property> | ||
201 | <property stdset="1"> | ||
202 | <name>maximumSize</name> | ||
203 | <size> | ||
204 | <width>14</width> | ||
205 | <height>14</height> | ||
206 | </size> | ||
207 | </property> | ||
208 | <property stdset="1"> | ||
209 | <name>palette</name> | ||
210 | <palette> | ||
211 | <active> | ||
212 | <color> | ||
213 | <red>0</red> | ||
214 | <green>0</green> | ||
215 | <blue>0</blue> | ||
216 | </color> | ||
217 | <color> | ||
218 | <red>218</red> | ||
219 | <green>226</green> | ||
220 | <blue>255</blue> | ||
221 | </color> | ||
222 | <color> | ||
223 | <red>255</red> | ||
224 | <green>255</green> | ||
225 | <blue>255</blue> | ||
226 | </color> | ||
227 | <color> | ||
228 | <red>236</red> | ||
229 | <green>240</green> | ||
230 | <blue>255</blue> | ||
231 | </color> | ||
232 | <color> | ||
233 | <red>109</red> | ||
234 | <green>113</green> | ||
235 | <blue>127</blue> | ||
236 | </color> | ||
237 | <color> | ||
238 | <red>145</red> | ||
239 | <green>151</green> | ||
240 | <blue>170</blue> | ||
241 | </color> | ||
242 | <color> | ||
243 | <red>0</red> | ||
244 | <green>0</green> | ||
245 | <blue>0</blue> | ||
246 | </color> | ||
247 | <color> | ||
248 | <red>255</red> | ||
249 | <green>255</green> | ||
250 | <blue>255</blue> | ||
251 | </color> | ||
252 | <color> | ||
253 | <red>0</red> | ||
254 | <green>0</green> | ||
255 | <blue>0</blue> | ||
256 | </color> | ||
257 | <color> | ||
258 | <red>255</red> | ||
259 | <green>255</green> | ||
260 | <blue>255</blue> | ||
261 | </color> | ||
262 | <color> | ||
263 | <red>0</red> | ||
264 | <green>0</green> | ||
265 | <blue>0</blue> | ||
266 | </color> | ||
267 | <color> | ||
268 | <red>0</red> | ||
269 | <green>0</green> | ||
270 | <blue>0</blue> | ||
271 | </color> | ||
272 | <color> | ||
273 | <red>10</red> | ||
274 | <green>95</green> | ||
275 | <blue>137</blue> | ||
276 | </color> | ||
277 | <color> | ||
278 | <red>255</red> | ||
279 | <green>255</green> | ||
280 | <blue>255</blue> | ||
281 | </color> | ||
282 | </active> | ||
283 | <disabled> | ||
284 | <color> | ||
285 | <red>128</red> | ||
286 | <green>128</green> | ||
287 | <blue>128</blue> | ||
288 | </color> | ||
289 | <color> | ||
290 | <red>218</red> | ||
291 | <green>226</green> | ||
292 | <blue>255</blue> | ||
293 | </color> | ||
294 | <color> | ||
295 | <red>255</red> | ||
296 | <green>255</green> | ||
297 | <blue>255</blue> | ||
298 | </color> | ||
299 | <color> | ||
300 | <red>255</red> | ||
301 | <green>255</green> | ||
302 | <blue>255</blue> | ||
303 | </color> | ||
304 | <color> | ||
305 | <red>109</red> | ||
306 | <green>113</green> | ||
307 | <blue>127</blue> | ||
308 | </color> | ||
309 | <color> | ||
310 | <red>145</red> | ||
311 | <green>151</green> | ||
312 | <blue>170</blue> | ||
313 | </color> | ||
314 | <color> | ||
315 | <red>0</red> | ||
316 | <green>0</green> | ||
317 | <blue>0</blue> | ||
318 | </color> | ||
319 | <color> | ||
320 | <red>255</red> | ||
321 | <green>255</green> | ||
322 | <blue>255</blue> | ||
323 | </color> | ||
324 | <color> | ||
325 | <red>128</red> | ||
326 | <green>128</green> | ||
327 | <blue>128</blue> | ||
328 | </color> | ||
329 | <color> | ||
330 | <red>255</red> | ||
331 | <green>255</green> | ||
332 | <blue>255</blue> | ||
333 | </color> | ||
334 | <color> | ||
335 | <red>0</red> | ||
336 | <green>0</green> | ||
337 | <blue>0</blue> | ||
338 | </color> | ||
339 | <color> | ||
340 | <red>0</red> | ||
341 | <green>0</green> | ||
342 | <blue>0</blue> | ||
343 | </color> | ||
344 | <color> | ||
345 | <red>10</red> | ||
346 | <green>95</green> | ||
347 | <blue>137</blue> | ||
348 | </color> | ||
349 | <color> | ||
350 | <red>255</red> | ||
351 | <green>255</green> | ||
352 | <blue>255</blue> | ||
353 | </color> | ||
354 | </disabled> | ||
355 | <inactive> | ||
356 | <color> | ||
357 | <red>0</red> | ||
358 | <green>0</green> | ||
359 | <blue>0</blue> | ||
360 | </color> | ||
361 | <color> | ||
362 | <red>218</red> | ||
363 | <green>226</green> | ||
364 | <blue>255</blue> | ||
365 | </color> | ||
366 | <color> | ||
367 | <red>255</red> | ||
368 | <green>255</green> | ||
369 | <blue>255</blue> | ||
370 | </color> | ||
371 | <color> | ||
372 | <red>255</red> | ||
373 | <green>255</green> | ||
374 | <blue>255</blue> | ||
375 | </color> | ||
376 | <color> | ||
377 | <red>109</red> | ||
378 | <green>113</green> | ||
379 | <blue>127</blue> | ||
380 | </color> | ||
381 | <color> | ||
382 | <red>145</red> | ||
383 | <green>151</green> | ||
384 | <blue>170</blue> | ||
385 | </color> | ||
386 | <color> | ||
387 | <red>0</red> | ||
388 | <green>0</green> | ||
389 | <blue>0</blue> | ||
390 | </color> | ||
391 | <color> | ||
392 | <red>255</red> | ||
393 | <green>255</green> | ||
394 | <blue>255</blue> | ||
395 | </color> | ||
396 | <color> | ||
397 | <red>0</red> | ||
398 | <green>0</green> | ||
399 | <blue>0</blue> | ||
400 | </color> | ||
401 | <color> | ||
402 | <red>255</red> | ||
403 | <green>255</green> | ||
404 | <blue>255</blue> | ||
405 | </color> | ||
406 | <color> | ||
407 | <red>0</red> | ||
408 | <green>0</green> | ||
409 | <blue>0</blue> | ||
410 | </color> | ||
411 | <color> | ||
412 | <red>0</red> | ||
413 | <green>0</green> | ||
414 | <blue>0</blue> | ||
415 | </color> | ||
416 | <color> | ||
417 | <red>10</red> | ||
418 | <green>95</green> | ||
419 | <blue>137</blue> | ||
420 | </color> | ||
421 | <color> | ||
422 | <red>255</red> | ||
423 | <green>255</green> | ||
424 | <blue>255</blue> | ||
425 | </color> | ||
426 | </inactive> | ||
427 | </palette> | ||
428 | </property> | ||
429 | <property stdset="1"> | ||
430 | <name>frameShape</name> | ||
431 | <enum>Box</enum> | ||
432 | </property> | ||
433 | <property stdset="1"> | ||
434 | <name>frameShadow</name> | ||
435 | <enum>Plain</enum> | ||
436 | </property> | ||
437 | </widget> | ||
438 | <widget> | ||
439 | <class>QLabel</class> | ||
440 | <property stdset="1"> | ||
441 | <name>name</name> | ||
442 | <cstring>TextLabel4_2</cstring> | ||
443 | </property> | ||
444 | <property stdset="1"> | ||
445 | <name>text</name> | ||
446 | <string>Dark</string> | ||
447 | </property> | ||
448 | </widget> | ||
449 | <spacer> | ||
450 | <property> | ||
451 | <name>name</name> | ||
452 | <cstring>Spacer2_2</cstring> | ||
453 | </property> | ||
454 | <property stdset="1"> | ||
455 | <name>orientation</name> | ||
456 | <enum>Horizontal</enum> | ||
457 | </property> | ||
458 | <property stdset="1"> | ||
459 | <name>sizeType</name> | ||
460 | <enum>Expanding</enum> | ||
461 | </property> | ||
462 | <property> | ||
463 | <name>sizeHint</name> | ||
464 | <size> | ||
465 | <width>20</width> | ||
466 | <height>20</height> | ||
467 | </size> | ||
468 | </property> | ||
469 | </spacer> | ||
470 | <widget> | ||
471 | <class>QLabel</class> | ||
472 | <property stdset="1"> | ||
473 | <name>name</name> | ||
474 | <cstring>TextLabel5_2</cstring> | ||
475 | </property> | ||
476 | <property stdset="1"> | ||
477 | <name>text</name> | ||
478 | <string>Light</string> | ||
479 | </property> | ||
480 | </widget> | ||
481 | <widget> | ||
482 | <class>QLabel</class> | ||
483 | <property stdset="1"> | ||
484 | <name>name</name> | ||
485 | <cstring>TextLabel3_2</cstring> | ||
486 | </property> | ||
487 | <property stdset="1"> | ||
488 | <name>sizePolicy</name> | ||
489 | <sizepolicy> | ||
490 | <hsizetype>0</hsizetype> | ||
491 | <vsizetype>0</vsizetype> | ||
492 | </sizepolicy> | ||
493 | </property> | ||
494 | <property stdset="1"> | ||
495 | <name>minimumSize</name> | ||
496 | <size> | ||
497 | <width>14</width> | ||
498 | <height>14</height> | ||
499 | </size> | ||
500 | </property> | ||
501 | <property stdset="1"> | ||
502 | <name>maximumSize</name> | ||
503 | <size> | ||
504 | <width>14</width> | ||
505 | <height>14</height> | ||
506 | </size> | ||
507 | </property> | ||
508 | <property stdset="1"> | ||
509 | <name>palette</name> | ||
510 | <palette> | ||
511 | <active> | ||
512 | <color> | ||
513 | <red>0</red> | ||
514 | <green>0</green> | ||
515 | <blue>0</blue> | ||
516 | </color> | ||
517 | <color> | ||
518 | <red>218</red> | ||
519 | <green>226</green> | ||
520 | <blue>255</blue> | ||
521 | </color> | ||
522 | <color> | ||
523 | <red>255</red> | ||
524 | <green>255</green> | ||
525 | <blue>255</blue> | ||
526 | </color> | ||
527 | <color> | ||
528 | <red>236</red> | ||
529 | <green>240</green> | ||
530 | <blue>255</blue> | ||
531 | </color> | ||
532 | <color> | ||
533 | <red>109</red> | ||
534 | <green>113</green> | ||
535 | <blue>127</blue> | ||
536 | </color> | ||
537 | <color> | ||
538 | <red>145</red> | ||
539 | <green>151</green> | ||
540 | <blue>170</blue> | ||
541 | </color> | ||
542 | <color> | ||
543 | <red>0</red> | ||
544 | <green>0</green> | ||
545 | <blue>0</blue> | ||
546 | </color> | ||
547 | <color> | ||
548 | <red>255</red> | ||
549 | <green>255</green> | ||
550 | <blue>255</blue> | ||
551 | </color> | ||
552 | <color> | ||
553 | <red>0</red> | ||
554 | <green>0</green> | ||
555 | <blue>0</blue> | ||
556 | </color> | ||
557 | <color> | ||
558 | <red>255</red> | ||
559 | <green>255</green> | ||
560 | <blue>255</blue> | ||
561 | </color> | ||
562 | <color> | ||
563 | <red>255</red> | ||
564 | <green>255</green> | ||
565 | <blue>255</blue> | ||
566 | </color> | ||
567 | <color> | ||
568 | <red>0</red> | ||
569 | <green>0</green> | ||
570 | <blue>0</blue> | ||
571 | </color> | ||
572 | <color> | ||
573 | <red>10</red> | ||
574 | <green>95</green> | ||
575 | <blue>137</blue> | ||
576 | </color> | ||
577 | <color> | ||
578 | <red>255</red> | ||
579 | <green>255</green> | ||
580 | <blue>255</blue> | ||
581 | </color> | ||
582 | </active> | ||
583 | <disabled> | ||
584 | <color> | ||
585 | <red>128</red> | ||
586 | <green>128</green> | ||
587 | <blue>128</blue> | ||
588 | </color> | ||
589 | <color> | ||
590 | <red>218</red> | ||
591 | <green>226</green> | ||
592 | <blue>255</blue> | ||
593 | </color> | ||
594 | <color> | ||
595 | <red>255</red> | ||
596 | <green>255</green> | ||
597 | <blue>255</blue> | ||
598 | </color> | ||
599 | <color> | ||
600 | <red>255</red> | ||
601 | <green>255</green> | ||
602 | <blue>255</blue> | ||
603 | </color> | ||
604 | <color> | ||
605 | <red>109</red> | ||
606 | <green>113</green> | ||
607 | <blue>127</blue> | ||
608 | </color> | ||
609 | <color> | ||
610 | <red>145</red> | ||
611 | <green>151</green> | ||
612 | <blue>170</blue> | ||
613 | </color> | ||
614 | <color> | ||
615 | <red>0</red> | ||
616 | <green>0</green> | ||
617 | <blue>0</blue> | ||
618 | </color> | ||
619 | <color> | ||
620 | <red>255</red> | ||
621 | <green>255</green> | ||
622 | <blue>255</blue> | ||
623 | </color> | ||
624 | <color> | ||
625 | <red>128</red> | ||
626 | <green>128</green> | ||
627 | <blue>128</blue> | ||
628 | </color> | ||
629 | <color> | ||
630 | <red>255</red> | ||
631 | <green>255</green> | ||
632 | <blue>255</blue> | ||
633 | </color> | ||
634 | <color> | ||
635 | <red>255</red> | ||
636 | <green>255</green> | ||
637 | <blue>255</blue> | ||
638 | </color> | ||
639 | <color> | ||
640 | <red>0</red> | ||
641 | <green>0</green> | ||
642 | <blue>0</blue> | ||
643 | </color> | ||
644 | <color> | ||
645 | <red>10</red> | ||
646 | <green>95</green> | ||
647 | <blue>137</blue> | ||
648 | </color> | ||
649 | <color> | ||
650 | <red>255</red> | ||
651 | <green>255</green> | ||
652 | <blue>255</blue> | ||
653 | </color> | ||
654 | </disabled> | ||
655 | <inactive> | ||
656 | <color> | ||
657 | <red>0</red> | ||
658 | <green>0</green> | ||
659 | <blue>0</blue> | ||
660 | </color> | ||
661 | <color> | ||
662 | <red>218</red> | ||
663 | <green>226</green> | ||
664 | <blue>255</blue> | ||
665 | </color> | ||
666 | <color> | ||
667 | <red>255</red> | ||
668 | <green>255</green> | ||
669 | <blue>255</blue> | ||
670 | </color> | ||
671 | <color> | ||
672 | <red>255</red> | ||
673 | <green>255</green> | ||
674 | <blue>255</blue> | ||
675 | </color> | ||
676 | <color> | ||
677 | <red>109</red> | ||
678 | <green>113</green> | ||
679 | <blue>127</blue> | ||
680 | </color> | ||
681 | <color> | ||
682 | <red>145</red> | ||
683 | <green>151</green> | ||
684 | <blue>170</blue> | ||
685 | </color> | ||
686 | <color> | ||
687 | <red>0</red> | ||
688 | <green>0</green> | ||
689 | <blue>0</blue> | ||
690 | </color> | ||
691 | <color> | ||
692 | <red>255</red> | ||
693 | <green>255</green> | ||
694 | <blue>255</blue> | ||
695 | </color> | ||
696 | <color> | ||
697 | <red>0</red> | ||
698 | <green>0</green> | ||
699 | <blue>0</blue> | ||
700 | </color> | ||
701 | <color> | ||
702 | <red>255</red> | ||
703 | <green>255</green> | ||
704 | <blue>255</blue> | ||
705 | </color> | ||
706 | <color> | ||
707 | <red>255</red> | ||
708 | <green>255</green> | ||
709 | <blue>255</blue> | ||
710 | </color> | ||
711 | <color> | ||
712 | <red>0</red> | ||
713 | <green>0</green> | ||
714 | <blue>0</blue> | ||
715 | </color> | ||
716 | <color> | ||
717 | <red>10</red> | ||
718 | <green>95</green> | ||
719 | <blue>137</blue> | ||
720 | </color> | ||
721 | <color> | ||
722 | <red>255</red> | ||
723 | <green>255</green> | ||
724 | <blue>255</blue> | ||
725 | </color> | ||
726 | </inactive> | ||
727 | </palette> | ||
728 | </property> | ||
729 | <property stdset="1"> | ||
730 | <name>frameShape</name> | ||
731 | <enum>Box</enum> | ||
732 | </property> | ||
733 | <property stdset="1"> | ||
734 | <name>frameShadow</name> | ||
735 | <enum>Plain</enum> | ||
736 | </property> | ||
737 | </widget> | ||
738 | </hbox> | ||
739 | </widget> | ||
740 | </grid> | ||
741 | </widget> | ||
742 | <widget> | ||
743 | <class>QLayoutWidget</class> | ||
744 | <property stdset="1"> | ||
745 | <name>name</name> | ||
746 | <cstring>Layout22</cstring> | ||
747 | </property> | ||
748 | <property> | ||
749 | <name>layoutSpacing</name> | ||
750 | </property> | ||
751 | <hbox> | ||
752 | <property stdset="1"> | ||
753 | <name>margin</name> | ||
754 | <number>0</number> | ||
755 | </property> | ||
756 | <property stdset="1"> | ||
757 | <name>spacing</name> | ||
758 | <number>3</number> | ||
759 | </property> | ||
760 | <widget> | ||
761 | <class>QLabel</class> | ||
762 | <property stdset="1"> | ||
763 | <name>name</name> | ||
764 | <cstring>TextLabel4</cstring> | ||
765 | </property> | ||
766 | <property stdset="1"> | ||
767 | <name>text</name> | ||
768 | <string>Steps</string> | ||
769 | </property> | ||
770 | </widget> | ||
771 | <widget> | ||
772 | <class>QSlider</class> | ||
773 | <property stdset="1"> | ||
774 | <name>name</name> | ||
775 | <cstring>linesteps</cstring> | ||
776 | </property> | ||
777 | <property stdset="1"> | ||
778 | <name>minValue</name> | ||
779 | <number>2</number> | ||
780 | </property> | ||
781 | <property stdset="1"> | ||
782 | <name>maxValue</name> | ||
783 | <number>127</number> | ||
784 | </property> | ||
785 | <property stdset="1"> | ||
786 | <name>lineStep</name> | ||
787 | <number>10</number> | ||
788 | </property> | ||
789 | <property stdset="1"> | ||
790 | <name>orientation</name> | ||
791 | <enum>Horizontal</enum> | ||
792 | </property> | ||
793 | <property stdset="1"> | ||
794 | <name>tickmarks</name> | ||
795 | <enum>Right</enum> | ||
796 | </property> | ||
797 | </widget> | ||
798 | </hbox> | ||
799 | </widget> | ||
800 | <widget> | ||
801 | <class>QLayoutWidget</class> | ||
802 | <property stdset="1"> | ||
803 | <name>name</name> | ||
804 | <cstring>Layout28</cstring> | ||
805 | </property> | ||
806 | <property> | ||
807 | <name>layoutSpacing</name> | ||
808 | </property> | ||
809 | <hbox> | ||
810 | <property stdset="1"> | ||
811 | <name>margin</name> | ||
812 | <number>0</number> | ||
813 | </property> | ||
814 | <property stdset="1"> | ||
815 | <name>spacing</name> | ||
816 | <number>3</number> | ||
817 | </property> | ||
818 | <widget> | ||
819 | <class>QLabel</class> | ||
820 | <property stdset="1"> | ||
821 | <name>name</name> | ||
822 | <cstring>TextLabel6</cstring> | ||
823 | </property> | ||
824 | <property stdset="1"> | ||
825 | <name>text</name> | ||
826 | <string>Check interval</string> | ||
827 | </property> | ||
828 | </widget> | ||
829 | <widget> | ||
830 | <class>QSpinBox</class> | ||
831 | <property stdset="1"> | ||
832 | <name>name</name> | ||
833 | <cstring>interval</cstring> | ||
834 | </property> | ||
835 | <property stdset="1"> | ||
836 | <name>suffix</name> | ||
837 | <string> sec</string> | ||
838 | </property> | ||
839 | <property stdset="1"> | ||
840 | <name>buttonSymbols</name> | ||
841 | <enum>PlusMinus</enum> | ||
842 | </property> | ||
843 | <property stdset="1"> | ||
844 | <name>maxValue</name> | ||
845 | <number>10</number> | ||
846 | </property> | ||
847 | <property stdset="1"> | ||
848 | <name>minValue</name> | ||
849 | <number>1</number> | ||
850 | </property> | ||
851 | <property stdset="1"> | ||
852 | <name>lineStep</name> | ||
853 | <number>1</number> | ||
854 | </property> | ||
855 | </widget> | ||
856 | </hbox> | ||
857 | </widget> | ||
858 | </vbox> | ||
859 | </widget> | ||
860 | <images> | ||
861 | <image> | ||
862 | <name>image0</name> | ||
863 | <data format="XPM.GZ" length="439">789c6d8ec10ac2300c86ef7b8ad0ff36a4730777111f41f1288887b4b3e8610a3a0f22bebb6dd3d54d0ca5cdffe54f9aaaa4dd764d6555dc7beecf96ec896f54b68fae7bee0fab57a1ea86fc5950ad6685d2646973bd1c43ce3ec73c46903648e79a5624443a27d20cd2b9382704747e124382f11a7c5e30b364b957b331866331b3800c38f70282121c7c628367c098c1e0eb03121ccd4b46fcb0f80b26bb4833987f76b6d6f274de5fe6a1a031d30969f55e161fe4715f7b</data> | ||
864 | </image> | ||
865 | <image> | ||
866 | <name>image1</name> | ||
867 | <data format="XPM.GZ" length="424">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022130543251d2e253d856405bffcbc54105b19c856360003103711c4354b324b364b06719340dcb434b36488ac1e1a2020a6acac8c2ea60cc54862606ea232b218541b5810452c3111432c510f550c22886a1e482c115d0c2c88e6168818babaa4a42462c48082cae8e68102011a06b5d65c004336518f</data> | ||
868 | </image> | ||
869 | </images> | ||
870 | </UI> | ||
diff --git a/core/settings/light-and-power/settings.h b/core/settings/light-and-power/settings.h index adfd735..77290a3 100644 --- a/core/settings/light-and-power/settings.h +++ b/core/settings/light-and-power/settings.h | |||
@@ -1,20 +1,28 @@ | |||
1 | /********************************************************************** | 1 | /* |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | This file is part of the OPIE Project |
3 | ** | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | ** This file is part of Qtopia Environment. | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | ** | 5 | .>+-= |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | _;:, .> :=|. This file is free software; you can |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | ** packaging of this file. | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | ** | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ._= =} : or (at your option) any later version. |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | .%`+i> _;_. |
13 | ** | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | ** | 15 | : .. .:, . . . without even the implied warranty of |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | ** not clear to you. | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ** | 18 | ..}^=.= = ; Public License for more details. |
19 | **********************************************************************/ | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | ||
21 | -. .:....=;==+<; General Public License along with this file; | ||
22 | -_. . . )=. = see the file COPYING. If not, write to the | ||
23 | -- :-=` Free Software Foundation, Inc., | ||
24 | 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
20 | #ifndef SETTINGS_H | 28 | #ifndef SETTINGS_H |
@@ -42,10 +50,11 @@ protected: | |||
42 | 50 | ||
43 | private slots: | 51 | protected slots: |
44 | void applyBrightness(); | 52 | void setBacklight ( int ); |
45 | void applyBrightnessAC(); | 53 | virtual void calibrateSensor ( ); |
46 | void slotSliderTicks( int steps ); | 54 | virtual void calibrateSensorAC ( ); |
47 | 55 | ||
48 | private: | 56 | private: |
49 | int initbright; | 57 | int m_res; |
50 | int initbright_ac; | 58 | QStringList m_sensordata; |
59 | QStringList m_sensordata_ac; | ||
51 | }; | 60 | }; |