equal
deleted
inserted
replaced
248 } |
248 } |
249 } |
249 } |
250 |
250 |
251 void SelWeaponWidget::newWeaponsName() |
251 void SelWeaponWidget::newWeaponsName() |
252 { |
252 { |
253 setWeaponsName(tr("new")); |
253 QString newName = tr("new"); |
|
254 if(wconf->contains(newName)) { |
|
255 //name already used -> look for an appropriate name: |
|
256 int i=2; |
|
257 while(wconf->contains(newName = tr("new")+QString::number(i++))); |
|
258 } |
|
259 setWeaponsName(newName); |
254 } |
260 } |
255 |
261 |
256 void SelWeaponWidget::setWeaponsName(const QString& name) |
262 void SelWeaponWidget::setWeaponsName(const QString& name) |
257 { |
263 { |
258 m_name->setText(name); |
264 m_name->setText(name); |
271 return wconf->allKeys(); |
277 return wconf->allKeys(); |
272 } |
278 } |
273 |
279 |
274 void SelWeaponWidget::copy() |
280 void SelWeaponWidget::copy() |
275 { |
281 { |
276 QString ammo = getWeaponsString(curWeaponsName); |
282 if(wconf->contains(curWeaponsName)) { |
277 setWeaponsName(tr("copy of") + " " + curWeaponsName); |
283 QString ammo = getWeaponsString(curWeaponsName); |
278 setWeapons(ammo); |
284 QString newName = tr("copy of") + " " + curWeaponsName; |
279 } |
285 if(wconf->contains(newName)) { |
|
286 //name already used -> look for an appropriate name: |
|
287 int i=2; |
|
288 while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))); |
|
289 } |
|
290 setWeaponsName(newName); |
|
291 setWeapons(ammo); |
|
292 } |
|
293 } |