X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=classes%2Fchessclock.cpp;fp=classes%2Fchessclock.cpp;h=aedf53119eda0ce75380be5dd6e70a0b9f9371c8;hb=d145b92ee23ef361bbfd91eef606cfc3ed9994fa;hp=cc9269ea08ca96886d1b6460cc9f3c5c5c676468;hpb=e43c493689b3e5a28625a293f811a888bd5042e8;p=chessclock diff --git a/classes/chessclock.cpp b/classes/chessclock.cpp index cc9269e..aedf531 100644 --- a/classes/chessclock.cpp +++ b/classes/chessclock.cpp @@ -24,6 +24,7 @@ #include "turninformation.h" const int ChessClock::UPDATEINTERVAL; +const int ChessClock::DONTEATBATTERYTIME; ChessClock::ChessClock(bool white, QWidget *parent) : QWidget(parent) @@ -31,6 +32,7 @@ ChessClock::ChessClock(bool white, QWidget *parent) : isWhite_ = white; loser_ = false; turn_ = 0; + dontEatBatteryEmitted_ = false; timePlayedBeforeTurn_ = 0; status_ = NotRunning; another_ = 0; @@ -47,6 +49,7 @@ ChessClock::ChessClock(bool white, QWidget *parent) : void ChessClock::startTurn() { turn_++; + dontEatBatteryEmitted_ = false; // Turn information for this new turn currentTurn_ = new TurnInformation(turn_, isWhite_); @@ -143,8 +146,18 @@ int ChessClock::currentTurnPlayed() { // Update current time if( status_ == Running ) + { currentTurn_->addTime( clockTime_.restart()); + // since 1.1.2 + // emit dontEatBattery signal when screen should not to be keeped on + if ( currentTurn_->getDuration() > DONTEATBATTERYTIME && dontEatBatteryEmitted_ == false ) + { + dontEatBatteryEmitted_ = true; + emit dontEatBattery(); + } + } + // Return current time return currentTurn_->getDuration(); }