--- a/QTfrontend/ui/widget/selectWeapon.cpp Wed Jan 01 13:22:46 2014 +0400
+++ b/QTfrontend/ui/widget/selectWeapon.cpp Wed Jan 01 13:42:38 2014 +0400
@@ -93,7 +93,7 @@
for(int i = 0; i < keys.size(); i++)
{
if (wconf->value(keys[i]).toString().size() != cDefaultAmmoStore->size())
- wconf->remove(keys[i]);
+ wconf->setValue(keys[i], fixWeaponSet(wconf->value(keys[i]).toString()));
}
QString currentState = *cDefaultAmmoStore;
@@ -333,3 +333,22 @@
setWeapons(ammo);
}
}
+
+QString SelWeaponWidget::fixWeaponSet(const QString &s)
+{
+ int neededLength = cDefaultAmmoStore->size() / 4;
+ int thisSetLength = s.size() / 4;
+
+ QStringList sl;
+ sl
+ << s.left(thisSetLength)
+ << s.mid(thisSetLength, thisSetLength)
+ << s.mid(thisSetLength * 2, thisSetLength)
+ << s.right(thisSetLength)
+ ;
+
+ for(int i = sl.length() - 1; i >= 0; --i)
+ sl[i] = sl[i].leftJustified(neededLength, '0', true);
+
+ return sl.join(QString());
+}
--- a/QTfrontend/ui/widget/selectWeapon.h Wed Jan 01 13:22:46 2014 +0400
+++ b/QTfrontend/ui/widget/selectWeapon.h Wed Jan 01 13:42:38 2014 +0400
@@ -87,6 +87,8 @@
QGridLayout* p2Layout;
QGridLayout* p3Layout;
QGridLayout* p4Layout;
+
+ QString fixWeaponSet(const QString & s);
};
#endif // _SELECT_WEAPON_INCLUDED