Cute Chess  0.1
timecontroldlg.h
1 /*
2  This file is part of Cute Chess.
3  Copyright (C) 2008-2018 Cute Chess authors
4 
5  Cute Chess is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Cute Chess is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef TIMECONTROLDIALOG_H
20 #define TIMECONTROLDIALOG_H
21 
22 #include <QDialog>
23 #include <timecontrol.h>
24 
25 namespace Ui {
26  class TimeControlDialog;
27 }
28 
32 class TimeControlDialog : public QDialog
33 {
34  Q_OBJECT
35 
36  public:
42  explicit TimeControlDialog(const TimeControl& tc,
43  QWidget *parent = nullptr);
45  virtual ~TimeControlDialog();
46 
48  TimeControl timeControl() const;
49 
50  private slots:
51  void onTournamentSelected();
52  void onTimePerMoveSelected();
53  void onInfiniteSelected();
54  void onHourglassSelected();
55 
56  private:
57  enum TimeUnit
58  {
59  Seconds,
60  Minutes,
61  Hours
62  };
63 
64  int timeToMs() const;
65  void setTime(int ms);
66 
67  Ui::TimeControlDialog *ui;
68 };
69 
70 #endif // TIMECONTROLDIALOG_H
TimeControl timeControl() const
Definition: timecontroldlg.cpp:150
virtual ~TimeControlDialog()
Definition: timecontroldlg.cpp:73
Time controls of a chess game.
Definition: timecontrol.h:35
Definition: engineconfigurationdlg.h:30
TimeControlDialog(const TimeControl &tc, QWidget *parent=nullptr)
Definition: timecontroldlg.cpp:23
A dialog for setting a chess game&#39;s time controls.
Definition: timecontroldlg.h:32