author | llornkcor <llornkcor> | 2003-03-04 17:22:54 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-03-04 17:22:54 (UTC) |
commit | 55e5d2c95f70d296c541e4f2564713a593c3851c (patch) (side-by-side diff) | |
tree | 63e2a6b4c8429baac265826e3695bd3e185afc07 | |
parent | ca913d1f2035b6ddb77be497516e4dfc2371e5b3 (diff) | |
download | opie-55e5d2c95f70d296c541e4f2564713a593c3851c.zip opie-55e5d2c95f70d296c541e4f2564713a593c3851c.tar.gz opie-55e5d2c95f70d296c541e4f2564713a593c3851c.tar.bz2 |
make timerStart called twice just reset, instead of stop
-rw-r--r-- | noncore/tools/clock/clock.cpp | 39 | ||||
-rw-r--r-- | noncore/tools/clock/clock.h | 2 |
2 files changed, 24 insertions, 17 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp index 9898332..0eb2b83 100644 --- a/noncore/tools/clock/clock.cpp +++ b/noncore/tools/clock/clock.cpp @@ -256,43 +256,54 @@ void Clock::updateClock() void Clock::changeClock( bool a ) { ampm = a; updateClock(); } void Clock::clearClock( void ) { lcd->display( QTime( 0, 0, 0 ).toString() ); aclock->display( QTime( 0, 0, 0 ) ); } -void Clock::slotSet() +void Clock::startSWatch() { - if ( t->isActive() ) + swatch_start.start(); + set->setText( tr( "Stop" ) ); + t->start( 1000 ); + swatch_running = TRUE; + // disable screensaver while stop watch is running + toggleScreenSaver( FALSE ); +} + +void Clock::stopSWatch() { swatch_totalms += swatch_start.elapsed(); set->setText( tr( "Start" ) ); t->stop(); swatch_running = FALSE; toggleScreenSaver( TRUE ); updateClock(); } + + +void Clock::slotSet() +{ + if ( t->isActive() ) + { + startSWatch(); + } else { - swatch_start.start(); - set->setText( tr( "Stop" ) ); - t->start( 1000 ); - swatch_running = TRUE; - // disable screensaver while stop watch is running - toggleScreenSaver( FALSE ); + stopSWatch(); } } void Clock::slotReset() { t->stop(); swatch_start.start(); swatch_totalms = 0; if ( swatch_running ) t->start( 1000 ); @@ -592,44 +603,38 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a ) ( p.x() - c.x() ) * sin( angle ); return QPoint( nx, ny ); } void Clock::slotAdjustTime() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "systemtime" ); } void Clock::slotStartTimer() { - Config cfg( "Clock" ); - cfg.setGroup( "Mode" ); - int mode = cfg.readBoolEntry( "clockMode"); if ( clockRB->isChecked() ) setSwatchMode( 1); - slotSet(); + startSWatch(); } void Clock::slotStopTimer() { - Config cfg( "Clock" ); - cfg.setGroup( "Mode" ); - int mode = cfg.readBoolEntry( "clockMode"); if ( clockRB->isChecked() ) setSwatchMode( 1); -slotSet(); + stopSWatch(); } void Clock::slotResetTimer() { if ( clockRB->isChecked() ) setSwatchMode( 1); slotReset(); } void Clock::setSwatchMode(int mode) { - qDebug("Clock::setSwatchMode( %d)"), mode; + qDebug("Clock::setSwatchMode( %d)", mode); swatchRB->setChecked( mode); clearClock( ); modeSelect( mode ); } diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h index 9b00e28..1e5aa2c 100644 --- a/noncore/tools/clock/clock.h +++ b/noncore/tools/clock/clock.h @@ -91,16 +91,18 @@ private: QLCDNumber *lcd; QLabel *date; QLabel *ampmLabel; QPushButton *set, *reset, *alarmBtn, *snoozeBtn, *alarmOffBtn; QRadioButton *clockRB, *swatchRB; AnalogClock *aclock; QTime swatch_start; int swatch_totalms; bool swatch_running; bool ampm; void clearClock(); void clearTimer(); + void startSWatch(); + void stopSWatch(); }; #endif |