--- a/QTfrontend/hwform.cpp Sun Jan 20 12:15:23 2008 +0000
+++ b/QTfrontend/hwform.cpp Sun Jan 20 12:21:13 2008 +0000
@@ -194,13 +194,13 @@
void HWForm::GoToSelectNewWeapon()
{
- ui.pageSelectWeapon->pWeapons->setWeaponsName("");
+ ui.pageSelectWeapon->pWeapons->setWeaponsName("", false);
GoToPage(ID_PAGE_SELECTWEAPON);
}
void HWForm::GoToSelectWeapon()
{
- ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText());
+ ui.pageSelectWeapon->pWeapons->setWeaponsName(ui.pageOptions->WeaponsName->currentText(), true);
GoToPage(ID_PAGE_SELECTWEAPON);
}
--- a/QTfrontend/selectWeapon.cpp Sun Jan 20 12:15:23 2008 +0000
+++ b/QTfrontend/selectWeapon.cpp Sun Jan 20 12:21:13 2008 +0000
@@ -121,6 +121,10 @@
int num = it==weaponItems.end() ? 9 : (*this)[i];
currentState = QString("%1%2").arg(currentState).arg(num);
}
+ if (curWeaponsName!="") {
+ // remove old entry
+ wconf->remove(curWeaponsName);
+ }
wconf->setValue(m_name->text(), currentState);
emit weaponsChanged();
}
@@ -141,13 +145,15 @@
return wconf->value(name).toString();
}
-void SelWeaponWidget::setWeaponsName(const QString& name)
+void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
{
if(name!="" && wconf->contains(name)) {
setWeapons(wconf->value(name).toString());
}
- curWeaponsName=name;
+ if(editMode) curWeaponsName=name;
+ else curWeaponsName="";
+
m_name->setText(name);
}
--- a/QTfrontend/selectWeapon.h Sun Jan 20 12:15:23 2008 +0000
+++ b/QTfrontend/selectWeapon.h Sun Jan 20 12:21:13 2008 +0000
@@ -54,7 +54,7 @@
public slots:
void setDefault();
void setWeapons(const QString& ammo);
- void setWeaponsName(const QString& name);
+ void setWeaponsName(const QString& name, bool editMode);
void save();
signals: