author | Wuzzy <Wuzzy2@mail.ru> |
Wed, 25 Oct 2017 23:09:41 +0200 | |
changeset 12768 | ad67a3804981 |
parent 12691 | d5e09024d722 |
child 13232 | 26c739440bef |
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 |
11046 | 3 |
* Copyright (c) 2004-2015 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 |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
5078
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 |
|
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
35 |
#include "physfs.h" |
6930 | 36 |
#include "DataManager.h" |
8374 | 37 |
#include "hatbutton.h" |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
38 |
|
6196 | 39 |
#include "pageeditteam.h" |
40 |
||
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
|
41 |
QLayout * PageEditTeam::bodyLayoutDefinition() |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
42 |
{ |
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
|
43 |
QGridLayout * pageLayout = new QGridLayout(); |
8346 | 44 |
tbw = new QTabWidget(); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
45 |
QWidget * page1 = new QWidget(this); |
8346 | 46 |
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")); |
47 |
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
|
48 |
tbw->addTab(page1, tr("General")); |
8346 | 49 |
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
|
50 |
pageLayout->addWidget(tbw, 0, 0, 1, 3); |
6024 | 51 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
52 |
QHBoxLayout * page1Layout = new QHBoxLayout(page1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
53 |
page1Layout->setAlignment(Qt::AlignTop); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
54 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
55 |
// ====== Page 1 ====== |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
56 |
QVBoxLayout * vbox1 = new QVBoxLayout(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
57 |
QVBoxLayout * vbox2 = new QVBoxLayout(); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
58 |
page1Layout->addLayout(vbox1); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
59 |
page1Layout->addLayout(vbox2); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
60 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
61 |
GBoxHedgehogs = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
62 |
GBoxHedgehogs->setTitle(QGroupBox::tr("Team Members")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
63 |
GBoxHedgehogs->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
64 |
QGridLayout * GBHLayout = new QGridLayout(GBoxHedgehogs); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
65 |
|
6953
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;"); |
|
12254
d23695f96290
Move random team button of of team members box
Wuzzy <almikes@aol.com>
parents:
12253
diff
changeset
|
81 |
GBHLayout->addWidget(HHNameEdit[i], i + 1, 1, 1, 2); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
82 |
|
12253
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
83 |
btnRandomHogName[i] = addButton(":/res/dice.png", GBHLayout, i + 1, 5, 1, 1, true); |
8374 | 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 |
|
12253
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
88 |
btnRandomHats = new QPushButton(); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
89 |
btnRandomHats->setText(tr("Random Hats")); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
90 |
btnRandomHats->setStyleSheet("padding: 6px 10px;"); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
91 |
GBHLayout->addWidget(btnRandomHats, 9, 1, 1, 1, Qt::AlignCenter); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
92 |
btnRandomHats->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
93 |
|
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
94 |
btnRandomNames = new QPushButton(); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
95 |
btnRandomNames->setText(tr("Random Names")); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
96 |
btnRandomNames->setStyleSheet("padding: 6px 10px;"); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
97 |
GBHLayout->addWidget(btnRandomNames, 9, 2, 1, 1, Qt::AlignCenter); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
98 |
btnRandomNames->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
99 |
|
12254
d23695f96290
Move random team button of of team members box
Wuzzy <almikes@aol.com>
parents:
12253
diff
changeset
|
100 |
vbox1->addWidget(GBoxHedgehogs); |
d23695f96290
Move random team button of of team members box
Wuzzy <almikes@aol.com>
parents:
12253
diff
changeset
|
101 |
|
8374 | 102 |
btnRandomTeam = new QPushButton(); |
103 |
btnRandomTeam->setText(tr("Random Team")); |
|
104 |
btnRandomTeam->setStyleSheet("padding: 6px 10px;"); |
|
105 |
btnRandomTeam->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
12254
d23695f96290
Move random team button of of team members box
Wuzzy <almikes@aol.com>
parents:
12253
diff
changeset
|
106 |
vbox1->addWidget(btnRandomTeam, 0, Qt::AlignCenter); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
107 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
108 |
GBoxTeam = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
109 |
GBoxTeam->setTitle(QGroupBox::tr("Team Settings")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
110 |
GBoxTeam->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
111 |
QGridLayout * GBTLayout = new QGridLayout(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
112 |
QLabel * 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("Name")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
114 |
GBTLayout->addWidget(tmpLabel, 0, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
115 |
tmpLabel = new QLabel(GBoxTeam); |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
116 |
tmpLabel->setText(QLabel::tr("Player")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
117 |
GBTLayout->addWidget(tmpLabel, 1, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
118 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
119 |
tmpLabel->setText(QLabel::tr("Grave")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
120 |
GBTLayout->addWidget(tmpLabel, 2, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
121 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
122 |
tmpLabel->setText(QLabel::tr("Flag")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
123 |
GBTLayout->addWidget(tmpLabel, 3, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
124 |
tmpLabel = new QLabel(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
125 |
tmpLabel->setText(QLabel::tr("Voice")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
126 |
GBTLayout->addWidget(tmpLabel, 4, 0); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
127 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
128 |
TeamNameEdit = new QLineEdit(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
129 |
TeamNameEdit->setMaxLength(64); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
130 |
TeamNameEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
131 |
GBTLayout->addWidget(TeamNameEdit, 0, 1, 1, 2); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
132 |
vbox2->addWidget(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
133 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
134 |
CBTeamLvl = new QComboBox(GBoxTeam); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
135 |
CBTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
136 |
CBTeamLvl->setIconSize(QSize(32, 32)); |
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
137 |
CBTeamLvl->addItem(QIcon(":/res/botlevels/small0.png"), QComboBox::tr("Human")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
138 |
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
|
139 |
CBTeamLvl->addItem( |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
140 |
QIcon(QString(":/res/botlevels/small%1.png").arg(6 - i)), |
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
141 |
QComboBox::tr("Computer (Level %1)").arg(i) |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
142 |
); |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
143 |
CBTeamLvl->setFixedHeight(38); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
144 |
GBTLayout->addWidget(CBTeamLvl, 1, 1, 1, 2); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
145 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
146 |
CBGrave = new QComboBox(GBoxTeam); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
147 |
CBGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
148 |
CBGrave->setMaxCount(65535); |
11677
98545abbedb3
Increase size of drop-down lists in team editor
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
149 |
CBGrave->setMaxVisibleItems(20); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
150 |
CBGrave->setIconSize(QSize(32, 32)); |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
151 |
CBGrave->setFixedHeight(44); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
152 |
GBTLayout->addWidget(CBGrave, 2, 1, 1, 2); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
153 |
|
12255
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
154 |
// Player flags, combobox to select flag |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
155 |
CBFlag = new QComboBox(GBoxTeam); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
156 |
CBFlag->setMaxCount(65535); |
11677
98545abbedb3
Increase size of drop-down lists in team editor
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
157 |
CBFlag->setMaxVisibleItems(50); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
158 |
CBFlag->setIconSize(QSize(22, 15)); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
159 |
CBFlag->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
160 |
GBTLayout->addWidget(CBFlag, 3, 1, 1, 2); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
161 |
|
12255
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
162 |
// CPU level flag. Static image, only displayed when computer player is selected |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
163 |
QImage imgBotlevels = QImage("physfs://Graphics/botlevels.png"); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
164 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
165 |
int botlevelOffsets[5]= { 19, 14, 10, 6, 0 }; |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
166 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
167 |
for(int i=0; i<5; i++) { |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
168 |
QImage imgCPU = QImage("physfs://Graphics/Flags/cpu.png"); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
169 |
QPainter painter(&imgCPU); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
170 |
painter.drawImage(botlevelOffsets[i], 0, imgBotlevels, botlevelOffsets[i]); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
171 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
172 |
pixCPU[i] = QPixmap::fromImage(imgCPU); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
173 |
} |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
174 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
175 |
QHBoxLayout* hboxCPU = new QHBoxLayout(); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
176 |
hboxCPU->setContentsMargins(0, 0, 0, 0); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
177 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
178 |
hboxCPUWidget = new QWidget(); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
179 |
hboxCPUWidget->setLayout(hboxCPU); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
180 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
181 |
CPUFlag = new QLabel(); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
182 |
CPUFlag->setPixmap(pixCPU[0]); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
183 |
CPUFlag->setFixedHeight(38); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
184 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
185 |
hboxCPU->addWidget(CPUFlag); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
186 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
187 |
CPUFlagLabel = new QLabel("CPU"); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
188 |
CPUFlagLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
189 |
hboxCPU->addWidget(CPUFlagLabel); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
190 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
191 |
hboxCPUWidget->setHidden(true); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
192 |
GBTLayout->addWidget(hboxCPUWidget, 3, 1, 1, 1); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
193 |
|
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
194 |
btnRandomTeamName = addButton(":/res/dice.png", GBTLayout, 0, 3, 1, 1, true); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
195 |
btnRandomTeamName->setWhatsThis(tr("Randomize the team name")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
196 |
|
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
197 |
btnRandomGrave = addButton(":/res/dice.png", GBTLayout, 2, 3, 1, 1, true); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
198 |
btnRandomGrave->setWhatsThis(tr("Randomize the grave")); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
199 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
200 |
btnRandomFlag = addButton(":/res/dice.png", GBTLayout, 3, 3, 1, 1, true); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
201 |
btnRandomFlag->setWhatsThis(tr("Randomize the flag")); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
202 |
|
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
|
203 |
CBVoicepack = new QComboBox(GBoxTeam); |
11677
98545abbedb3
Increase size of drop-down lists in team editor
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
204 |
CBVoicepack->setMaxVisibleItems(50); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
205 |
CBVoicepack->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
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
|
206 |
|
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
207 |
GBTLayout->addWidget(CBVoicepack, 4, 1, 1, 1); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
208 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
209 |
btnTestSound = addSoundlessButton(":/res/PlaySound.png", GBTLayout, 4, 2, 1, 1, true); |
12128
4027903ff3e7
updates to polish translation by alzen, also add two unlocalised string he found in the gui
nemo
parents:
11814
diff
changeset
|
210 |
btnTestSound->setWhatsThis(tr("Play a random example of this voice")); |
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
|
211 |
|
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
212 |
btnRandomVoice = addButton(":/res/dice.png", GBTLayout, 4, 3, 1, 1, true); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
213 |
btnRandomVoice->setWhatsThis(tr("Randomize the voice")); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
214 |
|
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
215 |
GBoxFort = new QGroupBox(this); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
216 |
GBoxFort->setTitle(QGroupBox::tr("Fort")); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
217 |
QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
218 |
CBFort = new QComboBox(GBoxFort); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
219 |
CBFort->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); |
11813
ffe6e1344ebd
Team editor: Make bot icons and graves more visible in closed drop-down lists, smaller botlevel images
Wuzzy <almikes@aol.com>
parents:
11677
diff
changeset
|
220 |
CBFort->setMaxVisibleItems(25); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
221 |
CBFort->setMaxCount(65535); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
222 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
223 |
GBFLayout->addWidget(CBFort, 0, 0); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
224 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
225 |
btnRandomFort = addButton(":/res/dice.png", GBFLayout, 0, 2, 1, 1, true); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
226 |
btnRandomFort->setWhatsThis(tr("Randomize the fort")); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
227 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
228 |
FortPreview = new SquareLabel(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
229 |
FortPreview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
230 |
FortPreview->setMinimumSize(128, 128); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
231 |
FortPreview->setPixmap(QPixmap()); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
232 |
// 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
|
233 |
//FortPreview->setAttribute(Qt::WA_PaintOnScreen, true); |
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
234 |
GBFLayout->addWidget(FortPreview, 1, 0, 1, 2); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
235 |
vbox2->addWidget(GBoxFort); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
236 |
|
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
|
237 |
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
|
238 |
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
|
239 |
|
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
|
240 |
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
|
241 |
} |
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 |
|
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
|
243 |
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
|
244 |
{ |
6525
6c97379c584b
[GCI] backz task: unify the back button functionality, avoid using the save button
m4tx
parents:
6212
diff
changeset
|
245 |
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
|
246 |
} |
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
|
247 |
|
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
|
248 |
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
|
249 |
{ |
8384 | 250 |
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
|
251 |
|
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
|
252 |
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
|
253 |
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
|
254 |
|
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
|
255 |
connect(signalMapper1, SIGNAL(mapped(int)), this, SLOT(fixHHname(int))); |
12249 | 256 |
connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomHogName(int))); |
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
|
257 |
|
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
|
258 |
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
|
259 |
{ |
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
|
260 |
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
|
261 |
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
|
262 |
|
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
|
263 |
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
|
264 |
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
|
265 |
} |
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
|
266 |
|
12249 | 267 |
connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomTeam())); |
12253
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
268 |
connect(btnRandomNames, SIGNAL(clicked()), this, SLOT(setRandomHogNames())); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
269 |
connect(btnRandomHats, SIGNAL(clicked()), this, SLOT(setRandomHats())); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
270 |
|
12255
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
271 |
connect(CBTeamLvl, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBTeamLvl_activated(const int))); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
272 |
|
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
273 |
connect(btnRandomTeamName, SIGNAL(clicked()), this, SLOT(setRandomTeamName())); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
274 |
connect(btnRandomGrave, SIGNAL(clicked()), this, SLOT(setRandomGrave())); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
275 |
connect(btnRandomFlag, SIGNAL(clicked()), this, SLOT(setRandomFlag())); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
276 |
connect(btnRandomVoice, SIGNAL(clicked()), this, SLOT(setRandomVoice())); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
277 |
connect(btnRandomFort, SIGNAL(clicked()), this, SLOT(setRandomFort())); |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
278 |
|
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
|
279 |
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
|
280 |
|
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
281 |
connect(CBFort, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBFort_activated(const int))); |
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
|
282 |
} |
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
|
283 |
|
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
284 |
PageEditTeam::PageEditTeam(QWidget* parent) : |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
285 |
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
|
286 |
{ |
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
|
287 |
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
|
288 |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
289 |
m_playerHash = "0000000000000000000000000000000000000000"; |
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
290 |
m_loaded = false; |
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
291 |
} |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
292 |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
293 |
void PageEditTeam::lazyLoad() |
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
294 |
{ |
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
295 |
if(m_loaded) return; |
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
296 |
m_loaded = true; |
9738 | 297 |
qDebug("[LAZINESS] PageEditTeam::lazyLoad()"); |
298 |
||
299 |
HatModel * hatsModel = DataManager::instance().hatModel(); |
|
300 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
301 |
HHHats[i]->setModel(hatsModel); |
|
302 |
||
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
|
303 |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
304 |
QRegExp pngSuffix("\\.png$"); |
6930 | 305 |
DataManager & dataMgr = DataManager::instance(); |
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
|
306 |
QStringList list; |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
307 |
|
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
|
308 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
309 |
// voicepacks |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
310 |
list = dataMgr.entryList("Sounds/voices", |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
311 |
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
|
312 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
313 |
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
|
314 |
|
12690
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
315 |
QIcon dlcIcon; |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
316 |
dlcIcon.addFile(":/res/dlcMarker.png", QSize(), QIcon::Normal, QIcon::On); |
12691 | 317 |
dlcIcon.addFile(":/res/dlcMarkerSelected.png", QSize(), QIcon::Selected, QIcon::On); |
12690
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
318 |
QPixmap emptySpace = QPixmap(7, 15); |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
319 |
emptySpace.fill(QColor(0, 0, 0, 0)); |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
320 |
QIcon notDlcIcon = QIcon(emptySpace); |
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
|
321 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
322 |
// forts |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
323 |
list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png")); |
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
324 |
foreach (QString file, list) |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
325 |
{ |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
326 |
QString fortPath = PHYSFS_getRealDir(QString("Forts/%1").arg(file).toLocal8Bit().data()); |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
327 |
|
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
328 |
QString fort = file.replace(QRegExp("L\\.png$"), ""); |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
329 |
|
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
330 |
bool isDLC = !fortPath.startsWith(datadir->absolutePath()); |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
331 |
if (isDLC) |
12690
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
332 |
{ |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
333 |
CBFort->addItem(dlcIcon, fort, fort); |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
334 |
} |
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
335 |
else |
12690
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
336 |
{ |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
337 |
CBFort->addItem(notDlcIcon, fort, fort); |
ad1fd7ae479d
Mark custom maps/forts/scripts with circle icon instead of icon
Wuzzy <almikes@aol.com>
parents:
12689
diff
changeset
|
338 |
} |
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
339 |
|
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
340 |
} |
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
|
341 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
342 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
343 |
// graves |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
344 |
list = |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
345 |
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
|
346 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
347 |
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
|
348 |
{ |
8049 | 349 |
QPixmap pix("physfs://Graphics/Graves/" + file); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
350 |
if ((pix.height() > 32) || pix.width() > 32) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
351 |
pix = pix.copy(0, 0, 32, 32); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
352 |
QIcon icon(pix); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
353 |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
354 |
QString grave = file.remove(pngSuffix); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
355 |
|
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
|
356 |
CBGrave->addItem(icon, grave); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
357 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
358 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
359 |
// flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
360 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
361 |
list = |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
362 |
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
|
363 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
364 |
// skip cpu and hedgewars flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
365 |
int idx = list.indexOf("cpu.png"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
366 |
if (idx >= 0) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
367 |
list.removeAt(idx); |
7495 | 368 |
idx = list.indexOf("cpu_plain.png"); |
369 |
if (idx >= 0) |
|
370 |
list.removeAt(idx); |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
371 |
idx = list.indexOf("hedgewars.png"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
372 |
if (idx >= 0) |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
373 |
list.removeAt(idx); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
374 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
375 |
// add the default flag |
8049 | 376 |
QPixmap hwFlag("physfs://Graphics/Flags/hedgewars.png"); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
377 |
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
|
378 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
379 |
// add seperator after |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
380 |
CBFlag->insertSeparator(1); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
381 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
382 |
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
|
383 |
|
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
|
384 |
// add all country flags |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
385 |
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
|
386 |
{ |
8049 | 387 |
QIcon icon(QPixmap("physfs://Graphics/Flags/" + file)); |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
388 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
389 |
QString flag = QString(file).remove(pngSuffix); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
390 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
391 |
bool isCountryFlag = !file.startsWith("cm_"); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
392 |
|
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
393 |
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
|
394 |
{ |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
395 |
CBFlag->insertItem(insertAt, icon, flag.replace("_", " "), flag); |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
396 |
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
|
397 |
} |
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
398 |
else // append community flags at end |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
399 |
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
|
400 |
} |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
401 |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
402 |
// add separator between country flags and community flags |
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
403 |
CBFlag->insertSeparator(insertAt); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
404 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
405 |
|
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
|
406 |
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
|
407 |
{ |
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
|
408 |
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
|
409 |
|
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
|
410 |
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
|
411 |
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
|
412 |
} |
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
|
413 |
|
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
414 |
void PageEditTeam::CBFort_activated(const int index) |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
415 |
{ |
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
416 |
QString fortName = CBFort->itemData(index).toString(); |
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
417 |
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
|
418 |
FortPreview->setPixmap(pix); |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
419 |
} |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
420 |
|
12255
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
421 |
void PageEditTeam::CBTeamLvl_activated(const int index) |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
422 |
{ |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
423 |
CBFlag->setHidden(index != 0); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
424 |
btnRandomFlag->setHidden(index != 0); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
425 |
|
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
426 |
if(index > 0) |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
427 |
{ |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
428 |
int cpuLevel = 6 - index; |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
429 |
CPUFlag->setPixmap(pixCPU[cpuLevel - 1]); |
12479
42da9d8d82ab
Provide translator context for a few less obvious engine strings
Wuzzy <almikes@aol.com>
parents:
12301
diff
changeset
|
430 |
//: Name of a flag for computer-controlled enemies. %1 is replaced with the computer level |
12255
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
431 |
CPUFlagLabel->setText(tr("CPU %1").arg(cpuLevel)); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
432 |
} |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
433 |
hboxCPUWidget->setHidden(index == 0); |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
434 |
} |
05f1935175da
Team editor: Disable flag widget when selecting CPU team
Wuzzy <almikes@aol.com>
parents:
12254
diff
changeset
|
435 |
|
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
436 |
void PageEditTeam::testSound() |
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
437 |
{ |
6930 | 438 |
DataManager & dataMgr = DataManager::instance(); |
6196 | 439 |
|
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
440 |
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
|
441 |
|
6196 | 442 |
QStringList list = dataMgr.entryList( |
6616
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
443 |
voiceDir, |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
444 |
QDir::Files, |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
445 |
QStringList() << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
446 |
"Illgetyou.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
447 |
"Incoming.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
448 |
"Stupid.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
449 |
"Coward.ogg" << |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
450 |
"Firstblood.ogg" |
f77bb02b669f
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents:
6525
diff
changeset
|
451 |
); |
6165
6fe3e922246e
moving and renaming SDLs.*, making it a singleton; cleaning up class responsibilties wrt SDLInteraction; some comments
sheepluva
parents:
6060
diff
changeset
|
452 |
|
6167 | 453 |
if (!list.isEmpty()) |
8913 | 454 |
SDLInteraction::instance().playSoundFile("/" + voiceDir + "/" + |
8049 | 455 |
list[rand() % list.size()]); |
5078
3527f0e7bb21
Removing pages.cpp and splitting it up into various files.
Zorg <zorgiepoo@gmail.com>
parents:
diff
changeset
|
456 |
} |
6024 | 457 |
|
458 |
void PageEditTeam::createTeam(const QString & name, const QString & playerHash) |
|
459 |
{ |
|
460 |
m_playerHash = playerHash; |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
461 |
lazyLoad(); |
12674
bc34fc75670e
Fix old team name not being removed after renaming team in frontend
Wuzzy <almikes@aol.com>
parents:
12510
diff
changeset
|
462 |
OldTeamName = name; |
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
463 |
|
12247
09010333c947
Randomize forts and graves in new teams
Wuzzy <almikes@aol.com>
parents:
12128
diff
changeset
|
464 |
// Mostly create a default team, with 2 important exceptions: |
6024 | 465 |
HWTeam newTeam(name); |
12247
09010333c947
Randomize forts and graves in new teams
Wuzzy <almikes@aol.com>
parents:
12128
diff
changeset
|
466 |
// Randomize grave to make it less likely that default teams have equal graves (important for resurrector) |
12301
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12255
diff
changeset
|
467 |
HWNamegen::teamRandomGrave(newTeam, false); |
12247
09010333c947
Randomize forts and graves in new teams
Wuzzy <almikes@aol.com>
parents:
12128
diff
changeset
|
468 |
// Randomize fort for greater variety in fort mode with default teams |
12301
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12255
diff
changeset
|
469 |
HWNamegen::teamRandomFort(newTeam, false); |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12255
diff
changeset
|
470 |
// DLC forts and graves intentionally filtered out to prevent desyncs and missing grave error |
62975c0a89c6
Only select from default graves and forts for new themes
Wuzzy <almikes@aol.com>
parents:
12255
diff
changeset
|
471 |
// TODO: Remove DLC filter as soon it is not needed anymore |
6024 | 472 |
loadTeam(newTeam); |
473 |
} |
|
474 |
||
475 |
void PageEditTeam::editTeam(const QString & name, const QString & playerHash) |
|
476 |
{ |
|
477 |
m_playerHash = playerHash; |
|
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
478 |
lazyLoad(); |
12674
bc34fc75670e
Fix old team name not being removed after renaming team in frontend
Wuzzy <almikes@aol.com>
parents:
12510
diff
changeset
|
479 |
OldTeamName = name; |
9511
1be565d7b4b7
Fill PageEditTeam containers only when it is actually required:
unc0rr
parents:
9080
diff
changeset
|
480 |
|
6024 | 481 |
HWTeam team(name); |
482 |
team.loadFromFile(); |
|
483 |
loadTeam(team); |
|
484 |
} |
|
485 |
||
486 |
void PageEditTeam::deleteTeam(const QString & name) |
|
487 |
{ |
|
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
|
488 |
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
|
489 |
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
|
490 |
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
|
491 |
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
|
492 |
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
|
493 |
reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); |
6024 | 494 |
|
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
|
495 |
if (reallyDeleteMsg.exec() == QMessageBox::Ok) |
6024 | 496 |
HWTeam(name).deleteFile(); |
497 |
} |
|
498 |
||
12249 | 499 |
void PageEditTeam::setRandomTeam() |
6024 | 500 |
{ |
501 |
HWTeam team = data(); |
|
12510
82c75a317d48
Randomized teams now can have any random hats (not just from types.ini)
Wuzzy <almikes@aol.com>
parents:
12507
diff
changeset
|
502 |
HWNamegen::teamRandomEverything(team); |
12253
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
503 |
loadTeam(team); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
504 |
} |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
505 |
|
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
506 |
void PageEditTeam::setRandomHogNames() |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
507 |
{ |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
508 |
HWTeam team = data(); |
12510
82c75a317d48
Randomized teams now can have any random hats (not just from types.ini)
Wuzzy <almikes@aol.com>
parents:
12507
diff
changeset
|
509 |
HWNamegen::teamRandomHogNames(team); |
12253
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
510 |
loadTeam(team); |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
511 |
} |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
512 |
|
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
513 |
void PageEditTeam::setRandomHats() |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
514 |
{ |
07f67ee424dc
Add buttons to randomize hats and hog names only
Wuzzy <almikes@aol.com>
parents:
12250
diff
changeset
|
515 |
HWTeam team = data(); |
12507
f4b0e164a0d5
Chance that clicking the random hats button produces a set of equal hats
Wuzzy <almikes@aol.com>
parents:
12479
diff
changeset
|
516 |
HWNamegen::teamRandomHats(team); |
6024 | 517 |
loadTeam(team); |
518 |
} |
|
519 |
||
12249 | 520 |
void PageEditTeam::setRandomHogName(int hh_index) |
6024 | 521 |
{ |
522 |
HWTeam team = data(); |
|
12249 | 523 |
HWNamegen::teamRandomHogName(team,hh_index); |
6024 | 524 |
loadTeam(team); |
525 |
} |
|
526 |
||
12250
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
527 |
void PageEditTeam::setRandomTeamName() |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
528 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
529 |
HWTeam team = data(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
530 |
HWNamegen::teamRandomTeamName(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
531 |
loadTeam(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
532 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
533 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
534 |
void PageEditTeam::setRandomGrave() |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
535 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
536 |
HWTeam team = data(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
537 |
HWNamegen::teamRandomGrave(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
538 |
loadTeam(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
539 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
540 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
541 |
void PageEditTeam::setRandomFlag() |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
542 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
543 |
HWTeam team = data(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
544 |
HWNamegen::teamRandomFlag(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
545 |
loadTeam(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
546 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
547 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
548 |
void PageEditTeam::setRandomVoice() |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
549 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
550 |
HWTeam team = data(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
551 |
HWNamegen::teamRandomVoice(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
552 |
loadTeam(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
553 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
554 |
|
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
555 |
void PageEditTeam::setRandomFort() |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
556 |
{ |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
557 |
HWTeam team = data(); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
558 |
HWNamegen::teamRandomFort(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
559 |
loadTeam(team); |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
560 |
} |
5206f9a803d1
Allow to randomize team name, flag, grave, voice and fort seperately
Wuzzy <almikes@aol.com>
parents:
12249
diff
changeset
|
561 |
|
6024 | 562 |
void PageEditTeam::loadTeam(const HWTeam & team) |
563 |
{ |
|
8346 | 564 |
tbw->setCurrentIndex(0); |
565 |
binder->resetInterface(); |
|
8434 | 566 |
|
6024 | 567 |
TeamNameEdit->setText(team.name()); |
568 |
CBTeamLvl->setCurrentIndex(team.difficulty()); |
|
569 |
||
570 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
571 |
{ |
|
572 |
HWHog hh = team.hedgehog(i); |
|
573 |
||
574 |
HHNameEdit[i]->setText(hh.Name); |
|
575 |
||
576 |
if (hh.Hat.startsWith("Reserved")) |
|
6195
6c9ada03602d
* fixing my hat preview bug nemo pointed out (thanks!)
sheepluva
parents:
6167
diff
changeset
|
577 |
hh.Hat = "Reserved "+hh.Hat.remove(0,40); |
6024 | 578 |
|
8374 | 579 |
HHHats[i]->setCurrentHat(hh.Hat); |
6024 | 580 |
} |
581 |
||
582 |
CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
|
583 |
CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
|
584 |
||
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
585 |
CBFort->setCurrentIndex(CBFort->findData(team.fort())); |
6024 | 586 |
CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack())); |
587 |
||
7260 | 588 |
QStandardItemModel * binds = DataManager::instance().bindsModel(); |
6024 | 589 |
for(int i = 0; i < BINDS_NUMBER; i++) |
590 |
{ |
|
8346 | 591 |
if (team.keyBind(i).isEmpty()) continue; |
8434 | 592 |
|
7260 | 593 |
QModelIndexList mdl = binds->match(binds->index(0, 0), Qt::UserRole + 1, team.keyBind(i), 1, Qt::MatchExactly); |
594 |
||
595 |
if(mdl.size() == 1) |
|
8346 | 596 |
binder->setBindIndex(i, mdl[0].row()); |
7260 | 597 |
else |
598 |
qDebug() << "Binds: cannot find" << team.keyBind(i); |
|
6024 | 599 |
} |
600 |
} |
|
601 |
||
602 |
HWTeam PageEditTeam::data() |
|
603 |
{ |
|
12674
bc34fc75670e
Fix old team name not being removed after renaming team in frontend
Wuzzy <almikes@aol.com>
parents:
12510
diff
changeset
|
604 |
HWTeam team(OldTeamName); |
bc34fc75670e
Fix old team name not being removed after renaming team in frontend
Wuzzy <almikes@aol.com>
parents:
12510
diff
changeset
|
605 |
team.setName(TeamNameEdit->text()); |
6024 | 606 |
team.setDifficulty(CBTeamLvl->currentIndex()); |
607 |
||
608 |
for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++) |
|
609 |
{ |
|
610 |
HWHog hh; |
|
611 |
hh.Name = HHNameEdit[i]->text(); |
|
8374 | 612 |
hh.Hat = HHHats[i]->currentHat(); |
6024 | 613 |
|
614 |
if (hh.Hat.startsWith("Reserved")) |
|
615 |
hh.Hat = "Reserved"+m_playerHash+hh.Hat.remove(0,9); |
|
616 |
||
617 |
team.setHedgehog(i,hh); |
|
618 |
} |
|
619 |
||
620 |
team.setGrave(CBGrave->currentText()); |
|
12689
5f68b259305c
Mark custom forts with asterisk in team editor
Wuzzy <almikes@aol.com>
parents:
12675
diff
changeset
|
621 |
team.setFort(CBFort->itemData(CBFort->currentIndex()).toString()); |
6024 | 622 |
team.setVoicepack(CBVoicepack->currentText()); |
623 |
team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString()); |
|
624 |
||
7260 | 625 |
QStandardItemModel * binds = DataManager::instance().bindsModel(); |
6024 | 626 |
for(int i = 0; i < BINDS_NUMBER; i++) |
627 |
{ |
|
8346 | 628 |
team.bindKey(i, binds->index(binder->bindIndex(i), 0).data(Qt::UserRole + 1).toString()); |
6024 | 629 |
} |
630 |
||
631 |
return team; |
|
632 |
} |
|
633 |
||
634 |
void PageEditTeam::saveTeam() |
|
635 |
{ |
|
12675
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
636 |
HWTeam team = data(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
637 |
if(!team.wouldOverwriteOtherFile()) |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
638 |
{ |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
639 |
team.saveToFile(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
640 |
} |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
641 |
else |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
642 |
{ |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
643 |
// Name already used -> look for an appropriate name: |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
644 |
int i=2; |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
645 |
QString origName = team.name(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
646 |
QString newName; |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
647 |
while(team.wouldOverwriteOtherFile()) |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
648 |
{ |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
649 |
newName = tr("%1 (%2)").arg(origName).arg(i++); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
650 |
team.setName(newName); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
651 |
if(i > 1000) |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
652 |
break; |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
653 |
} |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
654 |
|
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
655 |
QMessageBox teamNameFixedMsg(this); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
656 |
teamNameFixedMsg.setIcon(QMessageBox::Warning); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
657 |
teamNameFixedMsg.setWindowTitle(QMessageBox::tr("Teams - Name already taken")); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
658 |
teamNameFixedMsg.setText(QMessageBox::tr("The team name '%1' is already taken, so your team has been renamed to '%2'.").arg(origName).arg(team.name())); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
659 |
teamNameFixedMsg.setWindowModality(Qt::WindowModal); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
660 |
teamNameFixedMsg.setStandardButtons(QMessageBox::Ok); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
661 |
teamNameFixedMsg.exec(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
662 |
|
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
663 |
team.saveToFile(); |
967990d958bc
Fix possibility to accidentally destroy team by entering an already existing team name
Wuzzy <almikes@aol.com>
parents:
12674
diff
changeset
|
664 |
} |
6024 | 665 |
} |
8346 | 666 |
|
667 |
// When the "Use default for all binds" is pressed... |
|
668 |
void PageEditTeam::resetAllBinds() |
|
669 |
{ |
|
670 |
for (int i = 0; i < BINDS_NUMBER; i++) |
|
671 |
binder->setBindIndex(i, 0); |
|
672 |
} |