QTfrontend/selectWeapon.cpp
changeset 724 21706280d913
parent 723 35f7bdb93268
child 725 a7a8eef5bbb6
equal deleted inserted replaced
723:35f7bdb93268 724:21706280d913
    25 #include <QHBoxLayout>
    25 #include <QHBoxLayout>
    26 #include <QLabel>
    26 #include <QLabel>
    27 #include <QBitmap>
    27 #include <QBitmap>
    28 #include <QLineEdit>
    28 #include <QLineEdit>
    29 #include <QSettings>
    29 #include <QSettings>
       
    30 #include <QMessageBox>
    30 
    31 
    31 QImage getAmmoImage(int num)
    32 QImage getAmmoImage(int num)
    32 {
    33 {
    33   static QImage ammo(":Ammos.png");
    34   static QImage ammo(":Ammos.png");
    34   return ammo.copy(0, num*32, 32, 32);
    35   return ammo.copy(0, num*32, 32, 32);
   147 }
   148 }
   148 
   149 
   149 void SelWeaponWidget::deleteWeaponsName()
   150 void SelWeaponWidget::deleteWeaponsName()
   150 {
   151 {
   151   if (curWeaponsName=="") return;
   152   if (curWeaponsName=="") return;
   152   wconf->remove(curWeaponsName);
   153 
       
   154   if (curWeaponsName=="Default") {
       
   155     QMessageBox impossible(QMessageBox::Warning, QMessageBox::tr("Weapons"), QMessageBox::tr("Can not delete default weapon set"));
       
   156     impossible.exec();
       
   157     return;
       
   158   }
       
   159 
       
   160   QMessageBox reallyDelete(QMessageBox::Question, QMessageBox::tr("Weapons"), QMessageBox::tr("Really delete this weapon set?"),
       
   161 			   QMessageBox::Ok | QMessageBox::Cancel);
       
   162   
       
   163   if (reallyDelete.exec()==QMessageBox::Ok) {
       
   164     wconf->remove(curWeaponsName);
       
   165     emit weaponsDeleted();
       
   166   }
   153 }
   167 }
   154 
   168 
   155 void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
   169 void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
   156 {
   170 {
   157   if(name!="" && wconf->contains(name)) {
   171   if(name!="" && wconf->contains(name)) {