356b8d6d73b242fdfa85b73600d277ba1e58d4b2
[chessclock] / classes / chessclockwidget.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 CHESSCLOCKWIDGET_H
23 #define CHESSCLOCKWIDGET_H
24
25 #include "chessclock.h"
26 #include <QPixmap>
27 #include <QString>
28
29 class QVBoxLayout;
30 class QLabel;
31
32 /*!  Simple chess clock widget
33
34   @author Arto Hyvättinen
35   @date 2010-08-14
36
37
38   */
39 class ChessClockWidget : public ChessClock
40 {
41     Q_OBJECT
42 public:
43     ChessClockWidget(bool white, QWidget *parent = 0);
44     /*! Set time begin of turn shown green.
45
46       Extra time of turn is shown green.
47       @param msecs Green time in msecs
48       */
49     void setGreenTime(int msecs);
50
51 signals:
52
53 public slots:
54     virtual void repaintClock();
55
56 protected:
57     /*! Init pictures from resources */
58     virtual void initPictures();
59     /*! Init QLabels */
60     virtual void initLabels();
61     /*! Init top: picture, details, loser mark */
62     virtual void initTop();
63     /*! Init time left in bottom.
64       Override to make different bottom area */
65     virtual void initBottom();
66
67     /*! Convert msecs to h:mm:ss QString */
68     QString timeString(int msecs);
69
70 protected:
71
72     QPixmap picActive_;
73     QPixmap picPassive_;
74     QPixmap picLoser_;
75
76     QLabel* pictureLabel_;
77     QLabel* timeUsedLabel_;
78     QLabel* timeAverageLabel_;
79     QLabel* turnLabel_;
80     QLabel* turnTimeLabel_;
81     QLabel* loserLabel_;
82     QLabel* leftLabel_;
83
84     QVBoxLayout* mainLayout;
85
86     int greenTime_; /*! Green time in begin of turn */
87
88
89 };
90
91 #endif // CHESSCLOCKWIDGET_H