-rw-r--r-- | core/settings/light-and-power/light.cpp | 17 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 22 | ||||
-rw-r--r-- | core/settings/light-and-power/settings.h | 1 |
3 files changed, 34 insertions, 6 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 | ||
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index fd85017..5e62626 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui | |||
@@ -8,13 +8,13 @@ | |||
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>419</width> | 14 | <width>415</width> |
15 | <height>532</height> | 15 | <height>532</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Light and Power Settings</string> | 20 | <string>Light and Power Settings</string> |
@@ -305,12 +305,16 @@ | |||
305 | </property> | 305 | </property> |
306 | <property stdset="1"> | 306 | <property stdset="1"> |
307 | <name>pageStep</name> | 307 | <name>pageStep</name> |
308 | <number>16</number> | 308 | <number>16</number> |
309 | </property> | 309 | </property> |
310 | <property stdset="1"> | 310 | <property stdset="1"> |
311 | <name>tracking</name> | ||
312 | <bool>true</bool> | ||
313 | </property> | ||
314 | <property stdset="1"> | ||
311 | <name>orientation</name> | 315 | <name>orientation</name> |
312 | <enum>Horizontal</enum> | 316 | <enum>Horizontal</enum> |
313 | </property> | 317 | </property> |
314 | <property stdset="1"> | 318 | <property stdset="1"> |
315 | <name>tickmarks</name> | 319 | <name>tickmarks</name> |
316 | <enum>Right</enum> | 320 | <enum>Right</enum> |
@@ -720,24 +724,36 @@ | |||
720 | <class>QSlider</class> | 724 | <class>QSlider</class> |
721 | <property stdset="1"> | 725 | <property stdset="1"> |
722 | <name>name</name> | 726 | <name>name</name> |
723 | <cstring>brightness_ac_3</cstring> | 727 | <cstring>brightness_ac_3</cstring> |
724 | </property> | 728 | </property> |
725 | <property stdset="1"> | 729 | <property stdset="1"> |
730 | <name>minValue</name> | ||
731 | <number>0</number> | ||
732 | </property> | ||
733 | <property stdset="1"> | ||
726 | <name>maxValue</name> | 734 | <name>maxValue</name> |
727 | <number>255</number> | 735 | <number>255</number> |
728 | </property> | 736 | </property> |
729 | <property stdset="1"> | 737 | <property stdset="1"> |
730 | <name>lineStep</name> | 738 | <name>lineStep</name> |
731 | <number>16</number> | 739 | <number>16</number> |
732 | </property> | 740 | </property> |
733 | <property stdset="1"> | 741 | <property stdset="1"> |
734 | <name>pageStep</name> | 742 | <name>pageStep</name> |
735 | <number>16</number> | 743 | <number>16</number> |
736 | </property> | 744 | </property> |
737 | <property stdset="1"> | 745 | <property stdset="1"> |
746 | <name>value</name> | ||
747 | <number>255</number> | ||
748 | </property> | ||
749 | <property stdset="1"> | ||
750 | <name>tracking</name> | ||
751 | <bool>true</bool> | ||
752 | </property> | ||
753 | <property stdset="1"> | ||
738 | <name>orientation</name> | 754 | <name>orientation</name> |
739 | <enum>Horizontal</enum> | 755 | <enum>Horizontal</enum> |
740 | </property> | 756 | </property> |
741 | <property stdset="1"> | 757 | <property stdset="1"> |
742 | <name>tickmarks</name> | 758 | <name>tickmarks</name> |
743 | <enum>Right</enum> | 759 | <enum>Right</enum> |
@@ -1204,12 +1220,16 @@ warning at</string> | |||
1204 | </property> | 1220 | </property> |
1205 | <property stdset="1"> | 1221 | <property stdset="1"> |
1206 | <name>maxValue</name> | 1222 | <name>maxValue</name> |
1207 | <number>127</number> | 1223 | <number>127</number> |
1208 | </property> | 1224 | </property> |
1209 | <property stdset="1"> | 1225 | <property stdset="1"> |
1226 | <name>tracking</name> | ||
1227 | <bool>false</bool> | ||
1228 | </property> | ||
1229 | <property stdset="1"> | ||
1210 | <name>orientation</name> | 1230 | <name>orientation</name> |
1211 | <enum>Horizontal</enum> | 1231 | <enum>Horizontal</enum> |
1212 | </property> | 1232 | </property> |
1213 | <property stdset="1"> | 1233 | <property stdset="1"> |
1214 | <name>tickmarks</name> | 1234 | <name>tickmarks</name> |
1215 | <enum>Right</enum> | 1235 | <enum>Right</enum> |
diff --git a/core/settings/light-and-power/settings.h b/core/settings/light-and-power/settings.h index 77f90d6..adfd735 100644 --- a/core/settings/light-and-power/settings.h +++ b/core/settings/light-and-power/settings.h | |||
@@ -39,12 +39,13 @@ protected: | |||
39 | void reject(); | 39 | void reject(); |
40 | 40 | ||
41 | void done ( int r ); | 41 | void done ( int r ); |
42 | 42 | ||
43 | private slots: | 43 | private slots: |
44 | void applyBrightness(); | 44 | void applyBrightness(); |
45 | void applyBrightnessAC(); | ||
45 | void slotSliderTicks( int steps ); | 46 | void slotSliderTicks( int steps ); |
46 | 47 | ||
47 | private: | 48 | private: |
48 | int initbright; | 49 | int initbright; |
49 | int initbright_ac; | 50 | int initbright_ac; |
50 | }; | 51 | }; |