50 { |
50 { |
51 ui.setupUi(this); |
51 ui.setupUi(this); |
52 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
52 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
53 |
53 |
54 UpdateTeamsLists(); |
54 UpdateTeamsLists(); |
|
55 UpdateWeapons(); |
55 |
56 |
56 connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
57 connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer())); |
57 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
58 connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup())); |
58 connect(ui.pageMain->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); |
59 connect(ui.pageMain->BtnMultiplayer, SIGNAL(clicked()), this, SLOT(GoToMultiplayer())); |
59 connect(ui.pageMain->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves())); |
60 connect(ui.pageMain->BtnLoad, SIGNAL(clicked()), this, SLOT(GoToSaves())); |
82 connect(ui.pageOptions->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
83 connect(ui.pageOptions->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
83 connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
84 connect(ui.pageOptions->BtnNewTeam, SIGNAL(clicked()), this, SLOT(NewTeam())); |
84 connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
85 connect(ui.pageOptions->BtnEditTeam, SIGNAL(clicked()), this, SLOT(EditTeam())); |
85 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); |
86 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), config, SLOT(SaveOptions())); |
86 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); |
87 connect(ui.pageOptions->BtnSaveOptions, SIGNAL(clicked()), this, SLOT(GoBack())); |
|
88 |
87 connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
89 connect(ui.pageOptions->WeaponEdit, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon())); |
88 connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
90 connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectNewWeapon())); |
|
91 connect(ui.pageSelectWeapon->pWeapons, SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons())); |
89 |
92 |
90 connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
93 connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack())); |
91 connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
94 connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect())); |
92 connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer())); |
95 connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer())); |
93 connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16))); |
96 connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16))); |
117 connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save())); |
120 connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save())); |
118 |
121 |
119 GoToPage(ID_PAGE_MAIN); |
122 GoToPage(ID_PAGE_MAIN); |
120 } |
123 } |
121 |
124 |
|
125 void HWForm::UpdateWeapons() |
|
126 { |
|
127 ui.pageOptions->WeaponsName->clear(); |
|
128 ui.pageOptions->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames()); |
|
129 } |
|
130 |
122 void HWForm::UpdateTeamsLists(const QStringList* editable_teams) |
131 void HWForm::UpdateTeamsLists(const QStringList* editable_teams) |
123 { |
132 { |
124 QStringList teamslist; |
133 QStringList teamslist; |
125 if(editable_teams) { |
134 if(editable_teams) { |
126 teamslist=*editable_teams; |
135 teamslist=*editable_teams; |
134 teamslist.push_back("DefaultTeam"); |
143 teamslist.push_back("DefaultTeam"); |
135 } |
144 } |
136 |
145 |
137 ui.pageOptions->CBTeamName->clear(); |
146 ui.pageOptions->CBTeamName->clear(); |
138 ui.pageOptions->CBTeamName->addItems(teamslist); |
147 ui.pageOptions->CBTeamName->addItems(teamslist); |
139 |
|
140 // now updates weapons also |
|
141 ui.pageOptions->WeaponsName->clear(); |
|
142 ui.pageOptions->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames()); |
|
143 } |
148 } |
144 |
149 |
145 void HWForm::GoToMain() |
150 void HWForm::GoToMain() |
146 { |
151 { |
147 GoToPage(ID_PAGE_MAIN); |
152 GoToPage(ID_PAGE_MAIN); |