QTfrontend/ui/widget/selectWeapon.cpp
changeset 11822 5f21387edff1
parent 11768 59e979b1408f
child 12668 d7492247a368
equal deleted inserted replaced
11821:f73a299c7884 11822:5f21387edff1
   284     }
   284     }
   285 }
   285 }
   286 
   286 
   287 void SelWeaponWidget::newWeaponsName()
   287 void SelWeaponWidget::newWeaponsName()
   288 {
   288 {
   289     QString newName = tr("new");
   289     QString newName = tr("New");
   290     if(wconf->contains(newName))
   290     if(wconf->contains(newName))
   291     {
   291     {
   292         //name already used -> look for an appropriate name:
   292         //name already used -> look for an appropriate name:
   293         int i=2;
   293         int i=2;
   294         while(wconf->contains(newName = tr("new")+QString::number(i++))) ;
   294         while(wconf->contains(newName = tr("New (%1)").arg(i++))) ;
   295     }
   295     }
   296     setWeaponsName(newName);
   296     setWeaponsName(newName);
   297 }
   297 }
   298 
   298 
   299 void SelWeaponWidget::setWeaponsName(const QString& name)
   299 void SelWeaponWidget::setWeaponsName(const QString& name)
   320 void SelWeaponWidget::copy()
   320 void SelWeaponWidget::copy()
   321 {
   321 {
   322     if(wconf->contains(curWeaponsName))
   322     if(wconf->contains(curWeaponsName))
   323     {
   323     {
   324         QString ammo = getWeaponsString(curWeaponsName);
   324         QString ammo = getWeaponsString(curWeaponsName);
   325         QString newName = tr("copy of %1").arg(curWeaponsName);
   325         QString newName = tr("Copy of %1").arg(curWeaponsName);
   326         if(wconf->contains(newName))
   326         if(wconf->contains(newName))
   327         {
   327         {
   328             //name already used -> look for an appropriate name:
   328             //name already used -> look for an appropriate name:
   329             int i=2;
   329             int i=2;
   330             while(wconf->contains(newName = tr("copy of %1").arg(curWeaponsName+QString::number(i++))));
   330             while(wconf->contains(newName = tr("Copy of %1 (%2)").arg(curWeaponsName, i++)));
   331         }
   331         }
   332         setWeaponsName(newName);
   332         setWeaponsName(newName);
   333         setWeapons(ammo);
   333         setWeapons(ammo);
   334     }
   334     }
   335 }
   335 }