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 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 8721a95..1a94209 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -137,25 +137,26 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
137 | LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); | 137 | LightStepSpin->setValue( config.readNumEntry("Steps", 10 ) ); |
138 | LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); | 138 | LightMinValueSlider->setValue( config.readNumEntry("MinValue", 70 ) ); |
139 | connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; | 139 | connect( LightStepSpin, SIGNAL( valueChanged( int ) ), this, SLOT( slotSliderTicks( int ) ) ) ; |
140 | LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); | 140 | LightShiftSpin->setValue( config.readNumEntry("Shift", 0 ) ); |
141 | 141 | ||
142 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); | 142 | connect(brightness, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); |
143 | connect(brightness_ac_3, SIGNAL(valueChanged(int)), this, SLOT(applyBrightness())); | 143 | connect(brightness_ac_3, SIGNAL( valueChanged(int) ), this, SLOT( applyBrightnessAC() ) ); |
144 | } | 144 | } |
145 | 145 | ||
146 | LightSettings::~LightSettings() | 146 | LightSettings::~LightSettings() |
147 | { | 147 | { |
148 | } | 148 | } |
149 | 149 | ||
150 | void LightSettings::slotSliderTicks( int steps ) { | 150 | void LightSettings::slotSliderTicks( int steps ) { |
151 | LightMinValueSlider->setTickInterval( steps ); | 151 | LightMinValueSlider->setTickInterval( steps ); |
152 | } | 152 | } |
153 | 153 | ||
154 | static void set_fl(int bright) | 154 | static void set_fl(int bright) |
155 | { | 155 | { |
156 | qDebug( QString("BRIGHT !! : %1").arg( bright ) ); | ||
156 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); | 157 | QCopEnvelope e("QPE/System", "setBacklight(int)" ); |
157 | e << bright; | 158 | e << bright; |
158 | } | 159 | } |
159 | 160 | ||
160 | void LightSettings::reject() | 161 | void LightSettings::reject() |
161 | { | 162 | { |
@@ -236,18 +237,24 @@ void LightSettings::accept() | |||
236 | 237 | ||
237 | QDialog::accept(); | 238 | QDialog::accept(); |
238 | } | 239 | } |
239 | 240 | ||
240 | void LightSettings::applyBrightness() | 241 | void LightSettings::applyBrightness() |
241 | { | 242 | { |
243 | if ( !PowerStatus::Online ) { | ||
244 | int bright = ( brightness->value() ) * 255 / brightness->maxValue(); | ||
245 | set_fl(bright); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | void LightSettings::applyBrightnessAC() | ||
250 | { | ||
251 | qDebug( QString("SLIDER : %1").arg( brightness_ac_3->value() ) ); | ||
242 | // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting | 252 | // if ac is attached, set directly that sliders setting, else the "on battery" sliders setting |
243 | if ( PowerStatus::Online ) { | 253 | if ( PowerStatus::Online ) { |
244 | int bright = (brightness_ac_3->maxValue() - brightness_ac_3->value())*255 / brightness_ac_3->maxValue(); | 254 | int bright = ( brightness_ac_3->value() ) * 255 / brightness_ac_3->maxValue(); |
245 | set_fl(bright); | ||
246 | } else { | ||
247 | int bright = (brightness->maxValue()-brightness->value())*255 / brightness->maxValue(); | ||
248 | set_fl(bright); | 255 | set_fl(bright); |
249 | } | 256 | } |
250 | } | 257 | } |
251 | 258 | ||
252 | 259 | ||
253 | 260 | ||