Clock of a individual player. More...
#include <chessclock.h>
Public Types | |
enum | RunningStatus { NotRunning = 0, Running = 1, Paused = 2 } |
Public Slots | |
virtual void | repaintClock ()=0 |
Refresh clock information. | |
virtual void | updateClock () |
Update clock information, check looser state and refresh. | |
Signals | |
void | timeOutLoser () |
void | turnEnded () |
void | dontEatBattery () |
Emitted after 30 min played one turn. | |
Public Member Functions | |
ChessClock (bool white, QWidget *parent=0) | |
bool | isLoser () const |
int | getTurn () const |
bool | isWhite () const |
RunningStatus | getStatus () const |
virtual void | startTurn () |
Start new turn. | |
virtual TurnInformation * | endTurn () |
End this turn. | |
virtual void | pauseTurn () |
Pause clock. | |
virtual void | continueTurn () |
Continue paused game. | |
void | setAnother (ChessClock *another) |
Set another chess clock for connecting. | |
virtual int | getTimeAvailable () |
Get total time available. | |
virtual int | getTimePlayed () |
Get total time played. | |
void | setTimeAvailable (int msecs) |
Set time available. | |
void | addTime (int msecs) |
Add time. | |
int | currentTurnPlayed () |
Get time played current turn. | |
Protected Attributes | |
ChessClock * | another_ |
bool | loser_ |
Another player's clock. | |
int | turn_ |
Is player losed because of timeout. | |
RunningStatus | status_ |
Current turn. | |
TurnInformation * | currentTurn_ |
bool | dontEatBatteryEmitted_ |
int | timePlayedBeforeTurn_ |
int | timeAvailableBeforeTurn_ |
Time played in this game BEFORE this turn msecs. | |
bool | isWhite_ |
Time available for play BEFORE this turn msecs ! | |
QTime | clockTime_ |
True if white player. | |
QTimer | updateTimer_ |
Static Protected Attributes | |
static const int | UPDATEINTERVAL = 1000 |
static const int | DONTEATBATTERYTIME = 30 * 60 * 1000 |
Clock of a individual player.
Base class of chess clock.
ChessClock has not GUI itself, but it is subclass of QWidget avoiding polymorphism.
Definition at line 43 of file chessclock.h.
Definition at line 50 of file chessclock.h.
ChessClock::ChessClock | ( | bool | white, | |
QWidget * | parent = 0 | |||
) |
Definition at line 29 of file chessclock.cpp.
void ChessClock::addTime | ( | int | msecs | ) |
Add time.
Add time to timeAvailableBeforeTurn_ total available time counter.
msecs | Time to add in msecs |
Definition at line 138 of file chessclock.cpp.
void ChessClock::continueTurn | ( | ) | [virtual] |
Continue paused game.
Definition at line 73 of file chessclock.cpp.
int ChessClock::currentTurnPlayed | ( | ) |
void ChessClock::dontEatBattery | ( | ) | [signal] |
Emitted after 30 min played one turn.
Will cause screen not to keeped lit.
TurnInformation * ChessClock::endTurn | ( | ) | [virtual] |
End this turn.
Player has done his move.
Reimplemented in DelayAfterClock, FischerAfterClock, and HourGlassClock.
Definition at line 84 of file chessclock.cpp.
RunningStatus ChessClock::getStatus | ( | ) | const [inline] |
Definition at line 59 of file chessclock.h.
int ChessClock::getTimeAvailable | ( | ) | [virtual] |
Get total time available.
Time does't contain delays.
Reimplemented in DelayClock, and HourGlassClock.
Definition at line 112 of file chessclock.cpp.
int ChessClock::getTimePlayed | ( | ) | [virtual] |
int ChessClock::getTurn | ( | ) | const [inline] |
Definition at line 57 of file chessclock.h.
bool ChessClock::isLoser | ( | ) | const [inline] |
Definition at line 56 of file chessclock.h.
bool ChessClock::isWhite | ( | ) | const [inline] |
Definition at line 58 of file chessclock.h.
void ChessClock::pauseTurn | ( | ) | [virtual] |
Pause clock.
Definition at line 64 of file chessclock.cpp.
virtual void ChessClock::repaintClock | ( | ) | [pure virtual, slot] |
Refresh clock information.
Implemented in ChessClockWidget.
void ChessClock::setAnother | ( | ChessClock * | another | ) |
Set another chess clock for connecting.
another | Clock of opposite player |
Definition at line 107 of file chessclock.cpp.
void ChessClock::setTimeAvailable | ( | int | msecs | ) |
Set time available.
msecs | Time available in msecs |
Definition at line 132 of file chessclock.cpp.
void ChessClock::startTurn | ( | ) | [virtual] |
void ChessClock::timeOutLoser | ( | ) | [signal] |
void ChessClock::turnEnded | ( | ) | [signal] |
void ChessClock::updateClock | ( | ) | [virtual, slot] |
Update clock information, check looser state and refresh.
Reimplemented in HourGlassClock.
Definition at line 169 of file chessclock.cpp.
ChessClock* ChessClock::another_ [protected] |
Definition at line 129 of file chessclock.h.
QTime ChessClock::clockTime_ [protected] |
True if white player.
Definition at line 142 of file chessclock.h.
TurnInformation* ChessClock::currentTurn_ [protected] |
Definition at line 134 of file chessclock.h.
bool ChessClock::dontEatBatteryEmitted_ [protected] |
Definition at line 135 of file chessclock.h.
const int ChessClock::DONTEATBATTERYTIME = 30 * 60 * 1000 [static, protected] |
Clock updating interval in msecs
Definition at line 146 of file chessclock.h.
bool ChessClock::isWhite_ [protected] |
Time available for play BEFORE this turn msecs !
Definition at line 140 of file chessclock.h.
bool ChessClock::loser_ [protected] |
Another player's clock.
Definition at line 131 of file chessclock.h.
RunningStatus ChessClock::status_ [protected] |
Current turn.
Definition at line 133 of file chessclock.h.
int ChessClock::timeAvailableBeforeTurn_ [protected] |
Time played in this game BEFORE this turn msecs.
Definition at line 138 of file chessclock.h.
int ChessClock::timePlayedBeforeTurn_ [protected] |
Definition at line 137 of file chessclock.h.
int ChessClock::turn_ [protected] |
Is player losed because of timeout.
Definition at line 132 of file chessclock.h.
const int ChessClock::UPDATEINTERVAL = 1000 [static, protected] |
Definition at line 145 of file chessclock.h.
QTimer ChessClock::updateTimer_ [protected] |
Definition at line 143 of file chessclock.h.