equal
deleted
inserted
replaced
30 #include <QDebug> |
30 #include <QDebug> |
31 #include "SquareLabel.h" |
31 #include "SquareLabel.h" |
32 #include "HWApplication.h" |
32 #include "HWApplication.h" |
33 #include "keybinder.h" |
33 #include "keybinder.h" |
34 |
34 |
|
35 #include "physfs.h" |
35 #include "DataManager.h" |
36 #include "DataManager.h" |
36 #include "hatbutton.h" |
37 #include "hatbutton.h" |
37 |
38 |
38 #include "pageeditteam.h" |
39 #include "pageeditteam.h" |
39 |
40 |
275 connect(btnRandomVoice, SIGNAL(clicked()), this, SLOT(setRandomVoice())); |
276 connect(btnRandomVoice, SIGNAL(clicked()), this, SLOT(setRandomVoice())); |
276 connect(btnRandomFort, SIGNAL(clicked()), this, SLOT(setRandomFort())); |
277 connect(btnRandomFort, SIGNAL(clicked()), this, SLOT(setRandomFort())); |
277 |
278 |
278 connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
279 connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound())); |
279 |
280 |
280 connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &))); |
281 connect(CBFort, SIGNAL(currentIndexChanged(const int)), this, SLOT(CBFort_activated(const int))); |
281 } |
282 } |
282 |
283 |
283 PageEditTeam::PageEditTeam(QWidget* parent) : |
284 PageEditTeam::PageEditTeam(QWidget* parent) : |
284 AbstractPage(parent) |
285 AbstractPage(parent) |
285 { |
286 { |
312 CBVoicepack->addItems(list); |
313 CBVoicepack->addItems(list); |
313 |
314 |
314 |
315 |
315 // forts |
316 // forts |
316 list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png")); |
317 list = dataMgr.entryList("Forts", QDir::Files, QStringList("*L.png")); |
317 list.replaceInStrings(QRegExp("L\\.png$"), ""); |
318 foreach (QString file, list) |
318 CBFort->addItems(list); |
319 { |
|
320 QString fortPath = PHYSFS_getRealDir(QString("Forts/%1").arg(file).toLocal8Bit().data()); |
|
321 |
|
322 QString fort = file.replace(QRegExp("L\\.png$"), ""); |
|
323 QString fortDisplay; |
|
324 |
|
325 bool isDLC = !fortPath.startsWith(datadir->absolutePath()); |
|
326 if (isDLC) |
|
327 fortDisplay = "*" + fort; |
|
328 else |
|
329 fortDisplay = fort; |
|
330 |
|
331 CBFort->addItem(fortDisplay, fort); |
|
332 } |
319 |
333 |
320 |
334 |
321 // graves |
335 // graves |
322 list = |
336 list = |
323 dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png")); |
337 dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png")); |
387 |
401 |
388 if (HHNameEdit[idx]->text().isEmpty()) |
402 if (HHNameEdit[idx]->text().isEmpty()) |
389 HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); |
403 HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1)); |
390 } |
404 } |
391 |
405 |
392 void PageEditTeam::CBFort_activated(const QString & fortname) |
406 void PageEditTeam::CBFort_activated(const int index) |
393 { |
407 { |
394 QPixmap pix("physfs://Forts/" + fortname + "L.png"); |
408 QString fortName = CBFort->itemData(index).toString(); |
|
409 QPixmap pix("physfs://Forts/" + fortName + "L.png"); |
395 FortPreview->setPixmap(pix); |
410 FortPreview->setPixmap(pix); |
396 } |
411 } |
397 |
412 |
398 void PageEditTeam::CBTeamLvl_activated(const int index) |
413 void PageEditTeam::CBTeamLvl_activated(const int index) |
399 { |
414 { |
557 } |
572 } |
558 |
573 |
559 CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
574 CBGrave->setCurrentIndex(CBGrave->findText(team.grave())); |
560 CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
575 CBFlag->setCurrentIndex(CBFlag->findData(team.flag())); |
561 |
576 |
562 CBFort->setCurrentIndex(CBFort->findText(team.fort())); |
577 CBFort->setCurrentIndex(CBFort->findData(team.fort())); |
563 CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack())); |
578 CBVoicepack->setCurrentIndex(CBVoicepack->findText(team.voicepack())); |
564 |
579 |
565 QStandardItemModel * binds = DataManager::instance().bindsModel(); |
580 QStandardItemModel * binds = DataManager::instance().bindsModel(); |
566 for(int i = 0; i < BINDS_NUMBER; i++) |
581 for(int i = 0; i < BINDS_NUMBER; i++) |
567 { |
582 { |
593 |
608 |
594 team.setHedgehog(i,hh); |
609 team.setHedgehog(i,hh); |
595 } |
610 } |
596 |
611 |
597 team.setGrave(CBGrave->currentText()); |
612 team.setGrave(CBGrave->currentText()); |
598 team.setFort(CBFort->currentText()); |
613 team.setFort(CBFort->itemData(CBFort->currentIndex()).toString()); |
599 team.setVoicepack(CBVoicepack->currentText()); |
614 team.setVoicepack(CBVoicepack->currentText()); |
600 team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString()); |
615 team.setFlag(CBFlag->itemData(CBFlag->currentIndex()).toString()); |
601 |
616 |
602 QStandardItemModel * binds = DataManager::instance().bindsModel(); |
617 QStandardItemModel * binds = DataManager::instance().bindsModel(); |
603 for(int i = 0; i < BINDS_NUMBER; i++) |
618 for(int i = 0; i < BINDS_NUMBER; i++) |