|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com> |
|
4 * |
|
5 * This program is free software; you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation; version 2 of the License |
|
8 * |
|
9 * This program is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 * GNU General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU General Public License |
|
15 * along with this program; if not, write to the Free Software |
|
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 */ |
|
18 |
|
19 #include <QGridLayout> |
|
20 #include <QHBoxLayout> |
|
21 #include <QPushButton> |
|
22 #include <QGroupBox> |
|
23 #include <QComboBox> |
|
24 #include <QLabel> |
|
25 #include <QLineEdit> |
|
26 #include <QMessageBox> |
|
27 #include <QDataWidgetMapper> |
|
28 #include <QSpinBox> |
|
29 |
|
30 #include "ammoSchemeModel.h" |
|
31 #include "pagescheme.h" |
|
32 #include "misc.h" |
|
33 |
|
34 |
|
35 QLayout * PageScheme::bodyLayoutDefinition() |
|
36 { |
|
37 QGridLayout * pageLayout = new QGridLayout(); |
|
38 QGroupBox * gb = new QGroupBox(this); |
|
39 |
|
40 QGridLayout * gl = new QGridLayout(); |
|
41 gb->setLayout(gl); |
|
42 QSizePolicy sp; |
|
43 sp.setVerticalPolicy(QSizePolicy::MinimumExpanding); |
|
44 sp.setHorizontalPolicy(QSizePolicy::Expanding); |
|
45 |
|
46 pageLayout->addWidget(gb, 1,0,13,5); |
|
47 |
|
48 gbGameModes = new QGroupBox(QGroupBox::tr("Game Modifiers"), gb); |
|
49 gbBasicSettings = new QGroupBox(QGroupBox::tr("Basic Settings"), gb); |
|
50 |
|
51 // TODO name stuff and put CSS into main style sheet |
|
52 gbGameModes->setStyleSheet(".QGroupBox {" |
|
53 "background-color: #130f2c; background-image:url();" |
|
54 "}"); |
|
55 gbBasicSettings->setStyleSheet(".QGroupBox {" |
|
56 "background-color: #130f2c; background-image:url();" |
|
57 "}"); |
|
58 |
|
59 gbGameModes->setSizePolicy(sp); |
|
60 gbBasicSettings->setSizePolicy(sp); |
|
61 gl->addWidget(gbGameModes,0,0,1,3,Qt::AlignTop); |
|
62 gl->addWidget(gbBasicSettings,0,3,1,3,Qt::AlignTop); |
|
63 |
|
64 QGridLayout * glGMLayout = new QGridLayout(gbGameModes); |
|
65 QGridLayout * glBSLayout = new QGridLayout(gbBasicSettings); |
|
66 gbGameModes->setLayout(glGMLayout); |
|
67 gbBasicSettings->setLayout(glBSLayout); |
|
68 // Left |
|
69 |
|
70 TBW_mode_Forts = new ToggleButtonWidget(gbGameModes, ":/res/btnForts.png"); |
|
71 TBW_mode_Forts->setToolTip("<b>" + ToggleButtonWidget::tr("Fort Mode") + "</b>:<br />" + tr("Defend your fort and destroy the opponents, two team colours max!")); |
|
72 glGMLayout->addWidget(TBW_mode_Forts,0,0,1,1); |
|
73 |
|
74 TBW_teamsDivide = new ToggleButtonWidget(gbGameModes, ":/res/btnTeamsDivide.png"); |
|
75 TBW_teamsDivide->setToolTip("<b>" + ToggleButtonWidget::tr("Divide Teams") + "</b>:<br />" + tr("Teams will start on opposite sides of the terrain, two team colours max!")); |
|
76 glGMLayout->addWidget(TBW_teamsDivide,0,1,1,1); |
|
77 |
|
78 TBW_solid = new ToggleButtonWidget(gbGameModes, ":/res/btnSolid.png"); |
|
79 TBW_solid->setToolTip("<b>" + ToggleButtonWidget::tr("Solid Land") + "</b>:<br />" + tr("Land can not be destroyed!")); |
|
80 glGMLayout->addWidget(TBW_solid,0,2,1,1); |
|
81 |
|
82 TBW_border = new ToggleButtonWidget(gbGameModes, ":/res/btnBorder.png"); |
|
83 TBW_border->setToolTip("<b>" + ToggleButtonWidget::tr("Add Border") + "</b>:<br />" + tr("Add an indestructible border around the terrain")); |
|
84 glGMLayout->addWidget(TBW_border,0,3,1,1); |
|
85 |
|
86 TBW_lowGravity = new ToggleButtonWidget(gbGameModes, ":/res/btnLowGravity.png"); |
|
87 TBW_lowGravity->setToolTip("<b>" + ToggleButtonWidget::tr("Low Gravity") + "</b>:<br />" + tr("Lower gravity")); |
|
88 glGMLayout->addWidget(TBW_lowGravity,0,4,1,1); |
|
89 |
|
90 TBW_laserSight = new ToggleButtonWidget(gbGameModes, ":/res/btnLaserSight.png"); |
|
91 TBW_laserSight->setToolTip("<b>" + ToggleButtonWidget::tr("Laser Sight") + "</b>:<br />" + tr("Assisted aiming with laser sight")); |
|
92 glGMLayout->addWidget(TBW_laserSight,1,0,1,1); |
|
93 |
|
94 TBW_invulnerable = new ToggleButtonWidget(gbGameModes, ":/res/btnInvulnerable.png"); |
|
95 TBW_invulnerable->setToolTip("<b>" + ToggleButtonWidget::tr("Invulnerable") + "</b>:<br />" + tr("All hogs have a personal forcefield")); |
|
96 glGMLayout->addWidget(TBW_invulnerable,1,1,1,1); |
|
97 |
|
98 TBW_resethealth = new ToggleButtonWidget(gbGameModes, ":/res/btnResetHealth.png"); |
|
99 TBW_resethealth->setToolTip("<b>" + ToggleButtonWidget::tr("Reset Health") + "</b>:<br />" + tr("All (living) hedgehogs are fully restored at the end of turn")); |
|
100 glGMLayout->addWidget(TBW_resethealth,1,2,1,1); |
|
101 |
|
102 TBW_vampiric = new ToggleButtonWidget(gbGameModes, ":/res/btnVampiric.png"); |
|
103 TBW_vampiric->setToolTip("<b>" + ToggleButtonWidget::tr("Vampirism") + "</b>:<br />" + tr("Gain 80% of the damage you do back in health")); |
|
104 glGMLayout->addWidget(TBW_vampiric,1,3,1,1); |
|
105 |
|
106 TBW_karma = new ToggleButtonWidget(gbGameModes, ":/res/btnKarma.png"); |
|
107 TBW_karma->setToolTip("<b>" + ToggleButtonWidget::tr("Karma") + "</b>:<br />" + tr("Share your opponents pain, share their damage")); |
|
108 glGMLayout->addWidget(TBW_karma,1,4,1,1); |
|
109 |
|
110 TBW_artillery = new ToggleButtonWidget(gbGameModes, ":/res/btnArtillery.png"); |
|
111 TBW_artillery->setToolTip("<b>" + ToggleButtonWidget::tr("Artillery") + "</b>:<br />" + tr("Your hogs are unable to move, put your artillery skills to the test")); |
|
112 glGMLayout->addWidget(TBW_artillery,2,0,1,1); |
|
113 |
|
114 TBW_randomorder = new ToggleButtonWidget(gbGameModes, ":/res/btnRandomOrder.png"); |
|
115 TBW_randomorder->setToolTip("<b>" + ToggleButtonWidget::tr("Random Order") + "</b>:<br />" + tr("Order of play is random instead of in room order.")); |
|
116 glGMLayout->addWidget(TBW_randomorder,2,1,1,1); |
|
117 |
|
118 TBW_king = new ToggleButtonWidget(gbGameModes, ":/res/btnKing.png"); |
|
119 TBW_king->setToolTip("<b>" + ToggleButtonWidget::tr("King") + "</b>:<br />" + tr("Play with a King. If he dies, your side dies.")); |
|
120 glGMLayout->addWidget(TBW_king,2,2,1,1); |
|
121 |
|
122 TBW_placehog = new ToggleButtonWidget(gbGameModes, ":/res/btnPlaceHog.png"); |
|
123 TBW_placehog->setToolTip("<b>" + ToggleButtonWidget::tr("Place Hedgehogs") + "</b>:<br />" + tr("Take turns placing your hedgehogs before the start of play.")); |
|
124 glGMLayout->addWidget(TBW_placehog,2,3,1,1); |
|
125 |
|
126 TBW_sharedammo = new ToggleButtonWidget(gbGameModes, ":/res/btnSharedAmmo.png"); |
|
127 TBW_sharedammo->setToolTip("<b>" + ToggleButtonWidget::tr("Clan Shares Ammo") + "</b>:<br />" + tr("Ammo is shared between all teams that share a colour.")); |
|
128 glGMLayout->addWidget(TBW_sharedammo,2,4,1,1); |
|
129 |
|
130 TBW_disablegirders = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableGirders.png"); |
|
131 TBW_disablegirders->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Girders") + "</b>:<br />" + tr("Disable girders when generating random maps.")); |
|
132 glGMLayout->addWidget(TBW_disablegirders,3,0,1,1); |
|
133 |
|
134 TBW_disablelandobjects = new ToggleButtonWidget(gbGameModes, ":/res/btnDisableLandObjects.png"); |
|
135 TBW_disablelandobjects->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Land Objects") + "</b>:<br />" + tr("Disable land objects when generating random maps.")); |
|
136 glGMLayout->addWidget(TBW_disablelandobjects,3,1,1,1); |
|
137 |
|
138 TBW_aisurvival = new ToggleButtonWidget(gbGameModes, ":/res/btnAISurvival.png"); |
|
139 TBW_aisurvival->setToolTip("<b>" + ToggleButtonWidget::tr("AI Survival Mode") + "</b>:<br />" + tr("AI respawns on death.")); |
|
140 glGMLayout->addWidget(TBW_aisurvival,3,2,1,1); |
|
141 |
|
142 TBW_infattack = new ToggleButtonWidget(gbGameModes, ":/res/btnInfAttack.png"); |
|
143 TBW_infattack->setToolTip("<b>" + ToggleButtonWidget::tr("Unlimited Attacks") + "</b>:<br />" + tr("Attacking does not end your turn.")); |
|
144 glGMLayout->addWidget(TBW_infattack,3,3,1,1); |
|
145 |
|
146 TBW_resetweps = new ToggleButtonWidget(gbGameModes, ":/res/btnResetWeps.png"); |
|
147 TBW_resetweps->setToolTip("<b>" + ToggleButtonWidget::tr("Reset Weapons") + "</b>:<br />" + tr("Weapons are reset to starting values each turn.")); |
|
148 glGMLayout->addWidget(TBW_resetweps,3,4,1,1); |
|
149 |
|
150 TBW_perhogammo = new ToggleButtonWidget(gbGameModes, ":/res/btnPerHogAmmo.png"); |
|
151 TBW_perhogammo->setToolTip("<b>" + ToggleButtonWidget::tr("Per Hedgehog Ammo") + "</b>:<br />" + tr("Each hedgehog has its own ammo. It does not share with the team.")); |
|
152 glGMLayout->addWidget(TBW_perhogammo,4,0,1,1); |
|
153 |
|
154 TBW_nowind = new ToggleButtonWidget(gbGameModes, ":/res/btnNoWind.png"); |
|
155 TBW_nowind->setToolTip("<b>" + ToggleButtonWidget::tr("Disable Wind") + "</b>:<br />" + tr("You will not have to worry about wind anymore.")); |
|
156 glGMLayout->addWidget(TBW_nowind,4,1,1,1); |
|
157 |
|
158 TBW_morewind = new ToggleButtonWidget(gbGameModes, ":/res/btnMoreWind.png"); |
|
159 TBW_morewind->setToolTip("<b>" + ToggleButtonWidget::tr("More Wind") + "</b>:<br />" + tr("Wind will affect almost everything.")); |
|
160 glGMLayout->addWidget(TBW_morewind,4,2,1,1); |
|
161 |
|
162 TBW_tagteam = new ToggleButtonWidget(gbGameModes, ":/res/btnTagTeam.png"); |
|
163 TBW_tagteam->setToolTip("<b>" + ToggleButtonWidget::tr("Tag Team") + "</b>:<br />" + tr("Teams in each clan take successive turns sharing their turn time.")); |
|
164 glGMLayout->addWidget(TBW_tagteam,4,3,1,1); |
|
165 |
|
166 TBW_bottomborder = new ToggleButtonWidget(gbGameModes, ":/res/btnBottomBorder.png"); |
|
167 TBW_bottomborder->setToolTip("<b>" + ToggleButtonWidget::tr("Add Bottom Border") + "</b>:<br />" + tr("Add an indestructible border along the bottom")); |
|
168 glGMLayout->addWidget(TBW_bottomborder,4,4,1,1); |
|
169 |
|
170 |
|
171 // Right |
|
172 QLabel * l; |
|
173 |
|
174 l = new QLabel(gbBasicSettings); |
|
175 l->setText(QLabel::tr("Damage Modifier")); |
|
176 l->setWordWrap(true); |
|
177 glBSLayout->addWidget(l,0,0,1,1); |
|
178 l = new QLabel(gbBasicSettings); |
|
179 l->setFixedSize(32,32); |
|
180 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
|
181 glBSLayout->addWidget(l,0,1,1,1); |
|
182 SB_DamageModifier = new QSpinBox(gbBasicSettings); |
|
183 SB_DamageModifier->setRange(10, 300); |
|
184 SB_DamageModifier->setValue(100); |
|
185 SB_DamageModifier->setSingleStep(25); |
|
186 glBSLayout->addWidget(SB_DamageModifier,0,2,1,1); |
|
187 |
|
188 l = new QLabel(gbBasicSettings); |
|
189 l->setText(QLabel::tr("Turn Time")); |
|
190 l->setWordWrap(true); |
|
191 glBSLayout->addWidget(l,1,0,1,1); |
|
192 l = new QLabel(gbBasicSettings); |
|
193 l->setFixedSize(32,32); |
|
194 l->setPixmap(QPixmap(":/res/iconTime.png")); |
|
195 glBSLayout->addWidget(l,1,1,1,1); |
|
196 SB_TurnTime = new QSpinBox(gbBasicSettings); |
|
197 SB_TurnTime->setRange(1, 9999); |
|
198 SB_TurnTime->setValue(45); |
|
199 SB_TurnTime->setSingleStep(15); |
|
200 glBSLayout->addWidget(SB_TurnTime,1,2,1,1); |
|
201 |
|
202 l = new QLabel(gbBasicSettings); |
|
203 l->setText(QLabel::tr("Initial Health")); |
|
204 l->setWordWrap(true); |
|
205 glBSLayout->addWidget(l,2,0,1,1); |
|
206 l = new QLabel(gbBasicSettings); |
|
207 l->setFixedSize(32,32); |
|
208 l->setPixmap(QPixmap(":/res/iconHealth.png")); |
|
209 glBSLayout->addWidget(l,2,1,1,1); |
|
210 SB_InitHealth = new QSpinBox(gbBasicSettings); |
|
211 SB_InitHealth->setRange(50, 200); |
|
212 SB_InitHealth->setValue(100); |
|
213 SB_InitHealth->setSingleStep(25); |
|
214 glBSLayout->addWidget(SB_InitHealth,2,2,1,1); |
|
215 |
|
216 l = new QLabel(gbBasicSettings); |
|
217 l->setText(QLabel::tr("Sudden Death Timeout")); |
|
218 l->setWordWrap(true); |
|
219 glBSLayout->addWidget(l,3,0,1,1); |
|
220 l = new QLabel(gbBasicSettings); |
|
221 l->setFixedSize(32,32); |
|
222 l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); |
|
223 glBSLayout->addWidget(l,3,1,1,1); |
|
224 SB_SuddenDeath = new QSpinBox(gbBasicSettings); |
|
225 SB_SuddenDeath->setRange(0, 50); |
|
226 SB_SuddenDeath->setValue(15); |
|
227 SB_SuddenDeath->setSingleStep(3); |
|
228 glBSLayout->addWidget(SB_SuddenDeath,3,2,1,1); |
|
229 |
|
230 l = new QLabel(gbBasicSettings); |
|
231 l->setText(QLabel::tr("Sudden Death Water Rise")); |
|
232 l->setWordWrap(true); |
|
233 glBSLayout->addWidget(l,4,0,1,1); |
|
234 l = new QLabel(gbBasicSettings); |
|
235 l->setFixedSize(32,32); |
|
236 l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon |
|
237 glBSLayout->addWidget(l,4,1,1,1); |
|
238 SB_WaterRise = new QSpinBox(gbBasicSettings); |
|
239 SB_WaterRise->setRange(0, 100); |
|
240 SB_WaterRise->setValue(47); |
|
241 SB_WaterRise->setSingleStep(5); |
|
242 glBSLayout->addWidget(SB_WaterRise,4,2,1,1); |
|
243 |
|
244 l = new QLabel(gbBasicSettings); |
|
245 l->setText(QLabel::tr("Sudden Death Health Decrease")); |
|
246 l->setWordWrap(true); |
|
247 glBSLayout->addWidget(l,5,0,1,1); |
|
248 l = new QLabel(gbBasicSettings); |
|
249 l->setFixedSize(32,32); |
|
250 l->setPixmap(QPixmap(":/res/iconSuddenDeath.png")); // TODO: icon |
|
251 glBSLayout->addWidget(l,5,1,1,1); |
|
252 SB_HealthDecrease = new QSpinBox(gbBasicSettings); |
|
253 SB_HealthDecrease->setRange(0, 100); |
|
254 SB_HealthDecrease->setValue(5); |
|
255 SB_HealthDecrease->setSingleStep(1); |
|
256 glBSLayout->addWidget(SB_HealthDecrease,5,2,1,1); |
|
257 |
|
258 l = new QLabel(gbBasicSettings); |
|
259 l->setText(QLabel::tr("% Rope Length")); |
|
260 l->setWordWrap(true); |
|
261 glBSLayout->addWidget(l,6,0,1,1); |
|
262 l = new QLabel(gbBasicSettings); |
|
263 l->setFixedSize(32,32); |
|
264 l->setPixmap(QPixmap(":/res/iconRope.png")); |
|
265 glBSLayout->addWidget(l,6,1,1,1); |
|
266 SB_RopeModifier = new QSpinBox(gbBasicSettings); |
|
267 SB_RopeModifier->setRange(25, 999); |
|
268 SB_RopeModifier->setValue(100); |
|
269 SB_RopeModifier->setSingleStep(25); |
|
270 glBSLayout->addWidget(SB_RopeModifier,6,2,1,1); |
|
271 |
|
272 l = new QLabel(gbBasicSettings); |
|
273 l->setText(QLabel::tr("Crate Drops")); |
|
274 l->setWordWrap(true); |
|
275 glBSLayout->addWidget(l,7,0,1,1); |
|
276 l = new QLabel(gbBasicSettings); |
|
277 l->setFixedSize(32,32); |
|
278 l->setPixmap(QPixmap(":/res/iconBox.png")); |
|
279 glBSLayout->addWidget(l,7,1,1,1); |
|
280 SB_CaseProb = new FreqSpinBox(gbBasicSettings); |
|
281 SB_CaseProb->setRange(0, 9); |
|
282 SB_CaseProb->setValue(5); |
|
283 glBSLayout->addWidget(SB_CaseProb,7,2,1,1); |
|
284 |
|
285 l = new QLabel(gbBasicSettings); |
|
286 l->setText(QLabel::tr("% Health Crates")); |
|
287 l->setWordWrap(true); |
|
288 glBSLayout->addWidget(l,8,0,1,1); |
|
289 l = new QLabel(gbBasicSettings); |
|
290 l->setFixedSize(32,32); |
|
291 l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon |
|
292 glBSLayout->addWidget(l,8,1,1,1); |
|
293 SB_HealthCrates = new QSpinBox(gbBasicSettings); |
|
294 SB_HealthCrates->setRange(0, 100); |
|
295 SB_HealthCrates->setValue(35); |
|
296 SB_HealthCrates->setSingleStep(5); |
|
297 glBSLayout->addWidget(SB_HealthCrates,8,2,1,1); |
|
298 |
|
299 l = new QLabel(gbBasicSettings); |
|
300 l->setText(QLabel::tr("Health in Crates")); |
|
301 l->setWordWrap(true); |
|
302 glBSLayout->addWidget(l,9,0,1,1); |
|
303 l = new QLabel(gbBasicSettings); |
|
304 l->setFixedSize(32,32); |
|
305 l->setPixmap(QPixmap(":/res/iconHealth.png")); // TODO: icon |
|
306 glBSLayout->addWidget(l,9,1,1,1); |
|
307 SB_CrateHealth = new QSpinBox(gbBasicSettings); |
|
308 SB_CrateHealth->setRange(0, 200); |
|
309 SB_CrateHealth->setValue(25); |
|
310 SB_CrateHealth->setSingleStep(5); |
|
311 glBSLayout->addWidget(SB_CrateHealth,9,2,1,1); |
|
312 |
|
313 l = new QLabel(gbBasicSettings); |
|
314 l->setText(QLabel::tr("Mines Time")); |
|
315 l->setWordWrap(true); |
|
316 glBSLayout->addWidget(l,10,0,1,1); |
|
317 l = new QLabel(gbBasicSettings); |
|
318 l->setFixedSize(32,32); |
|
319 l->setPixmap(QPixmap(":/res/iconTime.png")); // TODO: icon |
|
320 glBSLayout->addWidget(l,10,1,1,1); |
|
321 SB_MinesTime = new QSpinBox(gbBasicSettings); |
|
322 SB_MinesTime->setRange(-1, 5); |
|
323 SB_MinesTime->setValue(3); |
|
324 SB_MinesTime->setSingleStep(1); |
|
325 SB_MinesTime->setSpecialValueText(tr("Random")); |
|
326 SB_MinesTime->setSuffix(" "+ tr("Seconds")); |
|
327 glBSLayout->addWidget(SB_MinesTime,10,2,1,1); |
|
328 |
|
329 l = new QLabel(gbBasicSettings); |
|
330 l->setText(QLabel::tr("Mines")); |
|
331 l->setWordWrap(true); |
|
332 glBSLayout->addWidget(l,11,0,1,1); |
|
333 l = new QLabel(gbBasicSettings); |
|
334 l->setFixedSize(32,32); |
|
335 l->setPixmap(QPixmap(":/res/iconMine.png")); // TODO: icon |
|
336 glBSLayout->addWidget(l,11,1,1,1); |
|
337 SB_Mines = new QSpinBox(gbBasicSettings); |
|
338 SB_Mines->setRange(0, 80); |
|
339 SB_Mines->setValue(0); |
|
340 SB_Mines->setSingleStep(5); |
|
341 glBSLayout->addWidget(SB_Mines,11,2,1,1); |
|
342 |
|
343 l = new QLabel(gbBasicSettings); |
|
344 l->setText(QLabel::tr("% Dud Mines")); |
|
345 l->setWordWrap(true); |
|
346 glBSLayout->addWidget(l,12,0,1,1); |
|
347 l = new QLabel(gbBasicSettings); |
|
348 l->setFixedSize(32,32); |
|
349 l->setPixmap(QPixmap(":/res/iconDud.png")); |
|
350 glBSLayout->addWidget(l,12,1,1,1); |
|
351 SB_MineDuds = new QSpinBox(gbBasicSettings); |
|
352 SB_MineDuds->setRange(0, 100); |
|
353 SB_MineDuds->setValue(0); |
|
354 SB_MineDuds->setSingleStep(5); |
|
355 glBSLayout->addWidget(SB_MineDuds,12,2,1,1); |
|
356 |
|
357 l = new QLabel(gbBasicSettings); |
|
358 l->setText(QLabel::tr("Explosives")); |
|
359 l->setWordWrap(true); |
|
360 glBSLayout->addWidget(l,13,0,1,1); |
|
361 l = new QLabel(gbBasicSettings); |
|
362 l->setFixedSize(32,32); |
|
363 l->setPixmap(QPixmap(":/res/iconDamage.png")); |
|
364 glBSLayout->addWidget(l,13,1,1,1); |
|
365 SB_Explosives = new QSpinBox(gbBasicSettings); |
|
366 SB_Explosives->setRange(0, 40); |
|
367 SB_Explosives->setValue(0); |
|
368 SB_Explosives->setSingleStep(1); |
|
369 glBSLayout->addWidget(SB_Explosives,13,2,1,1); |
|
370 |
|
371 l = new QLabel(gbBasicSettings); |
|
372 l->setText(QLabel::tr("% Get Away Time")); |
|
373 l->setWordWrap(true); |
|
374 glBSLayout->addWidget(l,14,0,1,1); |
|
375 l = new QLabel(gbBasicSettings); |
|
376 l->setFixedSize(32,32); |
|
377 l->setPixmap(QPixmap(":/res/iconTime.png")); |
|
378 glBSLayout->addWidget(l,14,1,1,1); |
|
379 SB_GetAwayTime = new QSpinBox(gbBasicSettings); |
|
380 SB_GetAwayTime->setRange(0, 999); |
|
381 SB_GetAwayTime->setValue(100); |
|
382 SB_GetAwayTime->setSingleStep(25); |
|
383 glBSLayout->addWidget(SB_GetAwayTime,14,2,1,1); |
|
384 |
|
385 l = new QLabel(gbBasicSettings); |
|
386 l->setText(QLabel::tr("Scheme Name:")); |
|
387 |
|
388 LE_name = new QLineEdit(this); |
|
389 |
|
390 gl->addWidget(LE_name,15,1,1,5); |
|
391 gl->addWidget(l,15,0,1,1); |
|
392 |
|
393 return pageLayout; |
|
394 } |
|
395 |
|
396 QLayout * PageScheme::footerLayoutDefinition() |
|
397 { |
|
398 QHBoxLayout * bottomLayout = new QHBoxLayout(); |
|
399 selectScheme = new QComboBox(this); |
|
400 |
|
401 bottomLayout->addWidget(selectScheme, 0); |
|
402 BtnCopy = addButton(tr("Copy"), bottomLayout, 1); |
|
403 BtnNew = addButton(tr("New"), bottomLayout, 2); |
|
404 BtnDelete = addButton(tr("Delete"), bottomLayout, 3); |
|
405 |
|
406 bottomLayout->setStretch(1,1); |
|
407 bottomLayout->setStretch(2,1); |
|
408 bottomLayout->setStretch(3,1); |
|
409 |
|
410 return bottomLayout; |
|
411 } |
|
412 |
|
413 void PageScheme::connectSignals() |
|
414 { |
|
415 connect(BtnCopy, SIGNAL(clicked()), this, SLOT(copyRow())); |
|
416 connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow())); |
|
417 connect(BtnDelete, SIGNAL(clicked()), this, SLOT(deleteRow())); |
|
418 mapper = new QDataWidgetMapper(this); |
|
419 connect(selectScheme, SIGNAL(currentIndexChanged(int)), mapper, SLOT(setCurrentIndex(int))); |
|
420 connect(selectScheme, SIGNAL(currentIndexChanged(int)), this, SLOT(schemeSelected(int))); |
|
421 } |
|
422 |
|
423 PageScheme::PageScheme(QWidget* parent) : AbstractPage(parent) |
|
424 { |
|
425 initPage(); |
|
426 } |
|
427 |
|
428 void PageScheme::setModel(QAbstractItemModel * model) |
|
429 { |
|
430 mapper->setModel(model); |
|
431 selectScheme->setModel(model); |
|
432 |
|
433 mapper->addMapping(LE_name, 0); |
|
434 mapper->addMapping(TBW_mode_Forts, 1); |
|
435 mapper->addMapping(TBW_teamsDivide, 2); |
|
436 mapper->addMapping(TBW_solid, 3); |
|
437 mapper->addMapping(TBW_border, 4); |
|
438 mapper->addMapping(TBW_lowGravity, 5); |
|
439 mapper->addMapping(TBW_laserSight, 6); |
|
440 mapper->addMapping(TBW_invulnerable, 7); |
|
441 mapper->addMapping(TBW_resethealth, 8); |
|
442 mapper->addMapping(TBW_vampiric, 9); |
|
443 mapper->addMapping(TBW_karma, 10); |
|
444 mapper->addMapping(TBW_artillery, 11); |
|
445 mapper->addMapping(TBW_randomorder, 12); |
|
446 mapper->addMapping(TBW_king, 13); |
|
447 mapper->addMapping(TBW_placehog, 14); |
|
448 mapper->addMapping(TBW_sharedammo, 15); |
|
449 mapper->addMapping(TBW_disablegirders, 16); |
|
450 mapper->addMapping(TBW_disablelandobjects, 17); |
|
451 mapper->addMapping(TBW_aisurvival, 18); |
|
452 mapper->addMapping(TBW_infattack, 19); |
|
453 mapper->addMapping(TBW_resetweps, 20); |
|
454 mapper->addMapping(TBW_perhogammo, 21); |
|
455 mapper->addMapping(TBW_nowind, 22); |
|
456 mapper->addMapping(TBW_morewind, 23); |
|
457 mapper->addMapping(TBW_tagteam, 24); |
|
458 mapper->addMapping(TBW_bottomborder, 25); |
|
459 mapper->addMapping(SB_DamageModifier, 26); |
|
460 mapper->addMapping(SB_TurnTime, 27); |
|
461 mapper->addMapping(SB_InitHealth, 28); |
|
462 mapper->addMapping(SB_SuddenDeath, 29); |
|
463 mapper->addMapping(SB_CaseProb, 30); |
|
464 mapper->addMapping(SB_MinesTime, 31); |
|
465 mapper->addMapping(SB_Mines, 32); |
|
466 mapper->addMapping(SB_MineDuds, 33); |
|
467 mapper->addMapping(SB_Explosives, 34); |
|
468 mapper->addMapping(SB_HealthCrates, 35); |
|
469 mapper->addMapping(SB_CrateHealth, 36); |
|
470 mapper->addMapping(SB_WaterRise, 37); |
|
471 mapper->addMapping(SB_HealthDecrease, 38); |
|
472 mapper->addMapping(SB_RopeModifier, 39); |
|
473 mapper->addMapping(SB_GetAwayTime, 40); |
|
474 |
|
475 mapper->toFirst(); |
|
476 } |
|
477 |
|
478 void PageScheme::newRow() |
|
479 { |
|
480 QAbstractItemModel * model = mapper->model(); |
|
481 model->insertRow(-1); |
|
482 selectScheme->setCurrentIndex(model->rowCount() - 1); |
|
483 } |
|
484 |
|
485 void PageScheme::copyRow() |
|
486 { |
|
487 QAbstractItemModel * model = mapper->model(); |
|
488 model->insertRow(selectScheme->currentIndex()); |
|
489 selectScheme->setCurrentIndex(model->rowCount() - 1); |
|
490 } |
|
491 |
|
492 void PageScheme::deleteRow() |
|
493 { |
|
494 QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Schemes"), QMessageBox::tr("Really delete this game scheme?"), QMessageBox::Ok | QMessageBox::Cancel); |
|
495 |
|
496 if (reallyDelete.exec() == QMessageBox::Ok) { |
|
497 QAbstractItemModel * model = mapper->model(); |
|
498 model->removeRow(selectScheme->currentIndex()); |
|
499 } |
|
500 } |
|
501 |
|
502 void PageScheme::schemeSelected(int n) |
|
503 { |
|
504 int c = ((AmmoSchemeModel*)mapper->model())->numberOfDefaultSchemes; |
|
505 gbGameModes->setEnabled(n >= c); |
|
506 gbBasicSettings->setEnabled(n >= c); |
|
507 LE_name->setEnabled(n >= c); |
|
508 } |
|
509 |
|
510 |