forked from CPP-Final-Project/Chat_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LikeItem.h
48 lines (39 loc) · 1.01 KB
/
LikeItem.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
#pragma once
#include <QString>
#include <QObject>
#include <QDateTime>
#include <QIcon>
#include <ranges>
enum Like_enum {
NO_REACTION,
LIKE,
DISLIKE
};
class Likes : public QObject, public QEnableSharedFromThis<Likes>
{
Q_OBJECT;
public:
Likes(
Like_enum reaction_,
QString id_chat_,
QString user_name_)
: reaction(reaction_),
id_chat(id_chat_),
user_name(user_name_)
{};
Likes(const Likes&) = delete;
Likes(Likes&&) = delete;
const Likes& operator =(const Likes&) = delete;
Likes& operator = (Likes&&) = delete;
auto shared() { return sharedFromThis(); }
auto getLikeReaction() const { return reaction; };
auto getLikeChatId() const { return id_chat; };
auto getLikeUserName() const { return user_name; };
private:
Like_enum reaction;
QString id_chat;
QString user_name;
};
using likeItemPtr = QSharedPointer<Likes>;
using listLikes = QList<likeItemPtr>;
Q_DECLARE_METATYPE(likeItemPtr);