Diffstat (limited to 'noncore/tools/clock/clock.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/tools/clock/clock.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 74b7147..41c99a8 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp | |||
@@ -495,59 +495,65 @@ void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ ) | |||
495 | 495 | ||
496 | show(); | 496 | show(); |
497 | raise(); | 497 | raise(); |
498 | QPEApplication::setKeepRunning(); | 498 | QPEApplication::setKeepRunning(); |
499 | setActiveWindow(); | 499 | setActiveWindow(); |
500 | } | 500 | } |
501 | 501 | ||
502 | void Clock::timerEvent( QTimerEvent *e ) | 502 | void Clock::timerEvent( QTimerEvent *e ) |
503 | { | 503 | { |
504 | static int stop = 0; | 504 | static int stop = 0; |
505 | if ( stop < 120 && bSound ) | 505 | if ( stop < 120 && bSound ) |
506 | { | 506 | { |
507 | Sound::soundAlarm(); | 507 | Sound::soundAlarm(); |
508 | stop++; | 508 | stop++; |
509 | } | 509 | } |
510 | else | 510 | else |
511 | { | 511 | { |
512 | stop = 0; | 512 | stop = 0; |
513 | killTimer( e->timerId() ); | 513 | killTimer( e->timerId() ); |
514 | clearTimer(); | 514 | clearTimer(); |
515 | setCaption( tr( "Clock: Alarm was missed." ) ); | 515 | setCaption( tr( "Clock: Alarm was missed." ) ); |
516 | } | 516 | } |
517 | } | 517 | } |
518 | 518 | ||
519 | AnalogClock::AnalogClock(QWidget * parent, const char * name) : QFrame( parent, name ), clear(true) | ||
520 | { | ||
521 | bg = Resource::loadPixmap("clock/bg"); | ||
522 | } | ||
519 | 523 | ||
520 | QSizePolicy AnalogClock::sizePolicy() const | 524 | QSizePolicy AnalogClock::sizePolicy() const |
521 | { | 525 | { |
522 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | 526 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); |
523 | } | 527 | } |
524 | 528 | ||
525 | void AnalogClock::drawContents( QPainter *p ) | 529 | void AnalogClock::drawContents( QPainter *p ) |
526 | { | 530 | { |
527 | QRect r = contentsRect(); | 531 | QRect r = contentsRect(); |
528 | QRect fr; | 532 | QRect fr; |
529 | 533 | ||
534 | p->drawPixmap(QPoint(0, 0), bg, r); | ||
535 | |||
530 | if ( r. width ( ) > r. height ( )) | 536 | if ( r. width ( ) > r. height ( )) |
531 | fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( )); | 537 | fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( )); |
532 | else | 538 | else |
533 | fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( )); | 539 | fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( )); |
534 | 540 | ||
535 | QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 ); | 541 | QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 ); |
536 | QPoint l1 ( center. x ( ), fr. y ( ) + 2 ); | 542 | QPoint l1 ( center. x ( ), fr. y ( ) + 2 ); |
537 | QPoint l2 ( center. x ( ), fr. y ( ) + 8 ); | 543 | QPoint l2 ( center. x ( ), fr. y ( ) + 8 ); |
538 | 544 | ||
539 | 545 | ||
540 | 546 | ||
541 | if ( clear ) | 547 | if ( clear ) |
542 | { | 548 | { |
543 | erase ( r ); | 549 | erase ( r ); |
544 | p-> setPen ( NoPen ); | 550 | p-> setPen ( NoPen ); |
545 | p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base )); | 551 | p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base )); |
546 | p-> drawEllipse ( fr ); | 552 | p-> drawEllipse ( fr ); |
547 | p-> setBrush ( NoBrush ); | 553 | p-> setBrush ( NoBrush ); |
548 | 554 | ||
549 | // draw ticks | 555 | // draw ticks |
550 | p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) ); | 556 | p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) ); |
551 | for ( int i = 0; i < 12; i++ ) | 557 | for ( int i = 0; i < 12; i++ ) |
552 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); | 558 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); |
553 | } | 559 | } |