QTfrontend/hwform.cpp
changeset 1418 69df8f2a7cba
parent 1413 6393a1d5ac18
child 1419 8650a8f55006
--- a/QTfrontend/hwform.cpp	Sun Oct 26 14:37:50 2008 +0000
+++ b/QTfrontend/hwform.cpp	Sun Oct 26 14:45:07 2008 +0000
@@ -30,6 +30,7 @@
 #include <QCheckBox>
 #include <QTextBrowser>
 #include <QAction>
+#include <QTimer>
 
 #include "hwform.h"
 #include "game.h"
@@ -502,7 +503,7 @@
 		delete netHost;
 		netHost = new QString(hpd->leHost->text());
 		netPort = hpd->sbPort->value();
-		_NetConnect(*netHost, netPort, ui.pageOptions->editNetNick->text());
+		NetConnectServer(*netHost, netPort);
 	}
 }
 
@@ -520,9 +521,16 @@
 		return;
 	}
 
-	_NetConnect("localhost", pnetserver->getRunningPort(), ui.pageOptions->editNetNick->text());
+	QTimer::singleShot(250, this, SLOT(AsyncNetServerStart()));
 
-	pRegisterServer = new HWNetUdpServer(0, ui.pageNetServer->leServerDescr->text(), ui.pageNetServer->sbPort->value());
+	pRegisterServer = new HWNetUdpServer(0,
+			ui.pageNetServer->leServerDescr->text(),
+			ui.pageNetServer->sbPort->value());
+}
+
+void HWForm::AsyncNetServerStart()
+{
+	NetConnectServer("localhost", pnetserver->getRunningPort());
 }
 
 void HWForm::NetDisconnect()
@@ -547,14 +555,14 @@
 
 void HWForm::ForcedDisconnect()
 {
-  if(pnetserver) return; // we have server - let it care of all things
-  if (hwnet) {
-    hwnet->deleteLater();
-    hwnet=0;
-    QMessageBox::warning(this, QMessageBox::tr("Network"),
-			 QMessageBox::tr("Connection to server is lost"));
-  }
-  GoBack();
+	if(pnetserver) return; // we have server - let it care of all things
+	if (hwnet) {
+		hwnet->deleteLater();
+		hwnet = 0;
+		QMessageBox::warning(this, QMessageBox::tr("Network"),
+				QMessageBox::tr("Connection to server is lost"));
+	}
+	GoBack();
 }
 
 void HWForm::NetConnected()
@@ -569,7 +577,7 @@
 
 void HWForm::AddNetTeam(const HWTeam& team)
 {
-  ui.pageNetGame->pNetTeamsWidget->addTeam(team);
+	ui.pageNetGame->pNetTeamsWidget->addTeam(team);
 }
 
 void HWForm::StartMPGame()