40 lines
615 B
C++
40 lines
615 B
C++
#ifndef SOCKETIRC_H
|
|
#define SOCKETIRC_H
|
|
|
|
#include <QTcpSocket>
|
|
|
|
class QCoreApplication;
|
|
|
|
class SocketIRC : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
SocketIRC();
|
|
SocketIRC(QString server_, int port_);
|
|
void setServer(QString server_);
|
|
void setPort(int port_);
|
|
int connectToServer(QCoreApplication* app_);
|
|
|
|
private:
|
|
|
|
QCoreApplication* app;
|
|
QString server;
|
|
int port;
|
|
QTcpSocket sock;
|
|
bool isConnected;
|
|
|
|
private slots:
|
|
void readMsg();
|
|
void onDisconnect();
|
|
|
|
public slots:
|
|
void sendMsg(QString msg);
|
|
|
|
signals:
|
|
void receivedMsg(QString msg);
|
|
};
|
|
|
|
#endif // SOCKETIRC_H
|