-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 | |||
@@ -1,116 +1,118 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 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> |
26 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
27 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
28 | #include <qpe/alarmserver.h> | 29 | #include <qpe/alarmserver.h> |
29 | #include <qpe/sound.h> | 30 | #include <qpe/sound.h> |
30 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
31 | #include <qsound.h> | 32 | #include <qsound.h> |
32 | #include <qtimer.h> | 33 | #include <qtimer.h> |
33 | 34 | ||
34 | #include <opie/oclickablelabel.h> | 35 | #include <opie/oclickablelabel.h> |
35 | 36 | ||
36 | #include <qlcdnumber.h> | 37 | #include <qlcdnumber.h> |
37 | #include <qslider.h> | 38 | #include <qslider.h> |
38 | #include <qlabel.h> | 39 | #include <qlabel.h> |
39 | #include <qlayout.h> | 40 | #include <qlayout.h> |
40 | #include <qtimer.h> | 41 | #include <qtimer.h> |
41 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
42 | #include <qradiobutton.h> | 43 | #include <qradiobutton.h> |
43 | #include <qbuttongroup.h> | 44 | #include <qbuttongroup.h> |
44 | #include <qpainter.h> | 45 | #include <qpainter.h> |
45 | #include <qmessagebox.h> | 46 | #include <qmessagebox.h> |
46 | #include <qdatetime.h> | 47 | #include <qdatetime.h> |
47 | 48 | ||
48 | #include <math.h> | 49 | #include <math.h> |
49 | 50 | ||
50 | const double deg2rad = 0.017453292519943295769; // pi/180 | 51 | const double deg2rad = 0.017453292519943295769; // pi/180 |
51 | const int sw_prec = 2; | 52 | const int sw_prec = 2; |
52 | 53 | ||
53 | static void toggleScreenSaver( bool on ) | 54 | static void toggleScreenSaver( bool on ) |
54 | { | 55 | { |
55 | QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" ); | 56 | QCopEnvelope e("QPE/System", "setScreenSaverMode(int)" ); |
56 | e << (on ? QPEApplication::Enable: QPEApplication::DisableSuspend ); | 57 | e << (on ? QPEApplication::Enable: QPEApplication::DisableSuspend ); |
57 | } | 58 | } |
58 | 59 | ||
59 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) | 60 | Clock::Clock( QWidget * parent, const char * name, WFlags f ) |
60 | : QVBox( parent, name , f ) | 61 | : QVBox( parent, name , f ) |
61 | { | 62 | { |
62 | setSpacing( 4 ); | 63 | setSpacing( 4 ); |
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 ); |
75 | 77 | ||
76 | QHBox *hb = new QHBox( this ); | 78 | QHBox *hb = new QHBox( this ); |
77 | hb->setMargin( 0 ); | 79 | hb->setMargin( 0 ); |
78 | QWidget *space = new QWidget( hb ); | 80 | QWidget *space = new QWidget( hb ); |
79 | lcd = new QLCDNumber( hb ); | 81 | lcd = new QLCDNumber( hb ); |
80 | lcd->setSegmentStyle( QLCDNumber::Flat ); | 82 | lcd->setSegmentStyle( QLCDNumber::Flat ); |
81 | lcd->setFrameStyle( QFrame::NoFrame ); | 83 | lcd->setFrameStyle( QFrame::NoFrame ); |
82 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); | 84 | lcd->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ) ); |
83 | lcd->setFixedHeight( 23 ); | 85 | lcd->setFixedHeight( 23 ); |
84 | 86 | ||
85 | ampmLabel = new QLabel( tr("PM"), hb ); | 87 | ampmLabel = new QLabel( tr("PM"), hb ); |
86 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 88 | ampmLabel->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
87 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); | 89 | ampmLabel->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Preferred ) ); |
88 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); | 90 | ampmLabel->setAlignment( AlignLeft | AlignBottom ); |
89 | space = new QWidget( hb ); | 91 | space = new QWidget( hb ); |
90 | 92 | ||
91 | date = new QLabel( this ); | 93 | date = new QLabel( this ); |
92 | date->setAlignment( AlignHCenter | AlignVCenter ); | 94 | date->setAlignment( AlignHCenter | AlignVCenter ); |
93 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); | 95 | date->setFont( QFont( "Helvetica", 14, QFont::Bold ) ); |
94 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); | 96 | date->setText( TimeString::longDateString( QDate::currentDate() ) ); |
95 | 97 | ||
96 | QWidget *controls = new QWidget( this ); | 98 | QWidget *controls = new QWidget( this ); |
97 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); | 99 | QGridLayout *gl = new QGridLayout( controls, 3, 2, 6, 4 ); |
98 | 100 | ||
99 | QButtonGroup *grp = new QButtonGroup( controls ); | 101 | QButtonGroup *grp = new QButtonGroup( controls ); |
100 | grp->setRadioButtonExclusive( true ); | 102 | grp->setRadioButtonExclusive( true ); |
101 | grp->hide(); | 103 | grp->hide(); |
102 | 104 | ||
103 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); | 105 | clockRB = new QRadioButton ( tr( "Clock" ), controls ); |
104 | gl->addWidget( clockRB, 0, 0 ); | 106 | gl->addWidget( clockRB, 0, 0 ); |
105 | grp->insert( clockRB ); | 107 | grp->insert( clockRB ); |
106 | 108 | ||
107 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); | 109 | swatchRB = new QRadioButton ( tr( "Stopwatch" ), controls ); |
108 | gl->addWidget( swatchRB, 1, 0 ); | 110 | gl->addWidget( swatchRB, 1, 0 ); |
109 | grp->insert( swatchRB ); | 111 | grp->insert( swatchRB ); |
110 | 112 | ||
111 | connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) ); | 113 | connect( grp, SIGNAL(clicked(int)), this, SLOT(modeSelect(int)) ); |
112 | grp->setButton( 0 ); | 114 | grp->setButton( 0 ); |
113 | 115 | ||
114 | set = new QPushButton ( controls ); | 116 | set = new QPushButton ( controls ); |
115 | set->setMaximumSize(50,30); | 117 | set->setMaximumSize(50,30); |
116 | gl->addWidget( set, 0, 1 ); | 118 | gl->addWidget( set, 0, 1 ); |
@@ -335,100 +337,105 @@ void Clock::slotToggleAlarm() | |||
335 | config.writeEntry("clockAlarmSet","FALSE"); | 337 | config.writeEntry("clockAlarmSet","FALSE"); |
336 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 338 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
337 | snoozeBtn->hide(); | 339 | snoozeBtn->hide(); |
338 | alarmBool=FALSE; | 340 | alarmBool=FALSE; |
339 | alarmOff(); | 341 | alarmOff(); |
340 | } else { | 342 | } else { |
341 | config.writeEntry("clockAlarmSet","TRUE"); | 343 | config.writeEntry("clockAlarmSet","TRUE"); |
342 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); | 344 | alarmOffBtn->setText( tr( "Alarm Is On" ) ); |
343 | snoozeBtn->show(); | 345 | snoozeBtn->show(); |
344 | alarmBool=TRUE; | 346 | alarmBool=TRUE; |
345 | alarmOn(); | 347 | alarmOn(); |
346 | } | 348 | } |
347 | config.write(); | 349 | config.write(); |
348 | } | 350 | } |
349 | 351 | ||
350 | void Clock::alarmOn() | 352 | void Clock::alarmOn() |
351 | { | 353 | { |
352 | QDate d = QDate::currentDate(); | 354 | QDate d = QDate::currentDate(); |
353 | QTime tm((int)hour,(int)minute,0); | 355 | QTime tm((int)hour,(int)minute,0); |
354 | qDebug("Time set "+tm.toString()); | 356 | qDebug("Time set "+tm.toString()); |
355 | QTime t = QTime::currentTime(); | 357 | QTime t = QTime::currentTime(); |
356 | if( t > tm) | 358 | if( t > tm) |
357 | d = d.addDays(1); | 359 | d = d.addDays(1); |
358 | int warn = 0; | 360 | int warn = 0; |
359 | QDateTime whenl(d,tm); | 361 | QDateTime whenl(d,tm); |
360 | when=whenl; | 362 | when=whenl; |
361 | AlarmServer::addAlarm( when, | 363 | AlarmServer::addAlarm( when, |
362 | "QPE/Application/clock", | 364 | "QPE/Application/clock", |
363 | "alarm(QDateTime,int)", warn ); | 365 | "alarm(QDateTime,int)", warn ); |
364 | setCaption("Alarm set: "+ whenl.toString()); | 366 | setCaption("Alarm set: "+ whenl.toString()); |
365 | } | 367 | } |
366 | 368 | ||
367 | void Clock::alarmOff() | 369 | void Clock::alarmOff() |
368 | { | 370 | { |
369 | int warn = 0; | 371 | int warn = 0; |
370 | bSound=FALSE; | 372 | bSound=FALSE; |
371 | AlarmServer::deleteAlarm( when, | 373 | AlarmServer::deleteAlarm( when, |
372 | "QPE/Application/clock", | 374 | "QPE/Application/clock", |
373 | "alarm(QDateTime,int)", warn ); | 375 | "alarm(QDateTime,int)", warn ); |
374 | qDebug("Alarm Off "+ when.toString()); | 376 | qDebug("Alarm Off "+ when.toString()); |
375 | setCaption("Clock"); | 377 | setCaption("Clock"); |
376 | } | 378 | } |
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) { |
393 | Sound::soundAlarm(); | 400 | Sound::soundAlarm(); |
394 | stop++; | 401 | stop++; |
395 | } else { | 402 | } else { |
396 | stop = 0; | 403 | stop = 0; |
397 | killTimer( e->timerId() ); | 404 | killTimer( e->timerId() ); |
398 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); | 405 | alarmOffBtn->setText( tr( "Alarm Is Off" ) ); |
399 | alarmBool=FALSE; | 406 | alarmBool=FALSE; |
400 | snoozeBtn->hide(); | 407 | snoozeBtn->hide(); |
401 | setCaption("Clock: Alarm was missed."); | 408 | setCaption("Clock: Alarm was missed."); |
402 | } | 409 | } |
403 | } | 410 | } |
404 | 411 | ||
405 | 412 | ||
406 | QSizePolicy AnalogClock::sizePolicy() const | 413 | QSizePolicy AnalogClock::sizePolicy() const |
407 | { | 414 | { |
408 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); | 415 | return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); |
409 | } | 416 | } |
410 | 417 | ||
411 | void AnalogClock::drawContents( QPainter *p ) | 418 | void AnalogClock::drawContents( QPainter *p ) |
412 | { | 419 | { |
413 | QRect r = contentsRect(); | 420 | QRect r = contentsRect(); |
414 | QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | 421 | QPoint center( r.x() + r.width() / 2, r.y() + r.height() / 2 ); |
415 | 422 | ||
416 | QPoint l1( r.x() + r.width() / 2, r.y() + 2 ); | 423 | QPoint l1( r.x() + r.width() / 2, r.y() + 2 ); |
417 | QPoint l2( r.x() + r.width() / 2, r.y() + 8 ); | 424 | QPoint l2( r.x() + r.width() / 2, r.y() + 8 ); |
418 | 425 | ||
419 | QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 ); | 426 | QPoint h1( r.x() + r.width() / 2, r.y() + r.height() / 4 ); |
420 | QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | 427 | QPoint h2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); |
421 | 428 | ||
422 | QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 8 ); | 429 | QPoint m1( r.x() + r.width() / 2, r.y() + r.height() / 8 ); |
423 | QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | 430 | QPoint m2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); |
424 | 431 | ||
425 | QPoint s1( r.x() + r.width() / 2, r.y() + 8 ); | 432 | QPoint s1( r.x() + r.width() / 2, r.y() + 8 ); |
426 | QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); | 433 | QPoint s2( r.x() + r.width() / 2, r.y() + r.height() / 2 ); |
427 | 434 | ||
428 | QColor color( clear ? backgroundColor() : black ); | 435 | QColor color( clear ? backgroundColor() : black ); |
429 | QTime time = clear ? prevTime : currTime; | 436 | QTime time = clear ? prevTime : currTime; |
430 | 437 | ||
431 | if ( clear && prevTime.secsTo(currTime) > 1 ) { | 438 | if ( clear && prevTime.secsTo(currTime) > 1 ) { |
432 | p->eraseRect( rect() ); | 439 | p->eraseRect( rect() ); |
433 | return; | 440 | return; |
434 | } | 441 | } |
@@ -440,53 +447,53 @@ void AnalogClock::drawContents( QPainter *p ) | |||
440 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); | 447 | p->drawLine( rotate( center, l1, i * 30 ), rotate( center, l2, i * 30 ) ); |
441 | } | 448 | } |
442 | 449 | ||
443 | if ( !clear || prevTime.minute() != currTime.minute() || | 450 | if ( !clear || prevTime.minute() != currTime.minute() || |
444 | prevTime.hour() != currTime.hour() ) { | 451 | prevTime.hour() != currTime.hour() ) { |
445 | // draw hour pointer | 452 | // draw hour pointer |
446 | h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); | 453 | h1 = rotate( center, h1, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); |
447 | h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); | 454 | h2 = rotate( center, h2, 30 * ( time.hour() % 12 ) + time.minute() / 2 ); |
448 | p->setPen( QPen( color, 3 ) ); | 455 | p->setPen( QPen( color, 3 ) ); |
449 | p->drawLine( h1, h2 ); | 456 | p->drawLine( h1, h2 ); |
450 | } | 457 | } |
451 | 458 | ||
452 | if ( !clear || prevTime.minute() != currTime.minute() ) { | 459 | if ( !clear || prevTime.minute() != currTime.minute() ) { |
453 | // draw minute pointer | 460 | // draw minute pointer |
454 | m1 = rotate( center, m1, time.minute() * 6 ); | 461 | m1 = rotate( center, m1, time.minute() * 6 ); |
455 | m2 = rotate( center, m2, time.minute() * 6 ); | 462 | m2 = rotate( center, m2, time.minute() * 6 ); |
456 | p->setPen( QPen( color, 2 ) ); | 463 | p->setPen( QPen( color, 2 ) ); |
457 | p->drawLine( m1, m2 ); | 464 | p->drawLine( m1, m2 ); |
458 | } | 465 | } |
459 | 466 | ||
460 | // draw second pointer | 467 | // draw second pointer |
461 | s1 = rotate( center, s1, time.second() * 6 ); | 468 | s1 = rotate( center, s1, time.second() * 6 ); |
462 | s2 = rotate( center, s2, time.second() * 6 ); | 469 | s2 = rotate( center, s2, time.second() * 6 ); |
463 | p->setPen( QPen( color, 1 ) ); | 470 | p->setPen( QPen( color, 1 ) ); |
464 | p->drawLine( s1, s2 ); | 471 | p->drawLine( s1, s2 ); |
465 | 472 | ||
466 | if ( !clear ) | 473 | if ( !clear ) |
467 | prevTime = currTime; | 474 | prevTime = currTime; |
468 | } | 475 | } |
469 | 476 | ||
470 | void AnalogClock::display( const QTime& t ) | 477 | void AnalogClock::display( const QTime& t ) |
471 | { | 478 | { |
472 | currTime = t; | 479 | currTime = t; |
473 | clear = true; | 480 | clear = true; |
474 | repaint( false ); | 481 | repaint( false ); |
475 | clear = false; | 482 | clear = false; |
476 | repaint( false ); | 483 | repaint( false ); |
477 | } | 484 | } |
478 | 485 | ||
479 | QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) | 486 | QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) |
480 | { | 487 | { |
481 | double angle = deg2rad * ( - a + 180 ); | 488 | double angle = deg2rad * ( - a + 180 ); |
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 | |||
@@ -32,68 +32,67 @@ class QDateTime; | |||
32 | 32 | ||
33 | class AnalogClock : public QFrame | 33 | class AnalogClock : public QFrame |
34 | { | 34 | { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | 36 | ||
37 | public: | 37 | public: |
38 | AnalogClock( QWidget * parent = 0, const char * name = 0 ) | 38 | AnalogClock( QWidget * parent = 0, const char * name = 0 ) |
39 | : QFrame( parent, name ), clear(false) {} | 39 | : QFrame( parent, name ), clear(false) {} |
40 | 40 | ||
41 | QSizePolicy sizePolicy() const; | 41 | QSizePolicy sizePolicy() const; |
42 | 42 | ||
43 | void display( const QTime& time ); | 43 | void display( const QTime& time ); |
44 | 44 | ||
45 | protected: | 45 | protected: |
46 | void drawContents( QPainter *p ); | 46 | void drawContents( QPainter *p ); |
47 | 47 | ||
48 | private: | 48 | private: |
49 | QPoint rotate( QPoint center, QPoint p, int angle ); | 49 | QPoint rotate( QPoint center, QPoint p, int angle ); |
50 | 50 | ||
51 | QTime currTime; | 51 | QTime currTime; |
52 | QTime prevTime; | 52 | QTime prevTime; |
53 | bool clear; | 53 | bool clear; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | class Clock : public QVBox | 56 | class Clock : public QVBox |
57 | { | 57 | { |
58 | Q_OBJECT | 58 | Q_OBJECT |
59 | 59 | ||
60 | public: | 60 | public: |
61 | Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); | 61 | Clock( QWidget * parent = 0, const char * name = 0, WFlags f=0 ); |
62 | ~Clock(); | 62 | ~Clock(); |
63 | QDateTime when; | 63 | QDateTime when; |
64 | bool bSound; | 64 | bool bSound; |
65 | int hour, minute, snoozeTime; | 65 | int hour, minute, snoozeTime; |
66 | private slots: | 66 | private slots: |
67 | void slotSet(); | 67 | void slotSet(); |
68 | void slotReset(); | 68 | void slotReset(); |
69 | void modeSelect(int); | 69 | void modeSelect(int); |
70 | void updateClock(); | 70 | void updateClock(); |
71 | void changeClock( bool ); | 71 | void changeClock( bool ); |
72 | void slotSetAlarm(); | 72 | void slotSetAlarm(); |
73 | void slotSnooze(); | 73 | void slotSnooze(); |
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; |
87 | QLabel *date; | 86 | QLabel *date; |
88 | QLabel *ampmLabel; | 87 | QLabel *ampmLabel; |
89 | QPushButton *set, *reset, *alarmBtn, *snoozeBtn, *alarmOffBtn; | 88 | QPushButton *set, *reset, *alarmBtn, *snoozeBtn, *alarmOffBtn; |
90 | QRadioButton *clockRB, *swatchRB; | 89 | QRadioButton *clockRB, *swatchRB; |
91 | AnalogClock *aclock; | 90 | AnalogClock *aclock; |
92 | QTime swatch_start; | 91 | QTime swatch_start; |
93 | int swatch_totalms; | 92 | int swatch_totalms; |
94 | bool swatch_running; | 93 | bool swatch_running; |
95 | bool ampm; | 94 | bool ampm; |
96 | }; | 95 | }; |
97 | 96 | ||
98 | #endif | 97 | #endif |
99 | 98 | ||