-rw-r--r-- | noncore/tools/clock/clock.cpp | 11 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 1 |
2 files changed, 9 insertions, 3 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 0a21146..9b9e644 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -14,12 +14,13 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002 | ||
20 | 21 | ||
21 | #include "clock.h" | 22 | #include "clock.h" |
22 | #include "setAlarm.h" | 23 | #include "setAlarm.h" |
23 | 24 | ||
24 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
@@ -63,12 +64,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f ) | |||
63 | setMargin( 1 ); | 64 | setMargin( 1 ); |
64 | 65 | ||
65 | Config config( "qpe" ); | 66 | Config config( "qpe" ); |
66 | config.setGroup("Time"); | 67 | config.setGroup("Time"); |
67 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 68 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
68 | 69 | ||
70 | |||
69 | snoozeBtn = new QPushButton ( this); | 71 | snoozeBtn = new QPushButton ( this); |
70 | snoozeBtn->setText( tr( "Snooze" ) ); | 72 | snoozeBtn->setText( tr( "Snooze" ) ); |
71 | 73 | ||
72 | aclock = new AnalogClock( this ); | 74 | aclock = new AnalogClock( this ); |
73 | aclock->display( QTime::currentTime() ); | 75 | aclock->display( QTime::currentTime() ); |
74 | aclock->setLineWidth( 2 ); | 76 | aclock->setLineWidth( 2 ); |
@@ -377,16 +379,21 @@ void Clock::alarmOff() | |||
377 | 379 | ||
378 | void Clock::appMessage(const QCString& msg, const QByteArray& data) | 380 | void Clock::appMessage(const QCString& msg, const QByteArray& data) |
379 | { | 381 | { |
380 | int stopTimer = 0; | 382 | int stopTimer = 0; |
381 | int timerStay = 5000; | 383 | int timerStay = 5000; |
382 | bSound=TRUE; | 384 | bSound=TRUE; |
385 | qDebug("Message received in clock"); | ||
383 | if ( msg == "alarm(QDateTime,int)" ) { | 386 | if ( msg == "alarm(QDateTime,int)" ) { |
384 | Sound::soundAlarm(); | 387 | Sound::soundAlarm(); |
385 | stopTimer = startTimer( timerStay); | 388 | stopTimer = startTimer( timerStay); |
386 | } | 389 | } |
390 | show(); | ||
391 | raise(); | ||
392 | QPEApplication::setKeepRunning(); | ||
393 | setActiveWindow(); | ||
387 | } | 394 | } |
388 | 395 | ||
389 | void Clock::timerEvent( QTimerEvent *e ) | 396 | void Clock::timerEvent( QTimerEvent *e ) |
390 | { | 397 | { |
391 | static int stop = 0; | 398 | static int stop = 0; |
392 | if ( stop < 120 && bSound) { | 399 | if ( stop < 120 && bSound) { |
@@ -482,11 +489,11 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) | |||
482 | double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - | 489 | double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - |
483 | ( p.y() - c.y() ) * sin( angle ); | 490 | ( p.y() - c.y() ) * sin( angle ); |
484 | double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + | 491 | double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + |
485 | ( p.x() - c.x() ) * sin( angle ); | 492 | ( p.x() - c.x() ) * sin( angle ); |
486 | return QPoint( nx, ny ); | 493 | return QPoint( nx, ny ); |
487 | } | 494 | } |
488 | void Clock::slotAdjustTime() | 495 | |
489 | { | 496 | void Clock::slotAdjustTime() { |
490 | QCopEnvelope e("QPE/System", "execute(QString)"); | 497 | QCopEnvelope e("QPE/System", "execute(QString)"); |
491 | e << QString("systemtime"); | 498 | e << QString("systemtime"); |
492 | } | 499 | } |
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index 024dd28..be71b9d 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h | |||
@@ -74,13 +74,12 @@ private slots: | |||
74 | void slotToggleAlarm(); | 74 | void slotToggleAlarm(); |
75 | void alarmOn(); | 75 | void alarmOn(); |
76 | void alarmOff(); | 76 | void alarmOff(); |
77 | void appMessage(const QCString& msg, const QByteArray& data); | 77 | void appMessage(const QCString& msg, const QByteArray& data); |
78 | void timerEvent( QTimerEvent *e ); | 78 | void timerEvent( QTimerEvent *e ); |
79 | void slotAdjustTime(); | 79 | void slotAdjustTime(); |
80 | |||
81 | private: | 80 | private: |
82 | void clearClock(); | 81 | void clearClock(); |
83 | 82 | ||
84 | bool alarmBool; | 83 | bool alarmBool; |
85 | QTimer *t; | 84 | QTimer *t; |
86 | QLCDNumber *lcd; | 85 | QLCDNumber *lcd; |