KGameClock Class Reference

Class representing a game clock, wraps after 24 hours. More...

#include <kgameclock.h>

Collaboration diagram for KGameClock:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ClockType { HourMinSec = 0, MinSecOnly }

Public Slots

virtual void restart ()
 Reset the clock and start again from zero.
virtual void pause ()
 Pause the clock.
virtual void resume ()
 Resume counting time from the current position.

Signals

void timeChanged (const QString &)

Public Member Functions

 KGameClock (QObject *parent=0, ClockType clocktype=HourMinSec)
 
Returns:
Constructor

virtual ~KGameClock ()
uint seconds () const
 
Returns:
the total number of seconds elapsed.

QString timeString () const
 
Returns:
the time as a string to be displayed: "mm:ss" or "hh:mm:ss" depending on clock type.

void setTime (uint seconds)
 Set the time.
void setTime (const QString &s)
 Set the time (format should be "hh:mm:ss").
void showTime ()
 Refresh.

Protected Slots

virtual void timeoutClock ()

Friends

class KGameClockPrivate


Detailed Description

Class representing a game clock, wraps after 24 hours.

Definition at line 33 of file kgameclock.h.


Member Enumeration Documentation

enum KGameClock::ClockType

Enumerator:
HourMinSec 
MinSecOnly 

Definition at line 37 of file kgameclock.h.


Constructor & Destructor Documentation

KGameClock::KGameClock ( QObject *  parent = 0,
KGameClock::ClockType  clocktype = HourMinSec 
) [explicit]

Returns:
Constructor

Definition at line 40 of file kgameclock.cpp.

References KGameClockPrivate::clocktype, timeoutClock(), and KGameClockPrivate::timerClock.

KGameClock::~KGameClock (  )  [virtual]

Definition at line 48 of file kgameclock.cpp.


Member Function Documentation

uint KGameClock::seconds (  )  const

Returns:
the total number of seconds elapsed.

Definition at line 103 of file kgameclock.cpp.

References KGameClockPrivate::hour, KGameClockPrivate::min, and KGameClockPrivate::sec.

QString KGameClock::timeString (  )  const

Returns:
the time as a string to be displayed: "mm:ss" or "hh:mm:ss" depending on clock type.

Definition at line 68 of file kgameclock.cpp.

References KGameClockPrivate::clocktype, KGameClockPrivate::hour, KGameClockPrivate::min, MinSecOnly, and KGameClockPrivate::sec.

Referenced by showTime().

void KGameClock::setTime ( uint  seconds  ) 

Set the time.

Definition at line 108 of file kgameclock.cpp.

References KGameClockPrivate::hour, KGameClockPrivate::min, KGameClockPrivate::sec, and showTime().

Referenced by setTime().

Here is the call graph for this function:

void KGameClock::setTime ( const QString &  s  ) 

Set the time (format should be "hh:mm:ss").

Definition at line 117 of file kgameclock.cpp.

References setTime().

Here is the call graph for this function:

void KGameClock::showTime (  ) 

Refresh.

Definition at line 78 of file kgameclock.cpp.

References timeChanged(), and timeString().

Referenced by restart(), setTime(), and timeoutClock().

Here is the call graph for this function:

void KGameClock::timeChanged ( const QString &   )  [signal]

Referenced by showTime().

void KGameClock::restart (  )  [virtual, slot]

Reset the clock and start again from zero.

Definition at line 83 of file kgameclock.cpp.

References KGameClockPrivate::hour, KGameClockPrivate::min, resume(), KGameClockPrivate::sec, showTime(), and KGameClockPrivate::timerClock.

void KGameClock::pause (  )  [virtual, slot]

Pause the clock.

Definition at line 98 of file kgameclock.cpp.

References KGameClockPrivate::timerClock.

void KGameClock::resume (  )  [virtual, slot]

Resume counting time from the current position.

Definition at line 93 of file kgameclock.cpp.

References KGameClockPrivate::timerClock.

Referenced by restart().

void KGameClock::timeoutClock (  )  [protected, virtual, slot]

Definition at line 53 of file kgameclock.cpp.

References KGameClockPrivate::hour, KGameClockPrivate::min, KGameClockPrivate::sec, and showTime().

Referenced by KGameClock().


Friends And Related Function Documentation

friend class KGameClockPrivate [friend]

Definition at line 94 of file kgameclock.h.


The documentation for this class was generated from the following files:
Generated on Sun Mar 16 08:03:18 2008 for Libkdegames by  doxygen 1.5.3