QTfrontend/pagenetserver.cpp
changeset 5080 2e29c1e1c9cd
child 5204 e1a5f4d5d86a
equal deleted inserted replaced
5078:3527f0e7bb21 5080:2e29c1e1c9cd
       
     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 <QGroupBox>
       
    22 #include <QLabel>
       
    23 #include <QLineEdit>
       
    24 #include <QSpinBox>
       
    25 
       
    26 #include "pages.h"
       
    27 
       
    28 PageNetServer::PageNetServer(QWidget* parent) : AbstractPage(parent)
       
    29 {
       
    30     QFont * font14 = new QFont("MS Shell Dlg", 14);
       
    31     QGridLayout * pageLayout = new QGridLayout(this);
       
    32     pageLayout->setColumnStretch(0, 1);
       
    33     pageLayout->setColumnStretch(1, 1);
       
    34     pageLayout->setColumnStretch(2, 1);
       
    35 
       
    36     pageLayout->setRowStretch(0, 1);
       
    37     pageLayout->setRowStretch(1, 0);
       
    38 
       
    39     BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true);
       
    40 
       
    41     BtnStart = new QPushButton(this);
       
    42     BtnStart->setFont(*font14);
       
    43     BtnStart->setText(QPushButton::tr("Start"));
       
    44     pageLayout->addWidget(BtnStart, 1, 2);
       
    45 
       
    46     QWidget * wg = new QWidget(this);
       
    47     pageLayout->addWidget(wg, 0, 0, 1, 3);
       
    48 
       
    49     QGridLayout * wgLayout = new QGridLayout(wg);
       
    50     wgLayout->setColumnStretch(0, 1);
       
    51     wgLayout->setColumnStretch(1, 3);
       
    52     wgLayout->setColumnStretch(2, 1);
       
    53 
       
    54     wgLayout->setRowStretch(0, 0);
       
    55     wgLayout->setRowStretch(1, 1);
       
    56 
       
    57     QGroupBox * gb = new QGroupBox(wg);
       
    58     wgLayout->addWidget(gb, 0, 1);
       
    59 
       
    60     QGridLayout * gbLayout = new QGridLayout(gb);
       
    61 
       
    62     labelSD = new QLabel(gb);
       
    63     labelSD->setText(QLabel::tr("Server name:"));
       
    64     gbLayout->addWidget(labelSD, 0, 0);
       
    65 
       
    66     leServerDescr = new QLineEdit(gb);
       
    67     gbLayout->addWidget(leServerDescr, 0, 1);
       
    68 
       
    69     labelPort = new QLabel(gb);
       
    70     labelPort->setText(QLabel::tr("Server port:"));
       
    71     gbLayout->addWidget(labelPort, 1, 0);
       
    72 
       
    73     sbPort = new QSpinBox(gb);
       
    74     sbPort->setMinimum(0);
       
    75     sbPort->setMaximum(65535);
       
    76     gbLayout->addWidget(sbPort, 1, 1);
       
    77 
       
    78     BtnDefault = new QPushButton(gb);
       
    79     BtnDefault->setText(QPushButton::tr("default"));
       
    80     gbLayout->addWidget(BtnDefault, 1, 2);
       
    81 
       
    82     connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
       
    83 }
       
    84 
       
    85 void PageNetServer::setDefaultPort()
       
    86 {
       
    87     sbPort->setValue(46631);
       
    88 }