Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/room/delegate/messagelistdelegate.h
Show All 20 Lines | |||||
21 | #ifndef MESSAGELISTDELEGATE_H | 21 | #ifndef MESSAGELISTDELEGATE_H | ||
22 | #define MESSAGELISTDELEGATE_H | 22 | #define MESSAGELISTDELEGATE_H | ||
23 | 23 | | |||
24 | #include "libruqolawidgets_private_export.h" | 24 | #include "libruqolawidgets_private_export.h" | ||
25 | 25 | | |||
26 | #include <QFont> | 26 | #include <QFont> | ||
27 | #include <QItemDelegate> | 27 | #include <QItemDelegate> | ||
28 | #include <QScopedPointer> | 28 | #include <QScopedPointer> | ||
29 | #include <QHash> | ||||
29 | 30 | | |||
30 | class RocketChatAccount; | 31 | class RocketChatAccount; | ||
31 | class Message; | 32 | class Message; | ||
32 | class MessageDelegateHelperBase; | 33 | class MessageDelegateHelperBase; | ||
33 | class MessageDelegateHelperText; | 34 | class MessageDelegateHelperText; | ||
34 | class MessageDelegateHelperImage; | 35 | class MessageDelegateHelperImage; | ||
35 | class MessageDelegateHelperFile; | 36 | class MessageDelegateHelperFile; | ||
36 | class MessageDelegateHelperReactions; | 37 | class MessageDelegateHelperReactions; | ||
37 | class MessageDelegateHelperVideo; | 38 | class MessageDelegateHelperVideo; | ||
38 | class MessageDelegateHelperSound; | 39 | class MessageDelegateHelperSound; | ||
40 | class PixmapCache; | ||||
39 | 41 | | |||
40 | class LIBRUQOLAWIDGETS_TESTS_EXPORT MessageListDelegate : public QItemDelegate | 42 | class LIBRUQOLAWIDGETS_TESTS_EXPORT MessageListDelegate : public QItemDelegate | ||
41 | { | 43 | { | ||
42 | Q_OBJECT | 44 | Q_OBJECT | ||
43 | 45 | | |||
44 | public: | 46 | public: | ||
45 | explicit MessageListDelegate(QObject *parent = nullptr); | 47 | explicit MessageListDelegate(QObject *parent = nullptr); | ||
46 | ~MessageListDelegate() override; | 48 | ~MessageListDelegate() override; | ||
Show All 12 Lines | |||||
59 | 61 | | |||
60 | Q_REQUIRED_RESULT bool hasSelection() const; | 62 | Q_REQUIRED_RESULT bool hasSelection() const; | ||
61 | Q_REQUIRED_RESULT QString selectedText() const; | 63 | Q_REQUIRED_RESULT QString selectedText() const; | ||
62 | 64 | | |||
63 | void setLastSeenAt(qint64 lastSee); | 65 | void setLastSeenAt(qint64 lastSee); | ||
64 | 66 | | |||
65 | void selectAll(const QStyleOptionViewItem &option, const QModelIndex &index); | 67 | void selectAll(const QStyleOptionViewItem &option, const QModelIndex &index); | ||
66 | private: | 68 | private: | ||
67 | QPixmap makeAvatarPixmap(const QModelIndex &index, int maxHeight) const; | 69 | QPixmap makeAvatarPixmap(const QWidget *widget, const QModelIndex &index, int maxHeight) const; | ||
dfaure: two spaces after "QWidget" | |||||
dfaure: still there | |||||
68 | 70 | | |||
69 | struct Layout { | 71 | struct Layout { | ||
70 | // Sender | 72 | // Sender | ||
71 | QString senderText; | 73 | QString senderText; | ||
72 | QFont senderFont; | 74 | QFont senderFont; | ||
73 | QRectF senderRect; | 75 | QRectF senderRect; | ||
74 | 76 | | |||
75 | // Avatar pixmap | 77 | // Avatar pixmap | ||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
124 | RocketChatAccount *mRocketChatAccount = nullptr; | 126 | RocketChatAccount *mRocketChatAccount = nullptr; | ||
125 | 127 | | |||
126 | QScopedPointer<MessageDelegateHelperText> mHelperText; | 128 | QScopedPointer<MessageDelegateHelperText> mHelperText; | ||
127 | QScopedPointer<MessageDelegateHelperImage> mHelperImage; | 129 | QScopedPointer<MessageDelegateHelperImage> mHelperImage; | ||
128 | QScopedPointer<MessageDelegateHelperFile> mHelperFile; | 130 | QScopedPointer<MessageDelegateHelperFile> mHelperFile; | ||
129 | QScopedPointer<MessageDelegateHelperReactions> mHelperReactions; | 131 | QScopedPointer<MessageDelegateHelperReactions> mHelperReactions; | ||
130 | QScopedPointer<MessageDelegateHelperVideo> mHelperVideo; | 132 | QScopedPointer<MessageDelegateHelperVideo> mHelperVideo; | ||
131 | QScopedPointer<MessageDelegateHelperSound> mHelperSound; | 133 | QScopedPointer<MessageDelegateHelperSound> mHelperSound; | ||
134 | // DPR-dependent cache of avatars | ||||
135 | mutable QHash<qreal, PixmapCache> mScaledAvatars; | ||||
132 | }; | 136 | }; | ||
133 | 137 | | |||
134 | #endif // MESSAGELISTDELEGATE_H | 138 | #endif // MESSAGELISTDELEGATE_H |
two spaces after "QWidget"