Implement fancy reply rendering
This currently assumes the event, that is replied to, is already fetched. If it isn't, it will render an empty reply. In the future we should fetch replies before rendering them.
This commit is contained in:
parent
b130b85df8
commit
2b3dc3d8b9
10 changed files with 159 additions and 87 deletions
|
|
@ -212,6 +212,14 @@ TimelineModel::rowCount(const QModelIndex &parent) const
|
|||
return (int)this->eventOrder.size();
|
||||
}
|
||||
|
||||
QVariantMap
|
||||
TimelineModel::getDump(QString eventId) const
|
||||
{
|
||||
if (events.contains(eventId))
|
||||
return data(index(idToIndex(eventId), 0), Dump).toMap();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant
|
||||
TimelineModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
|
|
@ -263,11 +271,13 @@ TimelineModel::data(const QModelIndex &index, int role) const
|
|||
return QVariant(toRoomEventType(event));
|
||||
case Body:
|
||||
return QVariant(utils::replaceEmoji(QString::fromStdString(body(event))));
|
||||
case FormattedBody:
|
||||
case FormattedBody: {
|
||||
const static QRegularExpression replyFallback(
|
||||
"<mx-reply>.*</mx-reply>", QRegularExpression::DotMatchesEverythingOption);
|
||||
return QVariant(
|
||||
utils::replaceEmoji(utils::linkifyMessage(formattedBodyWithFallback(event)))
|
||||
.remove("<mx-reply>")
|
||||
.remove("</mx-reply>"));
|
||||
.remove(replyFallback));
|
||||
}
|
||||
case Url:
|
||||
return QVariant(QString::fromStdString(url(event)));
|
||||
case ThumbnailUrl:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue