author | nemo |
Tue, 29 Jan 2013 13:45:31 -0500 | |
changeset 8460 | 75e771c3c039 |
parent 7795 | ba32d3f9e567 |
child 8609 | 3f6c08223aa1 |
permissions | -rw-r--r-- |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
6952 | 3 |
* Copyright (c) 2004-2012 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 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
29 |
QGridLayout * layout = new QGridLayout(this); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
30 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
31 |
QLabel * lbHost = new QLabel(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
32 |
lbHost->setText(QLabel::tr("Host:")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
33 |
layout->addWidget(lbHost, 0, 0); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
34 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
35 |
QLabel * lbPort = new QLabel(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
36 |
lbPort->setText(QLabel::tr("Port:")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
37 |
layout->addWidget(lbPort, 1, 0); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
38 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
39 |
leHost = new QLineEdit(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
40 |
layout->addWidget(leHost, 0, 1, 1, 2); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
41 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
42 |
sbPort = new QSpinBox(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
43 |
sbPort->setMinimum(0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
44 |
sbPort->setMaximum(65535); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
45 |
layout->addWidget(sbPort, 1, 1, 1, 2); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
46 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
47 |
pbDefault = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
48 |
pbDefault->setText(QPushButton::tr("default")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
49 |
layout->addWidget(pbDefault, 1, 3); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
50 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
51 |
pbOK = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
52 |
pbOK->setText(QPushButton::tr("OK")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
53 |
pbOK->setDefault(true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
54 |
layout->addWidget(pbOK, 3, 1); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
55 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
56 |
pbCancel = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
57 |
pbCancel->setText(QPushButton::tr("Cancel")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
58 |
layout->addWidget(pbCancel, 3, 2); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
59 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
60 |
connect(pbOK, SIGNAL(clicked()), this, SLOT(accept())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
61 |
connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
62 |
connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
7795
ba32d3f9e567
set window modality also for custom dialogs, small text changes
koda
parents:
6952
diff
changeset
|
63 |
|
ba32d3f9e567
set window modality also for custom dialogs, small text changes
koda
parents:
6952
diff
changeset
|
64 |
this->setWindowModality(Qt::WindowModal); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
65 |
} |
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 |
void HWHostPortDialog::setDefaultPort() |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
68 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
69 |
sbPort->setValue(46631); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
70 |
} |