- Less crossclass dependancies
authorunc0rr
Fri, 05 Dec 2008 16:55:20 +0000
changeset 1531 f404233b6d9b
parent 1530 3b8d723661b2
child 1532 e77b2ed67431
- Less crossclass dependancies - Eliminate one more reason for different ammo schemes
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hwform.cpp
QTfrontend/hwform.h
--- a/QTfrontend/gamecfgwidget.cpp	Fri Dec 05 16:49:04 2008 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Fri Dec 05 16:55:20 2008 +0000
@@ -81,7 +81,7 @@
 	connect(CB_mode_Forts, SIGNAL(toggled(bool)), this, SIGNAL(fortsModeChanged(bool)));
 	connect(CB_teamsDivide, SIGNAL(toggled(bool)), this, SIGNAL(teamsDivideChanged(bool)));
 	connect(CB_solid, SIGNAL(toggled(bool)), this, SIGNAL(solidChanged(bool)));
-	connect(WeaponsName, SIGNAL(activated(const QString&)), this, SIGNAL(newWeaponsName(const QString&)));
+	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SIGNAL(seedChanged(const QString &)));
 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SIGNAL(mapChanged(const QString &)));
@@ -194,3 +194,8 @@
 		WeaponsName->setCurrentIndex(pos);
 	}
 }
+
+void GameCFGWidget::ammoChanged(int index)
+{
+	emit newWeaponScheme(WeaponsName->itemText(index), WeaponsName->itemData(index).toString());
+}
\ No newline at end of file
--- a/QTfrontend/gamecfgwidget.h	Fri Dec 05 16:49:04 2008 +0000
+++ b/QTfrontend/gamecfgwidget.h	Fri Dec 05 16:55:20 2008 +0000
@@ -66,7 +66,10 @@
 	void fortsModeChanged(bool value);
 	void teamsDivideChanged(bool value);
 	void solidChanged(bool value);
-	void newWeaponsName(const QString& weapon);
+	void newWeaponScheme(const QString & name, const QString & ammo);
+
+private slots:
+	void ammoChanged(int index);
 
 private:
 	QCheckBox * CB_mode_Forts;
--- a/QTfrontend/hwform.cpp	Fri Dec 05 16:49:04 2008 +0000
+++ b/QTfrontend/hwform.cpp	Fri Dec 05 16:55:20 2008 +0000
@@ -95,7 +95,6 @@
 	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.pageNetGame->pGameCFG, SIGNAL(newWeaponsName(const QString&)), this, SLOT(NetWeaponNameChanged(const QString&)));
 
 	connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
 	connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
@@ -185,14 +184,6 @@
 	}
 }
 
-void HWForm::NetWeaponNameChanged(const QString& name)
-{
-	QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(name);
-
-	if (hwnet)
-		hwnet->onWeaponsNameChanged(name, ammo);
-}
-
 void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
 {
 	QStringList teamslist;
@@ -502,6 +493,8 @@
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(fortsModeChanged(bool)), hwnet, SLOT(onFortsModeChanged(bool)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(teamsDivideChanged(bool)), hwnet, SLOT(onTeamsDivideChanged(bool)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(solidChanged(bool)), hwnet, SLOT(onSolidChanged(bool)));
+	connect(ui.pageNetGame->pGameCFG, SIGNAL(newWeaponScheme(const QString &, const QString &)),
+			hwnet, SLOT(onWeaponsNameChanged(const QString &, const QString &)));
 
 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()));
 	connect(hwnet, SIGNAL(seedChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setSeed(const QString &)));
@@ -612,7 +605,10 @@
 
 void HWForm::StartMPGame()
 {
-	QString ammo = ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageMultiplayer->gameCFG->WeaponsName->currentText());
+	QString ammo;
+	ammo = ui.pageMultiplayer->gameCFG->WeaponsName->itemData(
+		ui.pageMultiplayer->gameCFG->WeaponsName->currentIndex()
+		).toString();
 
 	CreateGame(ui.pageMultiplayer->gameCFG, ui.pageMultiplayer->teamsSelect, ammo);
 
--- a/QTfrontend/hwform.h	Fri Dec 05 16:49:04 2008 +0000
+++ b/QTfrontend/hwform.h	Fri Dec 05 16:55:20 2008 +0000
@@ -84,7 +84,6 @@
 	void GetRecord(bool isDemo, const QByteArray & record);
 	void CreateNetGame();
 	void UpdateWeapons();
-	void NetWeaponNameChanged(const QString& name);
 	void onFrontendFullscreen(bool value);
 	void Music(bool checked);
 	void NetGameMaster();