forked from CPP-Final-Project/Chat_Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SrvUser.h
62 lines (52 loc) · 1.64 KB
/
SrvUser.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once
#include <QObject>
#include <QTcpSocket>
#include <QDataStream>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QJsonObject>
#include <QTimer>
#include <plog/Log.h>
class SrvUser : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(SrvUser)
public:
explicit SrvUser(QObject* parent = nullptr);
explicit SrvUser(const QString& username_, const QString& password_, const QByteArray& userpic_, const qint32& rating_, const qint32& room_id_);
//SrvUser(const QTcpSocket)
virtual bool setSocketDescriptor(qintptr _socket_descriptor);
QString getUserName() const;
void setUserName(const QString& username_);
QString getPassword() const;
void setPassword(const QString& password_);
QByteArray getUserpic() const;
void setUserpic(const QByteArray& userpic_);
qint32 getRating() const;
void setRating(const qint32& rating_);
qint32 getRoomId() const;
void setRoomId(const qint32& room_id_);
bool isFloodLimit() const;
void setFloodLimit();
signals:
void jsonReceived( const QJsonObject& _json_doc);
void jsonWMedia( const QJsonObject& _json_doc_, const QByteArray& media_);
void disconnectedFromClient();
void errorSignal();
void mediaRequest( const QJsonObject& object_);
public slots:
void disconnectFromClient();
void sendJson(const QJsonObject& _json_data);
void sendMedia(const QByteArray& data_);
private slots:
void receiveJson();
private:
QTcpSocket* user_socket;
QString username;
QString password;
QByteArray userpic;
qint32 rating = 0;
qint32 room_id = 0;
bool flood_limit = false;
quint16 nextBlockSize = 0;
};