added copying of weapon sets
authorHenek
Tue, 21 Dec 2010 21:56:34 +0100
changeset 4598 7cb8c9db6e8d
parent 4596 3bf748d3bec7
child 4600 5a3b1dbdd4c9
added copying of weapon sets
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/selectWeapon.cpp
QTfrontend/selectWeapon.h
--- a/QTfrontend/pages.cpp	Tue Dec 21 15:12:06 2010 -0500
+++ b/QTfrontend/pages.cpp	Tue Dec 21 21:56:34 2010 +0100
@@ -1107,23 +1107,25 @@
     QGridLayout * pageLayout = new QGridLayout(this);
 
     pWeapons = new SelWeaponWidget(cAmmoNumber, this);
-    pageLayout->addWidget(pWeapons, 0, 0, 1, 6);
+    pageLayout->addWidget(pWeapons, 0, 0, 1, 5);
 
-    BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
-    BtnDefault = addButton(tr("Default"), pageLayout, 1, 2);
-    BtnNew = addButton(tr("New"), pageLayout, 1, 3);
-    BtnDelete = addButton(tr("Delete"), pageLayout, 1, 4);
-    BtnSave = addButton(":/res/Save.png", pageLayout, 1, 5, true);
+    BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, 2, 1, true);
+    BtnDefault = addButton(tr("Default"), pageLayout, 1, 3);
+    BtnNew = addButton(tr("New"), pageLayout, 1, 2);
+    BtnCopy = addButton(tr("Copy"), pageLayout, 2, 2);
+    BtnDelete = addButton(tr("Delete"), pageLayout, 2, 3);
+    BtnSave = addButton(":/res/Save.png", pageLayout, 1, 4, 2, 1, true);
     BtnSave->setStyleSheet("QPushButton{margin: 24px 0px 0px 0px;}");
     BtnBack->setFixedHeight(BtnSave->height());
     BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}");
 
     selectWeaponSet = new QComboBox(this);
-    pageLayout->addWidget(selectWeaponSet, 1, 1);
+    pageLayout->addWidget(selectWeaponSet, 1, 1, 2, 1);
 
     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
     connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
     connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
+    connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy()));
     connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
 }
 
--- a/QTfrontend/pages.h	Tue Dec 21 15:12:06 2010 -0500
+++ b/QTfrontend/pages.h	Tue Dec 21 21:56:34 2010 +0100
@@ -395,6 +395,7 @@
     QPushButton *BtnDefault;
     QPushButton *BtnDelete;
     QPushButton *BtnNew;
+    QPushButton *BtnCopy;
     QPushButton *BtnBack;
     SelWeaponWidget* pWeapons;
     QComboBox* selectWeaponSet;
--- a/QTfrontend/selectWeapon.cpp	Tue Dec 21 15:12:06 2010 -0500
+++ b/QTfrontend/selectWeapon.cpp	Tue Dec 21 21:56:34 2010 +0100
@@ -269,3 +269,10 @@
 {
     return wconf->allKeys();
 }
+
+void SelWeaponWidget::copy()
+{
+    QString ammo = getWeaponsString(curWeaponsName);
+    setWeaponsName(tr("copy of") + " " + curWeaponsName);
+    setWeapons(ammo);
+}
--- a/QTfrontend/selectWeapon.h	Tue Dec 21 15:12:06 2010 -0500
+++ b/QTfrontend/selectWeapon.h	Tue Dec 21 21:56:34 2010 +0100
@@ -59,6 +59,7 @@
   void deleteWeaponsName();
   void newWeaponsName();
   void save();
+  void copy();
 
  signals:
   void weaponsChanged();