QTfrontend/ui/widget/selectWeapon.cpp
changeset 6479 4f08821cbff5
parent 6472 bced12412f94
child 6616 f77bb02b669f
equal deleted inserted replaced
6478:752d4fb5e376 6479:4f08821cbff5
   252 {
   252 {
   253     QString newName = tr("new");
   253     QString newName = tr("new");
   254     if(wconf->contains(newName)) {
   254     if(wconf->contains(newName)) {
   255         //name already used -> look for an appropriate name:
   255         //name already used -> look for an appropriate name:
   256         int i=2;
   256         int i=2;
   257         while(wconf->contains(newName = tr("new")+QString::number(i++)));
   257         while(wconf->contains(newName = tr("new")+QString::number(i++))) ;
   258     }
   258     }
   259     setWeaponsName(newName);
   259     setWeaponsName(newName);
   260 }
   260 }
   261 
   261 
   262 void SelWeaponWidget::setWeaponsName(const QString& name)
   262 void SelWeaponWidget::setWeaponsName(const QString& name)
   283         QString ammo = getWeaponsString(curWeaponsName);
   283         QString ammo = getWeaponsString(curWeaponsName);
   284         QString newName = tr("copy of") + " " + curWeaponsName;
   284         QString newName = tr("copy of") + " " + curWeaponsName;
   285         if(wconf->contains(newName)) {
   285         if(wconf->contains(newName)) {
   286             //name already used -> look for an appropriate name:
   286             //name already used -> look for an appropriate name:
   287             int i=2;
   287             int i=2;
   288             while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++)));
   288             while(wconf->contains(newName = tr("copy of") + " " + curWeaponsName+QString::number(i++))) ;
   289         }
   289         }
   290         setWeaponsName(newName);
   290         setWeaponsName(newName);
   291         setWeapons(ammo);
   291         setWeapons(ammo);
   292     }
   292     }
   293 }
   293 }