author | llornkcor <llornkcor> | 2003-02-17 01:22:21 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-17 01:22:21 (UTC) |
commit | a5e3911518d00ae327d3fe29871c03354344f086 (patch) (side-by-side diff) | |
tree | 15b4a17d942283a98bd7f482c380ef54220d2fa8 /noncore/tools/clock/clock.cpp | |
parent | 0c50793d0ef839e90b9b2dea5001c3170971fc06 (diff) | |
download | opie-a5e3911518d00ae327d3fe29871c03354344f086.zip opie-a5e3911518d00ae327d3fe29871c03354344f086.tar.gz opie-a5e3911518d00ae327d3fe29871c03354344f086.tar.bz2 |
attempt to fix bug 586 - new thread and sleep 15 sec for cards to mount for mp3 alarm
-rw-r--r-- | noncore/tools/clock/clock.cpp | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 2f81c3a..0937362 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -49,2 +49,7 @@ #include <math.h> +#include <unistd.h> +#include <sys/types.h> + +#include <pthread.h> + @@ -53,2 +58,12 @@ const int sw_prec = 2; +void startPlayer() +{ + Config config( "qpe" ); + config.setGroup( "Time" ); + sleep(15); + QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); + e << config.readEntry( "mp3File", "" ); +} + + static void toggleScreenSaver( bool on ) @@ -399,2 +414,10 @@ void Clock::alarmOff() +void Clock::clearTimer() +{ + alarmOffBtn->setText( tr( "Alarm Is Off" ) ); + alarmBool = FALSE; + snoozeBtn->hide(); + setCaption( "Clock" ); +} + void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) @@ -408,8 +431,26 @@ void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) config.setGroup( "Time" ); - if ( config.readBoolEntry( "mp3Alarm", 0 ) ) { + if ( config.readBoolEntry( "mp3Alarm", 0 ) ) + { + clearTimer(); +// pid_t pid; +// switch(pid = fork()) +// { +// case -1: +// {//failed +// } +// break; +// case 0: +// {//child +// QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); +// e << config.readEntry( "mp3File", "" ); + pthread_t thread; + pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/); +// startPlayer(); +// } +// break; +// }; - QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); - e << config.readEntry( "mp3File", "" ); } - else { + else + { @@ -435,5 +476,3 @@ void Clock::timerEvent( QTimerEvent *e ) killTimer( e->timerId() ); - alarmOffBtn->setText( tr( "Alarm Is Off" ) ); - alarmBool = FALSE; - snoozeBtn->hide(); + clearTimer(); setCaption( tr( "Clock: Alarm was missed." ) ); |