QTfrontend/hwform.cpp
changeset 12665 5664ec82aed7
parent 12635 5ba8361acabc
child 12667 2e0a38566178
equal deleted inserted replaced
12664:943b258d5443 12665:5664ec82aed7
   263     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   263     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   264     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   264     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   265             ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   265             ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   266     connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   266     connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   267     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   267     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   268     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
   268     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToWeapons(int)));
   269     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
   269     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
   270     pageSwitchMapper->setMapping(ui.pageMultiplayer->gameCFG, ID_PAGE_DRAWMAP);
   270     pageSwitchMapper->setMapping(ui.pageMultiplayer->gameCFG, ID_PAGE_DRAWMAP);
   271 
   271 
   272 
   272 
   273     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   273     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   277     connect(ui.pageOptions, SIGNAL(editTeamRequested(const QString&)), this, SLOT(EditTeam(const QString&)));
   277     connect(ui.pageOptions, SIGNAL(editTeamRequested(const QString&)), this, SLOT(EditTeam(const QString&)));
   278     connect(ui.pageOptions, SIGNAL(deleteTeamRequested(const QString&)), this, SLOT(DeleteTeam(const QString&)));
   278     connect(ui.pageOptions, SIGNAL(deleteTeamRequested(const QString&)), this, SLOT(DeleteTeam(const QString&)));
   279     connect(ui.pageOptions, SIGNAL(goBack()), config, SLOT(SaveOptions()));
   279     connect(ui.pageOptions, SIGNAL(goBack()), config, SLOT(SaveOptions()));
   280     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   280     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   281 
   281 
   282     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   282     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToEditWeapons()));
   283     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
   283     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToNewWeapons()));
   284     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
   284     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
   285     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   285     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   286     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
   286     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
   287     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
   287     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
   288     connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) );
   288     connect(ui.pageOptions->CBFrontendEffects, SIGNAL(toggled(bool)), this, SLOT(onFrontendEffects(bool)) );
   289     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
       
   290 
   289 
   291     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   290     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   292     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   291     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   293     pageSwitchMapper->setMapping(ui.pageNet->BtnNetSvrStart, ID_PAGE_NETSERVER);
   292     pageSwitchMapper->setMapping(ui.pageNet->BtnNetSvrStart, ID_PAGE_NETSERVER);
   294 
   293 
   298 
   297 
   299     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   298     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   300             ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   299             ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   301     connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   300     connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   302     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   301     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   303     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
   302     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToWeapons(int)));
   304     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
   303     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToDrawMap()), pageSwitchMapper, SLOT(map()));
   305     pageSwitchMapper->setMapping(ui.pageNetGame->pGameCFG, ID_PAGE_DRAWMAP);
   304     pageSwitchMapper->setMapping(ui.pageNetGame->pGameCFG, ID_PAGE_DRAWMAP);
   306 
   305 
   307     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   306     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), pageSwitchMapper, SLOT(map()));
   308     pageSwitchMapper->setMapping(ui.pageRoomsList->BtnAdmin, ID_PAGE_ADMIN);
   307     pageSwitchMapper->setMapping(ui.pageRoomsList->BtnAdmin, ID_PAGE_ADMIN);
   332     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
   331     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
   333     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageTeam(int)));
   332     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageTeam(int)));
   334     connect(ui.pageCampaign->CBCampaign, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
   333     connect(ui.pageCampaign->CBCampaign, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
   335     connect(ui.pageCampaign->CBMission, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageMission(int)));
   334     connect(ui.pageCampaign->CBMission, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPageMission(int)));
   336 
   335 
   337     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   336     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted(QString)),
   338             ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   337              this, SLOT(DeleteWeapons(QString)));
   339     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   338     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsAdded(QString, QString)),
   340             this, SLOT(UpdateWeapons())); // executed second
   339              this, SLOT(AddWeapons(QString, QString)));
   341     //connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   340     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsEdited(QString, QString, QString)),
   342     //    this, SLOT(GoBack())); // executed third
   341              this, SLOT(EditWeapons(QString, QString, QString)));
   343 
       
   344 
   342 
   345     connect(ui.pageMain->BtnNetLocal, SIGNAL(clicked()), this, SLOT(GoToNet()));
   343     connect(ui.pageMain->BtnNetLocal, SIGNAL(clicked()), this, SLOT(GoToNet()));
   346     connect(ui.pageMain->BtnNetOfficial, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   344     connect(ui.pageMain->BtnNetOfficial, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
   347 
   345 
   348     connect(ui.pageVideos, SIGNAL(goBack()), config, SLOT(SaveVideosOptions()));
   346     connect(ui.pageVideos, SIGNAL(goBack()), config, SLOT(SaveVideosOptions()));
   448         int pos = (*it)->findText("Default");
   446         int pos = (*it)->findText("Default");
   449         if (pos != -1)
   447         if (pos != -1)
   450         {
   448         {
   451             (*it)->setCurrentIndex(pos);
   449             (*it)->setCurrentIndex(pos);
   452         }
   450         }
       
   451     }
       
   452 }
       
   453 
       
   454 void HWForm::AddWeapons(QString weaponsName, QString ammo)
       
   455 {
       
   456     QVector<QComboBox*> combos;
       
   457     combos.push_back(ui.pageOptions->WeaponsName);
       
   458     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
       
   459     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
       
   460     combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
       
   461 
       
   462     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
       
   463 
       
   464     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it)
       
   465     {
       
   466         (*it)->addItem(weaponsName, QVariant(ammo));
       
   467     }
       
   468     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageSelectWeapon->selectWeaponSet->count()-1);
       
   469 }
       
   470 
       
   471 void HWForm::DeleteWeapons(QString weaponsName)
       
   472 {
       
   473     QVector<QComboBox*> combos;
       
   474     combos.push_back(ui.pageOptions->WeaponsName);
       
   475     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
       
   476     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
       
   477     combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
       
   478 
       
   479     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
       
   480 
       
   481     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it)
       
   482     {
       
   483         int pos = (*it)->findText(weaponsName);
       
   484         if (pos != -1)
       
   485         {
       
   486             (*it)->removeItem(pos);
       
   487         }
       
   488     }
       
   489     ui.pageSelectWeapon->pWeapons->deletionDone();
       
   490 }
       
   491 
       
   492 void HWForm::EditWeapons(QString oldWeaponsName, QString newWeaponsName, QString ammo)
       
   493 {
       
   494     QVector<QComboBox*> combos;
       
   495     combos.push_back(ui.pageOptions->WeaponsName);
       
   496     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
       
   497     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
       
   498     combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
       
   499 
       
   500     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
       
   501 
       
   502     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it)
       
   503     {
       
   504         int pos = (*it)->findText(oldWeaponsName);
       
   505         (*it)->setItemText(pos, newWeaponsName);
       
   506         (*it)->setItemData(pos, ammo);
   453     }
   507     }
   454 }
   508 }
   455 
   509 
   456 void HWForm::UpdateTeamsLists()
   510 void HWForm::UpdateTeamsLists()
   457 {
   511 {
   525             ui.pageCampaign->CBTeam->addItem(teamslist[i]);
   579             ui.pageCampaign->CBTeam->addItem(teamslist[i]);
   526         }
   580         }
   527     }
   581     }
   528 }
   582 }
   529 
   583 
   530 void HWForm::GoToSelectNewWeapon()
   584 void HWForm::GoToNewWeapons()
   531 {
   585 {
   532     ui.pageSelectWeapon->pWeapons->newWeaponsName();
   586     ui.pageSelectWeapon->pWeapons->newWeaponsName();
   533     GoToPage(ID_PAGE_SELECTWEAPON);
   587     GoToPage(ID_PAGE_SELECTWEAPON);
   534 }
   588 }
   535 
   589 
   536 void HWForm::GoToSelectWeapon()
   590 void HWForm::GoToEditWeapons()
   537 {
   591 {
   538     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
   592     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
   539     GoToPage(ID_PAGE_SELECTWEAPON);
   593     GoToPage(ID_PAGE_SELECTWEAPON);
   540 }
   594 }
   541 
   595 
   542 void HWForm::GoToSelectWeaponSet(int index)
   596 void HWForm::GoToWeapons(int index)
   543 {
   597 {
   544     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index);
   598     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index);
   545     GoToPage(ID_PAGE_SELECTWEAPON);
   599     GoToPage(ID_PAGE_SELECTWEAPON);
   546 }
   600 }
       
   601 
   547 
   602 
   548 void HWForm::GoToSaves()
   603 void HWForm::GoToSaves()
   549 {
   604 {
   550     ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save);
   605     ui.pagePlayDemo->FillFromDir(PagePlayDemo::RT_Save);
   551 
   606