author | llornkcor <llornkcor> | 2003-02-17 01:22:21 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-02-17 01:22:21 (UTC) |
commit | a5e3911518d00ae327d3fe29871c03354344f086 (patch) (unidiff) | |
tree | 15b4a17d942283a98bd7f482c380ef54220d2fa8 /noncore/tools/clock | |
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 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 2 | ||||
-rw-r--r-- | noncore/tools/clock/clock.pro | 2 |
3 files changed, 48 insertions, 9 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 @@ | |||
49 | #include <math.h> | 49 | #include <math.h> |
50 | #include <unistd.h> | ||
51 | #include <sys/types.h> | ||
52 | |||
53 | #include <pthread.h> | ||
54 | |||
50 | 55 | ||
@@ -53,2 +58,12 @@ const int sw_prec = 2; | |||
53 | 58 | ||
59 | void startPlayer() | ||
60 | { | ||
61 | Config config( "qpe" ); | ||
62 | config.setGroup( "Time" ); | ||
63 | sleep(15); | ||
64 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | ||
65 | e << config.readEntry( "mp3File", "" ); | ||
66 | } | ||
67 | |||
68 | |||
54 | static void toggleScreenSaver( bool on ) | 69 | static void toggleScreenSaver( bool on ) |
@@ -399,2 +414,10 @@ void Clock::alarmOff() | |||
399 | 414 | ||
415 | void Clock::clearTimer() | ||
416 | { | ||
417 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | ||
418 | alarmBool = FALSE; | ||
419 | snoozeBtn->hide(); | ||
420 | setCaption( "Clock" ); | ||
421 | } | ||
422 | |||
400 | void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) | 423 | void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) |
@@ -408,8 +431,26 @@ void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) | |||
408 | config.setGroup( "Time" ); | 431 | config.setGroup( "Time" ); |
409 | if ( config.readBoolEntry( "mp3Alarm", 0 ) ) { | 432 | if ( config.readBoolEntry( "mp3Alarm", 0 ) ) |
433 | { | ||
434 | clearTimer(); | ||
435 | // pid_t pid; | ||
436 | // switch(pid = fork()) | ||
437 | // { | ||
438 | // case -1: | ||
439 | // {//failed | ||
440 | // } | ||
441 | // break; | ||
442 | // case 0: | ||
443 | // {//child | ||
444 | // QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | ||
445 | // e << config.readEntry( "mp3File", "" ); | ||
446 | pthread_t thread; | ||
447 | pthread_create(&thread, NULL, (void * (*) (void *))startPlayer, NULL/* &*/); | ||
448 | // startPlayer(); | ||
449 | // } | ||
450 | // break; | ||
451 | // }; | ||
410 | 452 | ||
411 | QCopEnvelope e( "QPE/Application/opieplayer", "setDocument(QString)" ); | ||
412 | e << config.readEntry( "mp3File", "" ); | ||
413 | } | 453 | } |
414 | else { | 454 | else |
455 | { | ||
415 | 456 | ||
@@ -435,5 +476,3 @@ void Clock::timerEvent( QTimerEvent *e ) | |||
435 | killTimer( e->timerId() ); | 476 | killTimer( e->timerId() ); |
436 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 477 | clearTimer(); |
437 | alarmBool = FALSE; | ||
438 | snoozeBtn->hide(); | ||
439 | setCaption( tr( "Clock: Alarm was missed." ) ); | 478 | setCaption( tr( "Clock: Alarm was missed." ) ); |
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index 092d84f..23cc143 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h | |||
@@ -82,3 +82,3 @@ private: | |||
82 | void clearClock(); | 82 | void clearClock(); |
83 | 83 | void clearTimer(); | |
84 | bool alarmBool; | 84 | bool alarmBool; |
diff --git a/noncore/tools/clock/clock.pro b/noncore/tools/clock/clock.pro index 29dd52b..8b92118 100644 --- a/noncore/tools/clock/clock.pro +++ b/noncore/tools/clock/clock.pro | |||
@@ -8,3 +8,3 @@ INCLUDEPATH += $(OPIEDIR)/include | |||
8 | DEPENDPATH += $(OPIEDIR)/include | 8 | DEPENDPATH += $(OPIEDIR)/include |
9 | LIBS += -lqpe -lopie | 9 | LIBS += -lqpe -lopie -lpthread |
10 | INTERFACES = | 10 | INTERFACES = |