1 /**************************************************************************
5 Copyright (c) Arto Hyvättinen 2010
7 This file is part of Chess Clock software.
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.
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.
20 **************************************************************************/
34 /*! Basic dialog for Time Control settings
36 @author Arto Hyvättinen
39 Basic dialog setting up clock.
40 Time control can use this dialog.
41 Using disableAddition(), disablePerTurns() or disableUnEquals()
42 it is possible to customize dialog.
44 All the widgets are public for customization.
47 class BasicDialog : public QDialog
53 @param timeControlName Name of time controller, will be window title */
54 BasicDialog(QString timeContolName, QWidget *parent = 0);
56 void disableAddition();
57 void disablePerTurns();
58 void disableUnEquals();
60 int getWhiteInitial();
61 int getBlackInitial();
62 int getWhiteAddition();
63 int getBlackAddition();
64 int getWhitePerTurns();
65 int getBlackPerTurns();
66 /*! Store values to settings */
68 /*! Load values from settings, or init to initial values */
69 void init(QTime whiteInitial=QTime(1,30),
70 QTime blackInitial=QTime(1,30),
71 QTime whiteAddition=QTime(0,0,30),
72 QTime blackAddition=QTime(0,0,30),
73 int whitePerTurns = 1,
74 int blackPerTurns = 1);
80 static QTimeEdit* initTimeEdit();
81 static int toMsecs(QTimeEdit* timeEdit);
84 QTimeEdit *whiteInitial_, *blackInitial_;
85 QTimeEdit *whiteAddition_, *blackAddition_;
86 QSpinBox *whiteTurns_, *blackTurns_;
89 QLabel *initialLabel_, *additionLabel_, *perTurnLabel_, *equalsLabel_;
90 QLabel *whiteLabel_, *blackLabel_;
93 QString timeControlName_;
98 #endif // BASICDIALOG_H