Frontend:
* Updated the flag selection to sort flags and divide them into groups (countries/community flags)
--- a/QTfrontend/pages.cpp Wed Aug 25 01:30:25 2010 +0200
+++ b/QTfrontend/pages.cpp Wed Aug 25 12:28:37 2010 +0200
@@ -301,12 +301,33 @@
tmpdir.cd(datadir->absolutePath());
tmpdir.cd("Graphics/Flags");
list = tmpdir.entryList(QStringList("*.png"));
+
+ // add the default flag
+ CBFlag->addItem(QIcon(QPixmap(datadir->absolutePath() + "/Graphics/Flags/hedgewars.png").copy(0, 0, 22, 15)), "Hedgewars", "hedgewars");
+
+ CBFlag->insertSeparator(CBFlag->count());
+ // add all country flags
for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
QIcon icon(pix.copy(0, 0, 22, 15));
- if(it->compare("cpu.png")) // skip cpu flag
- CBFlag->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1"));
+ if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags
+ {
+ QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
+ CBFlag->addItem(icon, QString(flag).replace("_", " "), flag);
+ }
+ }
+ CBFlag->insertSeparator(CBFlag->count());
+ // add all community flags
+ for (QStringList::Iterator it = list.begin(); it != list.end(); ++it )
+ {
+ QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it);
+ QIcon icon(pix.copy(0, 0, 22, 15));
+ if(it->indexOf("cm_") > -1) // skip non community flags this time
+ {
+ QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1");
+ CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag);
+ }
}
vbox1->addStretch();
--- a/QTfrontend/team.cpp Wed Aug 25 01:30:25 2010 +0200
+++ b/QTfrontend/team.cpp Wed Aug 25 12:28:37 2010 +0200
@@ -209,7 +209,7 @@
hwform->ui.pageEditTeam->HHHats[i]->setCurrentIndex(hwform->ui.pageEditTeam->HHHats[i]->findData(Hedgehogs[i].Hat, Qt::DisplayRole));
}
hwform->ui.pageEditTeam->CBGrave->setCurrentIndex(hwform->ui.pageEditTeam->CBGrave->findText(Grave));
- hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findText(Flag));
+ hwform->ui.pageEditTeam->CBFlag->setCurrentIndex(hwform->ui.pageEditTeam->CBFlag->findData(Flag));
hwform->ui.pageEditTeam->CBFort->setCurrentIndex(hwform->ui.pageEditTeam->CBFort->findText(Fort));
hwform->ui.pageEditTeam->CBVoicepack->setCurrentIndex(hwform->ui.pageEditTeam->CBVoicepack->findText(Voicepack));
@@ -237,7 +237,7 @@
Grave = hwform->ui.pageEditTeam->CBGrave->currentText();
Fort = hwform->ui.pageEditTeam->CBFort->currentText();
Voicepack = hwform->ui.pageEditTeam->CBVoicepack->currentText();
- Flag = hwform->ui.pageEditTeam->CBFlag->currentText();
+ Flag = hwform->ui.pageEditTeam->CBFlag->itemData(hwform->ui.pageEditTeam->CBFlag->currentIndex()).toString();
for(int i = 0; i < BINDS_NUMBER; i++)
{
binds[i].strbind = hwform->ui.pageEditTeam->CBBind[i]->itemData(hwform->ui.pageEditTeam->CBBind[i]->currentIndex()).toString();
Binary file share/hedgewars/Data/Graphics/Flags/cm_pacman2.png has changed
Binary file share/hedgewars/Data/Graphics/Flags/pirate.png has changed