QTfrontend/hwform.cpp
changeset 290 09738170c557
parent 289 604c4a779c20
child 301 29bf9c1a3ad3
equal deleted inserted replaced
289:604c4a779c20 290:09738170c557
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    83 
    83 
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    85 
    85 
    86 	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
    86 	GoToPage(ID_PAGE_MAIN);
    87 }
    87 }
    88 
    88 
    89 void HWForm::UpdateTeamsLists()
    89 void HWForm::UpdateTeamsLists()
    90 {
    90 {
    91 	QStringList teamslist = config->GetTeamsList();
    91 	QStringList teamslist = config->GetTeamsList();
   128 	  HWTeam team(*it);
   128 	  HWTeam team(*it);
   129 	  team.LoadFromFile();
   129 	  team.LoadFromFile();
   130 	  teamsList.push_back(team);
   130 	  teamsList.push_back(team);
   131 	}
   131 	}
   132 	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
   132 	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
   133 	ui.Pages->setCurrentIndex(ID_PAGE_MULTIPLAYER);
   133 	GoToPage(ID_PAGE_MULTIPLAYER);
   134 }
   134 }
   135 
   135 
   136 void HWForm::GoToDemos()
   136 void HWForm::GoToDemos()
   137 {
   137 {
   138 	QDir tmpdir;
   138 	QDir tmpdir;
   140 	tmpdir.cd("Demos");
   140 	tmpdir.cd("Demos");
   141 	tmpdir.setFilter(QDir::Files);
   141 	tmpdir.setFilter(QDir::Files);
   142 	ui.pagePlayDemo->DemosList->clear();
   142 	ui.pagePlayDemo->DemosList->clear();
   143 	ui.pagePlayDemo->DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_" + cProtoVer))
   143 	ui.pagePlayDemo->DemosList->addItems(tmpdir.entryList(QStringList("*.hwd_" + cProtoVer))
   144 			.replaceInStrings(QRegExp("^(.*).hwd_" + cProtoVer), "\\1"));
   144 			.replaceInStrings(QRegExp("^(.*).hwd_" + cProtoVer), "\\1"));
   145 	ui.Pages->setCurrentIndex(ID_PAGE_DEMOS);
   145 	GoToPage(ID_PAGE_DEMOS);
   146 }
   146 }
   147 
   147 
   148 void HWForm::GoToNet()
   148 void HWForm::GoToNet()
   149 {
   149 {
   150 	GoToPage(ID_PAGE_NET);
   150 	GoToPage(ID_PAGE_NET);
   169 
   169 
   170 void HWForm::NewTeam()
   170 void HWForm::NewTeam()
   171 {
   171 {
   172 	editedTeam = new HWTeam("unnamed");
   172 	editedTeam = new HWTeam("unnamed");
   173 	editedTeam->SetToPage(this);
   173 	editedTeam->SetToPage(this);
   174 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   174 	GoToPage(ID_PAGE_SETUP_TEAM);
   175 }
   175 }
   176 
   176 
   177 void HWForm::EditTeam()
   177 void HWForm::EditTeam()
   178 {
   178 {
   179 	editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   179 	editedTeam = new HWTeam(ui.pageOptions->CBTeamName->currentText());
   180 	editedTeam->LoadFromFile();
   180 	editedTeam->LoadFromFile();
   181 	editedTeam->SetToPage(this);
   181 	editedTeam->SetToPage(this);
   182 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM);
   182 	GoToPage(ID_PAGE_SETUP_TEAM);
   183 }
   183 }
   184 
   184 
   185 void HWForm::TeamSave()
   185 void HWForm::TeamSave()
   186 {
   186 {
   187 	editedTeam->GetFromPage(this);
   187 	editedTeam->GetFromPage(this);
   188 	editedTeam->SaveToFile();
   188 	editedTeam->SaveToFile();
   189 	delete editedTeam;
   189 	delete editedTeam;
   190 	UpdateTeamsLists();
   190 	UpdateTeamsLists();
   191 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
   191 	GoBack();
   192 }
   192 }
   193 
   193 
   194 void HWForm::TeamDiscard()
   194 void HWForm::TeamDiscard()
   195 {
   195 {
   196 	delete editedTeam;
   196 	delete editedTeam;
   197 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
   197 	GoBack();
   198 }
   198 }
   199 
   199 
   200 void HWForm::SimpleGame()
   200 void HWForm::SimpleGame()
   201 {
   201 {
   202 	game = new HWGame(config, ui.pageLocalGame->gameCFG);
   202 	game = new HWGame(config, ui.pageLocalGame->gameCFG);
   230 }
   230 }
   231 
   231 
   232 void HWForm::NetDisconnect()
   232 void HWForm::NetDisconnect()
   233 {
   233 {
   234 	hwnet->Disconnect();
   234 	hwnet->Disconnect();
   235 	GoToNet();
   235 	GoBack();
   236 }
   236 }
   237 
   237 
   238 void HWForm::AddGame(const QString & chan)
   238 void HWForm::AddGame(const QString & chan)
   239 {
   239 {
   240 	ui.pageNetChat->ChannelsList->addItem(chan);
   240 	ui.pageNetChat->ChannelsList->addItem(chan);
   241 }
   241 }
   242 
   242 
   243 void HWForm::NetGameEnter()
   243 void HWForm::NetGameEnter()
   244 {
   244 {
   245 	ui.Pages->setCurrentIndex(ID_PAGE_NETCFG);
   245 	GoToPage(ID_PAGE_NETCFG);
   246 }
   246 }
   247 
   247 
   248 void HWForm::NetJoin()
   248 void HWForm::NetJoin()
   249 {
   249 {
   250 	hwnet->JoinGame("#hw");
   250 	hwnet->JoinGame("#hw");