# HG changeset patch # User unc0rr # Date 1197582592 0 # Node ID 1019b8fa86387b987254633bdfe3901d0a8917eb # Parent 4f44fc06ca45aa192a08a7c4e802585e98155b71 Finish asking host/port dialog implementation diff -r 4f44fc06ca45 -r 1019b8fa8638 QTfrontend/gameuiconfig.cpp --- a/QTfrontend/gameuiconfig.cpp Thu Dec 13 21:31:47 2007 +0000 +++ b/QTfrontend/gameuiconfig.cpp Thu Dec 13 21:49:52 2007 +0000 @@ -39,7 +39,10 @@ Form->ui.pageOptions->CBEnableSound->setChecked(value("audio/sound", true).toBool()); Form->ui.pageOptions->editNetNick->setText(value("net/nick", QLineEdit::tr("unnamed")).toString()); -// Form->ui.pageNet->editIP->setText(value("net/ip", "").toString()); + + delete netHost; + netHost = new QString(value("net/ip", "").toString()); + netPort = value("net/port", 46631).toUInt(); Form->ui.pageOptions->CBShowFPS->setChecked(value("fps/show", false).toBool()); Form->ui.pageOptions->fpsedit->setValue(value("fps/interval", 27).toUInt()); @@ -71,7 +74,8 @@ setValue("audio/sound", isSoundEnabled()); setValue("net/nick", Form->ui.pageOptions->editNetNick->text()); -// setValue("net/ip", Form->ui.pageNet->editIP->text()); + setValue("net/ip", *netHost); + setValue("net/port", netPort); setValue("fps/show", isShowFPSEnabled()); setValue("fps/interval", Form->ui.pageOptions->fpsedit->value()); diff -r 4f44fc06ca45 -r 1019b8fa8638 QTfrontend/hwconsts.cpp.in --- a/QTfrontend/hwconsts.cpp.in Thu Dec 13 21:31:47 2007 +0000 +++ b/QTfrontend/hwconsts.cpp.in Thu Dec 13 21:49:52 2007 +0000 @@ -35,3 +35,6 @@ QColor * color4 = new QColor( 37, 181, 61); QColor * color5 = new QColor(247, 237, 112); QColor * color6 = new QColor(192, 85, 160); + +QString * netHost = new QString(); +quint16 netPort = 46631; diff -r 4f44fc06ca45 -r 1019b8fa8638 QTfrontend/hwconsts.h --- a/QTfrontend/hwconsts.h Thu Dec 13 21:31:47 2007 +0000 +++ b/QTfrontend/hwconsts.h Thu Dec 13 21:49:52 2007 +0000 @@ -38,3 +38,6 @@ extern QColor * color4; extern QColor * color5; extern QColor * color6; + +extern QString * netHost; +extern quint16 netPort; diff -r 4f44fc06ca45 -r 1019b8fa8638 QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Thu Dec 13 21:31:47 2007 +0000 +++ b/QTfrontend/hwform.cpp Thu Dec 13 21:49:52 2007 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include #include "hwform.h" #include "game.h" @@ -405,15 +406,22 @@ ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&))); hwnet->Connect(hostName, port, nick); - config->SaveOptions(); } void HWForm::NetConnect() { HWHostPortDialog * hpd = new HWHostPortDialog(this); + hpd->leHost->setText(*netHost); + hpd->sbPort->setValue(netPort); - hpd->exec(); -// FIXME: _NetConnect(ui.pageNet->editIP->text(), 46631, ui.pageNet->editNetNick->text()); + if (hpd->exec() == QDialog::Accepted) + { + config->SaveOptions(); + delete netHost; + netHost = new QString(hpd->leHost->text()); + netPort = hpd->sbPort->value(); + _NetConnect(*netHost, netPort, ui.pageOptions->editNetNick->text()); + } } void HWForm::NetStartServer() diff -r 4f44fc06ca45 -r 1019b8fa8638 QTfrontend/input_ip.h --- a/QTfrontend/input_ip.h Thu Dec 13 21:31:47 2007 +0000 +++ b/QTfrontend/input_ip.h Thu Dec 13 21:49:52 2007 +0000 @@ -33,9 +33,10 @@ public: HWHostPortDialog(QWidget* parent = 0); -private: QLineEdit* leHost; QSpinBox* sbPort; + +private: QPushButton* pbOK; QPushButton* pbCancel; QPushButton * pbDefault;