From: Arto Hyvättinen Date: Sat, 14 Aug 2010 14:42:46 +0000 (+0300) Subject: ClocksWidget: Continue & Stop X-Git-Tag: v1.9.0~111 X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=a9dfe54ac273d09f371241315f824719f550260a;hp=89725f528257bb5c943d3df8bf3ca7fa0de91bc4;p=chessclock ClocksWidget: Continue & Stop --- diff --git a/classes/clockswidget.cpp b/classes/clockswidget.cpp index 9882de5..95baa86 100644 --- a/classes/clockswidget.cpp +++ b/classes/clockswidget.cpp @@ -92,6 +92,15 @@ void ClocksWidget::pause() } } +void ClocksWidget::stopPlay() +{ + if( status_ == BlackTurn || status_ == BlackPause ) + emit TurnFinished( black_->endTurn()); + else if( status_ == WhiteTurn || status_ == WhitePause ) + emit TurnFinished( white_->endTurn()); + status_ = Stopped; +} + void ClocksWidget::mouseReleaseEvent(QMouseEvent *event) { @@ -117,6 +126,18 @@ void ClocksWidget::mouseReleaseEvent(QMouseEvent *event) white_->startTurn(); status_=WhiteTurn; break; + case WhitePause: + // Continue play + white_->continueTurn(); + status_=WhiteTurn; + break; + case BlackPause: + // Continue play + black_->continueTurn(); + status_=BlackTurn; + break; + case Stopped: + emit ClickedWhenStopped(); } diff --git a/classes/clockswidget.h b/classes/clockswidget.h index 88f41a6..7872915 100644 --- a/classes/clockswidget.h +++ b/classes/clockswidget.h @@ -55,9 +55,13 @@ protected: signals: void TurnFinished(TurnInformation* turnInfo); + void ClickedWhenStopped(); public slots: + /*! Pause game */ void pause(); + /*! End the game */ + void stopPlay(); protected: ChessClock* white_;