TheXception's patch:
authorunc0rr
Sun, 19 Apr 2009 15:44:47 +0000
changeset 2009 91f461c218ab
parent 2008 fc2fb5c938c3
child 2010 bac82fb13a42
TheXception's patch: - Add weapons button to game options widget
QTfrontend/gamecfgwidget.cpp
QTfrontend/gamecfgwidget.h
QTfrontend/hwform.cpp
QTfrontend/hwform.h
share/hedgewars/Data/Locale/hedgewars_de.ts
--- a/QTfrontend/gamecfgwidget.cpp	Sun Apr 19 13:36:51 2009 +0000
+++ b/QTfrontend/gamecfgwidget.cpp	Sun Apr 19 15:44:47 2009 +0000
@@ -58,12 +58,18 @@
 	GBoxOptionsLayout->addWidget(goToSchemePage, 1, 0, 1, 2);
 	connect(goToSchemePage, SIGNAL(clicked()), this, SIGNAL(goToSchemes()));
 	
-	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 8, 0);
+	GBoxOptionsLayout->addWidget(new QLabel(QLabel::tr("Weapons"), GBoxOptions), 2, 0);
 
 	WeaponsName = new QComboBox(GBoxOptions);
-	GBoxOptionsLayout->addWidget(WeaponsName, 8, 1);
+	GBoxOptionsLayout->addWidget(WeaponsName, 2, 1);
 	
 	connect(WeaponsName, SIGNAL(currentIndexChanged(int)), this, SLOT(ammoChanged(int)));
+	
+	QPushButton * goToWeaponPage = new QPushButton(GBoxOptions);
+	goToWeaponPage->setText(tr("Edit weapons"));
+	GBoxOptionsLayout->addWidget(goToWeaponPage, 3, 0, 1, 2);
+
+	connect(goToWeaponPage, SIGNAL(clicked()), this, SLOT(jumpToWeapons()));
 
 	connect(pMapContainer, SIGNAL(seedChanged(const QString &)), this, SLOT(seedChanged(const QString &)));
 	connect(pMapContainer, SIGNAL(mapChanged(const QString &)), this, SLOT(mapChanged(const QString &)));
@@ -71,6 +77,11 @@
 	connect(pMapContainer, SIGNAL(newTemplateFilter(int)), this, SLOT(templateFilterChanged(int)));
 }
 
+void GameCFGWidget::jumpToWeapons()
+{
+	emit goToWeapons(WeaponsName->currentText());
+}
+
 QVariant GameCFGWidget::schemeData(int column) const
 {
 	return GameSchemes->model()->data(GameSchemes->model()->index(GameSchemes->currentIndex(), column));
--- a/QTfrontend/gamecfgwidget.h	Sun Apr 19 13:36:51 2009 +0000
+++ b/QTfrontend/gamecfgwidget.h	Sun Apr 19 15:44:47 2009 +0000
@@ -52,6 +52,7 @@
 signals:
 	void paramChanged(const QString & param, const QStringList & value);
 	void goToSchemes();
+	void goToWeapons(const QString & name);
 
 private slots:
 	void ammoChanged(int index);
@@ -60,6 +61,7 @@
 	void seedChanged(const QString &);
 	void themeChanged(const QString &);
 	void schemeChanged(int);
+	void jumpToWeapons();
 
 private:
 	QGridLayout mainLayout;
--- a/QTfrontend/hwform.cpp	Sun Apr 19 13:36:51 2009 +0000
+++ b/QTfrontend/hwform.cpp	Sun Apr 19 15:44:47 2009 +0000
@@ -92,6 +92,7 @@
 		ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
 	connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
+	connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
 
 	connect(ui.pagePlayDemo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
 	connect(ui.pagePlayDemo->BtnPlayDemo, SIGNAL(clicked()), this, SLOT(PlayDemo()));
@@ -122,6 +123,7 @@
 		ui.pageNetGame->BtnStart, SLOT(setEnabled(bool)));
 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
+	connect(ui.pageNetGame->pGameCFG, SIGNAL(goToWeapons(const QString &)), this, SLOT(GoToSelectWeaponSet(const QString &)));
 
 	connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
 	connect(ui.pageRoomsList->BtnAdmin, SIGNAL(clicked()), this, SLOT(GoToAdmin()));
@@ -263,6 +265,12 @@
 	GoToPage(ID_PAGE_SELECTWEAPON);
 }
 
+void HWForm::GoToSelectWeaponSet(const QString & name)
+{
+	ui.pageSelectWeapon->pWeapons->setWeaponsName(name);
+	GoToPage(ID_PAGE_SELECTWEAPON);
+}
+
 void HWForm::GoToInfo()
 {
 	GoToPage(ID_PAGE_INFO);
--- a/QTfrontend/hwform.h	Sun Apr 19 13:36:51 2009 +0000
+++ b/QTfrontend/hwform.h	Sun Apr 19 15:44:47 2009 +0000
@@ -57,6 +57,7 @@
 	void GoToInfo();
 	void GoToTraining();
 	void GoToSelectWeapon();
+	void GoToSelectWeaponSet(const QString & name);
 	void GoToSelectNewWeapon();
 	void GoToNetServer();
 	void GoToSchemes();
--- a/share/hedgewars/Data/Locale/hedgewars_de.ts	Sun Apr 19 13:36:51 2009 +0000
+++ b/share/hedgewars/Data/Locale/hedgewars_de.ts	Sun Apr 19 15:44:47 2009 +0000
@@ -41,7 +41,7 @@
     <message>
         <location filename="../../../../QTfrontend/gamecfgwidget.cpp" line="57"/>
         <source>Edit schemes</source>
-        <translation>Waffenzusammenstellungen bearbeiten</translation>
+        <translation>Spielprofile bearbeiten</translation>
     </message>
 </context>
 <context>