-rw-r--r-- | core/launcher/desktop.cpp | 22 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/settings/light-and-power/lightsettingsbase.ui | 20 |
3 files changed, 29 insertions, 15 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 @@ -154,62 +154,55 @@ void DesktopPowerAlerter::hideEvent( QHideEvent *e ) } void DesktopApplication::switchLCD ( bool on ) { if ( qApp ) { DesktopApplication *dapp = (DesktopApplication *) qApp; if ( dapp-> m_screensaver ) { if ( on ) { dapp-> m_screensaver-> setDisplayState ( true ); dapp-> m_screensaver-> setBacklight ( -3 ); } else { dapp-> m_screensaver-> setDisplayState ( false ); } } } } DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType ) : QPEApplication( argc, argv, appType ) { - - Config cfg( "apm" ); - cfg.setGroup( "Warnings" ); - //cfg.readNumEntry( "checkinterval", 10000 ) - m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); - m_powerCritical = cfg.readNumEntry( "powercritical", 5 ); - m_ps = new PowerStatus; m_ps_last = new PowerStatus; pa = new DesktopPowerAlerter( 0 ); - m_timer = new QTimer( this ); - connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) ); - m_timer->start( 5000 ); + m_apm_timer = new QTimer ( this ); + connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( ))); + reloadPowerWarnSettings ( ); m_last_button = 0; m_button_timer = new QTimer ( ); connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( ))); channel = new QCopChannel( "QPE/System", this ); connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), this, SLOT( systemMessage( const QCString&, const QByteArray& ) ) ); channel = new QCopChannel( "QPE/Launcher", this ); connect( channel, SIGNAL( received( const QCString&, const QByteArray& ) ), this, SLOT( launcherMessage( const QCString&, const QByteArray& ) ) ); m_screensaver = new OpieScreenSaver ( ); m_screensaver-> setInterval ( -1 ); QWSServer::setScreenSaver( m_screensaver ); rereadVolumes(); connect( qApp, SIGNAL( volumeChanged( bool ) ), this, SLOT( rereadVolumes() ) ); apmTimeout ( ); grabKeyboard ( ); } @@ -280,90 +273,95 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray & int state; stream >> state; m_screensaver-> setDisplayState ( state != 0 ); } else if ( msg == "suspend()" ) { emit power(); } else if ( msg == "sendBusinessCard()" ) { QString card = ::getenv ( "HOME" ); card += "/Applications/addressbook/businesscard.vcf"; if ( QFile::exists( card ) ) { QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" ); QString mimetype = "text/x-vCard"; e << tr( "business card" ) << card << mimetype; } } } void DesktopApplication::reloadPowerWarnSettings() { Config cfg( "apm" ); cfg.setGroup( "Warnings" ); - // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) ); + int iv = cfg. readNumEntry ( "checkinterval", 10000 ); + + m_apm_timer-> stop ( ); + if ( iv ) + m_apm_timer-> start ( iv ); + m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 ); m_powerCritical = cfg.readNumEntry( "powervcritical", 5 ); } enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown; void DesktopApplication::launcherMessage( const QCString & msg, const QByteArray & data ) { QDataStream stream ( data, IO_ReadOnly ); if ( msg == "deviceButton(int,int,int)" ) { int keycode, press, autoRepeat; stream >> keycode >> press >> autoRepeat; const ODeviceButton *db = ODevice::inst ( )-> buttonForKeycode ( keycode ); if ( db ) checkButtonAction ( db, keycode, press, autoRepeat ); } else if ( msg == "keyRegister(int,QCString,QCString)" ) { int k; QCString c, m; stream >> k >> c >> m; keyRegisterList.append ( QCopKeyRegister ( k, c, m )); } } void DesktopApplication::sendHeldAction ( ) { if ( m_last_button ) { m_last_button-> heldAction ( ). send ( ); m_last_button = 0; } } -void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int keycode, bool press, bool autoRepeat ) +void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat ) { if ( db ) { if ( !press && !autoRepeat && m_button_timer-> isActive ( )) { m_button_timer-> stop ( ); if ( !db-> pressedAction ( ). channel ( ). isEmpty ( )) { db-> pressedAction ( ). send ( ); } } else if ( press && !autoRepeat ) { m_button_timer-> stop ( ); if ( !db-> heldAction ( ). channel ( ). isEmpty ( )) { m_last_button = db; m_button_timer-> start ( ODevice::inst ( )-> buttonHoldTime ( ), true ); } } } } bool DesktopApplication::eventFilter ( QObject *o, QEvent *e ) { if ( e-> type ( ) == QEvent::KeyPress || e-> type ( ) == QEvent::KeyRelease ) { QKeyEvent *ke = (QKeyEvent *) e; 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 @@ -74,49 +74,49 @@ protected: public slots: virtual void systemMessage ( const QCString &msg, const QByteArray &data ); virtual void launcherMessage ( const QCString &msg, const QByteArray &data ); void rereadVolumes(); protected slots: void shutdown ( ShutdownImpl::Type ); void apmTimeout ( ); void sendHeldAction ( ); protected: virtual bool eventFilter ( QObject *o, QEvent *e ); void checkButtonAction ( const Opie::ODeviceButton *db, int keycode, bool press, bool autoRepeat ); private: static DesktopApplication *me ( ); private: void reloadPowerWarnSettings(); DesktopPowerAlerter *pa; PowerStatus *m_ps, *m_ps_last; QTimer *cardSendTimer; QCopChannel *channel; OpieScreenSaver *m_screensaver; - QTimer * m_timer; + QTimer * m_apm_timer; int m_powerVeryLow; int m_powerCritical; int m_currentPowerLevel; const Opie::ODeviceButton *m_last_button; QTimer *m_button_timer; bool m_keyclick_sound : 1; bool m_screentap_sound : 1; bool m_alarm_sound : 1; }; class Desktop : public QWidget { Q_OBJECT public: Desktop(); ~Desktop(); static bool screenLocked(); void show(); void checkMemory(); 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 @@ -1,38 +1,38 @@ <!DOCTYPE UI><UI> <class>LightSettingsBase</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>LightSettingsBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>371</width> + <width>367</width> <height>532</height> </rect> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>7</hsizetype> <vsizetype>5</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>caption</name> <string>Light and Power Settings</string> </property> <property stdset="1"> <name>sizeGripEnabled</name> <bool>false</bool> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> @@ -1041,57 +1041,73 @@ <property stdset="1"> <name>maxValue</name> <number>80</number> </property> <property stdset="1"> <name>minValue</name> <number>2</number> </property> <property> <name>whatsThis</name> <string>At what battery level should the low power warning pop up</string> </property> </widget> <widget row="0" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>warnintervalBox</cstring> </property> <property stdset="1"> <name>suffix</name> <string> sec</string> </property> <property stdset="1"> + <name>specialValueText</name> + <string>never</string> + </property> + <property stdset="1"> + <name>wrapping</name> + <bool>true</bool> + </property> + <property stdset="1"> <name>buttonSymbols</name> <enum>PlusMinus</enum> </property> <property stdset="1"> <name>maxValue</name> - <number>60</number> + <number>300</number> </property> <property stdset="1"> <name>minValue</name> + <number>0</number> + </property> + <property stdset="1"> + <name>lineStep</name> + <number>5</number> + </property> + <property stdset="1"> + <name>value</name> <number>5</number> </property> <property> <name>whatsThis</name> <string>how often should be checked for low power. This determines the rate popups occure in low power situations</string> </property> </widget> <widget row="2" column="1" > <class>QSpinBox</class> <property stdset="1"> <name>name</name> <cstring>criticalSpinBox</cstring> </property> <property stdset="1"> <name>prefix</name> <string></string> </property> <property stdset="1"> <name>suffix</name> <string> %</string> </property> <property stdset="1"> <name>buttonSymbols</name> <enum>PlusMinus</enum> |