QTfrontend/hwform.cpp
changeset 86 664b536a1c27
parent 85 44d9045b26ff
child 87 ff213e443336
equal deleted inserted replaced
85:44d9045b26ff 86:664b536a1c27
   103 	config = new GameUIConfig(this);
   103 	config = new GameUIConfig(this);
   104 
   104 
   105 	QStringList teamslist = config->GetTeamsList();
   105 	QStringList teamslist = config->GetTeamsList();
   106 
   106 
   107 	if(teamslist.empty()) {
   107 	if(teamslist.empty()) {
   108 	  HWTeam defaultTeam("DefaultTeam");
   108 		HWTeam defaultTeam("DefaultTeam", config);
   109 	  defaultTeam.SetCfgDir(config->cfgdir.absolutePath());
   109 		defaultTeam.SaveToFile();
   110 	  defaultTeam.SaveToFile();
   110 		teamslist.push_back("DefaultTeam");
   111 	  teamslist.push_back("DefaultTeam");
       
   112 	}
   111 	}
   113 
   112 
   114 	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it )
   113 	for (QStringList::Iterator it = teamslist.begin(); it != teamslist.end(); ++it )
   115 	{
   114 	{
   116 	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1");
   115 	  QString tmpTeamStr=(*it).replace(QRegExp("^(.*).cfg$"), "\\1");
   188 	ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT);
   187 	ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT);
   189 }
   188 }
   190 
   189 
   191 void HWForm::NewTeam()
   190 void HWForm::NewTeam()
   192 {
   191 {
   193 	tmpTeam = new HWTeam("unnamed");
   192 	tmpTeam = new HWTeam("unnamed", config);
   194 	tmpTeam->SetCfgDir(config->cfgdir.absolutePath());
   193 
   195 	tmpTeam->SetToPage(this);
       
   196 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   194 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   197 }
   195 }
   198 
   196 
   199 void HWForm::EditTeam()
   197 void HWForm::EditTeam()
   200 {
   198 {
   201 	tmpTeam = new HWTeam(ui.CBTeamName->currentText());
   199 	tmpTeam = new HWTeam(ui.CBTeamName->currentText(), config);
   202 	tmpTeam->SetCfgDir(config->cfgdir.absolutePath());
       
   203 	tmpTeam->LoadFromFile();
   200 	tmpTeam->LoadFromFile();
   204 	tmpTeam->SetToPage(this);
   201 	tmpTeam->SetToPage(this);
   205 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   202 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   206 }
   203 }
   207 
   204 
   219 }
   216 }
   220 
   217 
   221 void HWForm::SimpleGame()
   218 void HWForm::SimpleGame()
   222 {
   219 {
   223 	game = new HWGame(config, ui.pageLGGameCFG);
   220 	game = new HWGame(config, ui.pageLGGameCFG);
   224 	game->AddTeam("DefaultTeam");
   221 	game->StartQuick();
   225 	game->AddTeam("DefaultTeam");
       
   226 	game->StartLocal();
       
   227 }
   222 }
   228 
   223 
   229 void HWForm::CBGrave_activated(const QString & gravename)
   224 void HWForm::CBGrave_activated(const QString & gravename)
   230 {
   225 {
   231 	QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png");
   226 	QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png");
   289 	hwnet->JoinGame("#hw");
   284 	hwnet->JoinGame("#hw");
   290 }
   285 }
   291 
   286 
   292 void HWForm::NetAddTeam()
   287 void HWForm::NetAddTeam()
   293 {
   288 {
   294 	HWTeam team("DefaultTeam");
   289 	HWTeam team("DefaultTeam", config);
   295 	team.SetCfgDir(config->cfgdir.absolutePath());
       
   296 	team.LoadFromFile();
   290 	team.LoadFromFile();
   297 	hwnet->AddTeam(team);
   291 	hwnet->AddTeam(team);
   298 }
   292 }
   299 
   293 
   300 void HWForm::NetStartGame()
   294 void HWForm::NetStartGame()