QTfrontend/pages.cpp
changeset 3767 2416a3f51c77
parent 3760 d30f1ba768d7
child 3786 0907b0fd5714
--- 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();