|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program 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; version 2 of the License |
|
8 * |
|
9 * This program 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 this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
17 */ |
|
18 |
|
19 /** |
|
20 * @file |
|
21 * @brief SDTimeoutSpinBox class definition |
|
22 */ |
|
23 |
|
24 #ifndef HEDGEWARS_SDTIMEOUTSPINBOX_H |
|
25 #define HEDGEWARS_SDTIMEOUTSPINBOX_H |
|
26 |
|
27 #include <QObject> |
|
28 #include <QSpinBox> |
|
29 |
|
30 /** |
|
31 * <code>SpinBox</code> for Sudden Death timeout. |
|
32 * The internally stored Sudden Death timeout is different |
|
33 * from the actual number of rounds it takes until SD starts. |
|
34 * e.g. value 0 means SD starts in 2nd round |
|
35 * @author Wuzzy |
|
36 * @since 0.9.25 |
|
37 */ |
|
38 class SDTimeoutSpinBox : public QSpinBox |
|
39 { |
|
40 Q_OBJECT |
|
41 |
|
42 public: |
|
43 /** |
|
44 * @brief Class constructor. |
|
45 * @param parent parent widget. |
|
46 */ |
|
47 SDTimeoutSpinBox(QWidget * parent); |
|
48 |
|
49 protected: |
|
50 /** |
|
51 * Returns its value in real number of rounds. |
|
52 * @param internal value integer value to be represented as string. |
|
53 * @return the real number of rounds |
|
54 */ |
|
55 QString textFromValue(int value) const; |
|
56 /** |
|
57 * Returns the internally-used value for SD timeout. |
|
58 * @param user-facing string, i.e. real number of rounds |
|
59 * @return internally-stored SD timeout value |
|
60 */ |
|
61 int valueFromText(const QString & text) const; |
|
62 }; |
|
63 |
|
64 |
|
65 #endif // HEDGEWARS_SDTIMEOUTSPINBOX_H |