class QHBoxLayout;
class QVBoxLayout;
class QLabel;
-class WelcomeScreenWidget;
+class TurnInformation;
+class QToolButton;
+class ScreenLitKeeper;
class ChessClock;
@author Arto Hyvättinen
@date 2010-08-14
- Central widget of Chess Clock
+ Central widget of Chess Clock.
+ Needed to create new ClocksWidget to
+ every new game.
*/
class ClocksWidget : public QWidget
{
Q_OBJECT
public:
- ClocksWidget(QWidget *parent = 0);
-
- /*! Set clocks and paint them.
-
- */
- void setClocks(ChessClock* white, ChessClock* black);
-
+ ClocksWidget(ChessClock* white, ChessClock* black, QWidget *parent = 0);
+ ~ClocksWidget();
+ bool isPlayStarted() { return (status_!=Welcome); }
protected:
-// void mouseReleaseEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
- void initEmptyScreen();
signals:
- void setupTouch();
+ void TurnFinished(TurnInformation* turnInfo);
+ void ClickedWhenStopped();
public slots:
+ /*! Pause game */
+ void pause();
+ /*! End the game */
+ void stopPlay();
protected:
ChessClock* white_;
ChessClock* black_;
- QHBoxLayout* clockLayout_;
-
QLabel* pauseLabel_;
QLabel* welcomeLabel_;
- WelcomeScreenWidget* welcomeScreen_;
+ QToolButton* pauseButton_;
+ ScreenLitKeeper* keeper_;
enum GameStatus {
Stopped /*! Not running */,
BlackTurn,
WhitePause,
BlackPause,
- NoClocks, /*! Clocks not set ! */
Welcome
};
GameStatus status_;
QTime delayTimer_; /*! To avoid double clicks */
- static int const CLICKDELAY = 500 ; /*! Click delay in msecs */
+ int recentX;
+ int recentY;
+
+ static int const CLICKDELAY = 1500 ; /*! Click delay in msecs */