A simple clock that can notify objects. More...
#include <clock.h>
Signals | |
void | timeChanged (const QDateTime &newTime) |
Public Member Functions | |
Clock () | |
const QDateTime & | time () const |
void | setTime (const QDateTime &time) |
void | addEvent (const QDateTime &time, StorableData *data) |
void | removeEvents (StorableData *data) |
void | setTicking (bool enable) |
bool | isTicking () const |
Static Public Member Functions | |
static QDateTime | currentTime () |
static void | newEvent (const QDateTime &time, StorableData *data) |
static void | deleteEvents (StorableData *data) |
Private Slots | |
void | tick () |
Private Attributes | |
QDateTime | m_time |
QMultiMap< QDateTime, StorableData * > | m_events |
QTimer | m_timer |
A simple clock that can notify objects.
This class offers functionality to store and modify a date/time. It can also notify StorableData objects at specific times. It does so by calling StorableData::notify().
Definition at line 22 of file clock.h.
Clock::Clock | ( | ) |
void Clock::addEvent | ( | const QDateTime & | time, | |
StorableData * | data | |||
) |
QDateTime Clock::currentTime | ( | ) | [static] |
Returns the time of the clock stored in TaskManagerData.
Definition at line 63 of file clock.cpp.
void Clock::deleteEvents | ( | StorableData * | data | ) | [static] |
Removes events from the clock stored in TaskManagerData.
Definition at line 58 of file clock.cpp.
bool Clock::isTicking | ( | ) | const |
Indicates whether this clock is ticking.
void Clock::newEvent | ( | const QDateTime & | time, | |
StorableData * | data | |||
) | [static] |
Registers a new event in the clock stored in TaskManagerData.
Definition at line 68 of file clock.cpp.
void Clock::removeEvents | ( | StorableData * | data | ) |
void Clock::setTicking | ( | bool | enable | ) |
Enables/disables the ticking of this clock. If a clock is ticking its time is incremented by 1s every 1000ms.
void Clock::setTime | ( | const QDateTime & | time | ) |
Sets the time of this clock to the given time. All StorableData abjects that are registered in this clock via addEvent() with a time smaller than or equal to this clocks time() are notified.
Definition at line 18 of file clock.cpp.
void Clock::tick | ( | ) | [private, slot] |
const QDateTime & Clock::time | ( | ) | const |
void domain::Clock::timeChanged | ( | const QDateTime & | newTime | ) | [signal] |
Emitted when the time stored in this clock changes.
newTime | The new time of this clock. |