299 } |
299 } |
300 |
300 |
301 tmpdir.cd(datadir->absolutePath()); |
301 tmpdir.cd(datadir->absolutePath()); |
302 tmpdir.cd("Graphics/Flags"); |
302 tmpdir.cd("Graphics/Flags"); |
303 list = tmpdir.entryList(QStringList("*.png")); |
303 list = tmpdir.entryList(QStringList("*.png")); |
|
304 |
|
305 // add the default flag |
|
306 CBFlag->addItem(QIcon(QPixmap(datadir->absolutePath() + "/Graphics/Flags/hedgewars.png").copy(0, 0, 22, 15)), "Hedgewars", "hedgewars"); |
|
307 |
|
308 CBFlag->insertSeparator(CBFlag->count()); |
|
309 // add all country flags |
304 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
310 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
305 { |
311 { |
306 QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); |
312 QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); |
307 QIcon icon(pix.copy(0, 0, 22, 15)); |
313 QIcon icon(pix.copy(0, 0, 22, 15)); |
308 if(it->compare("cpu.png")) // skip cpu flag |
314 if(it->compare("cpu.png") && it->compare("hedgewars.png") && (it->indexOf("cm_") == -1)) // skip cpu and hedgewars flags as well as all community flags |
309 CBFlag->addItem(icon, (*it).replace(QRegExp("^(.*)\\.png"), "\\1")); |
315 { |
|
316 QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1"); |
|
317 CBFlag->addItem(icon, QString(flag).replace("_", " "), flag); |
|
318 } |
|
319 } |
|
320 CBFlag->insertSeparator(CBFlag->count()); |
|
321 // add all community flags |
|
322 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
323 { |
|
324 QPixmap pix(datadir->absolutePath() + "/Graphics/Flags/" + *it); |
|
325 QIcon icon(pix.copy(0, 0, 22, 15)); |
|
326 if(it->indexOf("cm_") > -1) // skip non community flags this time |
|
327 { |
|
328 QString flag = (*it).replace(QRegExp("^(.*)\\.png"), "\\1"); |
|
329 CBFlag->addItem(icon, QString(flag).replace("cm_", QComboBox::tr("Community") + ": "), flag); |
|
330 } |
310 } |
331 } |
311 |
332 |
312 vbox1->addStretch(); |
333 vbox1->addStretch(); |
313 vbox2->addStretch(); |
334 vbox2->addStretch(); |
314 |
335 |