|
1 /* |
|
2 * Hedgewars, a free turn based strategy game |
|
3 * Copyright (c) 2007-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 <QLineEdit> |
|
20 #include <QSpinBox> |
|
21 #include <QPushButton> |
|
22 #include <QGridLayout> |
|
23 #include <QLabel> |
|
24 |
|
25 #include "input_ip.h" |
|
26 |
|
27 HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent) |
|
28 { |
|
29 QGridLayout * layout = new QGridLayout(this); |
|
30 |
|
31 QLabel * lbHost = new QLabel(this); |
|
32 lbHost->setText(QLabel::tr("Host:")); |
|
33 layout->addWidget(lbHost, 0, 0); |
|
34 |
|
35 QLabel * lbPort = new QLabel(this); |
|
36 lbPort->setText(QLabel::tr("Port:")); |
|
37 layout->addWidget(lbPort, 1, 0); |
|
38 |
|
39 leHost = new QLineEdit(this); |
|
40 layout->addWidget(leHost, 0, 1, 1, 2); |
|
41 |
|
42 sbPort = new QSpinBox(this); |
|
43 sbPort->setMinimum(0); |
|
44 sbPort->setMaximum(65535); |
|
45 layout->addWidget(sbPort, 1, 1, 1, 2); |
|
46 |
|
47 pbDefault = new QPushButton(this); |
|
48 pbDefault->setText(QPushButton::tr("default")); |
|
49 layout->addWidget(pbDefault, 1, 3); |
|
50 |
|
51 pbOK = new QPushButton(this); |
|
52 pbOK->setText(QPushButton::tr("OK")); |
|
53 pbOK->setDefault(true); |
|
54 layout->addWidget(pbOK, 3, 1); |
|
55 |
|
56 pbCancel = new QPushButton(this); |
|
57 pbCancel->setText(QPushButton::tr("Cancel")); |
|
58 layout->addWidget(pbCancel, 3, 2); |
|
59 |
|
60 connect(pbOK, SIGNAL(clicked()), this, SLOT(accept())); |
|
61 connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); |
|
62 connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
|
63 } |
|
64 |
|
65 void HWHostPortDialog::setDefaultPort() |
|
66 { |
|
67 sbPort->setValue(46631); |
|
68 } |