QTfrontend/hwform.cpp
changeset 1800 f1df2eb32a16
parent 1797 fedd8649fdd9
child 1802 dd148e2506e2
--- a/QTfrontend/hwform.cpp	Sun Feb 15 17:48:05 2009 +0000
+++ b/QTfrontend/hwform.cpp	Sun Feb 15 20:29:52 2009 +0000
@@ -329,7 +329,7 @@
 		if (id == ID_PAGE_NETGAME || id == ID_PAGE_NETGAME)
 			GoBack();
 
-	if (id == ID_PAGE_NET) {
+	if ((id == ID_PAGE_NET) && (curid != ID_PAGE_CONNECTING)) {
 		if(hwnet || pnetserver) NetDisconnect();
 	}
 }
@@ -449,6 +449,12 @@
 	
 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);
 
+	{
+		GoToPage(ID_PAGE_CONNECTING);
+		connect(hwnet, SIGNAL(Connected()), this, SLOT(GoBack()));
+		connect(hwnet, SIGNAL(Disconnected()), this, SLOT(GoBack()));
+	}
+
 	connect(hwnet, SIGNAL(showMessage(const QString &)), this, SLOT(ShowErrorMessage(const QString &)), Qt::QueuedConnection);
 
 	connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
@@ -533,7 +539,7 @@
 			hwnet, SLOT(onWeaponsNameChanged(const QString &, const QString &)));
 	connect(ui.pageNetGame->pGameCFG, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
 
-	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()));
+	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection);
 	connect(hwnet, SIGNAL(seedChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setSeed(const QString &)));
 	connect(hwnet, SIGNAL(mapChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setMap(const QString &)));
 	connect(hwnet, SIGNAL(themeChanged(const QString &)), ui.pageNetGame->pGameCFG, SLOT(setTheme(const QString &)));
@@ -599,6 +605,7 @@
 
 void HWForm::NetDisconnect()
 {
+	qDebug("NetDisconnect");
 	if(hwnet) {
 		hwnet->Disconnect();
 		delete hwnet;
@@ -625,8 +632,9 @@
 		hwnet = 0;
 		QMessageBox::warning(this, QMessageBox::tr("Network"),
 				QMessageBox::tr("Connection to server is lost"));
+	
 	}
-	GoBack();
+	if (ui.Pages->currentIndex() != ID_PAGE_NET) GoBack();
 }
 
 void HWForm::NetConnected()