author | harlekin <harlekin> | 2004-03-02 20:29:03 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2004-03-02 20:29:03 (UTC) |
commit | 9631067183b4cafa2ea07d2202bf88f4d42c35e2 (patch) (unidiff) | |
tree | 148a780ed518c978770d69ea93a08a3cb85d46b8 | |
parent | 914b5cd04a59c8569c14d9afedd9eeb1796e2db7 (diff) | |
download | opie-9631067183b4cafa2ea07d2202bf88f4d42c35e2.zip opie-9631067183b4cafa2ea07d2202bf88f4d42c35e2.tar.gz opie-9631067183b4cafa2ea07d2202bf88f4d42c35e2.tar.bz2 |
libopie1->libopie2, segfaulting
-rw-r--r-- | core/settings/light-and-power/light-and-power.pro | 4 | ||||
-rw-r--r-- | core/settings/light-and-power/light.cpp | 5 | ||||
-rw-r--r-- | core/settings/light-and-power/light.h | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/main.cpp | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.cpp | 31 | ||||
-rw-r--r-- | core/settings/light-and-power/sensor.h | 2 |
6 files changed, 24 insertions, 22 deletions
diff --git a/core/settings/light-and-power/light-and-power.pro b/core/settings/light-and-power/light-and-power.pro index 928976a..bc8ba4b 100644 --- a/core/settings/light-and-power/light-and-power.pro +++ b/core/settings/light-and-power/light-and-power.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | CONFIG += qt warn_on release quick-app | 1 | CONFIG += qt warn_on debug quick-app |
2 | HEADERS = light.h sensor.h calibration.h | 2 | HEADERS = light.h sensor.h calibration.h |
3 | SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp | 3 | SOURCES = light.cpp main.cpp sensor.cpp calibration.cpp |
4 | INTERFACES= lightsettingsbase.ui sensorbase.ui | 4 | INTERFACES= lightsettingsbase.ui sensorbase.ui |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH+= ../$(OPIEDIR)/include | 6 | DEPENDPATH+= ../$(OPIEDIR)/include |
7 | LIBS += -lqpe -lopie | 7 | LIBS += -lqpe -lopiecore2 |
8 | 8 | ||
9 | TARGET = light-and-power | 9 | TARGET = light-and-power |
10 | 10 | ||
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index ce45836..09fb767 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -1,313 +1,314 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
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 "light.h" | 29 | #include "light.h" |
30 | #include "sensor.h" | ||
31 | |||
32 | #include <opie2/odevice.h> | ||
30 | 33 | ||
31 | #include <qpe/config.h> | 34 | #include <qpe/config.h> |
32 | #include <qpe/power.h> | 35 | #include <qpe/power.h> |
33 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 36 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
34 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
35 | #endif | 38 | #endif |
36 | 39 | ||
37 | #include <qlabel.h> | 40 | #include <qlabel.h> |
38 | #include <qcheckbox.h> | 41 | #include <qcheckbox.h> |
39 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
40 | #include <qslider.h> | 43 | #include <qslider.h> |
41 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
42 | #include <qpushbutton.h> | 45 | #include <qpushbutton.h> |
43 | #include <qgroupbox.h> | 46 | #include <qgroupbox.h> |
44 | #include <qcombobox.h> | 47 | #include <qcombobox.h> |
45 | 48 | ||
46 | #include <opie/odevice.h> | ||
47 | 49 | ||
48 | #include "sensor.h" | ||
49 | 50 | ||
50 | using namespace Opie; | 51 | using namespace Opie; |
51 | 52 | ||
52 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | 53 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
53 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) | 54 | : LightSettingsBase( parent, name, false, WStyle_ContextHelp ) |
54 | { | 55 | { |
55 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 56 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
56 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 57 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
57 | 58 | ||
58 | // check whether to show the light sensor stuff | 59 | // check whether to show the light sensor stuff |
59 | 60 | ||
60 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 61 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
61 | auto_brightness-> hide ( ); | 62 | auto_brightness-> hide ( ); |
62 | CalibrateLightSensor-> hide ( ); | 63 | CalibrateLightSensor-> hide ( ); |
63 | auto_brightness_ac-> hide ( ); | 64 | auto_brightness_ac-> hide ( ); |
64 | CalibrateLightSensor_ac-> hide ( ); | 65 | CalibrateLightSensor_ac-> hide ( ); |
65 | } | 66 | } |
66 | 67 | ||
67 | // check whether to show the contrast stuff | 68 | // check whether to show the contrast stuff |
68 | 69 | ||
69 | if (m_cres) { | 70 | if (m_cres) { |
70 | GroupLight->setTitle(tr("Backlight && Contrast")); | 71 | GroupLight->setTitle(tr("Backlight && Contrast")); |
71 | GroupLight_ac->setTitle(GroupLight->title()); | 72 | GroupLight_ac->setTitle(GroupLight->title()); |
72 | } else { | 73 | } else { |
73 | contrast->hide(); | 74 | contrast->hide(); |
74 | contrast_ac->hide(); | 75 | contrast_ac->hide(); |
75 | } | 76 | } |
76 | 77 | ||
77 | // check whether to show the cpu frequency stuff | 78 | // check whether to show the cpu frequency stuff |
78 | 79 | ||
79 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 80 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
80 | if ( freq.count() ) { | 81 | if ( freq.count() ) { |
81 | frequency->insertStrList( freq ); | 82 | frequency->insertStrList( freq ); |
82 | frequency_ac->insertStrList( freq ); | 83 | frequency_ac->insertStrList( freq ); |
83 | } else { | 84 | } else { |
84 | frequencyLabel->hide(); | 85 | frequencyLabel->hide(); |
85 | frequency->hide(); | 86 | frequency->hide(); |
86 | frequencyLabel_ac->hide(); | 87 | frequencyLabel_ac->hide(); |
87 | frequency_ac->hide(); | 88 | frequency_ac->hide(); |
88 | } | 89 | } |
89 | 90 | ||
90 | // check whether to show the hinge action stuff | 91 | // check whether to show the hinge action stuff |
91 | 92 | ||
92 | if ( !ODevice::inst()->hasHingeSensor() ) { | 93 | if ( !ODevice::inst()->hasHingeSensor() ) { |
93 | closeHingeLabel->hide(); | 94 | closeHingeLabel->hide(); |
94 | closeHingeAction->hide(); | 95 | closeHingeAction->hide(); |
95 | closeHingeLabel_ac->hide(); | 96 | closeHingeLabel_ac->hide(); |
96 | closeHingeAction_ac->hide(); | 97 | closeHingeAction_ac->hide(); |
97 | } | 98 | } |
98 | 99 | ||
99 | Config config ( "apm" ); | 100 | Config config ( "apm" ); |
100 | config. setGroup ( "Battery" ); | 101 | config. setGroup ( "Battery" ); |
101 | 102 | ||
102 | // battery spinboxes | 103 | // battery spinboxes |
103 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); | 104 | interval_dim-> setValue ( config. readNumEntry ( "Dim", 30 )); |
104 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); | 105 | interval_lightoff-> setValue ( config. readNumEntry ( "LightOff", 20 )); |
105 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); | 106 | interval_suspend-> setValue ( config. readNumEntry ( "Suspend", 60 )); |
106 | 107 | ||
107 | // battery check and slider | 108 | // battery check and slider |
108 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 109 | LcdOffOnly->setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
109 | 110 | ||
110 | // CPU frequency | 111 | // CPU frequency |
111 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 112 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
112 | 113 | ||
113 | // hinge action | 114 | // hinge action |
114 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 115 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
115 | 116 | ||
116 | int bright = config. readNumEntry ( "Brightness", 127 ); | 117 | int bright = config. readNumEntry ( "Brightness", 127 ); |
117 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 118 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
118 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 119 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
119 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); | 120 | brightness-> setLineStep ( QMAX( 1, 256 / m_bres )); |
120 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); | 121 | brightness-> setPageStep ( QMAX( 1, 256 / m_bres )); |
121 | brightness-> setValue ( bright ); | 122 | brightness-> setValue ( bright ); |
122 | 123 | ||
123 | if (m_cres) { | 124 | if (m_cres) { |
124 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 125 | contrast-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
125 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); | 126 | contrast-> setLineStep ( QMAX( 1, 256 / m_cres )); |
126 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); | 127 | contrast-> setPageStep ( QMAX( 1, 256 / m_cres )); |
127 | contrast-> setValue ( contr ); | 128 | contrast-> setValue ( contr ); |
128 | } | 129 | } |
129 | 130 | ||
130 | // light sensor | 131 | // light sensor |
131 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 132 | auto_brightness-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
132 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); | 133 | m_sensordata = config. readListEntry ( "LightSensorData", ';' ); |
133 | 134 | ||
134 | config. setGroup ( "AC" ); | 135 | config. setGroup ( "AC" ); |
135 | 136 | ||
136 | // ac spinboxes | 137 | // ac spinboxes |
137 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); | 138 | interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 )); |
138 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); | 139 | interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 )); |
139 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); | 140 | interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 )); |
140 | 141 | ||
141 | // ac check and slider | 142 | // ac check and slider |
142 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); | 143 | LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); |
143 | 144 | ||
144 | // CPU frequency | 145 | // CPU frequency |
145 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 146 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
146 | 147 | ||
147 | // hinge action | 148 | // hinge action |
148 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | 149 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); |
149 | 150 | ||
150 | bright = config. readNumEntry ( "Brightness", 255 ); | 151 | bright = config. readNumEntry ( "Brightness", 255 ); |
151 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 152 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
152 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 153 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
153 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); | 154 | brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres )); |
154 | brightness_ac-> setValue ( bright ); | 155 | brightness_ac-> setValue ( bright ); |
155 | 156 | ||
156 | if (m_cres) { | 157 | if (m_cres) { |
157 | contr = config. readNumEntry ( "Contrast", 127); | 158 | contr = config. readNumEntry ( "Contrast", 127); |
158 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); | 159 | contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres )); |
159 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); | 160 | contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres )); |
160 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); | 161 | contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres )); |
161 | contrast_ac-> setValue ( contr ); | 162 | contrast_ac-> setValue ( contr ); |
162 | } | 163 | } |
163 | 164 | ||
164 | // light sensor | 165 | // light sensor |
165 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 166 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
166 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 167 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
167 | 168 | ||
168 | // warnings | 169 | // warnings |
169 | config. setGroup ( "Warnings" ); | 170 | config. setGroup ( "Warnings" ); |
170 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 171 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); |
171 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 172 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); |
172 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); | 173 | criticalSpinBox-> setValue ( config. readNumEntry ( "powercritical", 5 ) ); |
173 | 174 | ||
174 | m_resettimer = new QTimer ( this ); | 175 | m_resettimer = new QTimer ( this ); |
175 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); | 176 | connect ( m_resettimer, SIGNAL( timeout()), this, SLOT( resetBacklight())); |
176 | 177 | ||
177 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 178 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
178 | tabs-> setCurrentPage ( 0 ); | 179 | tabs-> setCurrentPage ( 0 ); |
179 | } | 180 | } |
180 | else { | 181 | else { |
181 | tabs-> setCurrentPage ( 1 ); | 182 | tabs-> setCurrentPage ( 1 ); |
182 | } | 183 | } |
183 | 184 | ||
184 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 185 | connect ( brightness, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
185 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); | 186 | connect ( brightness_ac, SIGNAL( valueChanged(int)), this, SLOT( setBacklight(int))); |
186 | if (m_cres) { | 187 | if (m_cres) { |
187 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 188 | connect ( contrast, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
188 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); | 189 | connect ( contrast_ac, SIGNAL( valueChanged(int)), this, SLOT( setContrast(int))); |
189 | } | 190 | } |
190 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 191 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
191 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 192 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
192 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 193 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
193 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | 194 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); |
194 | } | 195 | } |
195 | 196 | ||
196 | LightSettings::~LightSettings ( ) | 197 | LightSettings::~LightSettings ( ) |
197 | { | 198 | { |
198 | } | 199 | } |
199 | 200 | ||
200 | void LightSettings::calibrateSensor ( ) | 201 | void LightSettings::calibrateSensor ( ) |
201 | { | 202 | { |
202 | Sensor *s = new Sensor ( m_sensordata, this ); | 203 | Sensor *s = new Sensor ( m_sensordata, this ); |
203 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 204 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
204 | QPEApplication::execDialog( s ); | 205 | QPEApplication::execDialog( s ); |
205 | delete s; | 206 | delete s; |
206 | } | 207 | } |
207 | 208 | ||
208 | void LightSettings::calibrateSensorAC ( ) | 209 | void LightSettings::calibrateSensorAC ( ) |
209 | { | 210 | { |
210 | Sensor *s = new Sensor ( m_sensordata_ac, this ); | 211 | Sensor *s = new Sensor ( m_sensordata_ac, this ); |
211 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); | 212 | connect ( s, SIGNAL( viewBacklight(int)), this, SLOT( setBacklight(int))); |
212 | QPEApplication::execDialog ( s ); | 213 | QPEApplication::execDialog ( s ); |
213 | delete s; | 214 | delete s; |
214 | } | 215 | } |
215 | 216 | ||
216 | void LightSettings::setBacklight ( int bright ) | 217 | void LightSettings::setBacklight ( int bright ) |
217 | { | 218 | { |
218 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); | 219 | QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); |
219 | e << bright; | 220 | e << bright; |
220 | 221 | ||
221 | if ( bright != -1 ) { | 222 | if ( bright != -1 ) { |
222 | m_resettimer-> stop ( ); | 223 | m_resettimer-> stop ( ); |
223 | m_resettimer-> start ( 4000, true ); | 224 | m_resettimer-> start ( 4000, true ); |
224 | } | 225 | } |
225 | } | 226 | } |
226 | 227 | ||
227 | void LightSettings::setContrast ( int contr ) | 228 | void LightSettings::setContrast ( int contr ) |
228 | { | 229 | { |
229 | if (contr == -1) contr = m_oldcontrast; | 230 | if (contr == -1) contr = m_oldcontrast; |
230 | ODevice::inst ( )-> setDisplayContrast(contr); | 231 | ODevice::inst ( )-> setDisplayContrast(contr); |
231 | } | 232 | } |
232 | 233 | ||
233 | void LightSettings::setFrequency ( int index ) | 234 | void LightSettings::setFrequency ( int index ) |
234 | { | 235 | { |
235 | qWarning("LightSettings::setFrequency(%d)", index); | 236 | qWarning("LightSettings::setFrequency(%d)", index); |
236 | ODevice::inst ( )-> setCurrentCpuFrequency(index); | 237 | ODevice::inst ( )-> setCurrentCpuFrequency(index); |
237 | } | 238 | } |
238 | 239 | ||
239 | void LightSettings::resetBacklight ( ) | 240 | void LightSettings::resetBacklight ( ) |
240 | { | 241 | { |
241 | setBacklight ( -1 ); | 242 | setBacklight ( -1 ); |
242 | setContrast ( -1 ); | 243 | setContrast ( -1 ); |
243 | } | 244 | } |
244 | 245 | ||
245 | void LightSettings::setCloseHingeAction ( int index ) | 246 | void LightSettings::setCloseHingeAction ( int index ) |
246 | { | 247 | { |
247 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); | 248 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); |
248 | } | 249 | } |
249 | 250 | ||
250 | void LightSettings::accept ( ) | 251 | void LightSettings::accept ( ) |
251 | { | 252 | { |
252 | Config config ( "apm" ); | 253 | Config config ( "apm" ); |
253 | 254 | ||
254 | // bat | 255 | // bat |
255 | config. setGroup ( "Battery" ); | 256 | config. setGroup ( "Battery" ); |
256 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); | 257 | config. writeEntry ( "LcdOffOnly", LcdOffOnly-> isChecked ( )); |
257 | config. writeEntry ( "Dim", interval_dim-> value ( )); | 258 | config. writeEntry ( "Dim", interval_dim-> value ( )); |
258 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); | 259 | config. writeEntry ( "LightOff", interval_lightoff-> value ( )); |
259 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); | 260 | config. writeEntry ( "Suspend", interval_suspend-> value ( )); |
260 | config. writeEntry ( "Brightness", brightness-> value () ); | 261 | config. writeEntry ( "Brightness", brightness-> value () ); |
261 | if (m_cres) | 262 | if (m_cres) |
262 | config. writeEntry ( "Contrast", contrast-> value () ); | 263 | config. writeEntry ( "Contrast", contrast-> value () ); |
263 | config. writeEntry ( "Freq", frequency->currentItem() ); | 264 | config. writeEntry ( "Freq", frequency->currentItem() ); |
264 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | 265 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); |
265 | 266 | ||
266 | // ac | 267 | // ac |
267 | config. setGroup ( "AC" ); | 268 | config. setGroup ( "AC" ); |
268 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); | 269 | config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( )); |
269 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); | 270 | config. writeEntry ( "Dim", interval_dim_ac-> value ( )); |
270 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); | 271 | config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( )); |
271 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); | 272 | config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); |
272 | config. writeEntry ( "Brightness", brightness_ac-> value () ); | 273 | config. writeEntry ( "Brightness", brightness_ac-> value () ); |
273 | if (m_cres) | 274 | if (m_cres) |
274 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 275 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
275 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | 276 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); |
276 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); | 277 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); |
277 | 278 | ||
278 | // only make light sensor stuff appear if the unit has a sensor | 279 | // only make light sensor stuff appear if the unit has a sensor |
279 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 280 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |
280 | config. setGroup ( "Battery" ); | 281 | config. setGroup ( "Battery" ); |
281 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); | 282 | config. writeEntry ( "LightSensor", auto_brightness->isChecked() ); |
282 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); | 283 | config. writeEntry ( "LightSensorData", m_sensordata, ';' ); |
283 | config. setGroup ( "AC" ); | 284 | config. setGroup ( "AC" ); |
284 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); | 285 | config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() ); |
285 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); | 286 | config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); |
286 | } | 287 | } |
287 | 288 | ||
288 | // advanced | 289 | // advanced |
289 | config. setGroup ( "Warnings" ); | 290 | config. setGroup ( "Warnings" ); |
290 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); | 291 | config. writeEntry ( "check_interval", warnintervalBox-> value ( ) * 1000 ); |
291 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); | 292 | config. writeEntry ( "power_verylow", lowSpinBox-> value ( )); |
292 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); | 293 | config. writeEntry ( "power_critical", criticalSpinBox-> value ( )); |
293 | config. write ( ); | 294 | config. write ( ); |
294 | 295 | ||
295 | // notify the launcher | 296 | // notify the launcher |
296 | { | 297 | { |
297 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); | 298 | QCopEnvelope e ( "QPE/System", "reloadPowerWarnSettings()" ); |
298 | } | 299 | } |
299 | { | 300 | { |
300 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); | 301 | QCopEnvelope e ( "QPE/System", "setScreenSaverInterval(int)" ); |
301 | e << -1; | 302 | e << -1; |
302 | } | 303 | } |
303 | LightSettingsBase::accept ( ); | 304 | LightSettingsBase::accept ( ); |
304 | } | 305 | } |
305 | 306 | ||
306 | void LightSettings::done ( int r ) | 307 | void LightSettings::done ( int r ) |
307 | { | 308 | { |
308 | m_resettimer-> stop ( ); | 309 | m_resettimer-> stop ( ); |
309 | resetBacklight ( ); | 310 | resetBacklight ( ); |
310 | 311 | ||
311 | LightSettingsBase::done ( r ); | 312 | LightSettingsBase::done ( r ); |
312 | close ( ); | 313 | close ( ); |
313 | } | 314 | } |
diff --git a/core/settings/light-and-power/light.h b/core/settings/light-and-power/light.h index 2167817..9077a09 100644 --- a/core/settings/light-and-power/light.h +++ b/core/settings/light-and-power/light.h | |||
@@ -1,72 +1,72 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
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 | #ifndef __LIGHT_H__ | 28 | #ifndef __LIGHT_H__ |
29 | #define __LIGHT_H__ | 29 | #define __LIGHT_H__ |
30 | 30 | ||
31 | #include "lightsettingsbase.h" | ||
31 | 32 | ||
32 | #include <qstringlist.h> | 33 | #include <qstringlist.h> |
33 | #include <qlistbox.h> | 34 | #include <qlistbox.h> |
34 | #include "lightsettingsbase.h" | ||
35 | 35 | ||
36 | class QTimer; | 36 | class QTimer; |
37 | 37 | ||
38 | class LightSettings : public LightSettingsBase | 38 | class LightSettings : public LightSettingsBase |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | LightSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 43 | LightSettings( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | ~LightSettings(); | 44 | ~LightSettings(); |
45 | static QString appName() { return QString::fromLatin1("light-and-power"); } | 45 | static QString appName() { return QString::fromLatin1("light-and-power"); } |
46 | 46 | ||
47 | protected: | 47 | protected: |
48 | virtual void accept(); | 48 | virtual void accept(); |
49 | virtual void done ( int r ); | 49 | virtual void done ( int r ); |
50 | 50 | ||
51 | protected slots: | 51 | protected slots: |
52 | virtual void calibrateSensor ( ); | 52 | virtual void calibrateSensor ( ); |
53 | virtual void calibrateSensorAC ( ); | 53 | virtual void calibrateSensorAC ( ); |
54 | void setBacklight ( int ); | 54 | void setBacklight ( int ); |
55 | void setContrast ( int ); | 55 | void setContrast ( int ); |
56 | void setFrequency ( int ); | 56 | void setFrequency ( int ); |
57 | void setCloseHingeAction ( int ); | 57 | void setCloseHingeAction ( int ); |
58 | void resetBacklight ( ); | 58 | void resetBacklight ( ); |
59 | 59 | ||
60 | private: | 60 | private: |
61 | int m_bres; | 61 | int m_bres; |
62 | int m_cres; | 62 | int m_cres; |
63 | int m_oldcontrast; | 63 | int m_oldcontrast; |
64 | int m_oldfreq; | 64 | int m_oldfreq; |
65 | QTimer *m_resettimer; | 65 | QTimer *m_resettimer; |
66 | QStringList m_sensordata; | 66 | QStringList m_sensordata; |
67 | QStringList m_sensordata_ac; | 67 | QStringList m_sensordata_ac; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | 70 | ||
71 | #endif | 71 | #endif |
72 | 72 | ||
diff --git a/core/settings/light-and-power/main.cpp b/core/settings/light-and-power/main.cpp index cb43ce0..7a47b0b 100644 --- a/core/settings/light-and-power/main.cpp +++ b/core/settings/light-and-power/main.cpp | |||
@@ -1,26 +1,26 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "light.h" | 21 | #include "light.h" |
22 | 22 | ||
23 | #include <opie/oapplicationfactory.h> | 23 | #include <opie2/oapplicationfactory.h> |
24 | 24 | ||
25 | 25 | ||
26 | OPIE_EXPORT_APP( OApplicationFactory<LightSettings> ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<LightSettings> ) |
diff --git a/core/settings/light-and-power/sensor.cpp b/core/settings/light-and-power/sensor.cpp index 013e655..53c3aed 100644 --- a/core/settings/light-and-power/sensor.cpp +++ b/core/settings/light-and-power/sensor.cpp | |||
@@ -1,102 +1,103 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
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 | |||
29 | #include "calibration.h" | ||
30 | #include "sensor.h" | ||
31 | |||
32 | #include <opie2/odevice.h> | ||
33 | |||
28 | #include <qlayout.h> | 34 | #include <qlayout.h> |
29 | #include <qslider.h> | 35 | #include <qslider.h> |
30 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
31 | 37 | ||
32 | #include <opie/odevice.h> | ||
33 | |||
34 | using namespace Opie; | 38 | using namespace Opie; |
35 | 39 | ||
36 | #include "calibration.h" | ||
37 | #include "sensor.h" | ||
38 | |||
39 | Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) | 40 | Sensor::Sensor ( QStringList ¶ms, QWidget *parent, const char *name ) |
40 | : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) | 41 | : SensorBase ( parent, name, true, WStyle_ContextHelp ), m_params ( params ) |
41 | { | 42 | { |
42 | int steps = 12; | 43 | int steps = 12; |
43 | int inter = 2; | 44 | int inter = 2; |
44 | 45 | ||
45 | int smin = 40; | 46 | int smin = 40; |
46 | int smax = 215; | 47 | int smax = 215; |
47 | int lmin = 1; | 48 | int lmin = 1; |
48 | int lmax = 255; | 49 | int lmax = 255; |
49 | 50 | ||
50 | switch ( params. count ( )) { | 51 | switch ( params. count ( )) { |
51 | case 6: lmax = params [5]. toInt ( ); | 52 | case 6: lmax = params [5]. toInt ( ); |
52 | case 5: lmin = params [4]. toInt ( ); | 53 | case 5: lmin = params [4]. toInt ( ); |
53 | case 4: smax = params [3]. toInt ( ); | 54 | case 4: smax = params [3]. toInt ( ); |
54 | case 3: smin = params [2]. toInt ( ); | 55 | case 3: smin = params [2]. toInt ( ); |
55 | case 2: steps = params [1]. toInt ( ); | 56 | case 2: steps = params [1]. toInt ( ); |
56 | case 1: inter = params [0]. toInt ( ) / 1000; | 57 | case 1: inter = params [0]. toInt ( ) / 1000; |
57 | } | 58 | } |
58 | 59 | ||
59 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); | 60 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); |
60 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); | 61 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); |
61 | 62 | ||
62 | QVBoxLayout *lay = new QVBoxLayout ( frame ); | 63 | QVBoxLayout *lay = new QVBoxLayout ( frame ); |
63 | lay-> setMargin ( 2 ); | 64 | lay-> setMargin ( 2 ); |
64 | m_calib = new Calibration ( frame ); | 65 | m_calib = new Calibration ( frame ); |
65 | lay-> add ( m_calib ); | 66 | lay-> add ( m_calib ); |
66 | 67 | ||
67 | m_calib-> setScale ( QSize ( xscale, yscale )); | 68 | m_calib-> setScale ( QSize ( xscale, yscale )); |
68 | m_calib-> setLineSteps ( steps ); | 69 | m_calib-> setLineSteps ( steps ); |
69 | m_calib-> setInterval ( inter ); | 70 | m_calib-> setInterval ( inter ); |
70 | m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); | 71 | m_calib-> setStartPoint ( QPoint ( smin * xscale / 256, lmax * yscale / 256 )); |
71 | m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); | 72 | m_calib-> setEndPoint ( QPoint ( smax * xscale / 256, lmin * yscale / 256 )); |
72 | 73 | ||
73 | interval-> setValue ( inter ); | 74 | interval-> setValue ( inter ); |
74 | linesteps-> setValue ( steps ); | 75 | linesteps-> setValue ( steps ); |
75 | 76 | ||
76 | connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int))); | 77 | connect ( interval, SIGNAL( valueChanged(int)), m_calib, SLOT( setInterval(int))); |
77 | connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int))); | 78 | connect ( linesteps, SIGNAL( valueChanged(int)), m_calib, SLOT( setLineSteps(int))); |
78 | 79 | ||
79 | connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); | 80 | connect ( m_calib, SIGNAL( startPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); |
80 | connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); | 81 | connect ( m_calib, SIGNAL( endPointChanged(const QPoint&)), this, SLOT( pointDrag(const QPoint&))); |
81 | } | 82 | } |
82 | 83 | ||
83 | void Sensor::accept ( ) | 84 | void Sensor::accept ( ) |
84 | { | 85 | { |
85 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); | 86 | int xscale = ODevice::inst ( )-> lightSensorResolution ( ); |
86 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); | 87 | int yscale = ODevice::inst ( )-> displayBrightnessResolution ( ); |
87 | 88 | ||
88 | m_params. clear ( ); | 89 | m_params. clear ( ); |
89 | m_params << QString::number ( m_calib-> interval ( ) * 1000 ) | 90 | m_params << QString::number ( m_calib-> interval ( ) * 1000 ) |
90 | << QString::number ( m_calib-> lineSteps ( )) | 91 | << QString::number ( m_calib-> lineSteps ( )) |
91 | << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) | 92 | << QString::number ( m_calib-> startPoint ( ). x ( ) * 256 / xscale ) |
92 | << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) | 93 | << QString::number ( m_calib-> endPoint ( ). x ( ) * 256 / xscale ) |
93 | << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) | 94 | << QString::number ( m_calib-> endPoint ( ). y ( ) * 256 / yscale ) |
94 | << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); | 95 | << QString::number ( m_calib-> startPoint ( ). y ( ) * 256 / yscale ); |
95 | 96 | ||
96 | QDialog::accept ( ); | 97 | QDialog::accept ( ); |
97 | } | 98 | } |
98 | 99 | ||
99 | void Sensor::pointDrag ( const QPoint &p ) | 100 | void Sensor::pointDrag ( const QPoint &p ) |
100 | { | 101 | { |
101 | emit viewBacklight ( p. y ( )); | 102 | emit viewBacklight ( p. y ( )); |
102 | } | 103 | } |
diff --git a/core/settings/light-and-power/sensor.h b/core/settings/light-and-power/sensor.h index b484519..092ac6c 100644 --- a/core/settings/light-and-power/sensor.h +++ b/core/settings/light-and-power/sensor.h | |||
@@ -1,55 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> | 3 | =. Copyright (c) 2002 Maximilian Reiss <harlekin@handhelds.org> |
4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 4 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
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 | #ifndef __SENSOR_H__ | 28 | #ifndef __SENSOR_H__ |
29 | #define __SENSOR_H__ | 29 | #define __SENSOR_H__ |
30 | 30 | ||
31 | #include "sensorbase.h" | 31 | #include "sensorbase.h" |
32 | 32 | ||
33 | class Calibration; | 33 | class Calibration; |
34 | class QStringList; | 34 | class QStringList; |
35 | 35 | ||
36 | class Sensor : public SensorBase { | 36 | class Sensor : public SensorBase { |
37 | Q_OBJECT | 37 | Q_OBJECT |
38 | 38 | ||
39 | public: | 39 | public: |
40 | Sensor ( QStringList ¶ms, QWidget *parent = 0, const char *name = 0 ); | 40 | Sensor ( QStringList ¶ms, QWidget *parent = 0, const char *name = 0 ); |
41 | 41 | ||
42 | virtual void accept ( ); | 42 | virtual void accept ( ); |
43 | 43 | ||
44 | signals: | 44 | signals: |
45 | void viewBacklight ( int ); | 45 | void viewBacklight ( int ); |
46 | 46 | ||
47 | private slots: | 47 | private slots: |
48 | void pointDrag ( const QPoint & ); | 48 | void pointDrag ( const QPoint & ); |
49 | 49 | ||
50 | private: | 50 | private: |
51 | QStringList &m_params; | 51 | QStringList &m_params; |
52 | Calibration *m_calib; | 52 | Calibration *m_calib; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | #endif \ No newline at end of file | 55 | #endif |