Add ClocksWidget
[chessclock] / classes / clockswidget.h
1  /**************************************************************************
2
3     Chess Clock
4
5     Copyright (c) Arto Hyvättinen 2010
6
7     This file is part of Chess Clock software.
8
9     Chess Clock is free software: you can redistribute it and/or modify
10     it under the terms of the GNU General Public License as published by
11     the Free Software Foundation, either version 3 of the License, or
12     (at your option) any later version.
13
14     Chess Clock is distributed in the hope that it will be useful,
15     but WITHOUT ANY WARRANTY; without even the implied warranty of
16     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     GNU General Public License for more details.
18
19
20 **************************************************************************/
21
22 #ifndef CLOCKSWIDGET_H
23 #define CLOCKSWIDGET_H
24
25 #include <QWidget>
26 #include <QTime>
27
28 class QHBoxLayout;
29 class QVBoxLayout;
30 class QLabel;
31 class WelcomeScreenWidget;
32
33 class ChessClock;
34
35 /*! Widget with two clocks
36
37     @author Arto Hyvättinen
38     @date 2010-08-14
39
40     Central widget of Chess Clock
41
42   */
43 class ClocksWidget : public QWidget
44 {
45     Q_OBJECT
46 public:
47     ClocksWidget(QWidget *parent = 0);
48
49     /*! Set clocks and paint them.
50
51       */
52     void setClocks(ChessClock* white, ChessClock* black);
53
54
55 protected:
56 //    void mouseReleaseEvent(QMouseEvent *event);
57
58     void initEmptyScreen();
59
60 signals:
61     void setupTouch();
62
63 public slots:
64
65 protected:
66     ChessClock* white_;
67     ChessClock* black_;
68
69     QHBoxLayout* clockLayout_;
70
71     QLabel* pauseLabel_;
72     QLabel* welcomeLabel_;
73     WelcomeScreenWidget* welcomeScreen_;
74
75     enum GameStatus {
76         Stopped  /*! Not running */,
77         WhiteTurn,
78         BlackTurn,
79         WhitePause,
80         BlackPause,
81         NoClocks,    /*! Clocks not set ! */
82         Welcome
83         };
84
85     GameStatus status_;
86     QTime delayTimer_; /*! To avoid double clicks */
87
88     static int const CLICKDELAY = 500 ; /*! Click delay in msecs */
89
90
91
92 };
93
94 #endif // CLOCKSWIDGET_H