QTfrontend/ui/page/pageeditteam.cpp
changeset 6616 f77bb02b669f
parent 6525 6c97379c584b
child 6700 e04da46ee43c
equal deleted inserted replaced
6615:65602f1ef0f8 6616:f77bb02b669f
   112     CBTeamLvl = new QComboBox(GBoxTeam);
   112     CBTeamLvl = new QComboBox(GBoxTeam);
   113     CBTeamLvl->setIconSize(QSize(48, 48));
   113     CBTeamLvl->setIconSize(QSize(48, 48));
   114     CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
   114     CBTeamLvl->addItem(QIcon(":/res/botlevels/0.png"), QComboBox::tr("Human"));
   115     for(int i = 5; i > 0; i--)
   115     for(int i = 5; i > 0; i--)
   116         CBTeamLvl->addItem(
   116         CBTeamLvl->addItem(
   117                 QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
   117             QIcon(QString(":/res/botlevels/%1.png").arg(6 - i)),
   118                 QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
   118             QString("%1 %2").arg(QComboBox::tr("Level")).arg(i)
   119                 );
   119         );
   120     GBTLayout->addWidget(CBTeamLvl, 1, 1);
   120     GBTLayout->addWidget(CBTeamLvl, 1, 1);
   121 
   121 
   122     CBGrave = new QComboBox(GBoxTeam);
   122     CBGrave = new QComboBox(GBoxTeam);
   123     CBGrave->setMaxCount(65535);
   123     CBGrave->setMaxCount(65535);
   124     CBGrave->setIconSize(QSize(32, 32));
   124     CBGrave->setIconSize(QSize(32, 32));
   168     quint16 i = 0;
   168     quint16 i = 0;
   169     quint16 num = 0;
   169     quint16 num = 0;
   170     QWidget * curW = NULL;
   170     QWidget * curW = NULL;
   171     QGridLayout * pagelayout = NULL;
   171     QGridLayout * pagelayout = NULL;
   172     QLabel* l = NULL;
   172     QLabel* l = NULL;
   173     while (i < BINDS_NUMBER) {
   173     while (i < BINDS_NUMBER)
       
   174     {
   174         if(cbinds[i].category != NULL)
   175         if(cbinds[i].category != NULL)
   175         {
   176         {
   176             if(curW != NULL)
   177             if(curW != NULL)
   177             {
   178             {
   178                 l = new QLabel(curW);
   179                 l = new QLabel(curW);
   220     connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomName(int)));
   221     connect(signalMapper2, SIGNAL(mapped(int)), this, SLOT(setRandomName(int)));
   221 
   222 
   222     for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
   223     for(int i = 0; i < HEDGEHOGS_PER_TEAM; i++)
   223     {
   224     {
   224         connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map()));
   225         connect(HHNameEdit[i], SIGNAL(editingFinished()), signalMapper1, SLOT(map()));
   225             signalMapper1->setMapping(HHNameEdit[i], i);
   226         signalMapper1->setMapping(HHNameEdit[i], i);
   226 
   227 
   227         connect(btnRandomHogName[i], SIGNAL(clicked()), signalMapper2, SLOT(map()));
   228         connect(btnRandomHogName[i], SIGNAL(clicked()), signalMapper2, SLOT(map()));
   228             signalMapper2->setMapping(btnRandomHogName[i], i);
   229         signalMapper2->setMapping(btnRandomHogName[i], i);
   229     }
   230     }
   230 
   231 
   231     connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomNames()));
   232     connect(btnRandomTeam, SIGNAL(clicked()), this, SLOT(setRandomNames()));
   232     
   233 
   233     connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
   234     connect(btnTestSound, SIGNAL(clicked()), this, SLOT(testSound()));
   234 
   235 
   235     connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
   236     connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
   236 }
   237 }
   237 
   238 
   238 PageEditTeam::PageEditTeam(QWidget* parent) :
   239 PageEditTeam::PageEditTeam(QWidget* parent) :
   239   AbstractPage(parent)
   240     AbstractPage(parent)
   240 {
   241 {
   241     initPage();
   242     initPage();
   242 
   243 
   243     QRegExp pngSuffix("\\.png$");
   244     QRegExp pngSuffix("\\.png$");
   244 
   245 
   248 
   249 
   249     QStringList list;
   250     QStringList list;
   250 
   251 
   251 
   252 
   252     // voicepacks
   253     // voicepacks
   253     list = dataMgr.entryList("Sounds/voices", 
   254     list = dataMgr.entryList("Sounds/voices",
   254                              QDir::AllDirs | QDir::NoDotAndDotDot);
   255                              QDir::AllDirs | QDir::NoDotAndDotDot);
   255 
   256 
   256     CBVoicepack->addItems(list);
   257     CBVoicepack->addItems(list);
   257 
   258 
   258 
   259 
   342     HWDataManager & dataMgr = HWDataManager::instance();
   343     HWDataManager & dataMgr = HWDataManager::instance();
   343 
   344 
   344     QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText();
   345     QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText();
   345 
   346 
   346     QStringList list = dataMgr.entryList(
   347     QStringList list = dataMgr.entryList(
   347             voiceDir,
   348                            voiceDir,
   348             QDir::Files,
   349                            QDir::Files,
   349             QStringList() <<
   350                            QStringList() <<
   350                 "Illgetyou.ogg" <<
   351                            "Illgetyou.ogg" <<
   351                 "Incoming.ogg" <<
   352                            "Incoming.ogg" <<
   352                 "Stupid.ogg" <<
   353                            "Stupid.ogg" <<
   353                 "Coward.ogg" <<
   354                            "Coward.ogg" <<
   354                 "Firstblood.ogg"
   355                            "Firstblood.ogg"
   355             );
   356                        );
   356 
   357 
   357     if (!list.isEmpty())
   358     if (!list.isEmpty())
   358         SDLInteraction::instance().playSoundFile(
   359         SDLInteraction::instance().playSoundFile(
   359             dataMgr.findFileForRead(voiceDir + "/" +
   360             dataMgr.findFileForRead(voiceDir + "/" +
   360                 list[rand() % list.size()])
   361                                     list[rand() % list.size()])
   361         );
   362         );
   362 }
   363 }
   363 
   364 
   364 void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
   365 void PageEditTeam::createTeam(const QString & name, const QString & playerHash)
   365 {
   366 {