QTfrontend/hwform.cpp
changeset 3760 d30f1ba768d7
parent 3757 ad2f669c8435
child 3932 2fc211f60015
equal deleted inserted replaced
3759:f352e9dcf516 3760:d30f1ba768d7
   102             updater->checkForUpdates();
   102             updater->checkForUpdates();
   103 #endif
   103 #endif
   104 #endif
   104 #endif
   105 
   105 
   106     UpdateTeamsLists();
   106     UpdateTeamsLists();
       
   107     UpdateCampaignPage(0);
   107     UpdateWeapons();
   108     UpdateWeapons();
   108 
   109 
   109     connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
   110     connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
   110     onFrontendFullscreen(config->isFrontendFullscreen());
   111     onFrontendFullscreen(config->isFrontendFullscreen());
   111 
   112 
   169 
   170 
   170     connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   171     connect(ui.pageGameStats->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   171 
   172 
   172     connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
   173     connect(ui.pageSinglePlayer->BtnSimpleGamePage, SIGNAL(clicked()), this, SLOT(SimpleGame()));
   173     connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining()));
   174     connect(ui.pageSinglePlayer->BtnTrainPage, SIGNAL(clicked()), this, SLOT(GoToTraining()));
       
   175     connect(ui.pageSinglePlayer->BtnCampaignPage, SIGNAL(clicked()), this, SLOT(GoToCampaign()));
   174     connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
   176     connect(ui.pageSinglePlayer->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer()));
   175     connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
   177     connect(ui.pageSinglePlayer->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves()));
   176     connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
   178     connect(ui.pageSinglePlayer->BtnDemos, SIGNAL(clicked()), this, SLOT(GoToDemos()));
   177     connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   179     connect(ui.pageSinglePlayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   178 
   180 
   179     connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
   181     connect(ui.pageTraining->BtnStartTrain, SIGNAL(clicked()), this, SLOT(StartTraining()));
   180     connect(ui.pageTraining->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   182     connect(ui.pageTraining->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
       
   183 
       
   184     connect(ui.pageCampaign->BtnStartCampaign, SIGNAL(clicked()), this, SLOT(StartCampaign()));
       
   185     connect(ui.pageCampaign->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
       
   186     connect(ui.pageCampaign->CBTeam, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCampaignPage(int)));
   181 
   187 
   182     connect(ui.pageSelectWeapon->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   188     connect(ui.pageSelectWeapon->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   183 
   189 
   184     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   190     connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
   185         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   191         ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   308     } else {
   314     } else {
   309       teamslist = config->GetTeamsList();
   315       teamslist = config->GetTeamsList();
   310     }
   316     }
   311 
   317 
   312     if(teamslist.empty()) {
   318     if(teamslist.empty()) {
   313         HWTeam defaultTeam("DefaultTeam");
   319         HWTeam defaultTeam(tr("DefaultTeam"));
   314         defaultTeam.SaveToFile();
   320         defaultTeam.SaveToFile();
   315         teamslist.push_back("DefaultTeam");
   321         teamslist.push_back(tr("DefaultTeam"));
   316     }
   322     }
   317 
   323 
   318     ui.pageOptions->CBTeamName->clear();
   324     ui.pageOptions->CBTeamName->clear();
   319     ui.pageOptions->CBTeamName->addItems(teamslist);
   325     ui.pageOptions->CBTeamName->addItems(teamslist);
       
   326     ui.pageCampaign->CBTeam->clear();
       
   327     ui.pageCampaign->CBTeam->addItems(teamslist);
   320 }
   328 }
   321 
   329 
   322 void HWForm::GoToMain()
   330 void HWForm::GoToMain()
   323 {
   331 {
   324     GoToPage(ID_PAGE_MAIN);
   332     GoToPage(ID_PAGE_MAIN);
   330 }
   338 }
   331 
   339 
   332 void HWForm::GoToTraining()
   340 void HWForm::GoToTraining()
   333 {
   341 {
   334     GoToPage(ID_PAGE_TRAINING);
   342     GoToPage(ID_PAGE_TRAINING);
       
   343 }
       
   344 
       
   345 void HWForm::GoToCampaign()
       
   346 {
       
   347     GoToPage(ID_PAGE_CAMPAIGN);
   335 }
   348 }
   336 
   349 
   337 void HWForm::GoToSetup()
   350 void HWForm::GoToSetup()
   338 {
   351 {
   339     GoToPage(ID_PAGE_SETUP);
   352     GoToPage(ID_PAGE_SETUP);
   960 
   973 
   961 void HWForm::StartTraining()
   974 void HWForm::StartTraining()
   962 {
   975 {
   963     CreateGame(0, 0, 0);
   976     CreateGame(0, 0, 0);
   964 
   977 
   965     game->StartTraining(ui.pageTraining->CBSelect->currentText());
   978     game->StartTraining(ui.pageTraining->CBSelect->itemData(ui.pageTraining->CBSelect->currentIndex()).toString());
       
   979 }
       
   980 
       
   981 void HWForm::StartCampaign()
       
   982 {
       
   983     CreateGame(0, 0, 0);
       
   984 
       
   985     game->StartCampaign(ui.pageCampaign->CBSelect->itemData(ui.pageCampaign->CBSelect->currentIndex()).toString());
   966 }
   986 }
   967 
   987 
   968 void HWForm::CreateNetGame()
   988 void HWForm::CreateNetGame()
   969 {
   989 {
   970     QString ammo;
   990     QString ammo;
  1073     if (wBackground) {
  1093     if (wBackground) {
  1074         wBackground->setFixedSize(w, h);
  1094         wBackground->setFixedSize(w, h);
  1075         wBackground->move(0, 0);
  1095         wBackground->move(0, 0);
  1076     }
  1096     }
  1077 }
  1097 }
       
  1098 
       
  1099 void HWForm::UpdateCampaignPage(int index)
       
  1100 {
       
  1101     HWTeam team(ui.pageCampaign->CBTeam->currentText());
       
  1102     ui.pageCampaign->CBSelect->clear();
       
  1103 
       
  1104     QDir tmpdir;
       
  1105     tmpdir.cd(datadir->absolutePath());
       
  1106     tmpdir.cd("Missions/Campaign");
       
  1107     tmpdir.setFilter(QDir::Files);
       
  1108     QStringList entries = tmpdir.entryList(QStringList("*#*.lua"));
       
  1109     //entries.sort();
       
  1110     for(int i = 0; (i < entries.count()) && (i <= team.CampaignProgress); i++)
       
  1111         ui.pageCampaign->CBSelect->addItem(QString(entries[i]).replace(QRegExp("^(\\d+)#(.+)\\.lua"), QComboBox::tr("Mission") + " \\1: \\2"), QString(entries[i]).replace(QRegExp("^(.*)\\.lua"), "\\1"));
       
  1112 }