QTfrontend/ui/page/pageeditteam.cpp
branchphysfslayer
changeset 8049 133e22b5c410
parent 7794 ab7b94c03bc9
child 8103 c247346d296f
child 8346 3443e0de2c9d
equal deleted inserted replaced
8046:4d3415927d2c 8049:133e22b5c410
   268     list =
   268     list =
   269         dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png"));
   269         dataMgr.entryList("Graphics/Graves", QDir::Files, QStringList("*.png"));
   270 
   270 
   271     foreach (QString file, list)
   271     foreach (QString file, list)
   272     {
   272     {
   273         QPixmap pix(dataMgr.findFileForRead("Graphics/Graves/" + file));
   273         QPixmap pix("physfs://Graphics/Graves/" + file);
   274         if ((pix.height() > 32) || pix.width() > 32)
   274         if ((pix.height() > 32) || pix.width() > 32)
   275             pix = pix.copy(0, 0, 32, 32);
   275             pix = pix.copy(0, 0, 32, 32);
   276         QIcon icon(pix);
   276         QIcon icon(pix);
   277 
   277 
   278         QString grave = QString(file).remove(pngSuffix);
   278         QString grave = QString(file).remove(pngSuffix);
   295     idx = list.indexOf("hedgewars.png");
   295     idx = list.indexOf("hedgewars.png");
   296     if (idx >= 0)
   296     if (idx >= 0)
   297         list.removeAt(idx);
   297         list.removeAt(idx);
   298 
   298 
   299     // add the default flag
   299     // add the default flag
   300     QPixmap hwFlag(dataMgr.findFileForRead("Graphics/Flags/hedgewars.png"));
   300     QPixmap hwFlag("physfs://Graphics/Flags/hedgewars.png");
   301     CBFlag->addItem(QIcon(hwFlag.copy(0, 0, 22, 15)), "Hedgewars", "hedgewars");
   301     CBFlag->addItem(QIcon(hwFlag.copy(0, 0, 22, 15)), "Hedgewars", "hedgewars");
   302 
   302 
   303     // add seperator after
   303     // add seperator after
   304     CBFlag->insertSeparator(1);
   304     CBFlag->insertSeparator(1);
   305 
   305 
   306     int insertAt = 2; // insert country flags after Hedgewars flag and seperator
   306     int insertAt = 2; // insert country flags after Hedgewars flag and seperator
   307 
   307 
   308     // add all country flags
   308     // add all country flags
   309     foreach (const QString & file, list)
   309     foreach (const QString & file, list)
   310     {
   310     {
   311         QIcon icon(QPixmap(dataMgr.findFileForRead("Graphics/Flags/" + file)));
   311         QIcon icon(QPixmap("physfs://Graphics/Flags/" + file));
   312 
   312 
   313         QString flag = QString(file).remove(pngSuffix);
   313         QString flag = QString(file).remove(pngSuffix);
   314 
   314 
   315         bool isCountryFlag = !file.startsWith("cm_");
   315         bool isCountryFlag = !file.startsWith("cm_");
   316 
   316 
   335         HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1));
   335         HHNameEdit[idx]->setText(QLineEdit::tr("hedgehog %1").arg(idx+1));
   336 }
   336 }
   337 
   337 
   338 void PageEditTeam::CBFort_activated(const QString & fortname)
   338 void PageEditTeam::CBFort_activated(const QString & fortname)
   339 {
   339 {
   340     DataManager & dataMgr = DataManager::instance();
   340     QPixmap pix("physfs://Forts/" + fortname + "L.png");
   341     QPixmap pix(dataMgr.findFileForRead("Forts/" + fortname + "L.png"));
       
   342     FortPreview->setPixmap(pix);
   341     FortPreview->setPixmap(pix);
   343 }
   342 }
   344 
   343 
   345 void PageEditTeam::testSound()
   344 void PageEditTeam::testSound()
   346 {
   345 {
   358                            "Coward.ogg" <<
   357                            "Coward.ogg" <<
   359                            "Firstblood.ogg"
   358                            "Firstblood.ogg"
   360                        );
   359                        );
   361 
   360 
   362     if (!list.isEmpty())
   361     if (!list.isEmpty())
   363         SDLInteraction::instance().playSoundFile(
   362         SDLInteraction::instance().playSoundFile("physfs://" + voiceDir + "/" +
   364             dataMgr.findFileForRead(voiceDir + "/" +
   363                                     list[rand() % list.size()]);
   365                                     list[rand() % list.size()])
       
   366         );
       
   367 }
   364 }
   368 
   365 
   369 void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
   366 void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
   370 {
   367 {
   371     m_playerHash = playerHash;
   368     m_playerHash = playerHash;