-
Notifications
You must be signed in to change notification settings - Fork 7
/
connection.h
38 lines (28 loc) · 757 Bytes
/
connection.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef CONNECTION_H
#define CONNECTION_H
#include <QTcpSocket>
#include "authenticator.h"
class Connection : public QTcpSocket
{
Q_OBJECT
public:
enum PackageType {
PTroleDefinition,
PTchatMessage,
PThasFile,
PTcustomData
};
explicit Connection(QObject *parent = 0);
signals:
void logMessage(QString entry, Qt::GlobalColor backgroundColor = Qt::white);
void receivedData(Connection::PackageType type, QVariant data);
public slots:
void receiveData();
void sendData(const PackageType type, const QVariant& data);
private slots:
private:
qint64 blockSize;
static const QDataStream::Version streamVersion;
Authenticator authenticator;
};
#endif // CONNECTION_H