Cute Chess
0.1
projects
gui
src
chessclock.h
1
/*
2
This file is part of Cute Chess.
3
4
Cute Chess is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
Cute Chess is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef CHESSCLOCK_H
19
#define CHESSCLOCK_H
20
21
#include <QWidget>
22
#include <QTime>
23
24
class
QTimerEvent
;
25
class
QLabel
;
26
27
class
ChessClock
:
public
QWidget
28
{
29
Q_OBJECT
30
31
public
:
32
ChessClock
(
QWidget
* parent =
nullptr
);
33
34
public
slots:
35
void
setPlayerName(
const
QString
& name);
36
void
setInfiniteTime(
bool
infinite);
37
void
setTime(
int
totalTime);
38
void
start(
int
totalTime);
39
void
stop();
40
41
protected
:
42
virtual
void
timerEvent(
QTimerEvent
* event);
43
44
private
:
45
void
stopTimer();
46
47
int
m_totalTime;
48
int
m_timerId;
49
bool
m_infiniteTime;
50
QTime
m_time;
51
QLabel
* m_nameLabel;
52
QLabel
* m_timeLabel;
53
QPalette
m_defaultPalette;
54
};
55
56
#endif // CHESSCLOCK
QWidget
ChessClock
Definition:
chessclock.h:27
QTime
QTimerEvent
QString
QLabel
QPalette
Generated by
1.8.14