QTfrontend/hwform.cpp
changeset 4416 29d2d1548387
parent 4410 f9e38ce1e813
child 4428 2bc3d3475edf
equal deleted inserted replaced
4415:941251bad467 4416:29d2d1548387
   127     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   127     connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
   128     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   128     connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
   129         ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   129         ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
   130     connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   130     connect(ui.pageMultiplayer, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   131     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   131     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   132     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
   132     connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
   133 
   133 
   134     connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   134     connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   135     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   135     connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
   136     connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo()));
   136     connect(ui.pagePlayDemo->DemosList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(PlayDemo()));
   137 
   137 
   145     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   145     connect(ui.pageOptions->BtnAssociateFiles, SIGNAL(clicked()), this, SLOT(AssociateFiles()));
   146 #endif
   146 #endif
   147 
   147 
   148     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   148     connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
   149     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
   149     connect(ui.pageOptions->WeaponNew, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon()));
       
   150     connect(ui.pageOptions->WeaponDelete, SIGNAL(clicked()), this, SLOT(DeleteWeaponSet()));
   150     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   151     connect(ui.pageOptions->SchemeEdit, SIGNAL(clicked()), this, SLOT(GoToEditScheme()));
   151     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
   152     connect(ui.pageOptions->SchemeNew, SIGNAL(clicked()), this, SLOT(GoToNewScheme()));
       
   153     connect(ui.pageOptions->SchemeDelete, SIGNAL(clicked()), this, SLOT(DeleteScheme()));
   152     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
   154     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
   153 
   155 
   154     connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   156     connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   155     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   157     connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
   156     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer()));
   158     connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer()));
   164         ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   166         ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   165     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   167     connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   166         ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   168         ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
   167     connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   169     connect(ui.pageNetGame, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   168     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   170     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes(int)), this, SLOT(GoToScheme(int)));
   169     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
   171     connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(int)), this, SLOT(GoToSelectWeaponSet(int)));
   170 
   172 
   171     connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   173     connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   172     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin()));
   174     connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin()));
   173 
   175 
   174     connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   176     connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   194 
   196 
   195     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   197     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   196         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   198         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   197     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   199     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   198         this, SLOT(UpdateWeapons())); // executed second
   200         this, SLOT(UpdateWeapons())); // executed second
   199     connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   201     //connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsDeleted()),
   200         this, SLOT(GoBack())); // executed third
   202     //    this, SLOT(GoBack())); // executed third
   201 
   203 
   202     connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   204     connect(ui.pageScheme->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   203 
   205 
   204     connect(ui.pageAdmin->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   206     connect(ui.pageAdmin->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   205 
   207 
   300 {
   302 {
   301     QVector<QComboBox*> combos;
   303     QVector<QComboBox*> combos;
   302     combos.push_back(ui.pageOptions->WeaponsName);
   304     combos.push_back(ui.pageOptions->WeaponsName);
   303     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   305     combos.push_back(ui.pageMultiplayer->gameCFG->WeaponsName);
   304     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
   306     combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName);
       
   307     combos.push_back(ui.pageSelectWeapon->selectWeaponSet);
   305 
   308 
   306     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
   309     QStringList names = ui.pageSelectWeapon->pWeapons->getWeaponNames();
   307 
   310 
   308     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) {
   311     for(QVector<QComboBox*>::iterator it = combos.begin(); it != combos.end(); ++it) {
   309         (*it)->clear();
   312         (*it)->clear();
   364     GoToPage(ID_PAGE_SETUP);
   367     GoToPage(ID_PAGE_SETUP);
   365 }
   368 }
   366 
   369 
   367 void HWForm::GoToSelectNewWeapon()
   370 void HWForm::GoToSelectNewWeapon()
   368 {
   371 {
   369     ui.pageSelectWeapon->pWeapons->setWeaponsName(tr("new"));
   372     ui.pageSelectWeapon->pWeapons->newWeaponsName();
   370     GoToPage(ID_PAGE_SELECTWEAPON);
   373     GoToPage(ID_PAGE_SELECTWEAPON);
   371 }
   374 }
   372 
   375 
   373 void HWForm::GoToSelectWeapon()
   376 void HWForm::GoToSelectWeapon()
   374 {
   377 {
   375     ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText());
   378     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
   376     GoToPage(ID_PAGE_SELECTWEAPON);
   379     GoToPage(ID_PAGE_SELECTWEAPON);
   377 }
   380 }
   378 
   381 
   379 void HWForm::GoToSelectWeaponSet(const QString & name)
   382 void HWForm::GoToSelectWeaponSet(int index)
   380 {
   383 {
   381     ui.pageSelectWeapon->pWeapons->setWeaponsName(name);
   384     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(index);
   382     GoToPage(ID_PAGE_SELECTWEAPON);
   385     GoToPage(ID_PAGE_SELECTWEAPON);
   383 }
   386 }
   384 
   387 
   385 void HWForm::GoToInfo()
   388 void HWForm::GoToInfo()
   386 {
   389 {
   603     GoToPage(ID_PAGE_SETUP_TEAM);
   606     GoToPage(ID_PAGE_SETUP_TEAM);
   604 }
   607 }
   605 
   608 
   606 void HWForm::DeleteTeam()
   609 void HWForm::DeleteTeam()
   607 {
   610 {
   608     editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   611     QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Teams"), QMessageBox::tr("Really delete this team?"), QMessageBox::Ok | QMessageBox::Cancel);
   609     editedTeam->DeleteFile();
   612 
   610 
   613     if (reallyDelete.exec() == QMessageBox::Ok) {
   611     // Remove from lists
   614         editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   612     ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
   615         editedTeam->DeleteFile();
       
   616 
       
   617         // Remove from lists
       
   618         ui.pageOptions->CBTeamName->removeItem(ui.pageOptions->CBTeamName->currentIndex());
       
   619     }
   613 }
   620 }
   614 
   621 
   615 void HWForm::RandomNames()
   622 void HWForm::RandomNames()
   616 {
   623 {
   617     editedTeam->GetFromPage(this);
   624     editedTeam->GetFromPage(this);
   639 void HWForm::TeamDiscard()
   646 void HWForm::TeamDiscard()
   640 {
   647 {
   641     delete editedTeam;
   648     delete editedTeam;
   642     editedTeam=0;
   649     editedTeam=0;
   643     GoBack();
   650     GoBack();
       
   651 }
       
   652 
       
   653 void HWForm::DeleteScheme()
       
   654 {
       
   655     ui.pageScheme->selectScheme->setCurrentIndex(ui.pageOptions->SchemesName->currentIndex());
       
   656     if (ui.pageOptions->SchemesName->currentIndex() < ammoSchemeModel->numberOfDefaultSchemes) {
       
   657         QMessageBox::warning(0, QMessageBox::tr("Schemes"), QMessageBox::tr("Can not delete default scheme '%1'!").arg(ui.pageOptions->SchemesName->currentText()));
       
   658     } else {
       
   659         ui.pageScheme->deleteRow();
       
   660     }
       
   661 }
       
   662 
       
   663 void HWForm::DeleteWeaponSet()
       
   664 {
       
   665     ui.pageSelectWeapon->selectWeaponSet->setCurrentIndex(ui.pageOptions->WeaponsName->currentIndex());
       
   666     ui.pageSelectWeapon->pWeapons->deleteWeaponsName();
   644 }
   667 }
   645 
   668 
   646 void HWForm::SimpleGame()
   669 void HWForm::SimpleGame()
   647 {
   670 {
   648     CreateGame(0, 0, *cDefaultAmmoStore);
   671     CreateGame(0, 0, *cDefaultAmmoStore);