QTfrontend/selectWeapon.cpp
changeset 1576 a02353129a41
parent 1509 34f7dd4efe84
child 1904 20348675b015
equal deleted inserted replaced
1575:ec56e8956fcb 1576:a02353129a41
    73   m_numItems(numItems),
    73   m_numItems(numItems),
    74   QFrame(parent)
    74   QFrame(parent)
    75 {
    75 {
    76 	wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this);
    76 	wconf = new QSettings(cfgdir->absolutePath() + "/weapons.ini", QSettings::IniFormat, this);
    77 
    77 
    78 	wconf->setValue("Default", cDefaultAmmoStore->mid(10));
    78 	wconf->setValue("Default", *cDefaultAmmoStore);
    79 
    79 
    80 	QString currentState = cDefaultAmmoStore->mid(10);
    80 	QStringList keys = wconf->allKeys();
       
    81 	for(int i = 0; i < keys.size(); i++)
       
    82 	{
       
    83 		if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size())
       
    84 			wconf->remove(keys[i]);
       
    85 	}
       
    86 
       
    87 	QString currentState = *cDefaultAmmoStore;
    81 
    88 
    82 	pLayout = new QGridLayout(this);
    89 	pLayout = new QGridLayout(this);
    83 	pLayout->setSpacing(1);
    90 	pLayout->setSpacing(1);
    84 	pLayout->setMargin(1);
    91 	pLayout->setMargin(1);
    85 
    92 
   108 	update();
   115 	update();
   109 }
   116 }
   110 
   117 
   111 void SelWeaponWidget::setDefault()
   118 void SelWeaponWidget::setDefault()
   112 {
   119 {
   113 	setWeapons(cDefaultAmmoStore->mid(10));
   120 	setWeapons(*cDefaultAmmoStore);
   114 }
   121 }
   115 
   122 
   116 void SelWeaponWidget::save()
   123 void SelWeaponWidget::save()
   117 {
   124 {
   118 	if (m_name->text() == "Default") {
   125 	if (m_name->text() == "Default") {