Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 97120f2..77c6b40 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -52,35 +52,31 @@ | |||
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | #include <opie/odevice.h> | 54 | #include <opie/odevice.h> |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie; |
57 | 57 | ||
58 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | 58 | LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) |
59 | : LightSettingsBase( parent, name, TRUE, fl ) | 59 | : LightSettingsBase( parent, name, TRUE, WStyle_ContextHelp ) |
60 | { | 60 | { |
61 | 61 | ||
62 | if ( ODevice::inst()->hasLightSensor() ) { | 62 | if ( ODevice::inst()->hasLightSensor() ) { |
63 | // Not supported yet - hide until implemented | 63 | // Not supported yet - hide until implemented |
64 | auto_brightness->setEnabled( false ); | ||
65 | CalibrateLightSensor->setEnabled( false ); | 64 | CalibrateLightSensor->setEnabled( false ); |
66 | auto_brightness_ac_3->setEnabled( false ); | ||
67 | CalibrateLightSensorAC->setEnabled( false ); | 65 | CalibrateLightSensorAC->setEnabled( false ); |
68 | } else { | 66 | } else { |
69 | // if ipaq no need to show the sensor box | 67 | // if ipaq no need to show the sensor box |
70 | auto_brightness->hide(); | 68 | auto_brightness->hide(); |
71 | CalibrateLightSensor->hide(); | 69 | CalibrateLightSensor->hide(); |
72 | auto_brightness_ac_3->hide(); | 70 | auto_brightness_ac_3->hide(); |
73 | CalibrateLightSensorAC->hide(); | 71 | CalibrateLightSensorAC->hide(); |
74 | } | 72 | } |
75 | 73 | ||
76 | Config config( "qpe" ); | 74 | Config config( "qpe" ); |
77 | config.setGroup( "Screensaver" ); | 75 | config.setGroup( "Screensaver" ); |
78 | |||
79 | int interval; | 76 | int interval; |
80 | |||
81 | // battery spinboxes | 77 | // battery spinboxes |
82 | interval = config.readNumEntry( "Interval_Dim", 20 ); | 78 | interval = config.readNumEntry( "Interval_Dim", 20 ); |
83 | if ( config.readNumEntry("Dim",1) == 0 ) { | 79 | if ( config.readNumEntry("Dim",1) == 0 ) { |
84 | interval_dim->setSpecialValueText( tr("never") ); | 80 | interval_dim->setSpecialValueText( tr("never") ); |
85 | } else { | 81 | } else { |
86 | interval_dim->setValue( interval ); | 82 | interval_dim->setValue( interval ); |
@@ -121,16 +117,12 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
121 | } else { | 117 | } else { |
122 | interval_suspend_ac_3->setValue( interval ); | 118 | interval_suspend_ac_3->setValue( interval ); |
123 | } | 119 | } |
124 | 120 | ||
125 | 121 | ||
126 | // battery check and slider | 122 | // battery check and slider |
127 | |||
128 | |||
129 | |||
130 | |||
131 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); | 123 | LcdOffOnly->setChecked( config.readNumEntry("LcdOffOnly",0) != 0 ); |
132 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); | 124 | int maxbright = ODevice::inst ( )-> displayBrightnessResolution ( ); |
133 | initbright = config.readNumEntry("Brightness",255); | 125 | initbright = config.readNumEntry("Brightness",255); |
134 | brightness->setMaxValue( maxbright ); | 126 | brightness->setMaxValue( maxbright ); |
135 | brightness->setTickInterval( QMAX(1,maxbright/16) ); | 127 | brightness->setTickInterval( QMAX(1,maxbright/16) ); |
136 | brightness->setLineStep( QMAX(1,maxbright/16) ); | 128 | brightness->setLineStep( QMAX(1,maxbright/16) ); |
@@ -147,14 +139,14 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
147 | brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); | 139 | brightness_ac_3->setPageStep( QMAX(1,maxbright_ac/16) ); |
148 | brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); | 140 | brightness_ac_3->setValue( (maxbright_ac*255 - initbright_ac*maxbright_ac)/255 ); |
149 | 141 | ||
150 | 142 | ||
151 | // ipaq sensor | 143 | // ipaq sensor |
152 | config.setGroup( "Ipaqlightsensor" ); | 144 | config.setGroup( "Ipaqlightsensor" ); |
153 | auto_brightness->setChecked( config.readNumEntry("LightSensor",1) != 0 ); | 145 | auto_brightness->setChecked( config.readNumEntry("LightSensor",0) != 0 ); |
154 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",1) != 0 ); | 146 | auto_brightness_ac_3->setChecked( config.readNumEntry("LightSensorAC",0) != 0 ); |
155 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | 147 | //LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); |
156 | //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); | 148 | //LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); |
157 | //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; | 149 | //connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; |
158 | //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); | 150 | //LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); |
159 | 151 | ||
160 | // advanced settings | 152 | // advanced settings |
@@ -165,14 +157,13 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
165 | criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); | 157 | criticalSpinBox->setValue( conf.readNumEntry("powercritical", 5 ) ); |
166 | 158 | ||
167 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); | 159 | connect( brightness, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightness() ) ); |
168 | connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); | 160 | connect( brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); |
169 | } | 161 | } |
170 | 162 | ||
171 | LightSettings::~LightSettings() | 163 | LightSettings::~LightSettings() { |
172 | { | ||
173 | } | 164 | } |
174 | 165 | ||
175 | void LightSettings::slotSliderTicks( int steps ) { | 166 | void LightSettings::slotSliderTicks( int steps ) { |
176 | // LightMinValueSlider->setTickInterval( steps ); | 167 | // LightMinValueSlider->setTickInterval( steps ); |
177 | } | 168 | } |
178 | 169 | ||
@@ -183,13 +174,12 @@ static void set_fl(int bright) | |||
183 | e << bright; | 174 | e << bright; |
184 | } | 175 | } |
185 | 176 | ||
186 | void LightSettings::reject() | 177 | void LightSettings::reject() |
187 | { | 178 | { |
188 | set_fl(initbright); | 179 | set_fl(initbright); |
189 | |||
190 | QDialog::reject(); | 180 | QDialog::reject(); |
191 | } | 181 | } |
192 | 182 | ||
193 | void LightSettings::accept() | 183 | void LightSettings::accept() |
194 | { | 184 | { |
195 | if ( qApp->focusWidget() ) { | 185 | if ( qApp->focusWidget() ) { |
@@ -281,8 +271,8 @@ void LightSettings::applyBrightnessAC() | |||
281 | 271 | ||
282 | 272 | ||
283 | 273 | ||
284 | void LightSettings::done(int r) | 274 | void LightSettings::done(int r) |
285 | { | 275 | { |
286 | QDialog::done(r); | 276 | QDialog::done(r); |
287 | close ( ); | 277 | close (); |
288 | } | 278 | } |