QTfrontend/hwform.cpp
changeset 311 b8905423f19f
parent 307 96b428ac11f2
child 312 c36d0b34ac3d
equal deleted inserted replaced
310:b95fd124cb09 311:b8905423f19f
    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 	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    86 	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    87 
    87 
       
    88 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(NewTeam()), this, SLOT(NewTeam()));
       
    89 
    88 	GoToPage(ID_PAGE_MAIN);
    90 	GoToPage(ID_PAGE_MAIN);
    89 }
    91 }
    90 
    92 
    91 void HWForm::UpdateTeamsLists()
    93 void HWForm::UpdateTeamsLists()
    92 {
    94 {
   122 	GoToPage(ID_PAGE_INFO);
   124 	GoToPage(ID_PAGE_INFO);
   123 }
   125 }
   124 
   126 
   125 void HWForm::GoToMultiplayer()
   127 void HWForm::GoToMultiplayer()
   126 {
   128 {
   127 	QStringList tmNames=config->GetTeamsList();
       
   128 	QList<HWTeam> teamsList;
       
   129 	for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) {
       
   130 	  HWTeam team(*it);
       
   131 	  team.LoadFromFile();
       
   132 	  teamsList.push_back(team);
       
   133 	}
       
   134 	ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
       
   135 	GoToPage(ID_PAGE_MULTIPLAYER);
   129 	GoToPage(ID_PAGE_MULTIPLAYER);
   136 }
   130 }
   137 
   131 
   138 void HWForm::GoToDemos()
   132 void HWForm::GoToDemos()
   139 {
   133 {
   155 void HWForm::GoToNetChat()
   149 void HWForm::GoToNetChat()
   156 {
   150 {
   157 	GoToPage(ID_PAGE_NETCHAT);
   151 	GoToPage(ID_PAGE_NETCHAT);
   158 }
   152 }
   159 
   153 
       
   154 void HWForm::OnPageShown(quint8 id)
       
   155 {
       
   156 	if (id == ID_PAGE_MULTIPLAYER) {
       
   157 		QStringList tmNames=config->GetTeamsList();
       
   158 		QList<HWTeam> teamsList;
       
   159 		for(QStringList::iterator it=tmNames.begin(); it!=tmNames.end(); it++) {
       
   160 		  HWTeam team(*it);
       
   161 		  team.LoadFromFile();
       
   162 		  teamsList.push_back(team);
       
   163 		}
       
   164 		ui.pageMultiplayer->teamsSelect->resetPlayingTeams(teamsList);
       
   165 	}
       
   166 }
       
   167 
   160 void HWForm::GoToPage(quint8 id)
   168 void HWForm::GoToPage(quint8 id)
   161 {
   169 {
   162 	PagesStack.push(ui.Pages->currentIndex());
   170 	PagesStack.push(ui.Pages->currentIndex());
       
   171 	OnPageShown(id);
   163 	ui.Pages->setCurrentIndex(id);
   172 	ui.Pages->setCurrentIndex(id);
   164 }
   173 }
   165 
   174 
   166 void HWForm::GoBack()
   175 void HWForm::GoBack()
   167 {
   176 {
   168 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
   177 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
       
   178 	OnPageShown(id);
   169 	ui.Pages->setCurrentIndex(id);
   179 	ui.Pages->setCurrentIndex(id);
   170 }
   180 }
   171 
   181 
   172 void HWForm::NewTeam()
   182 void HWForm::NewTeam()
   173 {
   183 {