QTfrontend/input_ip.cpp
author unc0rr
Sat, 11 Apr 2009 11:01:17 +0000
changeset 1961 70ca07ab2dcf
parent 1066 1f1b3686a2b0
child 2948 3f21a9dc93d0
permissions -rw-r--r--
Remove Codec dir
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 883
diff changeset
     2
 * Hedgewars, a free turn based strategy game
883
07a568ba44e0 Update copyright info in source files headers
unc0rr
parents: 657
diff changeset
     3
 * Copyright (c) 2007, 2008 Andrey Korotaev <unC0Rr@gmail.com>
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     4
 *
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     8
 *
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    12
 * GNU General Public License for more details.
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    13
 *
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    17
 */
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    18
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    19
#include <QLineEdit>
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    20
#include <QSpinBox>
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    21
#include <QPushButton>
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    22
#include <QGridLayout>
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    23
#include <QLabel>
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    24
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    25
#include "input_ip.h"
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    26
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    27
HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent)
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    28
{
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    29
	QGridLayout * layout = new QGridLayout(this);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    30
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    31
	QLabel * lbHost = new QLabel(this);
657
b34fc518a48a Basic concept for net server options page (subject to change)
unc0rr
parents: 653
diff changeset
    32
	lbHost->setText(QLabel::tr("Host:"));
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    33
	layout->addWidget(lbHost, 0, 0);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    34
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    35
	QLabel * lbPort = new QLabel(this);
657
b34fc518a48a Basic concept for net server options page (subject to change)
unc0rr
parents: 653
diff changeset
    36
	lbPort->setText(QLabel::tr("Port:"));
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    37
	layout->addWidget(lbPort, 1, 0);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    38
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    39
	leHost = new QLineEdit(this);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    40
	layout->addWidget(leHost, 0, 1, 1, 2);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    41
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    42
	sbPort = new QSpinBox(this);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    43
	sbPort->setMinimum(0);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    44
	sbPort->setMaximum(65535);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    45
	layout->addWidget(sbPort, 1, 1, 1, 2);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    46
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    47
	pbDefault = new QPushButton(this);
657
b34fc518a48a Basic concept for net server options page (subject to change)
unc0rr
parents: 653
diff changeset
    48
	pbDefault->setText(QPushButton::tr("default"));
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    49
	layout->addWidget(pbDefault, 1, 3);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    50
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    51
	pbOK = new QPushButton(this);
657
b34fc518a48a Basic concept for net server options page (subject to change)
unc0rr
parents: 653
diff changeset
    52
	pbOK->setText(QPushButton::tr("OK"));
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    53
	pbOK->setDefault(true);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    54
	layout->addWidget(pbOK, 3, 1);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    55
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    56
	pbCancel = new QPushButton(this);
657
b34fc518a48a Basic concept for net server options page (subject to change)
unc0rr
parents: 653
diff changeset
    57
	pbCancel->setText(QPushButton::tr("Cancel"));
653
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    58
	layout->addWidget(pbCancel, 3, 2);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    59
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    60
	connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    61
	connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    62
	connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    63
}
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    64
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    65
void HWHostPortDialog::setDefaultPort()
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    66
{
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    67
	sbPort->setValue(46631);
4f44fc06ca45 Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff changeset
    68
}