QTfrontend/hwform.cpp
changeset 695 34a93d123712
parent 694 436045756181
child 696 d6f32ed6edc8
--- a/QTfrontend/hwform.cpp	Tue Jan 08 20:32:17 2008 +0000
+++ b/QTfrontend/hwform.cpp	Wed Jan 09 20:26:31 2008 +0000
@@ -52,6 +52,7 @@
 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
 
 	UpdateTeamsLists();
+	UpdateWeapons();
 
 	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
 	connect(ui.pageMain->BtnSetup,	SIGNAL(clicked()),	this, SLOT(GoToSetup()));
@@ -84,8 +85,10 @@
 	connect(ui.pageOptions->BtnEditTeam,	SIGNAL(clicked()),	this, SLOT(EditTeam()));
 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	config, SLOT(SaveOptions()));
 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	this, SLOT(GoBack()));
+
 	connect(ui.pageOptions->WeaponEdit,	SIGNAL(clicked()),	this, SLOT(GoToSelectWeapon()));
 	connect(ui.pageOptions->WeaponsButt,	SIGNAL(clicked()),	this, SLOT(GoToSelectNewWeapon()));
+	connect(ui.pageSelectWeapon->pWeapons,       SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
 
 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 	connect(ui.pageNet->BtnSpecifyServer,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
@@ -119,6 +122,12 @@
 	GoToPage(ID_PAGE_MAIN);
 }
 
+void HWForm::UpdateWeapons()
+{
+  ui.pageOptions->WeaponsName->clear();
+  ui.pageOptions->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
+}
+
 void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
 {
 	QStringList teamslist;
@@ -136,10 +145,6 @@
 
 	ui.pageOptions->CBTeamName->clear();
 	ui.pageOptions->CBTeamName->addItems(teamslist);
-
-	// now updates weapons also
-	ui.pageOptions->WeaponsName->clear();
-	ui.pageOptions->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
 }
 
 void HWForm::GoToMain()