Move the function to get a subtitle string to eventhandler

This commit is contained in:
James Graham
2023-12-10 13:19:13 +00:00
parent 4751ac6acc
commit 8d717b78ac
7 changed files with 43 additions and 44 deletions

View File

@@ -341,25 +341,6 @@ bool NeoChatRoom::lastEventIsSpoiler() const
return false;
}
QString NeoChatRoom::lastEventToString(Qt::TextFormat format, bool stripNewlines) const
{
if (auto event = lastEvent()) {
EventHandler eventHandler;
eventHandler.setRoom(this);
eventHandler.setEvent(event);
QString body;
if (format == Qt::TextFormat::RichText) {
body = eventHandler.getRichBody(stripNewlines);
} else {
body = eventHandler.getPlainBody(stripNewlines);
}
return eventHandler.singleLineAuthorDisplayname() + (event->isStateEvent() ? QLatin1String(" ") : QLatin1String(": ")) + body;
}
return {};
}
bool NeoChatRoom::isEventHighlighted(const RoomEvent *e) const
{
return highlights.contains(e);