author | harlekin <harlekin> | 2002-10-20 16:14:46 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-20 16:14:46 (UTC) |
commit | d3936c24518e9fea48a060eaef02e64a89646657 (patch) (unidiff) | |
tree | 0dc08dc1c757e0d7a2b32d53ed2a56d8b0442fa3 /core/settings/light-and-power/light.cpp | |
parent | 56ac4499a8e13a58d006b35ea023153df9995f7a (diff) | |
download | opie-d3936c24518e9fea48a060eaef02e64a89646657.zip opie-d3936c24518e9fea48a060eaef02e64a89646657.tar.gz opie-d3936c24518e9fea48a060eaef02e64a89646657.tar.bz2 |
fixed emmited slider values
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 | |||
@@ -140,7 +140,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags fl ) | |||
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() |
@@ -153,6 +153,7 @@ void LightSettings::slotSliderTicks( int steps ) { | |||
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 | } |
@@ -239,12 +240,18 @@ void LightSettings::accept() | |||
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 | } |