author | dag10 |
Mon, 14 Jan 2013 13:28:03 +0100 | |
changeset 8384 | a6e7a95f3b2e |
parent 8374 | 3a1708759c4f |
child 8385 | 9e8924ff9813 |
permissions | -rw-r--r-- |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
1 |
/* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
2 |
* Hedgewars, a free turn based strategy game |
6952 | 3 |
* Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
4 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
7 |
* the Free Software Foundation; version 2 of the License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
8 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
13 |
* |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
17 |
*/ |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
18 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
19 |
#include <QGridLayout> |
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:
6024
diff
changeset
|
20 |
#include <QHBoxLayout> |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
21 |
#include <QPushButton> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
22 |
#include <QComboBox> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
23 |
#include <QLabel> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
24 |
#include <QLineEdit> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
25 |
#include <QTabWidget> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
26 |
#include <QGroupBox> |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
27 |
#include <QToolBox> |
6024 | 28 |
#include <QMessageBox> |
7260 | 29 |
#include <QStandardItemModel> |
30 |
#include <QDebug> |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
31 |
#include "SquareLabel.h" |
5252 | 32 |
#include "HWApplication.h" |
8346 | 33 |
#include "keybinder.h" |
6196 | 34 |
|
6930 | 35 |
#include "DataManager.h" |
8374 | 36 |
#include "hatbutton.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
37 |
|
6196 | 38 |
#include "pageeditteam.h" |
39 |
||
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:
6024
diff
changeset
|
40 |
QLayout * PageEditTeam::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
41 |
{ |
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:
6024
diff
changeset
|
42 |
QGridLayout * pageLayout = new QGridLayout(); |
8346 | 43 |
tbw = new QTabWidget(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
44 |
QWidget * page1 = new QWidget(this); |
8346 | 45 |
binder = new KeyBinder(this, tr("Select an action to choose a custom key bind for this team"), tr("Use my default"), tr("Reset all binds")); |
46 |
connect(binder, SIGNAL(resetAllBinds()), this, SLOT(resetAllBinds())); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
47 |
tbw->addTab(page1, tr("General")); |
8346 | 48 |
tbw->addTab(binder, tr("Custom Controls")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
49 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
6024 | 50 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
51 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
52 |
page1Layout->setAlignment(Qt::AlignTop); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
53 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
54 |
// ====== Page 1 ====== |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
55 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
56 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
57 |
page1Layout->addLayout(vbox1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
58 |
page1Layout->addLayout(vbox2); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
59 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
60 |
GBoxHedgehogs = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
61 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
62 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
63 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
64 |
|
6953
4c2dd25630a7
* make HatModel update automatically (also renamed class and files)
sheepluva
parents:
6952
diff
changeset
|
65 |
HatModel * hatModel = DataManager::instance().hatModel(); |
4c2dd25630a7
* make HatModel update automatically (also renamed class and files)
sheepluva
parents:
6952
diff
changeset
|
66 |
|
8374 | 67 |
GBHLayout->addWidget(new QLabel(tr("Hat")), 0, 0); |
68 |
GBHLayout->addWidget(new QLabel(tr("Name")), 0, 1); |
|
69 |
||
6024 | 70 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
71 |
{ |
8374 | 72 |
HHHats[i] = new HatButton(GBoxHedgehogs); |
73 |
GBHLayout->addWidget(HHHats[i], i + 1, 0); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
74 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
75 |
HHNameEdit[i] = new QLineEdit(GBoxHedgehogs); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
76 |
HHNameEdit[i]->setMaxLength(64); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
77 |
HHNameEdit[i]->setMinimumWidth(120); |
8374 | 78 |
HHNameEdit[i]->setFixedHeight(36); |
79 |
HHNameEdit[i]->setWhatsThis(tr("This hedgehog's name")); |
|
80 |
HHNameEdit[i]->setStyleSheet("padding: 6px;"); |
|
81 |
GBHLayout->addWidget(HHNameEdit[i], i + 1, 1); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
82 |
|
8374 | 83 |
btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 3, 1, 1, true); |
84 |
btnRandomHogName[i]->setFixedHeight(HHNameEdit[i]->height()); |
|
85 |
btnRandomHogName[i]->setWhatsThis(tr("Randomize this hedgehog's name")); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
86 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
87 |
|
8374 | 88 |
btnRandomTeam = new QPushButton(); |
89 |
btnRandomTeam->setText(tr("Random Team")); |
|
90 |
btnRandomTeam->setStyleSheet("padding: 6px 10px;"); |
|
91 |
GBHLayout->addWidget(btnRandomTeam, 9, 0, 1, 4, Qt::AlignCenter); |
|
92 |
btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
93 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
94 |
vbox1->addWidget(GBoxHedgehogs); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
95 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
96 |
GBoxTeam = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
97 |
GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
98 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
99 |
QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
100 |
QLabel * tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
101 |
tmpLabel->setText(QLabel::tr("Name")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
102 |
GBTLayout->addWidget(tmpLabel, 0, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
103 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
104 |
tmpLabel->setText(QLabel::tr("Type")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
105 |
GBTLayout->addWidget(tmpLabel, 1, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
106 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
107 |
tmpLabel->setText(QLabel::tr("Grave")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
108 |
GBTLayout->addWidget(tmpLabel, 2, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
109 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
110 |
tmpLabel->setText(QLabel::tr("Flag")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
111 |
GBTLayout->addWidget(tmpLabel, 3, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
112 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
113 |
tmpLabel->setText(QLabel::tr("Voice")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
114 |
GBTLayout->addWidget(tmpLabel, 4, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
115 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
116 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
117 |
TeamNameEdit->setMaxLength(64); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
118 |
GBTLayout->addWidget(TeamNameEdit, 0, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
119 |
vbox2->addWidget(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
120 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
121 |
CBTeamLvl = new QComboBox(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
122 |
CBTeamLvl->setIconSize(QSize(48, 48)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
123 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
124 |
for(int i = 5; i > 0; i--) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
125 |
CBTeamLvl->addItem( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
126 |
QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
127 |
QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
128 |
); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
129 |
GBTLayout->addWidget(CBTeamLvl, 1, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
130 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
131 |
CBGrave = new QComboBox(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
132 |
CBGrave->setMaxCount(65535); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
133 |
CBGrave->setIconSize(QSize(32, 32)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
134 |
GBTLayout->addWidget(CBGrave, 2, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
135 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
136 |
CBFlag = new QComboBox(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
137 |
CBFlag->setMaxCount(65535); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
138 |
CBFlag->setIconSize(QSize(22, 15)); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
139 |
GBTLayout->addWidget(CBFlag, 3, 1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
140 |
|
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:
6024
diff
changeset
|
141 |
QHBoxLayout * hbox = new QHBoxLayout(); |
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:
6024
diff
changeset
|
142 |
CBVoicepack = new QComboBox(GBoxTeam); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
143 |
|
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:
6024
diff
changeset
|
144 |
hbox->addWidget(CBVoicepack, 100); |
7781
6505805e7f98
crude workaround for problem inu reported with sound button
nemo
parents:
7553
diff
changeset
|
145 |
btnTestSound = addSoundlessButton(":/res/PlaySound.png", hbox, 1, true); |
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:
6024
diff
changeset
|
146 |
hbox->setStretchFactor(btnTestSound, 1); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
147 |
|
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:
6024
diff
changeset
|
148 |
GBTLayout->addLayout(hbox, 4, 1); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
149 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
150 |
GBoxFort = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
151 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
152 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
153 |
CBFort = new QComboBox(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
154 |
CBFort->setMaxCount(65535); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
155 |
GBFLayout->addWidget(CBFort, 0, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
156 |
FortPreview = new SquareLabel(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
157 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
158 |
FortPreview->setMinimumSize(128, 128); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
159 |
FortPreview->setPixmap(QPixmap()); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
160 |
// perhaps due to handling its own paintevents, SquareLabel doesn't play nice with the stars |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
161 |
//FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
162 |
GBFLayout->addWidget(FortPreview, 1, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
163 |
vbox2->addWidget(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
164 |
|
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:
6024
diff
changeset
|
165 |
vbox1->addStretch(); |
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:
6024
diff
changeset
|
166 |
vbox2->addStretch(); |
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:
6024
diff
changeset
|
167 |
|
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:
6024
diff
changeset
|
168 |
return pageLayout; |
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:
6024
diff
changeset
|
169 |
} |
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:
6024
diff
changeset
|
170 |
|
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:
6024
diff
changeset
|
171 |
QLayout * PageEditTeam::footerLayoutDefinition() |
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:
6024
diff
changeset
|
172 |
{ |
6525
6c97379c584b
[GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents:
6212
diff
changeset
|
173 |
return NULL; |
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:
6024
diff
changeset
|
174 |
} |
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:
6024
diff
changeset
|
175 |
|
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:
6024
diff
changeset
|
176 |
void PageEditTeam::connectSignals() |
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:
6024
diff
changeset
|
177 |
{ |
8384 | 178 |
connect(this, SIGNAL(pageLeave()), this, SLOT(saveTeam())); |
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:
6024
diff
changeset
|
179 |
|
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:
6024
diff
changeset
|
180 |
signalMapper1 = new QSignalMapper(this); |
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:
6024
diff
changeset
|
181 |
signalMapper2 = new QSignalMapper(this); |
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:
6024
diff
changeset
|
182 |
|
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:
6024
diff
changeset
|
183 |
connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); |
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:
6024
diff
changeset
|
184 |
connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomName(int))); |
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:
6024
diff
changeset
|
185 |
|
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:
6024
diff
changeset
|
186 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
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:
6024
diff
changeset
|
187 |
{ |
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:
6024
diff
changeset
|
188 |
connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map())); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
189 |
signalMapper1->setMapping(HHNameEdit[i], i); |
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:
6024
diff
changeset
|
190 |
|
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:
6024
diff
changeset
|
191 |
connect(btnRandomHogName[i], SIGNAL(clicked()), signalMapper2, SLOT(map())); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
192 |
signalMapper2->setMapping(btnRandomHogName[i], i); |
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:
6024
diff
changeset
|
193 |
} |
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:
6024
diff
changeset
|
194 |
|
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:
6024
diff
changeset
|
195 |
connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomNames())); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
196 |
|
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:
6024
diff
changeset
|
197 |
connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
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:
6024
diff
changeset
|
198 |
|
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:
6024
diff
changeset
|
199 |
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
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:
6024
diff
changeset
|
200 |
} |
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:
6024
diff
changeset
|
201 |
|
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
202 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
203 |
AbstractPage(parent) |
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:
6024
diff
changeset
|
204 |
{ |
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:
6024
diff
changeset
|
205 |
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:
6024
diff
changeset
|
206 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
207 |
QRegExp pngSuffix("\\.png$"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
208 |
|
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:
6024
diff
changeset
|
209 |
m_playerHash = "0000000000000000000000000000000000000000"; |
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:
6024
diff
changeset
|
210 |
|
6930 | 211 |
DataManager & dataMgr = DataManager::instance(); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
212 |
|
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:
6024
diff
changeset
|
213 |
QStringList list; |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
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:
6024
diff
changeset
|
215 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
216 |
// voicepacks |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
217 |
list = dataMgr.entryList("Sounds/voices", |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
218 |
QDir::AllDirs | QDir::NoDotAndDotDot); |
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:
6024
diff
changeset
|
219 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
220 |
CBVoicepack->addItems(list); |
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:
6024
diff
changeset
|
221 |
|
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
222 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
223 |
// forts |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
224 |
list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png")); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
225 |
list.replaceInStrings(QRegExp("L\\.png$"), ""); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
226 |
CBFort->addItems(list); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
227 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
228 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
229 |
// graves |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
230 |
list = |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
231 |
dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
232 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
233 |
foreach (QString file, list) |
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:
6024
diff
changeset
|
234 |
{ |
8049 | 235 |
QPixmap pix("physfs://Graphics/Graves/" + file); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
236 |
if ((pix.height() > 32) || pix.width() > 32) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
237 |
pix = pix.copy(0, 0, 32, 32); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
238 |
QIcon icon(pix); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
239 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
240 |
QString grave = QString(file).remove(pngSuffix); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
241 |
|
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:
6024
diff
changeset
|
242 |
CBGrave->addItem(icon, grave); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
243 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
244 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
245 |
// flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
246 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
247 |
list = |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
248 |
dataMgr.entryList("Graphics/Flags", QDir::Files, QStringList("*.png")); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
249 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
250 |
// skip cpu and hedgewars flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
251 |
int idx = list.indexOf("cpu.png"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
252 |
if (idx >= 0) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
253 |
list.removeAt(idx); |
7495 | 254 |
idx = list.indexOf("cpu_plain.png"); |
255 |
if (idx >= 0) |
|
256 |
list.removeAt(idx); |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
257 |
idx = list.indexOf("hedgewars.png"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
258 |
if (idx >= 0) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
259 |
list.removeAt(idx); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
260 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
261 |
// add the default flag |
8049 | 262 |
QPixmap hwFlag("physfs://Graphics/Flags/hedgewars.png"); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
263 |
CBFlag->addItem(QIcon(hwFlag.copy(0, 0, 22, 15)), "Hedgewars", "hedgewars"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
264 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
265 |
// add seperator after |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
266 |
CBFlag->insertSeparator(1); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
267 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
268 |
int insertAt = 2; // insert country flags after Hedgewars flag and seperator |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
269 |
|
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
270 |
// add all country flags |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
271 |
foreach (const QString & file, list) |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
272 |
{ |
8049 | 273 |
QIcon icon(QPixmap("physfs://Graphics/Flags/" + file)); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
274 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
275 |
QString flag = QString(file).remove(pngSuffix); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
276 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
277 |
bool isCountryFlag = !file.startsWith("cm_"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
278 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
279 |
if (isCountryFlag) |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
280 |
{ |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
281 |
CBFlag->insertItem(insertAt, icon, flag.replace("_", " "), flag); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
282 |
insertAt++; |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
283 |
} |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
284 |
else // append community flags at end |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
285 |
CBFlag->addItem(icon, flag.replace("cm_", QComboBox::tr("Community") + ": "), flag); |
5238
46ddaf14509d
Enable ~/.hedgewars/Data (or platform equivalent) to override/extend pretty much everything in system Data dir. Obviously desyncing can occur, so this is at user's own risk. Should simplify map etc install. Needs testing.
nemo
parents:
5204
diff
changeset
|
286 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
287 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
288 |
// add separator between country flags and community flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
289 |
CBFlag->insertSeparator(insertAt); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
290 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
291 |
|
5907
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
292 |
void PageEditTeam::fixHHname(int idx) |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
293 |
{ |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
294 |
HHNameEdit[idx]->setText(HHNameEdit[idx]->text().trimmed()); |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
295 |
|
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
296 |
if (HHNameEdit[idx]->text().isEmpty()) |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
297 |
HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
298 |
} |
64ccc6be0ec5
team edit: restore default hedgehog name if name is empty- since empty names are not supported and will lead to errors; also lupdate
sheepluva
parents:
5886
diff
changeset
|
299 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
300 |
void PageEditTeam::CBFort_activated(const QString & fortname) |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
301 |
{ |
8049 | 302 |
QPixmap pix("physfs://Forts/" + fortname + "L.png"); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
303 |
FortPreview->setPixmap(pix); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
304 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
305 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
306 |
void PageEditTeam::testSound() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
307 |
{ |
6930 | 308 |
DataManager & dataMgr = DataManager::instance(); |
6196 | 309 |
|
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
310 |
QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText(); |
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
311 |
|
6196 | 312 |
QStringList list = dataMgr.entryList( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
313 |
voiceDir, |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
314 |
QDir::Files, |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
315 |
QStringList() << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
316 |
"Illgetyou.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
317 |
"Incoming.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
318 |
"Stupid.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
319 |
"Coward.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
320 |
"Firstblood.ogg" |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
321 |
); |
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
322 |
|
6167 | 323 |
if (!list.isEmpty()) |
8049 | 324 |
SDLInteraction::instance().playSoundFile("physfs://" + voiceDir + "/" + |
325 |
list[rand() % list.size()]); |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
326 |
} |
6024 | 327 |
|
328 |
void PageEditTeam::createTeam(const QString & name, const QString & playerHash) |
|
329 |
{ |
|
330 |
m_playerHash = playerHash; |
|
331 |
HWTeam newTeam(name); |
|
332 |
loadTeam(newTeam); |
|
333 |
} |
|
334 |
||
335 |
void PageEditTeam::editTeam(const QString & name, const QString & playerHash) |
|
336 |
{ |
|
337 |
m_playerHash = playerHash; |
|
338 |
HWTeam team(name); |
|
339 |
team.loadFromFile(); |
|
340 |
loadTeam(team); |
|
341 |
} |
|
342 |
||
343 |
void PageEditTeam::deleteTeam(const QString & name) |
|
344 |
{ |
|
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
345 |
QMessageBox reallyDeleteMsg(this); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
346 |
reallyDeleteMsg.setIcon(QMessageBox::Question); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
347 |
reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Teams - Are you sure?")); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
348 |
reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the team '%1'?").arg(name)); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
349 |
reallyDeleteMsg.setWindowModality(Qt::WindowModal); |
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
350 |
reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
6024 | 351 |
|
7794
ab7b94c03bc9
QMessageBox overhaul: unify buttons, style and appearance of info dialogs, fixing a few typos and return values along the way
koda
parents:
7781
diff
changeset
|
352 |
if (reallyDeleteMsg.exec() == QMessageBox::Ok) |
6024 | 353 |
HWTeam(name).deleteFile(); |
354 |
} |
|
355 |
||
356 |
void PageEditTeam::setRandomNames() |
|
357 |
{ |
|
358 |
HWTeam team = data(); |
|
359 |
HWNamegen::teamRandomNames(team, true); |
|
360 |
loadTeam(team); |
|
361 |
} |
|
362 |
||
363 |
void PageEditTeam::setRandomName(int hh_index) |
|
364 |
{ |
|
365 |
HWTeam team = data(); |
|
366 |
HWNamegen::teamRandomName(team,hh_index); |
|
367 |
loadTeam(team); |
|
368 |
} |
|
369 |
||
370 |
void PageEditTeam::loadTeam(const HWTeam & team) |
|
371 |
{ |
|
8346 | 372 |
tbw->setCurrentIndex(0); |
373 |
binder->resetInterface(); |
|
374 |
||
6024 | 375 |
TeamNameEdit->setText(team.name()); |
376 |
CBTeamLvl->setCurrentIndex(team.difficulty()); |
|
377 |
||
378 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
379 |
{ |
|
380 |
HWHog hh = team.hedgehog(i); |
|
381 |
||
382 |
HHNameEdit[i]->setText(hh.Name); |
|
383 |
||
384 |
if (hh.Hat.startsWith("Reserved")) |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
385 |
hh.Hat = "Reserved "+hh.Hat.remove(0,40); |
6024 | 386 |
|
8374 | 387 |
HHHats[i]->setCurrentHat(hh.Hat); |
6024 | 388 |
} |
389 |
||
390 |
CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
|
391 |
CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
|
392 |
||
393 |
CBFort->setCurrentIndex(CBFort->findText(team.fort())); |
|
394 |
CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack())); |
|
395 |
||
7260 | 396 |
QStandardItemModel * binds = DataManager::instance().bindsModel(); |
6024 | 397 |
for(int i = 0; i < BINDS_NUMBER; i++) |
398 |
{ |
|
8346 | 399 |
if (team.keyBind(i).isEmpty()) continue; |
400 |
||
7260 | 401 |
QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, team.keyBind(i), 1, Qt::MatchExactly); |
402 |
||
403 |
if(mdl.size() == 1) |
|
8346 | 404 |
binder->setBindIndex(i, mdl[0].row()); |
7260 | 405 |
else |
406 |
qDebug() << "Binds: cannot find" << team.keyBind(i); |
|
6024 | 407 |
} |
408 |
} |
|
409 |
||
410 |
HWTeam PageEditTeam::data() |
|
411 |
{ |
|
412 |
HWTeam team(TeamNameEdit->text()); |
|
413 |
team.setDifficulty(CBTeamLvl->currentIndex()); |
|
414 |
||
415 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
416 |
{ |
|
417 |
HWHog hh; |
|
418 |
hh.Name = HHNameEdit[i]->text(); |
|
8374 | 419 |
hh.Hat = HHHats[i]->currentHat(); |
6024 | 420 |
|
421 |
if (hh.Hat.startsWith("Reserved")) |
|
422 |
hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9); |
|
423 |
||
424 |
team.setHedgehog(i,hh); |
|
425 |
} |
|
426 |
||
427 |
team.setGrave(CBGrave->currentText()); |
|
428 |
team.setFort(CBFort->currentText()); |
|
429 |
team.setVoicepack(CBVoicepack->currentText()); |
|
430 |
team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString()); |
|
431 |
||
7260 | 432 |
QStandardItemModel * binds = DataManager::instance().bindsModel(); |
6024 | 433 |
for(int i = 0; i < BINDS_NUMBER; i++) |
434 |
{ |
|
8346 | 435 |
team.bindKey(i, binds->index(binder->bindIndex(i), 0).data(Qt::UserRole + 1).toString()); |
6024 | 436 |
} |
437 |
||
438 |
return team; |
|
439 |
} |
|
440 |
||
441 |
void PageEditTeam::saveTeam() |
|
442 |
{ |
|
443 |
data().saveToFile(); |
|
444 |
} |
|
8346 | 445 |
|
446 |
// When the "Use default for all binds" is pressed... |
|
447 |
void PageEditTeam::resetAllBinds() |
|
448 |
{ |
|
449 |
for (int i = 0; i < BINDS_NUMBER; i++) |
|
450 |
binder->setBindIndex(i, 0); |
|
451 |
} |