1
0
mirror of https://gitee.com/drabel/LibQQt.git synced 2025-01-04 10:18:44 +08:00
LibQQt/qqtclient.h

76 lines
1.9 KiB
C
Raw Normal View History

2016-12-29 16:49:18 +08:00
/**************************************************
* QQTClient
* QQTClient实现
**************************************************/
#ifndef QQT_CLIENT_H
#define QQT_CLIENT_H
#include <QTcpSocket>
#include "qqtprotocol.h"
#include "QStringList"
#define TANK_Q_TCP_SOCKET 0
#define TANK_Q_SOCKET 1
#define TANK_Q_THREAD 0
#define _TCP_BLOCKDATA_SIZE 0x400
#define _TCP_RECVBUFF_SIZE 0x800
/**
* @brief ;
*/
class QQTClient : public QTcpSocket
{
Q_OBJECT
public:
explicit QQTClient(QObject *parent = 0);
virtual ~QQTClient();
void SetServerIPAddress(QStringList ip) { m_serverIP = ip; }
void SetServerPort(quint32 p = 7079) { m_PORT = p; }
void installProtocol(QQTProtocol* stack);
void uninstallProtocol(QQTProtocol* stack);
QQTProtocol* installedProtocol();
void SendConnectMessage();
int SendDisConnectFromHost();
signals:
void signalConnecting();
void signalConnectSucc();
void signalConnectFail();//
void signalDisConnectSucc();//maybe
2017-08-13 18:27:13 +08:00
void signalDisConnectFail();//
void signalUpdateProgress(qint64 value);
2016-12-29 16:49:18 +08:00
private slots:
void domainHostFound();
void socketStateChanged(QAbstractSocket::SocketState);
void socketErrorOccured(QAbstractSocket::SocketError);
void socketConnected();
void socketDisconnect();
void updateProgress(qint64);
protected slots:
void readyReadData();
private:
void connectToSingelHost();
2017-08-13 11:49:27 +08:00
/*
* TODO:UI线程QTcpSocket局部变量化
* UI不必考虑此处
* UIUI却工作很慢
*/
2016-12-29 16:49:18 +08:00
//QTcpSocket* m_sock;
QQTProtocol* m_protocol;
quint32 eConType;
QStringList m_serverIP;
quint32 m_PORT;
};
#endif // QQT_CLIENT_H