diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-25 19:07:13 +0200 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-05-25 19:07:13 +0200 |
commit | f01940f57cd3365b42065dc8128dcbbdafca99f8 (patch) | |
tree | 20f7c14a644aa94e3e3097bafb3dae3f95d470b9 /src/GridImagePackModel.h | |
parent | 5c64dd682c61690b765b21b7551f9bcded38191a (diff) |
Make emoji picker use the grid view
Diffstat (limited to 'src/GridImagePackModel.h')
-rw-r--r-- | src/GridImagePackModel.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/GridImagePackModel.h b/src/GridImagePackModel.h index c6be3346..7e64f6c4 100644 --- a/src/GridImagePackModel.h +++ b/src/GridImagePackModel.h @@ -20,6 +20,7 @@ struct StickerImage Q_PROPERTY(QString shortcode MEMBER shortcode CONSTANT) Q_PROPERTY(QString body MEMBER body CONSTANT) Q_PROPERTY(QStringList descriptor READ descriptor CONSTANT) + Q_PROPERTY(QString markdown READ markdown CONSTANT) public: QStringList descriptor() const @@ -34,6 +35,13 @@ public: return {}; } + QString markdown() const + { + return QStringLiteral( + "<img data-mx-emoticon height=\"32\" src=\"%1\" alt=\"%2\" title=\"%2\">") + .arg(url.toHtmlEscaped(), !body.isEmpty() ? body : shortcode); + } + QString url; QString shortcode; QString body; @@ -54,6 +62,19 @@ public: int firstRowWith = 0; }; +struct TextEmoji +{ + Q_GADGET + Q_PROPERTY(QString unicode MEMBER unicode CONSTANT) + Q_PROPERTY(QString unicodeName MEMBER unicodeName CONSTANT) + Q_PROPERTY(QString shortcode MEMBER shortcode CONSTANT) + +public: + QString unicode; + QString unicodeName; + QString shortcode; +}; + class GridImagePackModel final : public QAbstractListModel { Q_OBJECT @@ -90,6 +111,7 @@ private: std::string room_id, state_key; std::vector<std::pair<mtx::events::msc2545::PackImage, QString>> images; + std::vector<TextEmoji> emojis; std::size_t firstRow; }; |