summaryrefslogtreecommitdiff
path: root/core/settings/light-and-power
Unidiff
Diffstat (limited to 'core/settings/light-and-power') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp64
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui86
2 files changed, 36 insertions, 114 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index a58b1c1..8b98672 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -82,15 +82,13 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
82 int bright = config. readNumEntry ( "Brightness", 127 ); 82 int bright = config. readNumEntry ( "Brightness", 127 );
83 int contr = config. readNumEntry ( "Contrast", 127 ); 83 int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 );
84 brightness-> setMaxValue ( m_bres - 1 ); 84 brightness-> setTickInterval ( QMAX( 16, 256 / m_bres ));
85 brightness-> setTickInterval ( QMAX( 1, m_bres / 16 )); 85 brightness-> setLineStep ( QMAX( 1, 256 / m_bres ));
86 brightness-> setLineStep ( QMAX( 1, m_bres / 16 )); 86 brightness-> setPageStep ( QMAX( 1, 256 / m_bres ));
87 brightness-> setPageStep ( QMAX( 1, m_bres / 16 )); 87 brightness-> setValue ( bright );
88 brightness-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 );
89 88
90 if (m_cres) { 89 if (m_cres) {
91 contrast-> setMaxValue ( m_cres - 1 ); 90 contrast-> setTickInterval ( QMAX( 16, 256 / m_cres ));
92 contrast-> setTickInterval ( QMAX( 1, m_cres / 16 )); 91 contrast-> setLineStep ( QMAX( 1, 256 / m_cres ));
93 contrast-> setLineStep ( QMAX( 1, m_cres / 16 )); 92 contrast-> setPageStep ( QMAX( 1, 256 / m_cres ));
94 contrast-> setPageStep ( QMAX( 1, m_cres / 16 )); 93 contrast-> setValue ( contr );
95 contrast-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 );
96 } 94 }
@@ -112,7 +110,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
112 bright = config. readNumEntry ( "Brightness", 255 ); 110 bright = config. readNumEntry ( "Brightness", 255 );
113 brightness_ac-> setMaxValue ( m_bres - 1 ); 111 brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres ));
114 brightness_ac-> setTickInterval ( QMAX( 1, m_bres / 16 )); 112 brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres ));
115 brightness_ac-> setLineStep ( QMAX( 1, m_bres / 16 )); 113 brightness_ac-> setPageStep ( QMAX( 1, 256 / m_bres ));
116 brightness_ac-> setPageStep ( QMAX( 1, m_bres / 16 )); 114 brightness_ac-> setValue ( bright );
117 brightness_ac-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 );
118 115
@@ -120,7 +117,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
120 contr = config. readNumEntry ( "Contrast", 127); 117 contr = config. readNumEntry ( "Contrast", 127);
121 contrast_ac-> setMaxValue ( m_cres - 1 ); 118 contrast_ac-> setTickInterval ( QMAX( 16, 256 / m_cres ));
122 contrast_ac-> setTickInterval ( QMAX( 1, m_cres / 16 )); 119 contrast_ac-> setLineStep ( QMAX( 1, 256 / m_cres ));
123 contrast_ac-> setLineStep ( QMAX( 1, m_cres / 16 )); 120 contrast_ac-> setPageStep ( QMAX( 1, 256 / m_cres ));
124 contrast_ac-> setPageStep ( QMAX( 1, m_cres / 16 )); 121 contrast_ac-> setValue ( contr );
125 contrast_ac-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 );
126 } 122 }
@@ -149,3 +145,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
149 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 145 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
150 if (m_havecontrast) { 146 if (m_cres) {
151 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); 147 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
@@ -179,5 +175,2 @@ void LightSettings::setBacklight ( int bright )
179{ 175{
180 if ( bright >= 0 )
181 bright = bright * 255 / ( m_bres - 1 );
182
183 QCopEnvelope e ( "QPE/System", "setBacklight(int)" ); 176 QCopEnvelope e ( "QPE/System", "setBacklight(int)" );
@@ -187,3 +180,3 @@ void LightSettings::setBacklight ( int bright )
187 m_resettimer-> stop ( ); 180 m_resettimer-> stop ( );
188 m_resettimer-> start ( 2000, true ); 181 m_resettimer-> start ( 4000, true );
189 } 182 }
@@ -193,12 +186,5 @@ void LightSettings::setContrast ( int contr )
193{ 186{
194 if ( contr >= 0 ) 187 if (contr == -1) contr = m_oldcontrast;
195 contr = contr * 255 / ( m_cres - 1 );
196
197 QCopEnvelope e ( "QPE/System", "setContrast(int)" );
198 e << contr;
199 188
200 if ( contr != -1 ) { 189 ODevice::inst ( )-> setDisplayContrast(contr);
201 m_resettimer-> stop ( );
202 m_resettimer-> start ( 2000, true );
203 }
204} 190}
@@ -221,5 +207,5 @@ void LightSettings::accept ( )
221 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 207 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
222 config. writeEntry ( "Brightness", brightness-> value ( ) * 255 / ( m_bres - 1 ) ); 208 config. writeEntry ( "Brightness", brightness-> value () );
223 if (m_cres) 209 if (m_cres)
224 config. writeEntry ( "Contrast", contrast-> value ( ) * 255 / ( m_cres - 1 ) ); 210 config. writeEntry ( "Contrast", contrast-> value () );
225 211
@@ -231,5 +217,5 @@ void LightSettings::accept ( )
231 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( )); 217 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( ));
232 config. writeEntry ( "Brightness", brightness_ac-> value ( ) * 255 / ( m_bres - 1 )); 218 config. writeEntry ( "Brightness", brightness_ac-> value () );
233 if (m_cres) 219 if (m_cres)
234 config. writeEntry ( "Contrast", contrast_ac-> value ( ) * 255 / ( m_cres - 1 )); 220 config. writeEntry ( "Contrast", contrast_ac-> value () );
235 221
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index 8fdd604..884c21c 100644
--- a/core/settings/light-and-power/lightsettingsbase.ui
+++ b/core/settings/light-and-power/lightsettingsbase.ui
@@ -13,3 +13,3 @@
13 <y>0</y> 13 <y>0</y>
14 <width>355</width> 14 <width>347</width>
15 <height>532</height> 15 <height>532</height>
@@ -82,3 +82,3 @@
82 <name>name</name> 82 <name>name</name>
83 <cstring>GroupBox3</cstring> 83 <cstring>Group1</cstring>
84 </property> 84 </property>
@@ -142,3 +142,3 @@
142 <name>name</name> 142 <name>name</name>
143 <cstring>TextLabel2_2</cstring> 143 <cstring>TL2</cstring>
144 </property> 144 </property>
@@ -160,3 +160,3 @@
160 <name>name</name> 160 <name>name</name>
161 <cstring>TextLabel1_3</cstring> 161 <cstring>TL1</cstring>
162 </property> 162 </property>
@@ -240,3 +240,3 @@
240 <name>name</name> 240 <name>name</name>
241 <cstring>TextLabel1_2</cstring> 241 <cstring>TL3</cstring>
242 </property> 242 </property>
@@ -310,14 +310,2 @@
310 <property stdset="1"> 310 <property stdset="1">
311 <name>lineStep</name>
312 <number>1</number>
313 </property>
314 <property stdset="1">
315 <name>pageStep</name>
316 <number>16</number>
317 </property>
318 <property stdset="1">
319 <name>tracking</name>
320 <bool>true</bool>
321 </property>
322 <property stdset="1">
323 <name>orientation</name> 311 <name>orientation</name>
@@ -329,6 +317,2 @@
329 </property> 317 </property>
330 <property stdset="1">
331 <name>tickInterval</name>
332 <number>32</number>
333 </property>
334 <property> 318 <property>
@@ -349,14 +333,2 @@
349 <property stdset="1"> 333 <property stdset="1">
350 <name>lineStep</name>
351 <number>1</number>
352 </property>
353 <property stdset="1">
354 <name>pageStep</name>
355 <number>16</number>
356 </property>
357 <property stdset="1">
358 <name>tracking</name>
359 <bool>true</bool>
360 </property>
361 <property stdset="1">
362 <name>orientation</name> 334 <name>orientation</name>
@@ -368,6 +340,2 @@
368 </property> 340 </property>
369 <property stdset="1">
370 <name>tickInterval</name>
371 <number>32</number>
372 </property>
373 <property> 341 <property>
@@ -414,3 +382,3 @@
414 <name>name</name> 382 <name>name</name>
415 <cstring>TextLabel4</cstring> 383 <cstring>TL4</cstring>
416 </property> 384 </property>
@@ -446,3 +414,3 @@
446 <name>name</name> 414 <name>name</name>
447 <cstring>TextLabel5</cstring> 415 <cstring>TL5</cstring>
448 </property> 416 </property>
@@ -568,3 +536,3 @@
568 <name>name</name> 536 <name>name</name>
569 <cstring>GroupBox4</cstring> 537 <cstring>Group3</cstring>
570 </property> 538 </property>
@@ -764,3 +732,3 @@
764 <name>name</name> 732 <name>name</name>
765 <cstring>GroupBox8</cstring> 733 <cstring>Group4</cstring>
766 </property> 734 </property>
@@ -792,6 +760,2 @@
792 <property stdset="1"> 760 <property stdset="1">
793 <name>minValue</name>
794 <number>0</number>
795 </property>
796 <property stdset="1">
797 <name>maxValue</name> 761 <name>maxValue</name>
@@ -800,10 +764,2 @@
800 <property stdset="1"> 764 <property stdset="1">
801 <name>lineStep</name>
802 <number>16</number>
803 </property>
804 <property stdset="1">
805 <name>pageStep</name>
806 <number>16</number>
807 </property>
808 <property stdset="1">
809 <name>value</name> 765 <name>value</name>
@@ -812,6 +768,2 @@
812 <property stdset="1"> 768 <property stdset="1">
813 <name>tracking</name>
814 <bool>true</bool>
815 </property>
816 <property stdset="1">
817 <name>orientation</name> 769 <name>orientation</name>
@@ -835,6 +787,2 @@
835 <property stdset="1"> 787 <property stdset="1">
836 <name>minValue</name>
837 <number>0</number>
838 </property>
839 <property stdset="1">
840 <name>maxValue</name> 788 <name>maxValue</name>
@@ -843,10 +791,2 @@
843 <property stdset="1"> 791 <property stdset="1">
844 <name>lineStep</name>
845 <number>16</number>
846 </property>
847 <property stdset="1">
848 <name>pageStep</name>
849 <number>16</number>
850 </property>
851 <property stdset="1">
852 <name>value</name> 792 <name>value</name>
@@ -855,6 +795,2 @@
855 <property stdset="1"> 795 <property stdset="1">
856 <name>tracking</name>
857 <bool>true</bool>
858 </property>
859 <property stdset="1">
860 <name>orientation</name> 796 <name>orientation</name>
@@ -868,3 +804,3 @@
868 <name>whatsThis</name> 804 <name>whatsThis</name>
869 <string>set a fix value for backlight</string> 805 <string>set a fix value for contrast</string>
870 </property> 806 </property>
@@ -1062,3 +998,3 @@
1062 <name>name</name> 998 <name>name</name>
1063 <cstring>GroupBox5</cstring> 999 <cstring>Group5</cstring>
1064 </property> 1000 </property>