QTfrontend/pageselectweapon.cpp
changeset 6042 8b5345758f62
parent 6009 14f6fc9869f2
equal deleted inserted replaced
6040:a740069c21e3 6042:8b5345758f62
    15  * along with this program; if not, write to the Free Software
    15  * along with this program; if not, write to the Free Software
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include <QGridLayout>
    19 #include <QGridLayout>
       
    20 #include <QHBoxLayout>
    20 #include <QPushButton>
    21 #include <QPushButton>
    21 #include <QComboBox>
    22 #include <QComboBox>
    22 
    23 
    23 #include "pageselectweapon.h"
    24 #include "pageselectweapon.h"
    24 #include "hwconsts.h"
    25 #include "hwconsts.h"
    25 #include "selectWeapon.h"
    26 #include "selectWeapon.h"
    26 
    27 
    27 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
    28 QLayout * PageSelectWeapon::bodyLayoutDefinition()
    28   AbstractPage(parent)
       
    29 {
    29 {
    30     QGridLayout * pageLayout = new QGridLayout(this);
    30     QGridLayout * pageLayout = new QGridLayout();
    31 
    31 
    32     pWeapons = new SelWeaponWidget(cAmmoNumber, this);
    32     pWeapons = new SelWeaponWidget(cAmmoNumber, this);
    33     pageLayout->addWidget(pWeapons, 0, 0, 1, 5);
    33     pageLayout->addWidget(pWeapons);
    34 
    34 
       
    35     return pageLayout;
       
    36 }
    35 
    37 
    36     BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, 2, 1, true);
    38 QLayout * PageSelectWeapon::footerLayoutDefinition()
    37     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
    39 {
    38 
    40     QGridLayout * bottomLayout = new QGridLayout();
    39 
       
    40     BtnDefault = addButton(tr("Default"), pageLayout, 1, 3);
       
    41     BtnNew = addButton(tr("New"), pageLayout, 1, 2);
       
    42     BtnCopy = addButton(tr("Copy"), pageLayout, 2, 2);
       
    43     BtnDelete = addButton(tr("Delete"), pageLayout, 2, 3);
       
    44     BtnSave = addButton(":/res/Save.png", pageLayout, 1, 4, 2, 1, true);
       
    45     BtnSave->setStyleSheet("QPushButton{margin: 24px 0px 0px 0px;}");
       
    46     BtnBack->setFixedHeight(BtnSave->height());
       
    47     BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}");
       
    48 
    41 
    49     selectWeaponSet = new QComboBox(this);
    42     selectWeaponSet = new QComboBox(this);
    50     pageLayout->addWidget(selectWeaponSet, 1, 1, 2, 1);
    43     bottomLayout->addWidget(selectWeaponSet, 0, 0, 2, 1);
    51 
    44 
       
    45     // first row
       
    46     BtnNew = addButton(tr("New"), bottomLayout, 0, 1);
       
    47     BtnDefault = addButton(tr("Default"), bottomLayout, 0, 2);
       
    48 
       
    49     // second row
       
    50     BtnCopy = addButton(tr("Copy"), bottomLayout, 1, 1);
       
    51     BtnDelete = addButton(tr("Delete"), bottomLayout, 1, 2);
       
    52 
       
    53     bottomLayout->setColumnStretch(1,1);
       
    54     bottomLayout->setColumnStretch(2,1);
       
    55 
       
    56     btnSave = addButton(":/res/Save.png", bottomLayout, 0, 3, 2, 1, true);
       
    57     btnSave->setStyleSheet("QPushButton{margin: 24px 0 0 0;}");
       
    58     bottomLayout->setAlignment(btnSave, Qt::AlignRight | Qt::AlignBottom);
       
    59 
       
    60     return bottomLayout;
       
    61 }
       
    62 
       
    63 void PageSelectWeapon::connectSignals()
       
    64 {
    52     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
    65     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
    53     connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
    66     connect(btnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
    54     connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
    67     connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
    55     connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy()));
    68     connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy()));
    56     connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
    69     connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
    57 }
    70 }
       
    71 
       
    72 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :  AbstractPage(parent)
       
    73 {
       
    74     initPage();
       
    75 }