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