📄 renjusocket.h
字号:
#include <qtextstream.h>
#include <qsocket.h>
#include <qstring.h>
class RenjuSocket : public QSocket
{
Q_OBJECT
private:
QTextStream *ts;
//new mycolor
//renew bool mycolor
//huiqi
//huiqi bool
//zhouqi x,y white
//msg msgStr
//分析网络数据,发送相应的信号通知view对象
void parser(QString &str);
public:
RenjuSocket::RenjuSocket( int sock, QObject *parent, const char *name );
RenjuSocket::RenjuSocket( QString &host, QObject *parent, const char *name );
//发送开新局的请求
void reqNewRenju();
//发送对新局请求的回复
void reNewRenju(bool b,int color);
//发送悔棋的请求
void reqHuiqiRenju(int x,int y);
void reqHuiqiRenjuno(int x,int y);
//发送走棋的位置颜色
void zhouqi(int x,int y);//,int color);
//发送消息给对方
void sendMsg(QString &msg);
void serverzhouqi(int x,int y);
void sendDone(int x,int y);
void sendclinetdone();
void sendhuiqi(int x,int y);
void sendagreetohuiqi(int x,int y);
void senddonotagreetohuiqi();
void serveragreetorestart();
void serverdonotagreetorestart();
signals:
//对方请求开新局,颜色表示对方的
void reqNew(int color);
//对方回复开新局、颜色表示对方的
void reNew(bool b,int color);
//对方发送的悔棋请求
void reqHuiqi();
//对方发送的悔棋请求回复
void reHuiqi(int ,int );
//对方走的棋
void parserzhouqi(int x,int y);//, int color);
//接收到对方的消息
void recvMsg(QString &msg);
void clinetdone();
void clientagreetohuiqi(int ,int);
void clientdonotagreetohuiqi();
void clienthuiqi(int x,int y);
void clientrestart();
void clientnewrequest();
void clientdonotagreetonew();
void clientconnectionClosed();
//void done();
public slots:
//读取网络数据,满1行后调用paser方法进行分析
void read();
void connectionClosed();
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -