00001 /************************************************************************** 00002 00003 Chess Clock 00004 00005 Copyright (c) Arto Hyvättinen 2010 00006 00007 This file is part of Chess Clock software. 00008 00009 Chess Clock is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 Chess Clock is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 00019 00020 **************************************************************************/ 00021 00022 #ifndef CLOCKSWIDGET_H 00023 #define CLOCKSWIDGET_H 00024 00025 #include <QWidget> 00026 #include <QTime> 00027 00028 class QHBoxLayout; 00029 class QVBoxLayout; 00030 class QLabel; 00031 class TurnInformation; 00032 00033 class ChessClock; 00034 00045 class ClocksWidget : public QWidget 00046 { 00047 Q_OBJECT 00048 public: 00049 ClocksWidget(ChessClock* white, ChessClock* black, QWidget *parent = 0); 00050 ~ClocksWidget(); 00051 bool isPlayStarted() { return (status_!=Welcome); } 00052 00053 protected: 00054 void mouseReleaseEvent(QMouseEvent *event); 00055 00056 00057 signals: 00058 void TurnFinished(TurnInformation* turnInfo); 00059 void ClickedWhenStopped(); 00060 00061 public slots: 00063 void pause(); 00065 void stopPlay(); 00066 00067 protected: 00068 ChessClock* white_; 00069 ChessClock* black_; 00070 00071 QLabel* pauseLabel_; 00072 QLabel* welcomeLabel_; 00073 00074 enum GameStatus { 00075 Stopped , 00076 WhiteTurn, 00077 BlackTurn, 00078 WhitePause, 00079 BlackPause, 00080 Welcome 00081 }; 00082 00083 GameStatus status_; 00084 QTime delayTimer_; 00086 static int const CLICKDELAY = 500 ; 00090 }; 00091 00092 #endif // CLOCKSWIDGET_H