mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 17:40:47 +03:00
Implement sending other message types in qml timeline
not using placeholders in timeline for now
This commit is contained in:
parent
a7595eab5a
commit
5c87d6faa6
2 changed files with 83 additions and 9 deletions
|
@ -100,3 +100,81 @@ TimelineViewManager::queueReplyMessage(const QString &reply, const RelatedInfo &
|
|||
if (timeline_)
|
||||
timeline_->sendMessage(text);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::queueEmoteMessage(const QString &msg)
|
||||
{
|
||||
auto html = utils::markdownToHtml(msg);
|
||||
|
||||
mtx::events::msg::Emote emote;
|
||||
emote.body = msg.trimmed().toStdString();
|
||||
|
||||
if (html != msg.trimmed().toHtmlEscaped())
|
||||
emote.formatted_body = html.toStdString();
|
||||
|
||||
if (timeline_)
|
||||
timeline_->sendMessage(emote);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::queueImageMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize,
|
||||
const QSize &dimensions)
|
||||
{
|
||||
mtx::events::msg::Image image;
|
||||
image.info.mimetype = mime.toStdString();
|
||||
image.info.size = dsize;
|
||||
image.body = filename.toStdString();
|
||||
image.url = url.toStdString();
|
||||
image.info.h = dimensions.height();
|
||||
image.info.w = dimensions.width();
|
||||
models.value(roomid)->sendMessage(image);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::queueFileMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{
|
||||
mtx::events::msg::File file;
|
||||
file.info.mimetype = mime.toStdString();
|
||||
file.info.size = dsize;
|
||||
file.body = filename.toStdString();
|
||||
file.url = url.toStdString();
|
||||
models.value(roomid)->sendMessage(file);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::queueAudioMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{
|
||||
mtx::events::msg::Audio audio;
|
||||
audio.info.mimetype = mime.toStdString();
|
||||
audio.info.size = dsize;
|
||||
audio.body = filename.toStdString();
|
||||
audio.url = url.toStdString();
|
||||
models.value(roomid)->sendMessage(audio);
|
||||
}
|
||||
|
||||
void
|
||||
TimelineViewManager::queueVideoMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{
|
||||
mtx::events::msg::Video video;
|
||||
video.info.mimetype = mime.toStdString();
|
||||
video.info.size = dsize;
|
||||
video.body = filename.toStdString();
|
||||
video.url = url.toStdString();
|
||||
models.value(roomid)->sendMessage(video);
|
||||
}
|
||||
|
|
|
@ -48,32 +48,28 @@ public slots:
|
|||
|
||||
void queueTextMessage(const QString &msg);
|
||||
void queueReplyMessage(const QString &reply, const RelatedInfo &related);
|
||||
void queueEmoteMessage(const QString &msg) {}
|
||||
void queueEmoteMessage(const QString &msg);
|
||||
void queueImageMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize,
|
||||
const QSize &dimensions)
|
||||
{}
|
||||
const QSize &dimensions);
|
||||
void queueFileMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{}
|
||||
uint64_t dsize);
|
||||
void queueAudioMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{}
|
||||
uint64_t dsize);
|
||||
void queueVideoMessage(const QString &roomid,
|
||||
const QString &filename,
|
||||
const QString &url,
|
||||
const QString &mime,
|
||||
uint64_t dsize)
|
||||
{}
|
||||
uint64_t dsize);
|
||||
|
||||
private:
|
||||
QQuickView *view;
|
||||
|
|
Loading…
Reference in a new issue