QTfrontend/newnetclient.cpp
changeset 1800 f1df2eb32a16
parent 1797 fedd8649fdd9
child 1802 dd148e2506e2
--- a/QTfrontend/newnetclient.cpp	Sun Feb 15 17:48:05 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Sun Feb 15 20:29:52 2009 +0000
@@ -17,7 +17,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
 
-#include <QMessageBox>
 #include <QDebug>
 
 #include "hwconsts.h"
@@ -49,7 +48,10 @@
 HWNewNet::~HWNewNet()
 {
 	if (m_game_connected)
+	{
 		RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
+		emit Disconnected();
+	}
 	NetSocket.flush();
 }
 
@@ -64,6 +66,7 @@
 	if (m_game_connected)
 		RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
 	m_game_connected = false;
+	
 	NetSocket.disconnectFromHost();
 }
 
@@ -172,20 +175,19 @@
 
 void HWNewNet::displayError(QAbstractSocket::SocketError socketError)
 {
+	emit Disconnected();
+	
 	switch (socketError) {
 		case QAbstractSocket::RemoteHostClosedError:
 			break;
 		case QAbstractSocket::HostNotFoundError:
-			QMessageBox::information(0, tr("Error"),
-					tr("The host was not found. Please check the host name and port settings."));
+			emit showMessage(tr("The host was not found. Please check the host name and port settings."));
 			break;
 		case QAbstractSocket::ConnectionRefusedError:
-			QMessageBox::information(0, tr("Error"),
-					tr("Connection refused"));
+			emit showMessage(tr("Connection refused"));
 			break;
 		default:
-			QMessageBox::information(0, tr("Error"),
-					NetSocket.errorString());
+			emit showMessage(NetSocket.errorString());
 		}
 }