author | Xeli |
Fri, 28 Oct 2011 17:41:39 +0200 | |
branch | hedgeroid |
changeset 6055 | 88cfcd9161d3 |
parent 6009 | 14f6fc9869f2 |
child 6038 | 58d9badf3e7f |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
4976 | 3 |
* Copyright (c) 2006-2011 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 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
19 |
#ifndef ABSTRACTPAGE_H |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
20 |
#define ABSTRACTPAGE_H |
184 | 21 |
|
22 |
#include <QWidget> |
|
684 | 23 |
#include <QPushButton> |
24 |
#include <QFont> |
|
25 |
#include <QGridLayout> |
|
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
26 |
#include <QComboBox> |
1840 | 27 |
#include <QSignalMapper> |
184 | 28 |
|
29 |
class QPushButton; |
|
30 |
class QGroupBox; |
|
31 |
class QComboBox; |
|
32 |
class QLabel; |
|
33 |
class QToolBox; |
|
34 |
class QLineEdit; |
|
665 | 35 |
class QListWidget; |
36 |
class QCheckBox; |
|
37 |
class QSpinBox; |
|
38 |
class QTextEdit; |
|
39 |
class QRadioButton; |
|
40 |
class QTableView; |
|
1377 | 41 |
class QTextBrowser; |
1399 | 42 |
class QTableWidget; |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
43 |
class QAction; |
1885 | 44 |
class QDataWidgetMapper; |
1887 | 45 |
class QAbstractItemModel; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2762
diff
changeset
|
46 |
class QSettings; |
3708
64e059b6f9c5
applied from experimental3D, use a slider to set up quality
koda
parents:
3695
diff
changeset
|
47 |
class QSlider; |
665 | 48 |
|
684 | 49 |
class AbstractPage : public QWidget |
50 |
{ |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
2915
diff
changeset
|
51 |
Q_OBJECT |
1885 | 52 |
|
6009 | 53 |
signals: |
54 |
void goBack(); |
|
684 | 55 |
|
56 |
protected: |
|
57 |
AbstractPage(QWidget* parent = 0) { |
|
4560
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
58 |
Q_UNUSED(parent); |
5d6c7f88db73
- Some work on drawMap widget and scene to allow undo, clear, save and load operations
unc0rr
parents:
4520
diff
changeset
|
59 |
|
684 | 60 |
font14 = new QFont("MS Shell Dlg", 14); |
4592
b1fe47b11b99
disable fix for issue 24 in order to fix issue 123, as suggested by koda
sheepluva
parents:
4586
diff
changeset
|
61 |
//setFocusPolicy(Qt::StrongFocus); |
684 | 62 |
} |
63 |
virtual ~AbstractPage() {}; |
|
64 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
65 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, bool iconed = false) { |
684 | 66 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
67 |
if (!iconed) { |
1148 | 68 |
butt->setFont(*font14); |
69 |
butt->setText(btname); |
|
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1399
diff
changeset
|
70 |
//butt->setStyleSheet("background-color: #0d0544"); |
1148 | 71 |
} else { |
72 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
73 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 74 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
75 |
butt->setFixedSize(sz); |
1148 | 76 |
butt->setIconSize(sz); |
77 |
butt->setFlat(true); |
|
1149 | 78 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 79 |
} |
684 | 80 |
grid->addWidget(butt, wy, wx); |
81 |
return butt; |
|
82 |
}; |
|
83 |
||
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
84 |
QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool iconed = false) { |
692 | 85 |
QPushButton* butt = new QPushButton(this); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
86 |
if (!iconed) { |
1148 | 87 |
butt->setFont(*font14); |
88 |
butt->setText(btname); |
|
89 |
} else { |
|
90 |
const QIcon& lp=QIcon(btname); |
|
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
91 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
1148 | 92 |
butt->setIcon(lp); |
1152
c72b939c00df
Make buttons border have different colors when mouse is over or it is pressed
unc0rr
parents:
1150
diff
changeset
|
93 |
butt->setFixedSize(sz); |
1148 | 94 |
butt->setIconSize(sz); |
95 |
butt->setFlat(true); |
|
1149 | 96 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
1148 | 97 |
} |
692 | 98 |
grid->addWidget(butt, wy, wx, rowSpan, columnSpan); |
99 |
return butt; |
|
100 |
}; |
|
101 |
||
1443 | 102 |
QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) { |
684 | 103 |
QPushButton* butt = new QPushButton(this); |
1443 | 104 |
if (!iconed) { |
105 |
butt->setFont(*font14); |
|
106 |
butt->setText(btname); |
|
107 |
} else { |
|
108 |
const QIcon& lp=QIcon(btname); |
|
109 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
|
110 |
butt->setIcon(lp); |
|
111 |
butt->setFixedSize(sz); |
|
112 |
butt->setIconSize(sz); |
|
113 |
butt->setFlat(true); |
|
114 |
butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
115 |
} |
|
684 | 116 |
box->addWidget(butt, where); |
117 |
return butt; |
|
118 |
}; |
|
119 |
||
120 |
QFont * font14; |
|
121 |
}; |
|
122 |
||
5205
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
123 |
#endif |
78138ae93820
some headers cleanup and rename of stats and playrecord pages for consistency
koda
parents:
5204
diff
changeset
|
124 |