author | Periklis Ntanasis <pntanasis@gmail.com> |
Tue, 27 Aug 2013 03:44:19 +0300 | |
branch | spacecampaign |
changeset 9588 | 797b8a41f8ca |
parent 9080 | 9b42757d7e71 |
child 9998 | 736015b847e3 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
9080 | 3 |
* Copyright (c) 2004-2013 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 |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
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. |
|
188 |
* |
|
189 |
* @return the button. |
|
190 |
*/ |
|
6577 | 191 |
QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false); |
684 | 192 |
|
6200 | 193 |
/** |
194 |
* @brief Creates a default formatted button and adds it to a |
|
195 |
* grid layout at the location specified. |
|
196 |
* |
|
197 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
198 |
* @param box pointer of the box layout in which to insert the button. |
|
199 |
* @param where layout ndex in which to insert the button. |
|
200 |
* @param hasIcon set to true if this is a picture button. |
|
201 |
* |
|
202 |
* @return the button. |
|
203 |
*/ |
|
6577 | 204 |
QPushButtonWithSound * addButton(const QString & name, QBoxLayout * box, int where, bool hasIcon = false); |
7781
6505805e7f98
crude workaround for problem inu reported with sound button
nemo
parents:
6952
diff
changeset
|
205 |
QPushButton* addSoundlessButton(const QString & name, QBoxLayout * box, int where, 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
|
206 |
|
6200 | 207 |
/** |
208 |
* @brief Changes visibility of the back-button. |
|
209 |
* |
|
210 |
* @param visible set to true if the button should be visible. |
|
211 |
*/ |
|
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
|
212 |
void setBackButtonVisible(bool visible = true); |
692 | 213 |
|
6200 | 214 |
QFont * font14; ///< used font |
684 | 215 |
|
6477 | 216 |
QLabel * descLabel; ///< text description |
217 |
QString * defautDesc; |
|
218 |
||
6577 | 219 |
QPushButtonWithSound * btnBack; ///< back button |
684 | 220 |
}; |
221 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
222 |
#endif |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
223 |