QTfrontend/pageselectweapon.cpp
branchhedgeroid
changeset 6224 42b256eca362
parent 6055 88cfcd9161d3
parent 6223 cc3eb9b7230f
child 6226 3106add9a5bf
equal deleted inserted replaced
6055:88cfcd9161d3 6224:42b256eca362
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2006-2011 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    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
       
    17  */
       
    18 
       
    19 #include <QGridLayout>
       
    20 #include <QPushButton>
       
    21 #include <QComboBox>
       
    22 
       
    23 #include "pageselectweapon.h"
       
    24 #include "hwconsts.h"
       
    25 #include "selectWeapon.h"
       
    26 
       
    27 PageSelectWeapon::PageSelectWeapon(QWidget* parent) :
       
    28   AbstractPage(parent)
       
    29 {
       
    30     QGridLayout * pageLayout = new QGridLayout(this);
       
    31 
       
    32     pWeapons = new SelWeaponWidget(cAmmoNumber, this);
       
    33     pageLayout->addWidget(pWeapons, 0, 0, 1, 5);
       
    34 
       
    35 
       
    36     BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, 2, 1, true);
       
    37     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
       
    38 
       
    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 
       
    49     selectWeaponSet = new QComboBox(this);
       
    50     pageLayout->addWidget(selectWeaponSet, 1, 1, 2, 1);
       
    51 
       
    52     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
       
    53     connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
       
    54     connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
       
    55     connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy()));
       
    56     connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
       
    57 }