Go page back when room is abandoned by its admin
authorunc0rr
Thu, 08 Jan 2009 15:34:51 +0000
changeset 1600 305e13c5f327
parent 1599 65b5d3cd3e01
child 1601 0cff69c8c4cf
Go page back when room is abandoned by its admin
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/newnetclient.cpp
--- a/QTfrontend/hwform.cpp	Thu Jan 08 15:32:26 2009 +0000
+++ b/QTfrontend/hwform.cpp	Thu Jan 08 15:34:51 2009 +0000
@@ -443,6 +443,7 @@
 	connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
 	connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected()));
 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
+	connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
 	connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
 
@@ -807,3 +808,11 @@
 {
 	ui.pageNetGame->BtnMaster->setVisible(false);
 }
+
+void HWForm::NetLeftRoom()
+{
+	if (ui.Pages->currentIndex() == ID_PAGE_NETGAME)
+		GoBack();
+	else
+		qWarning("Left room while not in room");
+}
--- a/QTfrontend/hwform.h	Thu Jan 08 15:32:26 2009 +0000
+++ b/QTfrontend/hwform.h	Thu Jan 08 15:34:51 2009 +0000
@@ -89,6 +89,7 @@
 	void NetGameMaster();
 	void NetGameSlave();
 	void AsyncNetServerStart();
+	void NetLeftRoom();
 
 private:
 	void _NetConnect(const QString & hostName, quint16 port, const QString & nick);
--- a/QTfrontend/newnetclient.cpp	Thu Jan 08 15:32:26 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Thu Jan 08 15:34:51 2009 +0000
@@ -211,17 +211,17 @@
 
 	if (lst[0] == "ERROR") {
 		if (lst.size() == 2)
-			QMessageBox::information(0, 0, "Error: " + lst[1]);
+			emit showMessage("Error: " + lst[1]);
 		else
-			QMessageBox::information(0, 0, "Unknown error");
+			emit showMessage("Unknown error");
 		return;
 	}
 
 	if (lst[0] == "WARNING") {
 		if (lst.size() == 2)
-			QMessageBox::information(0, 0, "Warning: " + lst[1]);
+			emit showMessage("Warning: " + lst[1]);
 		else
-			QMessageBox::information(0, 0, "Unknown warning");
+			emit showMessage("Unknown warning");
 		return;
 	}
 
@@ -334,6 +334,7 @@
 
 	if(lst[0]=="ROOMABANDONED") {
 		netClientState = 2;
+		emit showMessage(HWNewNet::tr("Room destroyed"));
 		emit LeftRoom();
 		return;
 	}