QTfrontend/ui/widget/selectWeapon.cpp
changeset 7797 5aedd02e7230
parent 6952 7f70f37bbf08
child 7830 72e52da6ea7f
equal deleted inserted replaced
7796:5d00c28059e3 7797:5aedd02e7230
   192 void SelWeaponWidget::save()
   192 void SelWeaponWidget::save()
   193 {
   193 {
   194     for(int i = 0; i < cDefaultAmmos.size(); i++)
   194     for(int i = 0; i < cDefaultAmmos.size(); i++)
   195         if (!cDefaultAmmos[i].first.compare(m_name->text()))
   195         if (!cDefaultAmmos[i].first.compare(m_name->text()))
   196         {
   196         {
   197             QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first));
   197             QMessageBox deniedMsg(this);
       
   198             deniedMsg.setIcon(QMessageBox::Warning);
       
   199             deniedMsg.setWindowTitle(QMessageBox::tr("Weapons - Warning"));
       
   200             deniedMsg.setText(QMessageBox::tr("Cannot overwrite default weapon set '%1'!").arg(cDefaultAmmos[i].first));
       
   201             deniedMsg.setWindowModality(Qt::WindowModal);
       
   202             deniedMsg.exec();
   198             return;
   203             return;
   199         }
   204         }
   200 
   205 
   201     if (m_name->text() == "") return;
   206     if (m_name->text() == "") return;
   202 
   207 
   242     if (curWeaponsName == "") return;
   247     if (curWeaponsName == "") return;
   243 
   248 
   244     for(int i = 0; i < cDefaultAmmos.size(); i++)
   249     for(int i = 0; i < cDefaultAmmos.size(); i++)
   245         if (!cDefaultAmmos[i].first.compare(m_name->text()))
   250         if (!cDefaultAmmos[i].first.compare(m_name->text()))
   246         {
   251         {
   247             QMessageBox::warning(0, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set '%1'!").arg(cDefaultAmmos[i].first));
   252             QMessageBox deniedMsg(this);
       
   253             deniedMsg.setIcon(QMessageBox::Warning);
       
   254             deniedMsg.setWindowTitle(QMessageBox::tr("Weapons - Warning"));
       
   255             deniedMsg.setText(QMessageBox::tr("Cannot delete default weapon set '%1'!").arg(cDefaultAmmos[i].first));
       
   256             deniedMsg.setWindowModality(Qt::WindowModal);
       
   257             deniedMsg.exec();
   248             return;
   258             return;
   249         }
   259         }
   250 
   260 
   251     QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"), QMessageBox::Ok | QMessageBox::Cancel);
   261     QMessageBox reallyDeleteMsg(this);
   252 
   262     reallyDeleteMsg.setIcon(QMessageBox::Question);
   253     if (reallyDelete.exec() == QMessageBox::Ok)
   263     reallyDeleteMsg.setWindowTitle(QMessageBox::tr("Weapons - Are you sure?"));
       
   264     reallyDeleteMsg.setText(QMessageBox::tr("Do you really want to delete the weapon set '%1'?").arg(curWeaponsName));
       
   265     reallyDeleteMsg.setWindowModality(Qt::WindowModal);
       
   266     reallyDeleteMsg.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
       
   267 
       
   268     if (reallyDeleteMsg.exec() == QMessageBox::Ok)
   254     {
   269     {
   255         wconf->remove(curWeaponsName);
   270         wconf->remove(curWeaponsName);
   256         emit weaponsDeleted();
   271         emit weaponsDeleted();
   257     }
   272     }
   258 }
   273 }