author | koda |
Fri, 16 Nov 2012 06:14:18 +0100 | |
changeset 8048 | e14daa2508fc |
parent 7781 | 6505805e7f98 |
child 8377 | 869f80966a77 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
6952 | 3 |
* Copyright (c) 2004-2012 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 |
*/ |
|
73 |
void setDefautDescription(QString text); |
|
74 |
||
75 |
/** |
|
76 |
* @brief Get the desc defaut text |
|
77 |
*/ |
|
78 |
QString * getDefautDescription(); |
|
79 |
||
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
80 |
signals: |
6200 | 81 |
/** |
82 |
* @brief This signal is emitted when going back to the previous is |
|
83 |
* requested - e.g. when the back-button is clicked. |
|
84 |
*/ |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
85 |
void goBack(); |
684 | 86 |
|
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
6009
diff
changeset
|
87 |
protected: |
6200 | 88 |
/** |
89 |
* @brief Class constructor |
|
90 |
* |
|
91 |
* @param parent parent widget. |
|
92 |
*/ |
|
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
|
93 |
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
|
94 |
|
6200 | 95 |
/// Class Destructor |
96 |
virtual ~AbstractPage() {}; |
|
97 |
||
98 |
/// 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
|
99 |
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
|
100 |
|
6200 | 101 |
/** |
102 |
* @brief Used during page construction. |
|
103 |
* You MUST implement this method in your subclass. |
|
104 |
* |
|
105 |
* Use it to define the main layout (no behavior) of the page. |
|
106 |
*/ |
|
107 |
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
|
108 |
|
6200 | 109 |
/** |
110 |
* @brief Used during page construction. |
|
111 |
* You can implement this method in your subclass. |
|
112 |
* |
|
113 |
* Use it to define layout (not behavior) of the page's footer. |
|
114 |
*/ |
|
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
115 |
virtual QLayout * footerLayoutDefinition() |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
116 |
{ |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
117 |
return NULL; |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6577
diff
changeset
|
118 |
}; |
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
|
119 |
|
6200 | 120 |
/** |
121 |
* @brief Used during page construction. |
|
122 |
* You can implement this method in your subclass. |
|
123 |
* |
|
124 |
* This is a good place to connect signals within your page in order |
|
125 |
* to get the desired page behavior.<br /> |
|
126 |
* Keep in mind not to expose twidgets as public! |
|
127 |
* instead define a signal with a meaningful name and connect the widget |
|
128 |
* signals to your page signals |
|
129 |
*/ |
|
130 |
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
|
131 |
|
6200 | 132 |
/** |
133 |
* @brief Creates a default formatted button for this page. |
|
134 |
* |
|
135 |
* @param name name of the button - used as its text if not hasIcon. |
|
136 |
* @param hasIcon set to true if this is a picture button. |
|
137 |
* |
|
138 |
* @return the button. |
|
139 |
*/ |
|
6577 | 140 |
QPushButtonWithSound * formattedButton(const QString & name, bool hasIcon = false); |
7781
6505805e7f98
crude workaround for problem inu reported with sound button
nemo
parents:
6952
diff
changeset
|
141 |
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
|
142 |
|
6200 | 143 |
/** |
144 |
* @brief Creates a default formatted button and adds it to a |
|
145 |
* grid layout at the location specified. |
|
146 |
* |
|
147 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
148 |
* @param grid pointer of the grid layout in which to insert the button. |
|
149 |
* @param row layout row index in which to insert the button. |
|
150 |
* @param column layout column index in which to insert the button. |
|
151 |
* @param rowSpan how many layout rows the button will span. |
|
152 |
* @param columnSpan how many layout columns the button will span. |
|
153 |
* @param hasIcon set to true if this is a picture button. |
|
154 |
* |
|
155 |
* @return the button. |
|
156 |
*/ |
|
6577 | 157 |
QPushButtonWithSound * addButton(const QString & name, QGridLayout * grid, int row, int column, int rowSpan = 1, int columnSpan = 1, bool hasIcon = false); |
684 | 158 |
|
6200 | 159 |
/** |
160 |
* @brief Creates a default formatted button and adds it to a |
|
161 |
* grid layout at the location specified. |
|
162 |
* |
|
163 |
* @param name label or path to icon of the button (depends on hasIcon) |
|
164 |
* @param box pointer of the box layout in which to insert the button. |
|
165 |
* @param where layout ndex in which to insert the button. |
|
166 |
* @param hasIcon set to true if this is a picture button. |
|
167 |
* |
|
168 |
* @return the button. |
|
169 |
*/ |
|
6577 | 170 |
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
|
171 |
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
|
172 |
|
6200 | 173 |
/** |
174 |
* @brief Changes visibility of the back-button. |
|
175 |
* |
|
176 |
* @param visible set to true if the button should be visible. |
|
177 |
*/ |
|
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
|
178 |
void setBackButtonVisible(bool visible = true); |
692 | 179 |
|
6200 | 180 |
QFont * font14; ///< used font |
684 | 181 |
|
6477 | 182 |
QLabel * descLabel; ///< text description |
183 |
QString * defautDesc; |
|
184 |
||
6577 | 185 |
QPushButtonWithSound * btnBack; ///< back button |
684 | 186 |
}; |
187 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
188 |
#endif |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
189 |