Make emoji picker use the grid view
This commit is contained in:
parent
5c64dd682c
commit
f01940f57c
6 changed files with 248 additions and 46 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue