CCIMXDesktop
 
Loading...
Searching...
No Matches
ListContextInfo.h
1#ifndef LISTCONTEXTINFO_H
2#define LISTCONTEXTINFO_H
3#include <QDateTime>
4#include <QPixmap>
5#include <QString>
6
8public:
9 ListContextInfo() = delete;
10 ListContextInfo(const QString markable_name, const QString& uuid);
11 ListContextInfo(const QString& markableName, const QString& uuid,
12 const QString& displayText,
13 const QDateTime& displayDatetime,
14 int unreadCount);
15 friend bool operator==(
16 const ListContextInfo& left,
17 const ListContextInfo& right) noexcept {
18 return left.markable_name == right.markable_name;
19 }
20 QString get_markable_name() const;
21 ;
22 void flush_datetime(const QDateTime& display_datetime);
23 const QDateTime& queryDateTime() const;
24 int getUnread() const;
25 const QString& getDisplayText() const;
26 const QString& uuid() const { return markingUuid; }
27 const QPixmap& avatar() const;
28
29 void setQueryDateTime(const QDateTime& dateTime);
30 void setUnread(int unreadCount);
31 void setDisplayText(const QString& text);
32 void setAvatar(const QPixmap& pixmap);
33
34private:
35 QString markable_name; // oh shit, these cannot be changed and be a must
36 QString displayText {};
37 QDateTime display_datetime;
38 QString markingUuid;
39 QPixmap avatar_pixmap;
40 int unread { 0 };
41};
42
43namespace std {
44template <>
45struct hash<ListContextInfo> {
46 std::size_t operator()(const ListContextInfo& info) const {
47 // Use the hash function for QString
48 return qHash(info.get_markable_name());
49 }
50};
51}
52
53#endif // LISTCONTEXTINFO_H
Definition ListContextInfo.h:7