Diffstat (limited to 'core/settings/light-and-power/light.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/light-and-power/light.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/core/settings/light-and-power/light.cpp b/core/settings/light-and-power/light.cpp index 6115178..d6d09a1 100644 --- a/core/settings/light-and-power/light.cpp +++ b/core/settings/light-and-power/light.cpp | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <qlabel.h> | ||
37 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
38 | #include <qtabwidget.h> | 39 | #include <qtabwidget.h> |
39 | #include <qslider.h> | 40 | #include <qslider.h> |
@@ -54,12 +55,17 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
54 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); | 55 | m_bres = ODevice::inst ( )-> displayBrightnessResolution ( ); |
55 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); | 56 | m_cres = ODevice::inst ( )-> displayContrastResolution ( ); |
56 | 57 | ||
58 | // check whether to show the light sensor stuff | ||
59 | |||
57 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 60 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
58 | auto_brightness-> hide ( ); | 61 | auto_brightness-> hide ( ); |
59 | CalibrateLightSensor-> hide ( ); | 62 | CalibrateLightSensor-> hide ( ); |
60 | auto_brightness_ac-> hide ( ); | 63 | auto_brightness_ac-> hide ( ); |
61 | CalibrateLightSensor_ac-> hide ( ); | 64 | CalibrateLightSensor_ac-> hide ( ); |
62 | } | 65 | } |
66 | |||
67 | // check whether to show the contrast stuff | ||
68 | |||
63 | if (m_cres) { | 69 | if (m_cres) { |
64 | GroupLight->setTitle(tr("Backlight && Contrast")); | 70 | GroupLight->setTitle(tr("Backlight && Contrast")); |
65 | GroupLight_ac->setTitle(GroupLight->title()); | 71 | GroupLight_ac->setTitle(GroupLight->title()); |
@@ -68,15 +74,28 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
68 | contrast_ac->hide(); | 74 | contrast_ac->hide(); |
69 | } | 75 | } |
70 | 76 | ||
77 | // check whether to show the cpu frequency stuff | ||
78 | |||
71 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 79 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
72 | if ( freq.count() ) { | 80 | if ( freq.count() ) { |
73 | frequency->insertStrList( freq ); | 81 | frequency->insertStrList( freq ); |
74 | frequency_ac->insertStrList( freq ); | 82 | frequency_ac->insertStrList( freq ); |
75 | } else { | 83 | } else { |
84 | frequencyLabel->hide(); | ||
76 | frequency->hide(); | 85 | frequency->hide(); |
86 | frequencyLabel_ac->hide(); | ||
77 | frequency_ac->hide(); | 87 | frequency_ac->hide(); |
78 | } | 88 | } |
79 | 89 | ||
90 | // check whether to show the hinge action stuff | ||
91 | |||
92 | if ( !ODevice::inst()->hasHingeSensor() ) { | ||
93 | closeHingeLabel->hide(); | ||
94 | closeHingeAction->hide(); | ||
95 | closeHingeLabel_ac->hide(); | ||
96 | closeHingeAction_ac->hide(); | ||
97 | } | ||
98 | |||
80 | Config config ( "apm" ); | 99 | Config config ( "apm" ); |
81 | config. setGroup ( "Battery" ); | 100 | config. setGroup ( "Battery" ); |
82 | 101 | ||
@@ -91,6 +110,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
91 | // CPU frequency | 110 | // CPU frequency |
92 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); | 111 | frequency->setCurrentItem( config.readNumEntry("Freq", 0) ); |
93 | 112 | ||
113 | // hinge action | ||
114 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | ||
115 | |||
94 | int bright = config. readNumEntry ( "Brightness", 127 ); | 116 | int bright = config. readNumEntry ( "Brightness", 127 ); |
95 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); | 117 | int contr = m_oldcontrast = config. readNumEntry ( "Contrast", 127 ); |
96 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 118 | brightness-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
@@ -122,6 +144,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
122 | // CPU frequency | 144 | // CPU frequency |
123 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); | 145 | frequency_ac->setCurrentItem( config.readNumEntry("Freq", 0) ); |
124 | 146 | ||
147 | // hinge action | ||
148 | closeHingeAction_ac->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | ||
149 | |||
125 | bright = config. readNumEntry ( "Brightness", 255 ); | 150 | bright = config. readNumEntry ( "Brightness", 255 ); |
126 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); | 151 | brightness_ac-> setTickInterval ( QMAX( 16, 256 / m_bres )); |
127 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); | 152 | brightness_ac-> setLineStep ( QMAX( 1, 256 / m_bres )); |
@@ -140,7 +165,7 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
140 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); | 165 | auto_brightness_ac-> setChecked ( config. readBoolEntry ( "LightSensor", false )); |
141 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); | 166 | m_sensordata_ac = config. readListEntry ( "LightSensorData", ';' ); |
142 | 167 | ||
143 | // advanced settings | 168 | // warnings |
144 | config. setGroup ( "Warnings" ); | 169 | config. setGroup ( "Warnings" ); |
145 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); | 170 | warnintervalBox-> setValue ( config. readNumEntry ( "checkinterval", 10000 ) / 1000 ); |
146 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); | 171 | lowSpinBox-> setValue ( config. readNumEntry ( "powerverylow", 10 ) ); |
@@ -163,6 +188,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
163 | connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); | 188 | connect ( contrast_ac, SIGNAL( valueChanged ( int )), this, SLOT( setContrast ( int ))); |
164 | } | 189 | } |
165 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | 190 | connect( frequency, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); |
191 | connect( frequency_ac, SIGNAL( activated(int) ), this, SLOT( setFrequency(int) ) ); | ||
192 | connect( closeHingeAction, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | ||
193 | connect( closeHingeAction_ac, SIGNAL( activated(int) ), this, SLOT( setCloseHingeAction(int) ) ); | ||
166 | } | 194 | } |
167 | 195 | ||
168 | LightSettings::~LightSettings ( ) | 196 | LightSettings::~LightSettings ( ) |
@@ -201,7 +229,6 @@ void LightSettings::setBacklight ( int bright ) | |||
201 | void LightSettings::setContrast ( int contr ) | 229 | void LightSettings::setContrast ( int contr ) |
202 | { | 230 | { |
203 | if (contr == -1) contr = m_oldcontrast; | 231 | if (contr == -1) contr = m_oldcontrast; |
204 | |||
205 | ODevice::inst ( )-> setDisplayContrast(contr); | 232 | ODevice::inst ( )-> setDisplayContrast(contr); |
206 | } | 233 | } |
207 | 234 | ||
@@ -217,6 +244,11 @@ void LightSettings::resetBacklight ( ) | |||
217 | setContrast ( -1 ); | 244 | setContrast ( -1 ); |
218 | } | 245 | } |
219 | 246 | ||
247 | void LightSettings::setCloseHingeAction ( int index ) | ||
248 | { | ||
249 | qWarning("LightSettings::setCloseHingeStatus(%d)", index); | ||
250 | } | ||
251 | |||
220 | void LightSettings::accept ( ) | 252 | void LightSettings::accept ( ) |
221 | { | 253 | { |
222 | Config config ( "apm" ); | 254 | Config config ( "apm" ); |
@@ -231,6 +263,7 @@ void LightSettings::accept ( ) | |||
231 | if (m_cres) | 263 | if (m_cres) |
232 | config. writeEntry ( "Contrast", contrast-> value () ); | 264 | config. writeEntry ( "Contrast", contrast-> value () ); |
233 | config. writeEntry ( "Freq", frequency->currentItem() ); | 265 | config. writeEntry ( "Freq", frequency->currentItem() ); |
266 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | ||
234 | 267 | ||
235 | // ac | 268 | // ac |
236 | config. setGroup ( "AC" ); | 269 | config. setGroup ( "AC" ); |
@@ -242,6 +275,7 @@ void LightSettings::accept ( ) | |||
242 | if (m_cres) | 275 | if (m_cres) |
243 | config. writeEntry ( "Contrast", contrast_ac-> value () ); | 276 | config. writeEntry ( "Contrast", contrast_ac-> value () ); |
244 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); | 277 | config. writeEntry ( "Freq", frequency_ac->currentItem() ); |
278 | config. writeEntry ( "CloseHingeAction", closeHingeAction_ac->currentItem() ); | ||
245 | 279 | ||
246 | // only make light sensor stuff appear if the unit has a sensor | 280 | // only make light sensor stuff appear if the unit has a sensor |
247 | if ( ODevice::inst ( )-> hasLightSensor ( )) { | 281 | if ( ODevice::inst ( )-> hasLightSensor ( )) { |