90 connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
90 connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
91 connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
91 connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
92 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); |
92 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); |
93 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); |
93 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); |
94 |
94 |
95 connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
95 connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
96 connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
96 connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
97 connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons())); |
97 connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons())); |
98 connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponsName(const QString&)), this, SLOT(NetWeaponNameChanged(const QString&))); |
98 connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponsName(const QString&)), this, SLOT(NetWeaponNameChanged(const QString&))); |
99 |
99 |
100 connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
100 connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
101 connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
101 connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
102 connect(ui.pageNet->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
102 connect(ui.pageNet->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer())); |
103 connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer())); |
103 connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer())); |
172 combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName); |
172 combos.push_back(ui.pageNetGame->pGameCFG->WeaponsName); |
173 |
173 |
174 for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) { |
174 for(QVector<QComboBox*>::iterator it=combos.begin(); it!=combos.end(); ++it) { |
175 (*it)->clear(); |
175 (*it)->clear(); |
176 (*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames()); |
176 (*it)->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames()); |
177 int pos=(*it)->findText("Default"); |
177 int pos = (*it)->findText("Default"); |
178 if (pos!=-1) { |
178 if (pos != -1) { |
179 (*it)->setCurrentIndex(pos); |
179 (*it)->setCurrentIndex(pos); |
180 } |
180 } |
181 } |
181 } |
182 } |
182 } |
183 |
183 |
184 void HWForm::NetWeaponNameChanged(const QString& name) |
184 void HWForm::NetWeaponNameChanged(const QString& name) |
185 { |
185 { |
186 QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString( |
186 QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(name); |
187 ui.pageNetGame->pGameCFG->WeaponsName->currentText() |
187 |
188 ); |
188 if (hwnet) |
189 |
189 hwnet->onWeaponsNameChanged(name, ammo); |
190 hwnet->onWeaponsNameChanged(name, ammo); |
|
191 } |
190 } |
192 |
191 |
193 void HWForm::UpdateTeamsLists(const QStringList* editable_teams) |
192 void HWForm::UpdateTeamsLists(const QStringList* editable_teams) |
194 { |
193 { |
195 QStringList teamslist; |
194 QStringList teamslist; |
196 if(editable_teams) { |
195 if(editable_teams) { |
197 teamslist=*editable_teams; |
196 teamslist =* editable_teams; |
198 } else { |
197 } else { |
199 teamslist = config->GetTeamsList(); |
198 teamslist = config->GetTeamsList(); |
200 } |
199 } |
201 |
200 |
202 if(teamslist.empty()) { |
201 if(teamslist.empty()) { |
229 GoToPage(ID_PAGE_SETUP); |
228 GoToPage(ID_PAGE_SETUP); |
230 } |
229 } |
231 |
230 |
232 void HWForm::GoToSelectNewWeapon() |
231 void HWForm::GoToSelectNewWeapon() |
233 { |
232 { |
234 ui.pageSelectWeapon->pWeapons->setWeaponsName("", false); |
233 ui.pageSelectWeapon->pWeapons->setWeaponsName(tr("new")); |
235 GoToPage(ID_PAGE_SELECTWEAPON); |
234 GoToPage(ID_PAGE_SELECTWEAPON); |
236 } |
235 } |
237 |
236 |
238 void HWForm::GoToSelectWeapon() |
237 void HWForm::GoToSelectWeapon() |
239 { |
238 { |
240 ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText(), true); |
239 ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText()); |
241 GoToPage(ID_PAGE_SELECTWEAPON); |
240 GoToPage(ID_PAGE_SELECTWEAPON); |
242 } |
241 } |
243 |
242 |
244 void HWForm::GoToInfo() |
243 void HWForm::GoToInfo() |
245 { |
244 { |
348 } |
347 } |
349 } |
348 } |
350 |
349 |
351 void HWForm::IntermediateSetup() |
350 void HWForm::IntermediateSetup() |
352 { |
351 { |
353 quint8 id=ui.Pages->currentIndex(); |
352 quint8 id=ui.Pages->currentIndex(); |
354 TeamSelWidget* curTeamSelWidget; |
353 TeamSelWidget* curTeamSelWidget; |
355 if(id == ID_PAGE_MULTIPLAYER) { |
354 |
356 curTeamSelWidget=ui.pageMultiplayer->teamsSelect; |
355 if(id == ID_PAGE_MULTIPLAYER) { |
357 } else { |
356 curTeamSelWidget = ui.pageMultiplayer->teamsSelect; |
358 curTeamSelWidget=ui.pageNetGame->pNetTeamsWidget; |
357 } else { |
359 } |
358 curTeamSelWidget = ui.pageNetGame->pNetTeamsWidget; |
360 QList<HWTeam> teams=curTeamSelWidget->getDontPlayingTeams(); |
359 } |
361 QStringList tmnames; |
360 |
362 for(QList<HWTeam>::iterator it = teams.begin(); it != teams.end(); ++it) { |
361 QList<HWTeam> teams = curTeamSelWidget->getDontPlayingTeams(); |
363 tmnames+=it->TeamName; |
362 QStringList tmnames; |
364 } |
363 for(QList<HWTeam>::iterator it = teams.begin(); it != teams.end(); ++it) { |
365 UpdateTeamsLists(&tmnames); // FIXME: still need more work if teamname is updated while configuring |
364 tmnames += it->TeamName; |
366 |
365 } |
367 GoToPage(ID_PAGE_SETUP); |
366 UpdateTeamsLists(&tmnames); // FIXME: still need more work if teamname is updated while configuring |
|
367 |
|
368 GoToPage(ID_PAGE_SETUP); |
368 } |
369 } |
369 |
370 |
370 void HWForm::NewTeam() |
371 void HWForm::NewTeam() |
371 { |
372 { |
372 editedTeam = new HWTeam("unnamed"); |
373 editedTeam = new HWTeam("unnamed"); |