summary refs log tree commit diff
path: root/src/GridImagePackModel.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/GridImagePackModel.h')
-rw-r--r--src/GridImagePackModel.h22
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;
     };