author | sandman <sandman> | 2002-12-29 18:41:55 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-29 18:41:55 (UTC) |
commit | 7c3dceb16d9007e2c36b2b83e2a499cda3411138 (patch) (unidiff) | |
tree | 78a0945be9233099ca7e5e4e01d8b78364f009cb | |
parent | f8673391881545af514054babe47fdc162770a72 (diff) | |
download | opie-7c3dceb16d9007e2c36b2b83e2a499cda3411138.zip opie-7c3dceb16d9007e2c36b2b83e2a499cda3411138.tar.gz opie-7c3dceb16d9007e2c36b2b83e2a499cda3411138.tar.bz2 |
Power warning changes:
- interval can now be in the range (0 [Never] ... 300 [5min] )
- some code cleanup in the launcher
-rw-r--r-- | core/launcher/desktop.cpp | 34 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 20 |
3 files changed, 35 insertions, 21 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index fa9736f..03a23dc 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp | |||
@@ -174,22 +174,15 @@ void DesktopApplication::switchLCD ( bool on ) | |||
174 | 174 | ||
175 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) | 175 | DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) |
176 | : QPEApplication( argc, argv, appType ) | 176 | : QPEApplication( argc, argv, appType ) |
177 | { | 177 | { |
178 | |||
179 | Config cfg( "apm" ); | ||
180 | cfg.setGroup( "Warnings" ); | ||
181 | //cfg.readNumEntry( "checkinterval", 10000 ) | ||
182 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); | ||
183 | m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); | ||
184 | |||
185 | m_ps = new PowerStatus; | 178 | m_ps = new PowerStatus; |
186 | m_ps_last = new PowerStatus; | 179 | m_ps_last = new PowerStatus; |
187 | pa = new DesktopPowerAlerter( 0 ); | 180 | pa = new DesktopPowerAlerter( 0 ); |
188 | 181 | ||
189 | m_timer = new QTimer( this ); | 182 | m_apm_timer = new QTimer ( this ); |
190 | connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); | 183 | connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( ))); |
191 | m_timer->start( 5000 ); | 184 | reloadPowerWarnSettings ( ); |
192 | 185 | ||
193 | m_last_button = 0; | 186 | m_last_button = 0; |
194 | m_button_timer = new QTimer ( ); | 187 | m_button_timer = new QTimer ( ); |
195 | connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); | 188 | connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); |
@@ -225,9 +218,9 @@ DesktopApplication::~DesktopApplication() | |||
225 | } | 218 | } |
226 | 219 | ||
227 | void DesktopApplication::apmTimeout() | 220 | void DesktopApplication::apmTimeout() |
228 | { | 221 | { |
229 | qpedesktop->checkMemory(); // in case no events are being generated | 222 | qpedesktop-> checkMemory ( ); // in case no events are being generated |
230 | 223 | ||
231 | *m_ps_last = *m_ps; | 224 | *m_ps_last = *m_ps; |
232 | *m_ps = PowerStatusManager::readStatus(); | 225 | *m_ps = PowerStatusManager::readStatus(); |
233 | 226 | ||
@@ -295,16 +288,21 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & | |||
295 | } | 288 | } |
296 | } | 289 | } |
297 | } | 290 | } |
298 | 291 | ||
299 | void DesktopApplication::reloadPowerWarnSettings() | 292 | void DesktopApplication::reloadPowerWarnSettings ( ) |
300 | { | 293 | { |
301 | Config cfg( "apm" ); | 294 | Config cfg ( "apm" ); |
302 | cfg.setGroup( "Warnings" ); | 295 | cfg. setGroup ( "Warnings" ); |
303 | 296 | ||
304 | // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); | 297 | int iv = cfg. readNumEntry ( "checkinterval", 10000 ); |
305 | m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); | 298 | |
306 | m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); | 299 | m_apm_timer-> stop ( ); |
300 | if ( iv ) | ||
301 | m_apm_timer-> start ( iv ); | ||
302 | |||
303 | m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 ); | ||
304 | m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 ); | ||
307 | } | 305 | } |
308 | 306 | ||
309 | 307 | ||
310 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; | 308 | enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; |
@@ -341,9 +339,9 @@ void DesktopApplication::sendHeldAction ( ) | |||
341 | } | 339 | } |
342 | 340 | ||
343 | 341 | ||
344 | 342 | ||
345 | void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int keycode, bool press, bool autoRepeat ) | 343 | void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) |
346 | { | 344 | { |
347 | if ( db ) { | 345 | if ( db ) { |
348 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { | 346 | if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { |
349 | m_button_timer-> stop ( ); | 347 | m_button_timer-> stop ( ); |
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index 6cb7ab2..db0173e 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h | |||
@@ -94,9 +94,9 @@ private: | |||
94 | PowerStatus *m_ps, *m_ps_last; | 94 | PowerStatus *m_ps, *m_ps_last; |
95 | QTimer *cardSendTimer; | 95 | QTimer *cardSendTimer; |
96 | QCopChannel *channel; | 96 | QCopChannel *channel; |
97 | OpieScreenSaver *m_screensaver; | 97 | OpieScreenSaver *m_screensaver; |
98 | QTimer * m_timer; | 98 | QTimer * m_apm_timer; |
99 | int m_powerVeryLow; | 99 | int m_powerVeryLow; |
100 | int m_powerCritical; | 100 | int m_powerCritical; |
101 | int m_currentPowerLevel; | 101 | int m_currentPowerLevel; |
102 | 102 | ||
diff --git a/core/settings/light-and-power/lightsettingsbase.ui b/core/settings/light-and-power/lightsettingsbase.ui index 309b95d..b583b5c 100644 --- a/core/settings/light-and-power/lightsettingsbase.ui +++ b/core/settings/light-and-power/lightsettingsbase.ui | |||
@@ -10,9 +10,9 @@ | |||
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>371</width> | 14 | <width>367</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"> |
@@ -1061,17 +1061,33 @@ | |||
1061 | <name>suffix</name> | 1061 | <name>suffix</name> |
1062 | <string> sec</string> | 1062 | <string> sec</string> |
1063 | </property> | 1063 | </property> |
1064 | <property stdset="1"> | 1064 | <property stdset="1"> |
1065 | <name>specialValueText</name> | ||
1066 | <string>never</string> | ||
1067 | </property> | ||
1068 | <property stdset="1"> | ||
1069 | <name>wrapping</name> | ||
1070 | <bool>true</bool> | ||
1071 | </property> | ||
1072 | <property stdset="1"> | ||
1065 | <name>buttonSymbols</name> | 1073 | <name>buttonSymbols</name> |
1066 | <enum>PlusMinus</enum> | 1074 | <enum>PlusMinus</enum> |
1067 | </property> | 1075 | </property> |
1068 | <property stdset="1"> | 1076 | <property stdset="1"> |
1069 | <name>maxValue</name> | 1077 | <name>maxValue</name> |
1070 | <number>60</number> | 1078 | <number>300</number> |
1071 | </property> | 1079 | </property> |
1072 | <property stdset="1"> | 1080 | <property stdset="1"> |
1073 | <name>minValue</name> | 1081 | <name>minValue</name> |
1082 | <number>0</number> | ||
1083 | </property> | ||
1084 | <property stdset="1"> | ||
1085 | <name>lineStep</name> | ||
1086 | <number>5</number> | ||
1087 | </property> | ||
1088 | <property stdset="1"> | ||
1089 | <name>value</name> | ||
1074 | <number>5</number> | 1090 | <number>5</number> |
1075 | </property> | 1091 | </property> |
1076 | <property> | 1092 | <property> |
1077 | <name>whatsThis</name> | 1093 | <name>whatsThis</name> |