--- a/QTfrontend/CMakeLists.txt Thu Dec 13 16:10:58 2007 +0000
+++ b/QTfrontend/CMakeLists.txt Thu Dec 13 21:31:47 2007 +0000
@@ -73,6 +73,7 @@
hwconsts.cpp
selectWeapon.cpp
itemNum.cpp
+ input_ip.cpp
weaponItem.cpp)
if (WIN32)
@@ -111,6 +112,7 @@
playrecordpage.h
selectWeapon.h
itemNum.h
+ input_ip.h
weaponItem.h)
set(hwfr_hdrs
--- a/QTfrontend/hwform.cpp Thu Dec 13 16:10:58 2007 +0000
+++ b/QTfrontend/hwform.cpp Thu Dec 13 21:31:47 2007 +0000
@@ -46,6 +46,7 @@
#include "netwwwserver.h"
#include "chatwidget.h"
#include "playrecordpage.h"
+#include "input_ip.h"
HWForm::HWForm(QWidget *parent)
: QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
@@ -89,7 +90,8 @@
connect(ui.pageOptions->WeaponsButt, SIGNAL(clicked()), this, SLOT(GoToSelectWeapon()));
connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
- connect(ui.pageNet->BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnect()));
+ connect(ui.pageNet->BtnNetConnect, SIGNAL(clicked()), this, SLOT(NetConnectServer()));
+ connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer()));
connect(ui.pageNet, SIGNAL(connectClicked()), this, SLOT(NetConnectServer()));
@@ -408,6 +410,9 @@
void HWForm::NetConnect()
{
+ HWHostPortDialog * hpd = new HWHostPortDialog(this);
+
+ hpd->exec();
// FIXME: _NetConnect(ui.pageNet->editIP->text(), 46631, ui.pageNet->editNetNick->text());
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/input_ip.cpp Thu Dec 13 21:31:47 2007 +0000
@@ -0,0 +1,68 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QPushButton>
+#include <QGridLayout>
+#include <QLabel>
+
+#include "input_ip.h"
+
+HWHostPortDialog::HWHostPortDialog(QWidget* parent) : QDialog(parent)
+{
+ QGridLayout * layout = new QGridLayout(this);
+
+ QLabel * lbHost = new QLabel(this);
+ lbHost->setText(tr("Host:"));
+ layout->addWidget(lbHost, 0, 0);
+
+ QLabel * lbPort = new QLabel(this);
+ lbPort->setText(tr("Port:"));
+ layout->addWidget(lbPort, 1, 0);
+
+ leHost = new QLineEdit(this);
+ layout->addWidget(leHost, 0, 1, 1, 2);
+
+ sbPort = new QSpinBox(this);
+ sbPort->setMinimum(0);
+ sbPort->setMaximum(65535);
+ layout->addWidget(sbPort, 1, 1, 1, 2);
+
+ pbDefault = new QPushButton(this);
+ pbDefault->setText(tr("default"));
+ layout->addWidget(pbDefault, 1, 3);
+
+ pbOK = new QPushButton(this);
+ pbOK->setText(tr("OK"));
+ pbOK->setDefault(true);
+ layout->addWidget(pbOK, 3, 1);
+
+ pbCancel = new QPushButton(this);
+ pbCancel->setText(tr("Cancel"));
+ layout->addWidget(pbCancel, 3, 2);
+
+ connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(pbDefault, SIGNAL(clicked()), this, SLOT(setDefaultPort()));
+}
+
+void HWHostPortDialog::setDefaultPort()
+{
+ sbPort->setValue(46631);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/QTfrontend/input_ip.h Thu Dec 13 21:31:47 2007 +0000
@@ -0,0 +1,48 @@
+/*
+ * Hedgewars, a worms-like game
+ * Copyright (c) 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+
+#ifndef INPUT_IP_H
+#define INPUT_IP_H
+
+#include <QDialog>
+#include <QHostAddress>
+
+class QLineEdit;
+class QSpinBox;
+class QPushButton;
+
+class HWHostPortDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ HWHostPortDialog(QWidget* parent = 0);
+
+private:
+ QLineEdit* leHost;
+ QSpinBox* sbPort;
+ QPushButton* pbOK;
+ QPushButton* pbCancel;
+ QPushButton * pbDefault;
+
+private slots:
+ void setDefaultPort();
+};
+
+
+#endif // INPUT_IP_H
--- a/QTfrontend/pages.cpp Thu Dec 13 16:10:58 2007 +0000
+++ b/QTfrontend/pages.cpp Thu Dec 13 21:31:47 2007 +0000
@@ -468,6 +468,11 @@
BtnUpdateSList->setText(QPushButton::tr("Update"));
GBClayout->addWidget(BtnUpdateSList, 2, 0);
+ BtnSpecifyServer = new QPushButton(ConnGroupBox);
+ BtnSpecifyServer->setFont(*font14);
+ BtnSpecifyServer->setText(QPushButton::tr("Specify"));
+ GBClayout->addWidget(BtnSpecifyServer, 2, 1);
+
BtnBack = new QPushButton(this);
BtnBack->setFont(*font14);
BtnBack->setText(QPushButton::tr("Back"));
--- a/QTfrontend/pages.h Thu Dec 13 16:10:58 2007 +0000
+++ b/QTfrontend/pages.h Thu Dec 13 21:31:47 2007 +0000
@@ -161,9 +161,10 @@
QPushButton* BtnUpdateSList;
HWNetServersWidget* netServersWidget;
- QPushButton *BtnBack;
- QPushButton *BtnNetConnect;
- QPushButton* BtnNetSvrStart;
+ QPushButton * BtnBack;
+ QPushButton * BtnNetConnect;
+ QPushButton * BtnNetSvrStart;
+ QPushButton * BtnSpecifyServer;
QRadioButton * rbLocalGame;
QRadioButton * rbInternetGame;