Add new QML-based emoji picker (work in progress)

This is necessary to support having a picker within QML.
Eventually, this should replace the existing widget-based one.
This commit is contained in:
Joseph Donofry 2020-05-13 00:35:26 -04:00
parent 8984661187
commit ee4dcef90f
No known key found for this signature in database
GPG key ID: E8A1D78EF044B0CB
16 changed files with 15558 additions and 4710 deletions

View file

@ -13,6 +13,8 @@
#include "MxcImageProvider.h"
#include "UserSettingsPage.h"
#include "dialogs/ImageOverlay.h"
#include "emoji/EmojiModel.h"
#include "emoji/Provider.h"
Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
@ -72,6 +74,12 @@ TimelineViewManager::TimelineViewManager(QSharedPointer<UserSettings> userSettin
qmlRegisterType<DelegateChoice>("im.nheko", 1, 0, "DelegateChoice");
qmlRegisterType<DelegateChooser>("im.nheko", 1, 0, "DelegateChooser");
qRegisterMetaType<mtx::events::collections::TimelineEvents>();
qmlRegisterType<emoji::EmojiModel>("im.nheko.EmojiModel", 1, 0, "EmojiModel");
qmlRegisterType<emoji::EmojiProxyModel>("im.nheko.EmojiModel", 1, 0, "EmojiProxyModel");
qmlRegisterUncreatableType<QAbstractItemModel>(
"im.nheko.EmojiModel", 1, 0, "QAbstractItemModel", "Used by proxy models");
qmlRegisterUncreatableType<emoji::Emoji>(
"im.nheko.EmojiModel", 1, 0, "Emoji", "Used by emoji models");
#ifdef USE_QUICK_VIEW
view = new QQuickView();
@ -290,7 +298,7 @@ TimelineViewManager::queueReactionMessage(const QString &roomId,
mtx::events::msg::Reaction reaction;
reaction.relates_to.rel_type = mtx::common::RelationType::Annotation;
reaction.relates_to.event_id = reactedEvent.toStdString();
reaction.relates_to.key = reactionKey.toStdString();
reaction.relates_to.key = reactionKey.toStdString();
auto model = models.value(roomId);
model->sendMessage(reaction);