author | sheepluva |
Sat, 23 Apr 2016 09:54:05 +0200 | |
changeset 11663 | 0427a9b6457b |
parent 11490 | fb7817a5c2b1 |
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 |
11046 | 3 |
* Copyright (c) 2004-2015 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 |
10108
c68cf030eded
update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents:
9998
diff
changeset
|
16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
653
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" |
8609
3f6c08223aa1
use NETGAME_DEFAULT_PORT macro across frontend sources
koda
parents:
7795
diff
changeset
|
26 |
#include "hwconsts.h" |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
27 |
|
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
28 |
HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent) |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
29 |
{ |
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
30 |
QGridLayout * layout = new QGridLayout(this); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
31 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
32 |
QLabel * lbHost = new QLabel(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
33 |
lbHost->setText(QLabel::tr("Host:")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
34 |
layout->addWidget(lbHost, 0, 0); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
35 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
36 |
QLabel * lbPort = new QLabel(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
37 |
lbPort->setText(QLabel::tr("Port:")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
38 |
layout->addWidget(lbPort, 1, 0); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
39 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
40 |
leHost = new QLineEdit(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
41 |
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
|
42 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
43 |
sbPort = new QSpinBox(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
44 |
sbPort->setMinimum(0); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
45 |
sbPort->setMaximum(65535); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
46 |
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
|
47 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
48 |
pbDefault = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
49 |
pbDefault->setText(QPushButton::tr("default")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
50 |
layout->addWidget(pbDefault, 1, 3); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
51 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
52 |
pbOK = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
53 |
pbOK->setText(QPushButton::tr("OK")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
54 |
pbOK->setDefault(true); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
55 |
layout->addWidget(pbOK, 3, 1); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
56 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
57 |
pbCancel = new QPushButton(this); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
58 |
pbCancel->setText(QPushButton::tr("Cancel")); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
59 |
layout->addWidget(pbCancel, 3, 2); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
60 |
|
2948
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
61 |
connect(pbOK, SIGNAL(clicked()), this, SLOT(accept())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
62 |
connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject())); |
3f21a9dc93d0
Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents:
1066
diff
changeset
|
63 |
connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort())); |
7795
ba32d3f9e567
set window modality also for custom dialogs, small text changes
koda
parents:
6952
diff
changeset
|
64 |
|
ba32d3f9e567
set window modality also for custom dialogs, small text changes
koda
parents:
6952
diff
changeset
|
65 |
this->setWindowModality(Qt::WindowModal); |
11490
fb7817a5c2b1
Add window titles for title-less windows
Wuzzy <almikes@aol.com>
parents:
11046
diff
changeset
|
66 |
this->setWindowTitle(tr("Connect to server")); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
67 |
} |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
68 |
|
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
69 |
void HWHostPortDialog::setDefaultPort() |
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
70 |
{ |
8609
3f6c08223aa1
use NETGAME_DEFAULT_PORT macro across frontend sources
koda
parents:
7795
diff
changeset
|
71 |
sbPort->setValue(NETGAME_DEFAULT_PORT); |
653
4f44fc06ca45
Class to ask host/port to connect to ('Specify' button on PageNet)
unc0rr
parents:
diff
changeset
|
72 |
} |