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 | 64 |
1 files changed, 49 insertions, 15 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 | |||
@@ -18,3 +18,3 @@ | |||
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
@@ -36,2 +36,3 @@ | |||
36 | 36 | ||
37 | #include <qlabel.h> | ||
37 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
@@ -56,2 +57,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
56 | 57 | ||
58 | // check whether to show the light sensor stuff | ||
59 | |||
57 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { | 60 | if ( !ODevice::inst ( )-> hasLightSensor ( )) { |
@@ -62,2 +65,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
62 | } | 65 | } |
66 | |||
67 | // check whether to show the contrast stuff | ||
68 | |||
63 | if (m_cres) { | 69 | if (m_cres) { |
@@ -70,2 +76,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
70 | 76 | ||
77 | // check whether to show the cpu frequency stuff | ||
78 | |||
71 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); | 79 | QStrList freq = ODevice::inst()->allowedCpuFrequencies(); |
@@ -75,3 +83,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
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(); |
@@ -79,2 +89,11 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
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" ); |
@@ -93,3 +112,6 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
93 | 112 | ||
94 | int bright = config. readNumEntry ( "Brightness", 127 ); | 113 | // hinge action |
114 | closeHingeAction->setCurrentItem( config.readNumEntry("CloseHingeAction", 0) ); | ||
115 | |||
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 ); |
@@ -112,3 +134,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
112 | config. setGroup ( "AC" ); | 134 | config. setGroup ( "AC" ); |
113 | 135 | ||
114 | // ac spinboxes | 136 | // ac spinboxes |
@@ -124,2 +146,5 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
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 ); |
@@ -141,4 +166,4 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
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" ); |
@@ -152,3 +177,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
152 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { | 177 | if ( PowerStatusManager::readStatus ( ). acStatus ( ) != PowerStatus::Online ) { |
153 | tabs-> setCurrentPage ( 0 ); | 178 | tabs-> setCurrentPage ( 0 ); |
154 | } | 179 | } |
@@ -157,3 +182,3 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
157 | } | 182 | } |
158 | 183 | ||
159 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); | 184 | connect ( brightness, SIGNAL( valueChanged ( int )), this, SLOT( setBacklight ( int ))); |
@@ -164,6 +189,9 @@ LightSettings::LightSettings( QWidget* parent, const char* name, WFlags ) | |||
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 ( ) |
169 | { | 197 | { |
@@ -193,3 +221,3 @@ void LightSettings::setBacklight ( int bright ) | |||
193 | e << bright; | 221 | e << bright; |
194 | 222 | ||
195 | if ( bright != -1 ) { | 223 | if ( bright != -1 ) { |
@@ -197,3 +225,3 @@ void LightSettings::setBacklight ( int bright ) | |||
197 | m_resettimer-> start ( 4000, true ); | 225 | m_resettimer-> start ( 4000, true ); |
198 | } | 226 | } |
199 | } | 227 | } |
@@ -203,3 +231,2 @@ void LightSettings::setContrast ( int contr ) | |||
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); |
@@ -209,3 +236,3 @@ void LightSettings::setFrequency ( int index ) | |||
209 | { | 236 | { |
210 | qWarning("LightSettings::setFrequency(%d)", index); | 237 | qWarning("LightSettings::setFrequency(%d)", index); |
211 | ODevice::inst ( )-> setCurrentCpuFrequency(index); | 238 | ODevice::inst ( )-> setCurrentCpuFrequency(index); |
@@ -219,2 +246,7 @@ void LightSettings::resetBacklight ( ) | |||
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 ( ) |
@@ -233,2 +265,3 @@ void LightSettings::accept ( ) | |||
233 | config. writeEntry ( "Freq", frequency->currentItem() ); | 265 | config. writeEntry ( "Freq", frequency->currentItem() ); |
266 | config. writeEntry ( "CloseHingeAction", closeHingeAction->currentItem() ); | ||
234 | 267 | ||
@@ -244,4 +277,5 @@ void LightSettings::accept ( ) | |||
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 ( )) { |
@@ -277,3 +311,3 @@ void LightSettings::done ( int r ) | |||
277 | resetBacklight ( ); | 311 | resetBacklight ( ); |
278 | 312 | ||
279 | LightSettingsBase::done ( r ); | 313 | LightSettingsBase::done ( r ); |