148 GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
148 GBoxGrave->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
149 GBoxGrave->setTitle(QGroupBox::tr("Grave")); |
149 GBoxGrave->setTitle(QGroupBox::tr("Grave")); |
150 QGridLayout * GBGLayout = new QGridLayout(GBoxGrave); |
150 QGridLayout * GBGLayout = new QGridLayout(GBoxGrave); |
151 CBGrave = new QComboBox(GBoxGrave); |
151 CBGrave = new QComboBox(GBoxGrave); |
152 CBGrave->setMaxCount(65535); |
152 CBGrave->setMaxCount(65535); |
|
153 CBGrave->setIconSize(QSize(32, 32)); |
153 GBGLayout->addWidget(CBGrave, 0, 0, 1, 3); |
154 GBGLayout->addWidget(CBGrave, 0, 0, 1, 3); |
154 GravePreview = new QLabel(GBoxGrave); |
|
155 GravePreview->setScaledContents(false); |
|
156 GBGLayout->addWidget(GravePreview, 1, 1); |
|
157 vbox2->addWidget(GBoxGrave); |
155 vbox2->addWidget(GBoxGrave); |
158 |
156 |
159 //page1Layout->addWidget(new QWidget(), 3, 1, 1, 1); |
157 //page1Layout->addWidget(new QWidget(), 3, 1, 1, 1); |
160 |
158 |
161 GBoxTeamLvl = new QGroupBox(this); |
159 GBoxTeamLvl = new QGroupBox(this); |
162 GBoxTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
160 GBoxTeamLvl->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
163 GBoxTeamLvl->setTitle(QGroupBox::tr("Team level")); |
161 GBoxTeamLvl->setTitle(QGroupBox::tr("Team level")); |
164 QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl); |
162 QGridLayout * GBTLLayout = new QGridLayout(GBoxTeamLvl); |
165 CBTeamLvl = new QComboBox(GBoxTeamLvl); |
163 CBTeamLvl = new QComboBox(GBoxTeamLvl); |
166 CBTeamLvl->addItem(QComboBox::tr("Human")); |
164 CBTeamLvl->setIconSize(QSize(32, 32)); |
167 CBTeamLvl->addItem(QComboBox::tr("Level 5")); |
165 CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human")); |
168 CBTeamLvl->addItem(QComboBox::tr("Level 4")); |
166 for(int i = 5; i > 0; i--) |
169 CBTeamLvl->addItem(QComboBox::tr("Level 3")); |
167 CBTeamLvl->addItem( |
170 CBTeamLvl->addItem(QComboBox::tr("Level 2")); |
168 QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)), |
171 CBTeamLvl->addItem(QComboBox::tr("Level 1")); |
169 QString("%1 %2").arg(QComboBox::tr("Level")).arg(i) |
172 CBTeamLvl->setMaxCount(6); |
170 ); |
|
171 |
173 GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3); |
172 GBTLLayout->addWidget(CBTeamLvl, 0, 0, 1, 3); |
174 LevelPict = new QLabel(GBoxTeamLvl); |
|
175 LevelPict->setScaledContents(false); |
|
176 LevelPict->setFixedSize(32, 32); |
|
177 GBTLLayout->addWidget(LevelPict, 1, 1); |
|
178 vbox2->addWidget(GBoxTeamLvl); |
173 vbox2->addWidget(GBoxTeamLvl); |
179 |
174 |
180 GBoxFort = new QGroupBox(this); |
175 GBoxFort = new QGroupBox(this); |
181 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
176 GBoxFort->setTitle(QGroupBox::tr("Fort")); |
182 QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
177 QGridLayout * GBFLayout = new QGridLayout(GBoxFort); |
192 QDir tmpdir; |
187 QDir tmpdir; |
193 tmpdir.cd(datadir->absolutePath()); |
188 tmpdir.cd(datadir->absolutePath()); |
194 tmpdir.cd("Forts"); |
189 tmpdir.cd("Forts"); |
195 tmpdir.setFilter(QDir::Files); |
190 tmpdir.setFilter(QDir::Files); |
196 |
191 |
|
192 connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
197 CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
193 CBFort->addItems(tmpdir.entryList(QStringList("*L.png")).replaceInStrings(QRegExp("^(.*)L\\.png"), "\\1")); |
|
194 |
198 tmpdir.cd("../Graphics/Graves"); |
195 tmpdir.cd("../Graphics/Graves"); |
199 QStringList list = tmpdir.entryList(QStringList("*.png")); |
196 QStringList list = tmpdir.entryList(QStringList("*.png")); |
200 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
197 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
201 { |
198 { |
202 CBGrave->addItem((*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
199 QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + *it); |
|
200 QIcon icon(pix.copy(0, 0, 32, 32)); |
|
201 CBGrave->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
203 } |
202 } |
204 |
|
205 connect(CBGrave, SIGNAL(activated(const QString &)), this, SLOT(CBGrave_activated(const QString &))); |
|
206 connect(CBTeamLvl, SIGNAL(activated(int)), this, SLOT(CBTeamLvl_activated(int))); |
|
207 connect(CBFort, SIGNAL(activated(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
|
208 |
203 |
209 vbox1->addStretch(); |
204 vbox1->addStretch(); |
210 vbox2->addStretch(); |
205 vbox2->addStretch(); |
211 // vbox3->addStretch(); |
206 // vbox3->addStretch(); |
212 |
207 |
250 pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2); |
245 pagelayout->addWidget(new QWidget(BindsBox->widget(widind)), num, 0, 1, 2); |
251 widind++; |
246 widind++; |
252 } |
247 } |
253 } |
248 } |
254 |
249 |
255 void PageEditTeam::CBGrave_activated(const QString & gravename) |
|
256 { |
|
257 QPixmap pix(datadir->absolutePath() + "/Graphics/Graves/" + gravename + ".png"); |
|
258 GravePreview->setPixmap(pix.copy(0, 0, 32, 32)); |
|
259 } |
|
260 |
|
261 void PageEditTeam::CBFort_activated(const QString & fortname) |
250 void PageEditTeam::CBFort_activated(const QString & fortname) |
262 { |
251 { |
263 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
252 QPixmap pix(datadir->absolutePath() + "/Forts/" + fortname + "L.png"); |
264 FortPreview->setPixmap(pix); |
253 FortPreview->setPixmap(pix); |
265 } |
254 } |
266 |
255 |
267 void PageEditTeam::CBTeamLvl_activated(int id) |
256 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
268 { |
|
269 QPixmap pix(QString(":/res/botlevels/%1.png").arg(id)); |
|
270 LevelPict->setPixmap(pix); |
|
271 } |
|
272 |
|
273 PageMultiplayer::PageMultiplayer(QWidget* parent) : |
|
274 AbstractPage(parent) |
257 AbstractPage(parent) |
275 { |
258 { |
276 QGridLayout * pageLayout = new QGridLayout(this); |
259 QGridLayout * pageLayout = new QGridLayout(this); |
277 |
260 |
278 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |
261 BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true); |