QTfrontend/pageselectweapon.cpp
changeset 5078 3527f0e7bb21
child 5204 e1a5f4d5d86a
equal deleted inserted replaced
5076:b3bb27f4ba6b 5078:3527f0e7bb21
       
     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 "pages.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     BtnBack = addButton(":/res/Exit.png", pageLayout, 1, 0, 2, 1, true);
       
    36     BtnDefault = addButton(tr("Default"), pageLayout, 1, 3);
       
    37     BtnNew = addButton(tr("New"), pageLayout, 1, 2);
       
    38     BtnCopy = addButton(tr("Copy"), pageLayout, 2, 2);
       
    39     BtnDelete = addButton(tr("Delete"), pageLayout, 2, 3);
       
    40     BtnSave = addButton(":/res/Save.png", pageLayout, 1, 4, 2, 1, true);
       
    41     BtnSave->setStyleSheet("QPushButton{margin: 24px 0px 0px 0px;}");
       
    42     BtnBack->setFixedHeight(BtnSave->height());
       
    43     BtnBack->setStyleSheet("QPushButton{margin-top: 31px;}");
       
    44 
       
    45     selectWeaponSet = new QComboBox(this);
       
    46     pageLayout->addWidget(selectWeaponSet, 1, 1, 2, 1);
       
    47 
       
    48     connect(BtnDefault, SIGNAL(clicked()), pWeapons, SLOT(setDefault()));
       
    49     connect(BtnSave, SIGNAL(clicked()), pWeapons, SLOT(save()));
       
    50     connect(BtnNew, SIGNAL(clicked()), pWeapons, SLOT(newWeaponsName()));
       
    51     connect(BtnCopy, SIGNAL(clicked()), pWeapons, SLOT(copy()));
       
    52     connect(selectWeaponSet, SIGNAL(currentIndexChanged(const QString&)), pWeapons, SLOT(setWeaponsName(const QString&)));
       
    53 }