QTfrontend/newnetclient.cpp
changeset 1302 4290ba4a14ca
parent 1245 d2eca4a053f5
child 1305 453882eb4467
equal deleted inserted replaced
1301:c6fe8a4bfd34 1302:4290ba4a14ca
   107   RawSendNet(str.toUtf8());
   107   RawSendNet(str.toUtf8());
   108 }
   108 }
   109 
   109 
   110 void HWNewNet::RawSendNet(const QByteArray & buf)
   110 void HWNewNet::RawSendNet(const QByteArray & buf)
   111 {
   111 {
   112 qDebug() << "Client: " << buf;
   112   qDebug() << "Client: " << buf;
   113   NetSocket.write(buf);
   113   NetSocket.write(buf);
   114   NetSocket.write("\n\n", 2);
   114   NetSocket.write("\n\n", 2);
   115 }
   115 }
   116 
   116 
   117 void HWNewNet::ClientRead()
   117 void HWNewNet::ClientRead()
   142   m_game_connected=false;
   142   m_game_connected=false;
   143 }
   143 }
   144 
   144 
   145 void HWNewNet::displayError(QAbstractSocket::SocketError socketError)
   145 void HWNewNet::displayError(QAbstractSocket::SocketError socketError)
   146 {
   146 {
   147   switch (socketError) {
   147 	switch (socketError) {
   148   case QAbstractSocket::RemoteHostClosedError:
   148 		case QAbstractSocket::RemoteHostClosedError:
   149     break;
   149 			break;
   150   case QAbstractSocket::HostNotFoundError:
   150 		case QAbstractSocket::HostNotFoundError:
   151     QMessageBox::information(0, tr("Error"),
   151 			QMessageBox::information(0, tr("Error"),
   152 			     tr("The host was not found. Please check the host name and port settings."));
   152 					tr("The host was not found. Please check the host name and port settings."));
   153     break;
   153 			break;
   154   case QAbstractSocket::ConnectionRefusedError:
   154 		case QAbstractSocket::ConnectionRefusedError:
   155     QMessageBox::information(0, tr("Error"),
   155 			QMessageBox::information(0, tr("Error"),
   156 			     tr("Connection refused"));
   156 					tr("Connection refused"));
   157     break;
   157 			break;
   158   default:
   158 		default:
   159     QMessageBox::information(0, tr("Error"),
   159 			QMessageBox::information(0, tr("Error"),
   160 			     NetSocket.errorString());
   160 					NetSocket.errorString());
   161   }
   161 		}
   162 }
   162 }
   163 
   163 
   164 void HWNewNet::ParseCmd(const QStringList & lst)
   164 void HWNewNet::ParseCmd(const QStringList & lst)
   165 {
   165 {
   166 qDebug() << "Server: " << lst;
   166   qDebug() << "Server: " << lst;
   167 
   167 
   168   if(!lst.size())
   168   if(!lst.size())
   169   {
   169   {
   170     qWarning("Net client: Bad message");
   170     qWarning("Net client: Bad message");
   171     return;
   171     return;