summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/light-and-power/light.cpp103
-rw-r--r--core/settings/light-and-power/light.h5
-rw-r--r--core/settings/light-and-power/lightsettingsbase.ui128
3 files changed, 185 insertions, 51 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp
index 21377b7..a58b1c1 100644
--- a/core/settings/light-and-power/light.cpp
+++ b/core/settings/light-and-power/light.cpp
@@ -43,2 +43,3 @@
43#include <qpushbutton.h> 43#include <qpushbutton.h>
44#include <qgroupbox.h>
44 45
@@ -53,3 +54,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
53{ 54{
54 m_res = ODevice::inst ( )-> displayBrightnessResolution ( ); 55 m_bres = ODevice::inst ( )-> displayBrightnessResolution ( );
56 m_cres = ODevice::inst ( )-> displayContrastResolution ( );
55 57
@@ -58,4 +60,10 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
58 CalibrateLightSensor-> hide ( ); 60 CalibrateLightSensor-> hide ( );
59 auto_brightness_ac_3-> hide ( ); 61 auto_brightness_ac-> hide ( );
60 CalibrateLightSensorAC-> hide ( ); 62 CalibrateLightSensor_ac-> hide ( );
63 }
64 if (m_cres) {
65 GroupLight->setTitle(tr("Backlight & Contrast"));
66 } else {
67 contrast->hide();
68 contrast_ac->hide();
61 } 69 }
@@ -74,7 +82,16 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
74 int bright = config. readNumEntry ( "Brightness", 127 ); 82 int bright = config. readNumEntry ( "Brightness", 127 );
75 brightness-> setMaxValue ( m_res - 1 ); 83 int contr = config. readNumEntry ( "Contrast", 127 );
76 brightness-> setTickInterval ( QMAX( 1, m_res / 16 )); 84 brightness-> setMaxValue ( m_bres - 1 );
77 brightness-> setLineStep ( QMAX( 1, m_res / 16 )); 85 brightness-> setTickInterval ( QMAX( 1, m_bres / 16 ));
78 brightness-> setPageStep ( QMAX( 1, m_res / 16 )); 86 brightness-> setLineStep ( QMAX( 1, m_bres / 16 ));
79 brightness-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); 87 brightness-> setPageStep ( QMAX( 1, m_bres / 16 ));
88 brightness-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 );
89
90 if (m_cres) {
91 contrast-> setMaxValue ( m_cres - 1 );
92 contrast-> setTickInterval ( QMAX( 1, m_cres / 16 ));
93 contrast-> setLineStep ( QMAX( 1, m_cres / 16 ));
94 contrast-> setPageStep ( QMAX( 1, m_cres / 16 ));
95 contrast-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 );
96 }
80 97
@@ -87,18 +104,27 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
87 // ac spinboxes 104 // ac spinboxes
88 interval_dim_ac_3-> setValue ( config. readNumEntry ( "Dim", 60 )); 105 interval_dim_ac-> setValue ( config. readNumEntry ( "Dim", 60 ));
89 interval_lightoff_ac_3-> setValue ( config. readNumEntry ( "LightOff", 120 )); 106 interval_lightoff_ac-> setValue ( config. readNumEntry ( "LightOff", 120 ));
90 interval_suspend_ac_3-> setValue ( config. readNumEntry ( "Suspend", 0 )); 107 interval_suspend_ac-> setValue ( config. readNumEntry ( "Suspend", 0 ));
91 108
92 // ac check and slider 109 // ac check and slider
93 LcdOffOnly_2_3-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false )); 110 LcdOffOnly_ac-> setChecked ( config. readBoolEntry ( "LcdOffOnly", false ));
94 111
95 bright = config. readNumEntry ( "Brightness", 255 ); 112 bright = config. readNumEntry ( "Brightness", 255 );
96 brightness_ac_3-> setMaxValue ( m_res - 1 ); 113 brightness_ac-> setMaxValue ( m_bres - 1 );
97 brightness_ac_3-> setTickInterval ( QMAX( 1, m_res / 16 )); 114 brightness_ac-> setTickInterval ( QMAX( 1, m_bres / 16 ));
98 brightness_ac_3-> setLineStep ( QMAX( 1, m_res / 16 )); 115 brightness_ac-> setLineStep ( QMAX( 1, m_bres / 16 ));
99 brightness_ac_3-> setPageStep ( QMAX( 1, m_res / 16 )); 116 brightness_ac-> setPageStep ( QMAX( 1, m_bres / 16 ));
100 brightness_ac_3-> setValue (( bright * ( m_res - 1 ) + 127 ) / 255 ); 117 brightness_ac-> setValue (( bright * ( m_bres - 1 ) + 127 ) / 255 );
118
119 if (m_cres) {
120 contr = config. readNumEntry ( "Contrast", 127);
121 contrast_ac-> setMaxValue ( m_cres - 1 );
122 contrast_ac-> setTickInterval ( QMAX( 1, m_cres / 16 ));
123 contrast_ac-> setLineStep ( QMAX( 1, m_cres / 16 ));
124 contrast_ac-> setPageStep ( QMAX( 1, m_cres / 16 ));
125 contrast_ac-> setValue (( contr * ( m_cres - 1 ) + 127 ) / 255 );
126 }
101 127
102 // light sensor 128 // light sensor
103 auto_brightness_ac_3-> setChecked ( config. readBoolEntry ( "LightSensor", false )); 129 auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false ));
104 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); 130 m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' );
@@ -122,3 +148,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags )
122 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 148 connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
123 connect ( brightness_ac_3, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); 149 connect ( brightness_ac, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int )));
150 if (m_havecontrast) {
151 connect ( contrast, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
152 connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int )));
153 }
124} 154}
@@ -150,3 +180,3 @@ void LightSettings::setBacklight ( int bright )
150 if ( bright >= 0 ) 180 if ( bright >= 0 )
151 bright = bright * 255 / ( m_res - 1 ); 181 bright = bright * 255 / ( m_bres - 1 );
152 182
@@ -161,2 +191,16 @@ void LightSettings::setBacklight ( int bright )
161 191
192void LightSettings::setContrast ( int contr )
193{
194 if ( contr >= 0 )
195 contr = contr * 255 / ( m_cres - 1 );
196
197 QCopEnvelope e ( "QPE/System", "setContrast(int)" );
198 e << contr;
199
200 if ( contr != -1 ) {
201 m_resettimer-> stop ( );
202 m_resettimer-> start ( 2000, true );
203 }
204}
205
162void LightSettings::resetBacklight ( ) 206void LightSettings::resetBacklight ( )
@@ -164,2 +208,3 @@ void LightSettings::resetBacklight ( )
164 setBacklight ( -1 ); 208 setBacklight ( -1 );
209 setContrast ( -1 );
165} 210}
@@ -176,3 +221,5 @@ void LightSettings::accept ( )
176 config. writeEntry ( "Suspend", interval_suspend-> value ( )); 221 config. writeEntry ( "Suspend", interval_suspend-> value ( ));
177 config. writeEntry ( "Brightness", brightness-> value ( ) * 255 / ( m_res - 1 ) ); 222 config. writeEntry ( "Brightness", brightness-> value ( ) * 255 / ( m_bres - 1 ) );
223 if (m_cres)
224 config. writeEntry ( "Contrast", contrast-> value ( ) * 255 / ( m_cres - 1 ) );
178 225
@@ -180,7 +227,9 @@ void LightSettings::accept ( )
180 config. setGroup ( "AC" ); 227 config. setGroup ( "AC" );
181 config. writeEntry ( "LcdOffOnly", LcdOffOnly_2_3-> isChecked ( )); 228 config. writeEntry ( "LcdOffOnly", LcdOffOnly_ac-> isChecked ( ));
182 config. writeEntry ( "Dim", interval_dim_ac_3-> value ( )); 229 config. writeEntry ( "Dim", interval_dim_ac-> value ( ));
183 config. writeEntry ( "LightOff", interval_lightoff_ac_3-> value ( )); 230 config. writeEntry ( "LightOff", interval_lightoff_ac-> value ( ));
184 config. writeEntry ( "Suspend", interval_suspend_ac_3-> value ( )); 231 config. writeEntry ( "Suspend", interval_suspend_ac-> value ( ));
185 config. writeEntry ( "Brightness", brightness_ac_3-> value ( ) * 255 / ( m_res - 1 )); 232 config. writeEntry ( "Brightness", brightness_ac-> value ( ) * 255 / ( m_bres - 1 ));
233 if (m_cres)
234 config. writeEntry ( "Contrast", contrast_ac-> value ( ) * 255 / ( m_cres - 1 ));
186 235
@@ -192,3 +241,3 @@ void LightSettings::accept ( )
192 config. setGroup ( "AC" ); 241 config. setGroup ( "AC" );
193 config. writeEntry ( "LightSensor", auto_brightness_ac_3->isChecked() ); 242 config. writeEntry ( "LightSensor", auto_brightness_ac->isChecked() );
194 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' ); 243 config. writeEntry ( "LightSensorData", m_sensordata_ac, ';' );
diff --git a/core/settings/light-and-power/light.h b/core/settings/light-and-power/light.h
index 0a3c60b..c9757da 100644
--- a/core/settings/light-and-power/light.h
+++ b/core/settings/light-and-power/light.h
@@ -52,2 +52,3 @@ protected slots:
52 void setBacklight ( int ); 52 void setBacklight ( int );
53 void setContrast ( int );
53 void resetBacklight ( ); 54 void resetBacklight ( );
@@ -55,3 +56,5 @@ protected slots:
55private: 56private:
56 int m_res; 57 int m_bres;
58 int m_cres;
59 int m_havecontrast;
57 QTimer *m_resettimer; 60 QTimer *m_resettimer;
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui
index 99bbd71..8fdd604 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>363</width> 14 <width>355</width>
15 <height>532</height> 15 <height>532</height>
@@ -278,3 +278,3 @@
278 <name>name</name> 278 <name>name</name>
279 <cstring>GroupBox9</cstring> 279 <cstring>GroupLight</cstring>
280 </property> 280 </property>
@@ -293,3 +293,3 @@
293 <name>margin</name> 293 <name>margin</name>
294 <number>5</number> 294 <number>11</number>
295 </property> 295 </property>
@@ -297,3 +297,3 @@
297 <name>spacing</name> 297 <name>spacing</name>
298 <number>3</number> 298 <number>6</number>
299 </property> 299 </property>
@@ -339,2 +339,41 @@
339 <widget> 339 <widget>
340 <class>QSlider</class>
341 <property stdset="1">
342 <name>name</name>
343 <cstring>contrast</cstring>
344 </property>
345 <property stdset="1">
346 <name>maxValue</name>
347 <number>255</number>
348 </property>
349 <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>
363 <enum>Horizontal</enum>
364 </property>
365 <property stdset="1">
366 <name>tickmarks</name>
367 <enum>Right</enum>
368 </property>
369 <property stdset="1">
370 <name>tickInterval</name>
371 <number>32</number>
372 </property>
373 <property>
374 <name>whatsThis</name>
375 <string>set a fix value for contrast</string>
376 </property>
377 </widget>
378 <widget>
340 <class>QLayoutWidget</class> 379 <class>QLayoutWidget</class>
@@ -558,3 +597,3 @@
558 <name>name</name> 597 <name>name</name>
559 <cstring>interval_lightoff_ac_3</cstring> 598 <cstring>interval_lightoff_ac</cstring>
560 </property> 599 </property>
@@ -607,3 +646,3 @@
607 <name>name</name> 646 <name>name</name>
608 <cstring>interval_suspend_ac_3</cstring> 647 <cstring>interval_suspend_ac</cstring>
609 </property> 648 </property>
@@ -656,3 +695,3 @@
656 <name>name</name> 695 <name>name</name>
657 <cstring>interval_dim_ac_3</cstring> 696 <cstring>interval_dim_ac</cstring>
658 </property> 697 </property>
@@ -705,3 +744,3 @@
705 <name>name</name> 744 <name>name</name>
706 <cstring>LcdOffOnly_2_3</cstring> 745 <cstring>LcdOffOnly_ac</cstring>
707 </property> 746 </property>
@@ -740,3 +779,3 @@
740 <name>margin</name> 779 <name>margin</name>
741 <number>5</number> 780 <number>11</number>
742 </property> 781 </property>
@@ -744,3 +783,3 @@
744 <name>spacing</name> 783 <name>spacing</name>
745 <number>3</number> 784 <number>6</number>
746 </property> 785 </property>
@@ -750,3 +789,46 @@
750 <name>name</name> 789 <name>name</name>
751 <cstring>brightness_ac_3</cstring> 790 <cstring>brightness_ac</cstring>
791 </property>
792 <property stdset="1">
793 <name>minValue</name>
794 <number>0</number>
795 </property>
796 <property stdset="1">
797 <name>maxValue</name>
798 <number>255</number>
799 </property>
800 <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>
810 <number>255</number>
811 </property>
812 <property stdset="1">
813 <name>tracking</name>
814 <bool>true</bool>
815 </property>
816 <property stdset="1">
817 <name>orientation</name>
818 <enum>Horizontal</enum>
819 </property>
820 <property stdset="1">
821 <name>tickmarks</name>
822 <enum>Right</enum>
823 </property>
824 <property>
825 <name>whatsThis</name>
826 <string>set a fix value for backlight</string>
827 </property>
828 </widget>
829 <widget>
830 <class>QSlider</class>
831 <property stdset="1">
832 <name>name</name>
833 <cstring>contrast_ac</cstring>
752 </property> 834 </property>
@@ -904,3 +986,3 @@
904 <name>name</name> 986 <name>name</name>
905 <cstring>auto_brightness_ac_3</cstring> 987 <cstring>auto_brightness_ac</cstring>
906 </property> 988 </property>
@@ -919,3 +1001,3 @@
919 <name>name</name> 1001 <name>name</name>
920 <cstring>CalibrateLightSensorAC</cstring> 1002 <cstring>CalibrateLightSensor_ac</cstring>
921 </property> 1003 </property>
@@ -1194,3 +1276,3 @@
1194 <name>image0</name> 1276 <name>image0</name>
1195 <data format="XPM.GZ" length="1265">789c55d34b4fe2601487f13d9fa2811d9960cba5854c66a1584511046f209359f46d8b50b9df1427f3dda7cf31e2e13c2efebf77a118e349deea775a56fe24b3de049b716885a36065e5a3ed74bafffde7d7df4cd671adf4cb2d5b4ef647265bb042ab3d9fc5ec92daaeda35b5ab6adfaa9d533b56db537baaf650ed96da1db5efd53e55fb51ed2bb5376a3fa87da9f656ed62ba733543b002038f605928079f851141471813b485438203686c827d183a049f842ec1b5302038161a82d74239d880914d30103a0467c222c10f6185e099d023b813560946c21ac10ba121d8168604f74239d813c604cf616c13f4850ec177619160222c1334c20ac150e8126c0a3d8237c22ac13b618d6057287f24b8121a824b6148b02e94df014e847270048736c137a14370212c119c0bcb045f851ec117a121f907e4728109a358e6d7db307c496f34566f71f22a37997ebfcde68bc57cb15c99f5e6eb6dbb7b4bef7dbfdf7f9c1edeceea93ba39f77dffe2f076d9484c92186392ddd5e1fb5d376f3eaff1fd335ad152ae7dab3e5fa73b4aefaea53ff37d779e5ef341bf3dca87f68fde0a4f3ddfeff58f7edfc2f3c0769ce2f15ba93c1854dce3b78257ad0d3f57f6dfcfcc7f522034e9</data> 1277 <data format="XPM.GZ" length="680">789c5dd04d6ac3301005e0bd4f21ec5d280931b1c0941ca1a5cb42e962a4194956e2d8f9e9a294debd9e9168ec3cbcd0f72ca1b1372bf5fef6a2569be27a835b67950d70512bfceafbef8fcffd4f516eb59a9e7aabb6e55351ae9555afc389787d9ed6556bdbb6b5cc2b1376d0c08e79115a0090b74326258e4cb333b591cd27a66d6c6d1b669fa9134988162c328f99945831b1c11a65f32153271a2121a0cc1c3329b16392a69a3413327562101201c9669f4989c874dad54e36bb4c9d6885ce8173f2df24158049abff0eec14a479371de1f859573944873e00dd3b8353ba18e3e1de1dbcf7d04d31b3b39033eb8e1052aad9bdc64be262bec0b784e5cc81c78387efe0ae5b767decba785a76c3380cc379d9ad2fe3787df82fb394bfcfc51f5517a686</data>
1196 </image> 1278 </image>
@@ -1198,3 +1280,3 @@
1198 <name>image1</name> 1280 <name>image1</name>
1199 <data format="XPM.GZ" length="2211">789c75d5594fdb401007f0773e45c4bca1eadfc4b755f581fba6d0420b547db077d7248424908310aa7ef7ae6736ee9683c1917ed9b13d9e592b1fd75a97a7c7adb58f2b936931eda996ea16e3d69a9e0d068b9fbf3eff5e59ed24adfabf1db582d50f2bab67d3966a9d8c86a6066df9d8f371e8e3c0c7be8f231fca03c887f131f091fb17e8fad07edad847e5a7f5fc95637f65e8af843e36fcb4898fff6afbeee3c4c7a67f4e0dca4b1b8abd5bbb48eb606fb3f98fbd60ebc214157b836d0a53f28468ddb9727e665765bb0cd93bb5ad6cb09f6aeb5c2589664fd95a9569ccc5ded536460751c98e6a57818ec3845d386771c4ced8a12e42cea7b9d84459c6eb9a1de92a95e79b89ed7aceeb5c7f15ebbccdfdc00f6715707d982c1d49fd8f6293e46c6cb11313c41d76c94e4d9e73bfa09c8b829f8fc0ce4c184b7fc6ce59c6c617766ee250fa113827622a9dd398e7831b6795733f68c4b6e3c9a47f47ecd2a41d9e0f86ce4aee4777ce2693cdd217575129f3b965ab2ac8a59e0bb6362a907ae4feba0a32b1710e3399d7837324cf8f986daa3891fea5ce4922f5edb3ab2ae8c8f9078d797e386c2cf3fde61cba799d3b47813ccfded2a1e45f3ac7915cffbab15cbfdd58f2af1acb7e796e2cfbe56b639977c73971e7274b27b25f17cea9ec77a2c652ef9373964aff8ba533e9d76963b9fed9d2b9bc7f95732eef37769d8b5cfab3dd58eadd59ba90eb3f2e2def33668da5fe7963e9dfb4b1bc5f7de752d6e9c15929ee1fdd3796fdfbcfb25f478da51f3d676de47eb7cec6b9db38935f8c658050a0848286f9f7ad9f830a37e8a267e3167ddcbdcec100438c706f0ff97cc0f855ce0453ccf088b9fd7cc202cf58c7869f834d6c611b3bd8b5c71ef67180431ce1f8bf9c137cc129ceecf115df70ce71f122e73b7ee01257b8461b1d8e3602842fea891023f12245f6aae69c4044850ba292d4ebfe902643958b1beabed543ead12df5edb3cfa94f77347833674823bab7fdbba7071ad3e4ad1c9b35a5193dda98d3d3dbf3b2390b7aa675dab0b1f96ece166dd38e8d5dda7b2fc766edd3011dd291ffddea9f4f2b7f01e4bc2999</data> 1281 <data format="XPM.GZ" length="1220">789c5dd35f53e2301000f0773e4507de981ba4a5443a37f7a028fe41101514bcb987344d0515a8b4a0e0dc77bfee6e36d0dbe121bf4d48361b38aa3ae341cfa91e95d24c6633e5a8a95c39d5683d9f6f7ffff9f55d2abbc2c93fcd63c72dff28956b8e72facb8586f1733eae042a080205f480d2974de903eb4825a5c4d927434d9c30435c3c26861ed105863ef31118692584043e18cae306700ad43af27c9cbd00c622120d2cf8c350d65bc02b66230056984d0f786ea83d9c7d67fab89562d2b92ba2f6e8bb4343d10a81236680579086927a1532a957d7c898b7fa32146e1db865d28d7acc26def7de50b6b0aa3b4b2ce3cc507bb8d58c498b0796b8386252cd1b62ec51199f96d8c95326f5aacfa49d6f99b455db50d0e235935ea1c3a43e279678c14ba6c0e62c99f40a5d4bbcc21b931afbc20c23e0c250d2e21b26d5bcb3c4d913265d21b5c417cc9874d09c49bfd857c358e1b931530ba0b6c4ff510da3224345239b8b74bee6657a989bbd62bc1de4dee7108b65f2b1cfadd22ccdd69bcde7d73eb7dd9dec92d376bb7db6cf9d77924e02b1dde72e2e4d5c1d9c7bddbdc9a3db2bd4d74ff3e8176bbe856206c5dc1d947c5fcc3d0c47a3e16331f7349e4c26cfc55cadeebade7f7d3988f2df9fa57f7da120b4</data>
1200 </image> 1282 </image>
@@ -1209,3 +1291,3 @@
1209 <connection> 1291 <connection>
1210 <sender>CalibrateLightSensorAC</sender> 1292 <sender>CalibrateLightSensor_ac</sender>
1211 <signal>clicked()</signal> 1293 <signal>clicked()</signal>
@@ -1226,9 +1308,9 @@
1226 <tabstop>tabs</tabstop> 1308 <tabstop>tabs</tabstop>
1227 <tabstop>interval_lightoff_ac_3</tabstop> 1309 <tabstop>interval_lightoff_ac</tabstop>
1228 <tabstop>interval_suspend_ac_3</tabstop> 1310 <tabstop>interval_suspend_ac</tabstop>
1229 <tabstop>interval_dim_ac_3</tabstop> 1311 <tabstop>interval_dim_ac</tabstop>
1230 <tabstop>LcdOffOnly_2_3</tabstop> 1312 <tabstop>LcdOffOnly_ac</tabstop>
1231 <tabstop>brightness_ac_3</tabstop> 1313 <tabstop>brightness_ac</tabstop>
1232 <tabstop>auto_brightness_ac_3</tabstop> 1314 <tabstop>auto_brightness_ac</tabstop>
1233 <tabstop>CalibrateLightSensorAC</tabstop> 1315 <tabstop>CalibrateLightSensor_ac</tabstop>
1234 <tabstop>lowSpinBox</tabstop> 1316 <tabstop>lowSpinBox</tabstop>