summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp39
-rw-r--r--noncore/tools/clock/clock.h2
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
@@ -265,9 +265,17 @@ void Clock::clearClock( void )
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" ) );
@@ -276,14 +284,17 @@ void Clock::slotSet()
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();
}
}
@@ -601,22 +612,16 @@ void Clock::slotAdjustTime()
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()
@@ -628,7 +633,7 @@ 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
@@ -100,6 +100,8 @@ private:
bool ampm;
void clearClock();
void clearTimer();
+ void startSWatch();
+ void stopSWatch();
};
#endif