delete weapon button added
authordisplacer
Sun, 20 Jan 2008 12:43:36 +0000
changeset 718 f93a38d2c982
parent 717 490dc8bb5b87
child 719 bea32693bd7a
delete weapon button added
QTfrontend/hwform.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/selectWeapon.cpp
QTfrontend/selectWeapon.h
--- 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: