184
|
1 |
/*
|
|
2 |
* Hedgewars, a worms-like game
|
|
3 |
* Copyright (c) 2006 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 <QResizeEvent>
|
218
|
20 |
#include <QGroupBox>
|
311
|
21 |
#include <QCheckBox>
|
|
22 |
#include <QGridLayout>
|
|
23 |
#include <QSpinBox>
|
|
24 |
#include <QLabel>
|
184
|
25 |
#include "gamecfgwidget.h"
|
|
26 |
|
218
|
27 |
GameCFGWidget::GameCFGWidget(QWidget* parent) :
|
184
|
28 |
QWidget(parent), mainLayout(this)
|
|
29 |
{
|
240
|
30 |
mainLayout.setMargin(0);
|
218
|
31 |
QGroupBox *GBoxMap = new QGroupBox(this);
|
|
32 |
GBoxMap->setTitle(QGroupBox::tr("Landscape"));
|
|
33 |
GBoxMap->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
34 |
mainLayout.addWidget(GBoxMap);
|
|
35 |
|
|
36 |
QHBoxLayout *GBoxMapLayout = new QHBoxLayout(GBoxMap);
|
240
|
37 |
GBoxMapLayout->setMargin(0);
|
218
|
38 |
pMapContainer = new HWMapContainer(GBoxMap);
|
|
39 |
GBoxMapLayout->addWidget(new QWidget);
|
|
40 |
GBoxMapLayout->addWidget(pMapContainer);
|
|
41 |
GBoxMapLayout->addWidget(new QWidget);
|
|
42 |
|
|
43 |
QGroupBox *GBoxOptions = new QGroupBox(this);
|
|
44 |
GBoxOptions->setTitle(QGroupBox::tr("Game scheme"));
|
|
45 |
GBoxOptions->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
46 |
mainLayout.addWidget(GBoxOptions);
|
|
47 |
|
311
|
48 |
QGridLayout *GBoxOptionsLayout = new QGridLayout(GBoxOptions);
|
218
|
49 |
CB_mode_Forts = new QCheckBox(GBoxOptions);
|
184
|
50 |
CB_mode_Forts->setText(QCheckBox::tr("Forts mode"));
|
311
|
51 |
GBoxOptionsLayout->addWidget(CB_mode_Forts, 0, 0, 1, 2);
|
|
52 |
|
|
53 |
L_TurnTime = new QLabel(QLabel::tr("Turn time"), GBoxOptions);
|
|
54 |
L_InitHealth = new QLabel(QLabel::tr("Initial health"), GBoxOptions);
|
|
55 |
GBoxOptionsLayout->addWidget(L_TurnTime, 1, 0);
|
|
56 |
GBoxOptionsLayout->addWidget(L_InitHealth, 2, 0);
|
|
57 |
|
|
58 |
SB_TurnTime = new QSpinBox(GBoxOptions);
|
|
59 |
SB_TurnTime->setRange(15, 90);
|
|
60 |
SB_TurnTime->setValue(45);
|
|
61 |
SB_TurnTime->setSingleStep(15);
|
|
62 |
SB_InitHealth = new QSpinBox(GBoxOptions);
|
|
63 |
SB_InitHealth->setRange(50, 200);
|
|
64 |
SB_TurnTime->setValue(100);
|
|
65 |
SB_InitHealth->setSingleStep(25);
|
|
66 |
GBoxOptionsLayout->addWidget(SB_TurnTime, 1, 1);
|
|
67 |
GBoxOptionsLayout->addWidget(SB_InitHealth, 2, 1);
|
218
|
68 |
|
|
69 |
mainLayout.addWidget(new QWidget, 100);
|
184
|
70 |
}
|
|
71 |
|
|
72 |
quint32 GameCFGWidget::getGameFlags()
|
|
73 |
{
|
|
74 |
quint32 result = 0;
|
|
75 |
if (CB_mode_Forts->isChecked())
|
|
76 |
result |= 1;
|
|
77 |
return result;
|
|
78 |
}
|
|
79 |
|
|
80 |
QString GameCFGWidget::getCurrentSeed() const
|
|
81 |
{
|
|
82 |
return pMapContainer->getCurrentSeed();
|
|
83 |
}
|
249
|
84 |
|
|
85 |
QString GameCFGWidget::getCurrentMap() const
|
|
86 |
{
|
|
87 |
return pMapContainer->getCurrentMap();
|
|
88 |
}
|
|
89 |
|
|
90 |
QString GameCFGWidget::getCurrentTheme() const
|
|
91 |
{
|
|
92 |
return pMapContainer->getCurrentTheme();
|
|
93 |
}
|