--- 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()
--- a/QTfrontend/hwform.h Tue Jan 08 20:32:17 2008 +0000
+++ b/QTfrontend/hwform.h Wed Jan 09 20:26:31 2008 +0000
@@ -82,6 +82,7 @@
void ShowErrorMessage(const QString &);
void GetRecord(bool isDemo, const QByteArray & record);
void CreateNetGame();
+ void UpdateWeapons();
private:
void _NetConnect(const QString & hostName, quint16 port, const QString & nick);
--- a/QTfrontend/selectWeapon.cpp Tue Jan 08 20:32:17 2008 +0000
+++ b/QTfrontend/selectWeapon.cpp Wed Jan 09 20:26:31 2008 +0000
@@ -122,6 +122,7 @@
currentState = QString("%1%2").arg(currentState).arg(num);
}
wconf->setValue(m_name->text(), currentState);
+ emit weaponsChanged();
}
int SelWeaponWidget::operator [] (unsigned int weaponIndex) const
--- a/QTfrontend/selectWeapon.h Tue Jan 08 20:32:17 2008 +0000
+++ b/QTfrontend/selectWeapon.h Wed Jan 09 20:26:31 2008 +0000
@@ -56,6 +56,9 @@
void setWeaponsName(const QString& name);
void save();
+ signals:
+ void weaponsChanged();
+
private:
QString currentState;
QString curWeaponsName;