author | alwin <alwin> | 2004-02-26 22:26:20 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-02-26 22:26:20 (UTC) |
commit | cb7a0156d641e96dfb6fe1cea6ca3a26e54ce6b2 (patch) (unidiff) | |
tree | 90b117bd6df3cc7ead72d191e618655725f84dc2 | |
parent | 303b5a8e72fe319e6123b01f104b7cb049599f6f (diff) | |
download | opie-cb7a0156d641e96dfb6fe1cea6ca3a26e54ce6b2.zip opie-cb7a0156d641e96dfb6fe1cea6ca3a26e54ce6b2.tar.gz opie-cb7a0156d641e96dfb6fe1cea6ca3a26e54ce6b2.tar.bz2 |
flag ms_is_starting
it will be set true until the main eventloop is reached.
Check it with ServerApp::isStarting()
-rw-r--r-- | core/launcher/serverapp.cpp | 14 | ||||
-rw-r--r-- | core/launcher/serverapp.h | 4 |
2 files changed, 17 insertions, 1 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index 11381e6..f7c2341 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp | |||
@@ -249,55 +249,56 @@ bool KeyFilter::checkButtonAction(bool db, int keycode, int press, int autoRepe | |||
249 | 249 | ||
250 | return FALSE; | 250 | return FALSE; |
251 | } | 251 | } |
252 | 252 | ||
253 | enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown; | 253 | enum MemState { MemUnknown, MemVeryLow, MemLow, MemNormal } memstate=MemUnknown; |
254 | 254 | ||
255 | #if defined(QPE_HAVE_MEMALERTER) | 255 | #if defined(QPE_HAVE_MEMALERTER) |
256 | QPE_MEMALERTER_IMPL | 256 | QPE_MEMALERTER_IMPL |
257 | #endif | 257 | #endif |
258 | 258 | ||
259 | 259 | ||
260 | 260 | ||
261 | //--------------------------------------------------------------------------- | 261 | //--------------------------------------------------------------------------- |
262 | 262 | ||
263 | bool ServerApplication::doRestart = FALSE; | 263 | bool ServerApplication::doRestart = FALSE; |
264 | bool ServerApplication::allowRestart = TRUE; | 264 | bool ServerApplication::allowRestart = TRUE; |
265 | bool ServerApplication::ms_is_starting = TRUE; | ||
265 | 266 | ||
266 | void ServerApplication::switchLCD( bool on ) { | 267 | void ServerApplication::switchLCD( bool on ) { |
267 | if ( !qApp ) | 268 | if ( !qApp ) |
268 | return; | 269 | return; |
269 | 270 | ||
270 | ServerApplication *dapp = ServerApplication::me() ; | 271 | ServerApplication *dapp = ServerApplication::me() ; |
271 | 272 | ||
272 | if ( !dapp-> m_screensaver ) | 273 | if ( !dapp-> m_screensaver ) |
273 | return; | 274 | return; |
274 | 275 | ||
275 | if ( on ) { | 276 | if ( on ) { |
276 | dapp-> m_screensaver-> setDisplayState ( true ); | 277 | dapp-> m_screensaver-> setDisplayState ( true ); |
277 | dapp-> m_screensaver-> setBacklight ( -3 ); | 278 | dapp-> m_screensaver-> setBacklight ( -3 ); |
278 | }else | 279 | }else |
279 | dapp-> m_screensaver-> setDisplayState ( false ); | 280 | dapp-> m_screensaver-> setDisplayState ( false ); |
280 | 281 | ||
281 | 282 | ||
282 | } | 283 | } |
283 | 284 | ||
284 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) | 285 | ServerApplication::ServerApplication( int& argc, char **argv, Type t ) |
285 | : QPEApplication( argc, argv, t ) | 286 | : QPEApplication( argc, argv, t ) |
286 | { | 287 | { |
287 | 288 | ms_is_starting = true; | |
288 | 289 | ||
289 | // We know we'll have lots of cached pixmaps due to App/DocLnks | 290 | // We know we'll have lots of cached pixmaps due to App/DocLnks |
290 | QPixmapCache::setCacheLimit(512); | 291 | QPixmapCache::setCacheLimit(512); |
291 | 292 | ||
292 | m_ps = new PowerStatus; | 293 | m_ps = new PowerStatus; |
293 | m_ps_last = new PowerStatus; | 294 | m_ps_last = new PowerStatus; |
294 | pa = new DesktopPowerAlerter( 0 ); | 295 | pa = new DesktopPowerAlerter( 0 ); |
295 | 296 | ||
296 | m_apm_timer = new QTimer( this ); | 297 | m_apm_timer = new QTimer( this ); |
297 | connect(m_apm_timer, SIGNAL( timeout() ), | 298 | connect(m_apm_timer, SIGNAL( timeout() ), |
298 | this, SLOT( apmTimeout() ) ); | 299 | this, SLOT( apmTimeout() ) ); |
299 | 300 | ||
300 | reloadPowerWarnSettings(); | 301 | reloadPowerWarnSettings(); |
301 | 302 | ||
302 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); | 303 | QCopChannel *channel = new QCopChannel( "QPE/System", this ); |
303 | connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), | 304 | connect(channel, SIGNAL(received( const QCString&, const QByteArray& ) ), |
@@ -833,18 +834,29 @@ void ServerApplication::keyClick(int , bool press, bool ) | |||
833 | void ServerApplication::screenClick(bool press) | 834 | void ServerApplication::screenClick(bool press) |
834 | { | 835 | { |
835 | if ( press && m_screentap_sound ) | 836 | if ( press && m_screentap_sound ) |
836 | ODevice::inst() -> playTouchSound(); | 837 | ODevice::inst() -> playTouchSound(); |
837 | } | 838 | } |
838 | 839 | ||
839 | void ServerApplication::soundAlarm() { | 840 | void ServerApplication::soundAlarm() { |
840 | if ( me ()->m_alarm_sound ) | 841 | if ( me ()->m_alarm_sound ) |
841 | ODevice::inst()->playAlarmSound(); | 842 | ODevice::inst()->playAlarmSound(); |
842 | } | 843 | } |
843 | 844 | ||
844 | ServerApplication *ServerApplication::me ( ) | 845 | ServerApplication *ServerApplication::me ( ) |
845 | { | 846 | { |
846 | return static_cast<ServerApplication*>( qApp ); | 847 | return static_cast<ServerApplication*>( qApp ); |
847 | } | 848 | } |
848 | 849 | ||
850 | bool ServerApplication::isStarting() | ||
851 | { | ||
852 | return ms_is_starting; | ||
853 | } | ||
854 | |||
855 | int ServerApplication::exec() | ||
856 | { | ||
857 | ms_is_starting = true; | ||
858 | qDebug("Serverapp - exec"); | ||
859 | return QPEApplication::exec(); | ||
860 | } | ||
849 | 861 | ||
850 | #include "serverapp.moc" | 862 | #include "serverapp.moc" |
diff --git a/core/launcher/serverapp.h b/core/launcher/serverapp.h index fe3f24a..4d9f808 100644 --- a/core/launcher/serverapp.h +++ b/core/launcher/serverapp.h | |||
@@ -81,37 +81,40 @@ private: | |||
81 | int held_tid; | 81 | int held_tid; |
82 | const Opie::ODeviceButton* heldButton; | 82 | const Opie::ODeviceButton* heldButton; |
83 | KeyRegisterList m_keys; | 83 | KeyRegisterList m_keys; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | class ServerApplication : public QPEApplication | 86 | class ServerApplication : public QPEApplication |
87 | { | 87 | { |
88 | Q_OBJECT | 88 | Q_OBJECT |
89 | public: | 89 | public: |
90 | ServerApplication( int& argc, char **argv, Type t ); | 90 | ServerApplication( int& argc, char **argv, Type t ); |
91 | ~ServerApplication(); | 91 | ~ServerApplication(); |
92 | 92 | ||
93 | static bool doRestart; | 93 | static bool doRestart; |
94 | static bool allowRestart; | 94 | static bool allowRestart; |
95 | static bool screenLocked(); | 95 | static bool screenLocked(); |
96 | static void login(bool at_poweron); | 96 | static void login(bool at_poweron); |
97 | |||
98 | static bool isStarting(); | ||
97 | 99 | ||
98 | static void switchLCD ( bool on ); // only for togglePower in Desktop | 100 | static void switchLCD ( bool on ); // only for togglePower in Desktop |
99 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar | 101 | static void soundAlarm(); // only because QCop soundAlarm() is defined in QPE/TaskBar |
100 | 102 | ||
101 | void restart(); | 103 | void restart(); |
104 | int exec(); | ||
102 | 105 | ||
103 | signals: | 106 | signals: |
104 | void menu(); | 107 | void menu(); |
105 | void home(); | 108 | void home(); |
106 | void launch(); | 109 | void launch(); |
107 | void power(); | 110 | void power(); |
108 | void backlight(); | 111 | void backlight(); |
109 | void symbol(); | 112 | void symbol(); |
110 | void numLockStateToggle(); | 113 | void numLockStateToggle(); |
111 | void capsLockStateToggle(); | 114 | void capsLockStateToggle(); |
112 | void prepareForRestart(); | 115 | void prepareForRestart(); |
113 | void activate(const Opie::ODeviceButton*,bool); | 116 | void activate(const Opie::ODeviceButton*,bool); |
114 | 117 | ||
115 | public slots: | 118 | public slots: |
116 | virtual void systemMessage( const QCString& msg, const QByteArray& ); | 119 | virtual void systemMessage( const QCString& msg, const QByteArray& ); |
117 | virtual void launcherMessage( const QCString& msg, const QByteArray& ); | 120 | virtual void launcherMessage( const QCString& msg, const QByteArray& ); |
@@ -142,24 +145,25 @@ private: | |||
142 | KeyFilter *kf; | 145 | KeyFilter *kf; |
143 | 146 | ||
144 | 147 | ||
145 | private: | 148 | private: |
146 | DesktopPowerAlerter *pa; | 149 | DesktopPowerAlerter *pa; |
147 | PowerStatus *m_ps, *m_ps_last; | 150 | PowerStatus *m_ps, *m_ps_last; |
148 | OpieScreenSaver *m_screensaver; | 151 | OpieScreenSaver *m_screensaver; |
149 | QTimer *m_apm_timer; | 152 | QTimer *m_apm_timer; |
150 | QDateTime m_suspendTime; | 153 | QDateTime m_suspendTime; |
151 | int m_powerVeryLow; | 154 | int m_powerVeryLow; |
152 | int m_powerCritical; | 155 | int m_powerCritical; |
153 | int m_currentPowerLevel; | 156 | int m_currentPowerLevel; |
154 | 157 | ||
155 | bool m_keyclick_sound : 1; | 158 | bool m_keyclick_sound : 1; |
156 | bool m_screentap_sound : 1; | 159 | bool m_screentap_sound : 1; |
157 | bool m_alarm_sound : 1; | 160 | bool m_alarm_sound : 1; |
161 | static bool ms_is_starting; | ||
158 | 162 | ||
159 | 163 | ||
160 | friend class KeyFilter; | 164 | friend class KeyFilter; |
161 | }; | 165 | }; |
162 | 166 | ||
163 | 167 | ||
164 | #endif // SERVERAPP_H | 168 | #endif // SERVERAPP_H |
165 | 169 | ||