summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index ecbf12f..4d92683 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -474,97 +474,99 @@ void Clock::appMessage( const QCString& msg, const QByteArray& /*data*/ )
474 474
475 } 475 }
476 else 476 else
477 { 477 {
478 478
479 Sound::soundAlarm(); 479 Sound::soundAlarm();
480 stopTimer = startTimer( timerStay ); 480 stopTimer = startTimer( timerStay );
481 } 481 }
482 } 482 }
483 483
484 if ( msg == "timerStart()" ) 484 if ( msg == "timerStart()" )
485 { 485 {
486 slotStartTimer(); 486 slotStartTimer();
487 } 487 }
488 if ( msg == "timerStop()" ) 488 if ( msg == "timerStop()" )
489 { 489 {
490 slotStopTimer(); 490 slotStopTimer();
491 } 491 }
492 if ( msg == "timerReset()" ) 492 if ( msg == "timerReset()" )
493 { 493 {
494 slotResetTimer(); 494 slotResetTimer();
495 } 495 }
496 496
497 show(); 497 show();
498 raise(); 498 raise();
499 QPEApplication::setKeepRunning(); 499 QPEApplication::setKeepRunning();
500 setActiveWindow(); 500 setActiveWindow();
501} 501}
502 502
503void Clock::timerEvent( QTimerEvent *e ) 503void Clock::timerEvent( QTimerEvent *e )
504{ 504{
505 static int stop = 0; 505 static int stop = 0;
506 if ( stop < 120 && bSound ) 506 if ( stop < 120 && bSound )
507 { 507 {
508 Sound::soundAlarm(); 508 Sound::soundAlarm();
509 stop++; 509 stop++;
510 } 510 }
511 else 511 else
512 { 512 {
513 stop = 0; 513 stop = 0;
514 killTimer( e->timerId() ); 514 killTimer( e->timerId() );
515 clearTimer(); 515 clearTimer();
516 setCaption( tr( "Clock: Alarm was missed." ) ); 516 setCaption( tr( "Clock: Alarm was missed." ) );
517 } 517 }
518} 518}
519 519
520AnalogClock::AnalogClock(QWidget * parent, const char * name) : QFrame( parent, name ), clear(true) 520AnalogClock::AnalogClock(QWidget * parent, const char * name) : QFrame( parent, name ), clear(true)
521{ 521{
522 bg = Resource::loadPixmap("clock/bg"); 522 QWidget *d = QApplication::desktop();
523 if(d->width() <= 240)
524 bg = Resource::loadPixmap("clock/bg");
523} 525}
524 526
525QSizePolicy AnalogClock::sizePolicy() const 527QSizePolicy AnalogClock::sizePolicy() const
526{ 528{
527 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); 529 return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
528} 530}
529 531
530void AnalogClock::drawContents( QPainter *p ) 532void AnalogClock::drawContents( QPainter *p )
531{ 533{
532 QRect r = contentsRect(); 534 QRect r = contentsRect();
533 QRect fr; 535 QRect fr;
534 536
535 p->drawPixmap(QPoint(0, 0), bg, r); 537 p->drawPixmap(QPoint(0, 0), bg, r);
536 538
537 if ( r. width ( ) > r. height ( )) 539 if ( r. width ( ) > r. height ( ))
538 fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( )); 540 fr. setRect (( r. width ( ) - r. height ( )) / 2, r. y ( ), r. height ( ), r. height ( ));
539 else 541 else
540 fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( )); 542 fr. setRect ( r. x ( ), ( r. height ( ) - r. width ( )) / 2, r. width ( ), r. width ( ));
541 543
542 QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 ); 544 QPoint center = fr. center ( ); // ( fr.x() + fr.width() / 2, fr.y() + fr.height() / 2 );
543 QPoint l1 ( center. x ( ), fr. y ( ) + 2 ); 545 QPoint l1 ( center. x ( ), fr. y ( ) + 2 );
544 QPoint l2 ( center. x ( ), fr. y ( ) + 8 ); 546 QPoint l2 ( center. x ( ), fr. y ( ) + 8 );
545 547
546 548
547 549
548 if ( clear ) 550 if ( clear )
549 { 551 {
550 erase ( r ); 552 erase ( r );
551 p-> setPen ( NoPen ); 553 p-> setPen ( NoPen );
552 p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base )); 554 p-> setBrush ( colorGroup ( ). color ( QColorGroup::Base ));
553 p-> drawEllipse ( fr ); 555 p-> drawEllipse ( fr );
554 p-> setBrush ( NoBrush ); 556 p-> setBrush ( NoBrush );
555 557
556 // draw ticks 558 // draw ticks
557 p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) ); 559 p->setPen( QPen( colorGroup ( ). color ( QColorGroup::Text ), 1 ) );
558 for ( int i = 0; i < 12; i++ ) 560 for ( int i = 0; i < 12; i++ )
559 p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); 561 p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) );
560 } 562 }
561 else 563 else
562 { 564 {
563 drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Base ), prevTime, &currTime ); 565 drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Base ), prevTime, &currTime );
564 } 566 }
565 567
566 drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Text ), currTime ); 568 drawPointers ( p, fr, colorGroup ( ). color ( QColorGroup::Text ), currTime );
567 569
568 prevTime = currTime; 570 prevTime = currTime;
569} 571}
570 572