QTfrontend/pagenetserver.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 <QGroupBox>
       
    22 #include <QLabel>
       
    23 #include <QLineEdit>
       
    24 #include <QSpinBox>
       
    25 
       
    26 #include "pagenetserver.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 
       
    40     BtnBack =addButton(":/res/Exit.png", pageLayout, 1, 0, true);
       
    41     connect(BtnBack, SIGNAL(clicked()), this, SIGNAL(goBack()));
       
    42 
       
    43 
       
    44     BtnStart = new QPushButton(this);
       
    45     BtnStart->setFont(*font14);
       
    46     BtnStart->setText(QPushButton::tr("Start"));
       
    47     pageLayout->addWidget(BtnStart, 1, 2);
       
    48 
       
    49     QWidget * wg = new QWidget(this);
       
    50     pageLayout->addWidget(wg, 0, 0, 1, 3);
       
    51 
       
    52     QGridLayout * wgLayout = new QGridLayout(wg);
       
    53     wgLayout->setColumnStretch(0, 1);
       
    54     wgLayout->setColumnStretch(1, 3);
       
    55     wgLayout->setColumnStretch(2, 1);
       
    56 
       
    57     wgLayout->setRowStretch(0, 0);
       
    58     wgLayout->setRowStretch(1, 1);
       
    59 
       
    60     QGroupBox * gb = new QGroupBox(wg);
       
    61     wgLayout->addWidget(gb, 0, 1);
       
    62 
       
    63     QGridLayout * gbLayout = new QGridLayout(gb);
       
    64 
       
    65     labelSD = new QLabel(gb);
       
    66     labelSD->setText(QLabel::tr("Server name:"));
       
    67     gbLayout->addWidget(labelSD, 0, 0);
       
    68 
       
    69     leServerDescr = new QLineEdit(gb);
       
    70     gbLayout->addWidget(leServerDescr, 0, 1);
       
    71 
       
    72     labelPort = new QLabel(gb);
       
    73     labelPort->setText(QLabel::tr("Server port:"));
       
    74     gbLayout->addWidget(labelPort, 1, 0);
       
    75 
       
    76     sbPort = new QSpinBox(gb);
       
    77     sbPort->setMinimum(0);
       
    78     sbPort->setMaximum(65535);
       
    79     gbLayout->addWidget(sbPort, 1, 1);
       
    80 
       
    81     BtnDefault = new QPushButton(gb);
       
    82     BtnDefault->setText(QPushButton::tr("default"));
       
    83     gbLayout->addWidget(BtnDefault, 1, 2);
       
    84 
       
    85     connect(BtnDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
       
    86 }
       
    87 
       
    88 void PageNetServer::setDefaultPort()
       
    89 {
       
    90     sbPort->setValue(46631);
       
    91 }