author | unc0rr |
Sun, 19 Nov 2017 22:35:16 +0100 | |
changeset 12845 | ad2d448bbcab |
parent 12250 | 5206f9a803d1 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
11046 | 3 |
* Copyright (c) 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 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 |
|
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | 17 |
*/ |
18 |
||
6200 | 19 |
/** |
20 |
* @file |
|
21 |
* @brief AbstractPage class definition |
|
22 |
*/ |
|
23 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
24 |
#ifndef ABSTRACTPAGE_H |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
25 |
#define ABSTRACTPAGE_H |
184 | 26 |
|
27 |
#include <QWidget> |
|
6577 | 28 |
#include <qpushbuttonwithsound.h> |
684 | 29 |
#include <QFont> |
30 |
#include <QGridLayout> |
|
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
31 |
#include <QComboBox> |
1840 | 32 |
#include <QSignalMapper> |
184 | 33 |
|
6577 | 34 |
class QPushButtonWithSound; |
184 | 35 |
class QGroupBox; |
36 |
class QComboBox; |
|
37 |
class QLabel; |
|
38 |
class QToolBox; |
|
39 |
class QLineEdit; |
|
665 | 40 |
class QListWidget; |
41 |
class QCheckBox; |
|
42 |
class QSpinBox; |
|
43 |
class QTextEdit; |
|
44 |
class QRadioButton; |
|
45 |
class QTableView; |
|
1377 | 46 |
class QTextBrowser; |
1399 | 47 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
48 |
class QAction; |
1885 | 49 |
class QDataWidgetMapper; |
1887 | 50 |
class QAbstractItemModel; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2762
diff
changeset
|
51 |
class QSettings; |
3694
3e9c0634065c
new quality slider widget (needs to be customized), removed obsolete arguments
koda
parents:
3690
diff
changeset
|
52 |
class QSlider; |
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
53 |
class QGridlayout; |
665 | 54 |
|
684 | 55 |
class AbstractPage : public QWidget |
56 |
{ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
57 |
Q_OBJECT |
1885 | 58 |
|
6477 | 59 |
public: |
60 |
||
61 |
/** |
|
62 |
* @brief Changes the desc text (should not be called manualy) |
|
63 |
* |
|
64 |
* @param desc the description of the widget focused |
|
65 |
*/ |
|
66 |
void setButtonDescription(QString desc); |
|
67 |
||
68 |
/** |
|
69 |
* @brief Changes the desc defaut text |
|
70 |
* |
|
71 |
* @param text the defaut desc |
|
72 |
*/ |
|
8729 | 73 |
void setDefaultDescription(QString text); |
6477 | 74 |
|
75 |
/** |
|
76 |
* @brief Get the desc defaut text |
|
77 |
*/ |
|
8729 | 78 |
QString * getDefaultDescription(); |
6477 | 79 |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
80 |
signals: |
8384 | 81 |
|
6200 | 82 |
/** |
83 |
* @brief This signal is emitted when going back to the previous is |
|
84 |
* requested - e.g. when the back-button is clicked. |
|
85 |
*/ |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
86 |
void goBack(); |
684 | 87 |
|
8384 | 88 |
/** |
89 |
* @brief This signal is emitted when the page is displayed |
|
90 |
*/ |
|
91 |
void pageEnter(); |
|
92 |
||
93 |
/** |
|
94 |
* @brief This signal is emitted when this page is left |
|
95 |
*/ |
|
96 |
void pageLeave(); |
|
97 |
||
98 |
public slots: |
|
99 |
||
100 |
/** |
|
101 |
* @brief This slot is called to trigger this page's pageEnter signal |
|
102 |
*/ |
|
103 |
void triggerPageEnter(); |
|
104 |
||
105 |
/** |
|
106 |
* @brief This slot is called to trigger this page's pageLeave signal |
|
107 |
*/ |
|
108 |
void triggerPageLeave(); |
|
109 |
||
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
110 |
protected: |
6200 | 111 |
/** |
112 |
* @brief Class constructor |
|
113 |
* |
|
114 |
* @param parent parent widget. |
|
115 |
*/ |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
116 |
AbstractPage(QWidget * parent = 0); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
117 |
|
6200 | 118 |
/// Class Destructor |
119 |
virtual ~AbstractPage() {}; |
|
120 |
||
121 |
/// Call this in the constructor of your subclass. |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
122 |
void initPage(); |
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
123 |
|
6200 | 124 |
/** |
125 |
* @brief Used during page construction. |
|
126 |
* You MUST implement this method in your subclass. |
|
127 |
* |
|
128 |
* Use it to define the main layout (no behavior) of the page. |
|
129 |
*/ |
|
130 |
virtual QLayout * bodyLayoutDefinition() = 0; |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
131 |
|
6200 | 132 |
/** |
133 |
* @brief Used during page construction. |
|
134 |
* You can implement this method in your subclass. |
|
135 |
* |
|
136 |
* Use it to define layout (not behavior) of the page's footer. |
|
137 |
*/ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
138 |
virtual QLayout * footerLayoutDefinition() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
139 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
140 |
return NULL; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
141 |
}; |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
142 |
|
6200 | 143 |
/** |
144 |
* @brief Used during page construction. |
|
145 |
* You can implement this method in your subclass. |
|
146 |
* |
|
8377 | 147 |
* Use it to define layout (not behavior) of the page's footer to the left of the help text. |
148 |
*/ |
|
149 |
virtual QLayout * footerLayoutLeftDefinition() |
|
150 |
{ |
|
151 |
return NULL; |
|
152 |
}; |
|
153 |
||
154 |
/** |
|
155 |
* @brief Used during page construction. |
|
156 |
* You can implement this method in your subclass. |
|
157 |
* |
|
6200 | 158 |
* This is a good place to connect signals within your page in order |
159 |
* to get the desired page behavior.<br /> |
|
160 |
* Keep in mind not to expose twidgets as public! |
|
161 |
* instead define a signal with a meaningful name and connect the widget |
|
162 |
* signals to your page signals |
|
163 |
*/ |
|
164 |
virtual void connectSignals() {}; |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
165 |
|
6200 | 166 |
/** |
167 |
* @brief Creates a default formatted button for this page. |
|
168 |
* |
|
169 |
* @param name name of the button - used as its text if not hasIcon. |
|
170 |
* @param hasIcon set to true if this is a picture button. |
|
171 |
* |
|
172 |
* @return the button. |
|
173 |
*/ |
|
6577 | 174 |
QPushButtonWithSound * formattedButton(const QString & name, bool hasIcon = false); |
7781
6505805e7f98
crude workaround for problem inu reported with sound button
nemo
parents:
6952
diff
changeset
|
175 |
QPushButton * formattedSoundlessButton(const QString & name, bool hasIcon = false); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
176 |
|
6200 | 177 |
/** |
178 |
* @brief Creates a default formatted button and adds it to a |
|
179 |
* grid layout at the location specified. |
|
180 |
* |
|
181 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
182 |
* @param grid pointer of the grid layout in which to insert the button. |
|
183 |
* @param row layout row index in which to insert the button. |
|
184 |
* @param column layout column index in which to insert the button. |
|
185 |
* @param rowSpan how many layout rows the button will span. |
|
186 |
* @param columnSpan how many layout columns the button will span. |
|
187 |
* @param hasIcon set to true if this is a picture button. |
|
11823
b421923c2577
Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
188 |
* @param alignment alignment of the button in the layout. |
6200 | 189 |
* |
190 |
* @return the button. |
|
191 |
*/ |
|
11823
b421923c2577
Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
192 |
QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false, Qt::Alignment alignment = 0); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
11823
diff
changeset
|
193 |
QPushButton * addSoundlessButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false, Qt::Alignment alignment = 0); |
684 | 194 |
|
6200 | 195 |
/** |
196 |
* @brief Creates a default formatted button and adds it to a |
|
197 |
* grid layout at the location specified. |
|
198 |
* |
|
199 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
200 |
* @param box pointer of the box layout in which to insert the button. |
|
201 |
* @param where layout ndex in which to insert the button. |
|
202 |
* @param hasIcon set to true if this is a picture button. |
|
11823
b421923c2577
Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
203 |
* @param alignment alignment of the button in the layout. |
6200 | 204 |
* |
205 |
* @return the button. |
|
206 |
*/ |
|
11823
b421923c2577
Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
207 |
QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false, Qt::Alignment alignment = 0); |
b421923c2577
Neatly align all the bottom buttons on the same height
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
208 |
QPushButton* addSoundlessButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false, Qt::Alignment alignment = 0); |
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
209 |
|
6200 | 210 |
/** |
211 |
* @brief Changes visibility of the back-button. |
|
212 |
* |
|
213 |
* @param visible set to true if the button should be visible. |
|
214 |
*/ |
|
6042
8b5345758f62
some more cleanups/refactoring/blahblah, some button positions may are a bit off atm. also I added a new picture for one of the buttons
sheepluva
parents:
6038
diff
changeset
|
215 |
void setBackButtonVisible(bool visible = true); |
692 | 216 |
|
6200 | 217 |
QFont * font14; ///< used font |
684 | 218 |
|
6477 | 219 |
QLabel * descLabel; ///< text description |
220 |
QString * defautDesc; |
|
221 |
||
6577 | 222 |
QPushButtonWithSound * btnBack; ///< back button |
684 | 223 |
}; |
224 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
225 |
#endif |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
226 |