43 connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect())); |
43 connect(&NetSocket, SIGNAL(disconnected()), this, SLOT(OnDisconnect())); |
44 connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, |
44 connect(&NetSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, |
45 SLOT(displayError(QAbstractSocket::SocketError))); |
45 SLOT(displayError(QAbstractSocket::SocketError))); |
46 } |
46 } |
47 |
47 |
|
48 HWNewNet::~HWNewNet() |
|
49 { |
|
50 if (m_game_connected) |
|
51 RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); |
|
52 NetSocket.flush(); |
|
53 } |
|
54 |
48 void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick) |
55 void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick) |
49 { |
56 { |
50 mynick = nick; |
57 mynick = nick; |
51 NetSocket.connectToHost(hostName, port); |
58 NetSocket.connectToHost(hostName, port); |
52 } |
59 } |
53 |
60 |
54 void HWNewNet::Disconnect() |
61 void HWNewNet::Disconnect() |
55 { |
62 { |
56 if (m_game_connected) |
63 if (m_game_connected) |
57 RawSendNet(QString("QUIT")); |
64 RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit")); |
58 m_game_connected = false; |
65 m_game_connected = false; |
59 NetSocket.disconnectFromHost(); |
66 NetSocket.disconnectFromHost(); |
60 } |
67 } |
61 |
68 |
62 void HWNewNet::CreateRoom(const QString & room) |
69 void HWNewNet::CreateRoom(const QString & room) |