Link preview messageeventmodel parameters

This move the finding of links and the creation of a `linkpreviewer` into c++.

- The links are now extracted from the text in `texthandler`
- The `messageeventmodel` now creates and stores `linkpreviewers` for events that have links in the current room.

Two new model roles have been created to let a text delegate know when the link preview should be shown (`showLinkPreview`) and pass the link previewer (`linkPreviewer`). Empty link previewer are returned where link don't exist so the qml doesn't have to have checks for whether the parameters are undefined.
This commit is contained in:
James Graham
2023-05-08 08:18:49 +00:00
committed by Tobias Fella
parent b82d3ab5ad
commit 72de7c6cfb
9 changed files with 187 additions and 73 deletions

View File

@@ -35,7 +35,8 @@ TimelineContainer {
}
LinkPreviewDelegate {
Layout.fillWidth: true
room: currentRoom
active: !currentRoom.usesEncryption && currentRoom.urlPreviewEnabled && Config.showLinkPreview && model.showLinkPreview
linkPreviewer: model.linkPreview
indicatorEnabled: messageDelegate.isVisibleInTimeline()
}
}