101 tr("Quit")); |
101 tr("Quit")); |
102 } |
102 } |
103 return ; |
103 return ; |
104 } |
104 } |
105 cfgdir.cd(".hedgewars"); |
105 cfgdir.cd(".hedgewars"); |
|
106 |
|
107 list = cfgdir.entryList(QStringList("*.cfg")); |
|
108 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it ) |
|
109 { |
|
110 ui.CBTeamName->addItem((*it).replace(QRegExp("^(.*).cfg"), "\\1")); |
|
111 } |
|
112 |
106 |
113 |
107 QFile settings(cfgdir.absolutePath() + "/options"); |
114 QFile settings(cfgdir.absolutePath() + "/options"); |
108 if (!settings.open(QIODevice::ReadOnly)) |
115 if (!settings.open(QIODevice::ReadOnly)) |
109 { |
116 { |
110 return ; |
117 return ; |
159 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
166 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
160 } |
167 } |
161 |
168 |
162 void HWForm::NewTeam() |
169 void HWForm::NewTeam() |
163 { |
170 { |
164 HWTeam tmpTeam(this); |
171 tmpTeam = new HWTeam(); |
165 tmpTeam.ToPage(); |
172 tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
|
173 tmpTeam->SetToPage(this); |
166 ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
174 ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
167 } |
175 } |
168 |
176 |
169 void HWForm::EditTeam() |
177 void HWForm::EditTeam() |
170 { |
178 { |
171 HWTeam tmpTeam(this); |
179 tmpTeam = new HWTeam(); |
172 tmpTeam.LoadFromFile(cfgdir.absolutePath() + "/team.cfg"); |
180 tmpTeam->SetCfgDir(cfgdir.absolutePath()); |
173 tmpTeam.ToPage(); |
181 tmpTeam->LoadFromFile(); |
|
182 tmpTeam->SetToPage(this); |
174 ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
183 ui.Pages->setCurrentIndex(ID_PAGE_SETUP_TEAM); |
175 } |
184 } |
176 |
185 |
177 void HWForm::TeamSave() |
186 void HWForm::TeamSave() |
178 { |
187 { |
179 HWTeam tmpTeam(this); |
188 tmpTeam = new HWTeam(); |
180 tmpTeam.FromPage(); |
189 tmpTeam->GetFromPage(this); |
181 tmpTeam.SaveToFile(cfgdir.absolutePath() + "/team.cfg"); |
190 tmpTeam->SaveToFile(); |
|
191 delete tmpTeam; |
182 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
192 ui.Pages->setCurrentIndex(ID_PAGE_SETUP); |
183 } |
193 } |
184 |
194 |
185 void HWForm::TeamDiscard() |
195 void HWForm::TeamDiscard() |
186 { |
196 { |
190 void HWForm::SimpleGame() |
200 void HWForm::SimpleGame() |
191 { |
201 { |
192 game = new HWGame(); |
202 game = new HWGame(); |
193 game->AddTeam(cfgdir.absolutePath() + "/team.cfg"); |
203 game->AddTeam(cfgdir.absolutePath() + "/team.cfg"); |
194 game->AddTeam(cfgdir.absolutePath() + "/team.cfg"); |
204 game->AddTeam(cfgdir.absolutePath() + "/team.cfg"); |
195 game->Start(ui.CBResolution->currentIndex()); |
205 game->Start(ui.CBResolution->currentIndex(), ui.CBFullscreen->isChecked()); |
196 } |
206 } |
197 |
207 |
198 void HWForm::CBGrave_activated(const QString & gravename) |
208 void HWForm::CBGrave_activated(const QString & gravename) |
199 { |
209 { |
200 QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); |
210 QPixmap pix(QString(DATA_PATH) + "/Graphics/Graves/" + gravename + ".png"); |