Screen keep lit when playing
[chessclock] / classes / clockswidget.h
index 88f41a6..e629ab3 100644 (file)
@@ -29,6 +29,8 @@ class QHBoxLayout;
 class QVBoxLayout;
 class QLabel;
 class TurnInformation;
+class QToolButton;
+class ScreenLitKeeper;
 
 class ChessClock;
 
@@ -47,7 +49,8 @@ class ClocksWidget : public QWidget
     Q_OBJECT
 public:
     ClocksWidget(ChessClock* white, ChessClock* black, QWidget *parent = 0);
-
+    ~ClocksWidget();
+    bool isPlayStarted()  { return (status_!=Welcome); }
 
 protected:
     void mouseReleaseEvent(QMouseEvent *event);
@@ -55,9 +58,13 @@ protected:
 
 signals:
    void TurnFinished(TurnInformation* turnInfo);
+   void ClickedWhenStopped();
 
 public slots:
+   /*! Pause game */
     void pause();
+    /*! End the game */
+    void stopPlay();
 
 protected:
     ChessClock* white_;
@@ -65,6 +72,8 @@ protected:
 
     QLabel* pauseLabel_;
     QLabel* welcomeLabel_;
+    QToolButton* pauseButton_;
+    ScreenLitKeeper* keeper_;
 
     enum GameStatus {
         Stopped  /*! Not running */,
@@ -78,7 +87,10 @@ protected:
     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 */