author | unc0rr |
Mon, 26 Sep 2011 21:45:33 +0400 | |
changeset 6040 | a740069c21e3 |
parent 6038 | 58d9badf3e7f |
child 6042 | 8b5345758f62 |
permissions | -rw-r--r-- |
6038
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
1 |
/* |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
3 |
* Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com> |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
4 |
* |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
8 |
* |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
13 |
* |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
17 |
*/ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
18 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
19 |
#include "AbstractPage.h" |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
20 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
21 |
AbstractPage::AbstractPage(QWidget* parent) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
22 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
23 |
Q_UNUSED(parent); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
24 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
25 |
font14 = new QFont("MS Shell Dlg", 14); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
26 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
27 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
28 |
QPushButton * AbstractPage::formattedButton(const QString & btname, bool hasIcon) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
29 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
30 |
QPushButton* btn = new QPushButton(this); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
31 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
32 |
if (hasIcon) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
33 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
34 |
const QIcon& lp=QIcon(btname); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
35 |
QSize sz = lp.actualSize(QSize(65535, 65535)); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
36 |
btn->setIcon(lp); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
37 |
btn->setFixedSize(sz); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
38 |
btn->setIconSize(sz); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
39 |
btn->setFlat(true); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
40 |
btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
41 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
42 |
else |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
43 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
44 |
btn->setFont(*font14); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
45 |
btn->setText(btname); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
46 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
47 |
return btn; |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
48 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
49 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
50 |
QPushButton * AbstractPage::addButton(const QString & btname, QGridLayout* grid, int wy, int wx, bool hasIcon) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
51 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
52 |
QPushButton* btn = formattedButton(btname, hasIcon); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
53 |
grid->addWidget(btn, wy, wx); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
54 |
return btn; |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
55 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
56 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
57 |
QPushButton * AbstractPage::addButton(const QString & btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, bool hasIcon) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
58 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
59 |
QPushButton* btn = formattedButton(btname, hasIcon); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
60 |
grid->addWidget(btn, wy, wx, rowSpan, columnSpan); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
61 |
return btn; |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
62 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
63 |
|
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
64 |
QPushButton * AbstractPage::addButton(const QString & btname, QBoxLayout* box, int where, bool hasIcon) |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
65 |
{ |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
66 |
QPushButton* btn = formattedButton(btname, hasIcon); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
67 |
box->addWidget(btn, where); |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
68 |
return btn; |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
69 |
} |
58d9badf3e7f
wow, somebody was smoking some reaaally good sh!t right there, man!
sheepluva
parents:
diff
changeset
|
70 |