Cute Chess  0.1
timecontroldlg.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 TIMECONTROLDIALOG_H
19 #define TIMECONTROLDIALOG_H
20 
21 #include <QDialog>
22 #include <timecontrol.h>
23 
24 namespace Ui {
25  class TimeControlDialog;
26 }
27 
31 class TimeControlDialog : public QDialog
32 {
33  Q_OBJECT
34 
35  public:
41  explicit TimeControlDialog(const TimeControl& tc,
42  QWidget *parent = nullptr);
44  virtual ~TimeControlDialog();
45 
47  TimeControl timeControl() const;
48 
49  private slots:
50  void onTournamentSelected();
51  void onTimePerMoveSelected();
52  void onInfiniteSelected();
53 
54  private:
55  enum TimeUnit
56  {
57  Seconds,
58  Minutes,
59  Hours
60  };
61 
62  int timeToMs() const;
63  void setTime(int ms);
64 
65  Ui::TimeControlDialog *ui;
66 };
67 
68 #endif // TIMECONTROLDIALOG_H
TimeControl timeControl() const
Definition: timecontroldlg.cpp:132
virtual ~TimeControlDialog()
Definition: timecontroldlg.cpp:64
Time controls of a chess game.
Definition: timecontrol.h:34
Definition: engineconfigurationdlg.h:30
TimeControlDialog(const TimeControl &tc, QWidget *parent=nullptr)
Definition: timecontroldlg.cpp:22
A dialog for setting a chess game&#39;s time controls.
Definition: timecontroldlg.h:31