--- a/QTfrontend/hwform.cpp Sun Jan 20 12:21:13 2008 +0000
+++ b/QTfrontend/hwform.cpp Sun Jan 20 12:43:36 2008 +0000
@@ -120,6 +120,13 @@
connect(ui.pageSelectWeapon->BtnDefault, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(setDefault()));
connect(ui.pageSelectWeapon->BtnSave, SIGNAL(clicked()), ui.pageSelectWeapon->pWeapons, SLOT(save()));
+ connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
+ connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ this, SLOT(UpdateWeapons())); // executed second
+ connect(ui.pageSelectWeapon->BtnDelete, SIGNAL(clicked()),
+ this, SLOT(GoBack())); // executed third
+
GoToPage(ID_PAGE_MAIN);
}
--- a/QTfrontend/pages.cpp Sun Jan 20 12:21:13 2008 +0000
+++ b/QTfrontend/pages.cpp Sun Jan 20 12:43:36 2008 +0000
@@ -661,11 +661,12 @@
pageLayout->setMargin(25);
pWeapons=new SelWeaponWidget(20, this);
- pageLayout->addWidget(pWeapons, 0, 0, 1, 3);
+ pageLayout->addWidget(pWeapons, 0, 0, 1, 4);
BtnBack = addButton("Back", pageLayout, 1, 0);
BtnDefault = addButton("Default", pageLayout, 1, 1);
- BtnSave = addButton("Save", pageLayout, 1, 2);
+ BtnDelete = addButton("Delete", pageLayout, 1, 2);
+ BtnSave = addButton("Save", pageLayout, 1, 3);
}
PageInGame::PageInGame(QWidget* parent) :
--- a/QTfrontend/pages.h Sun Jan 20 12:21:13 2008 +0000
+++ b/QTfrontend/pages.h Sun Jan 20 12:43:36 2008 +0000
@@ -315,6 +315,7 @@
QPushButton *BtnSave;
QPushButton *BtnDefault;
+ QPushButton *BtnDelete;
QPushButton *BtnBack;
SelWeaponWidget* pWeapons;
};
--- a/QTfrontend/selectWeapon.cpp Sun Jan 20 12:21:13 2008 +0000
+++ b/QTfrontend/selectWeapon.cpp Sun Jan 20 12:43:36 2008 +0000
@@ -145,6 +145,12 @@
return wconf->value(name).toString();
}
+void SelWeaponWidget::deleteWeaponsName()
+{
+ if (curWeaponsName=="") return;
+ wconf->remove(curWeaponsName);
+}
+
void SelWeaponWidget::setWeaponsName(const QString& name, bool editMode)
{
if(name!="" && wconf->contains(name)) {
--- a/QTfrontend/selectWeapon.h Sun Jan 20 12:21:13 2008 +0000
+++ b/QTfrontend/selectWeapon.h Sun Jan 20 12:43:36 2008 +0000
@@ -55,6 +55,7 @@
void setDefault();
void setWeapons(const QString& ammo);
void setWeaponsName(const QString& name, bool editMode);
+ void deleteWeaponsName();
void save();
signals: