Multiple Link Previews

- Show a preview for each link in the text below the block in which it appears.
- Allow link previews to be dismissed
This commit is contained in:
James Graham
2024-04-23 19:45:33 +00:00
parent 307536c6b6
commit de40701cf6
15 changed files with 201 additions and 200 deletions

View File

@@ -88,6 +88,13 @@ public:
*/
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
/**
* @brief Close the link preview at the given index.
*
* If the given index is not a link preview component, nothing happens.
*/
Q_INVOKABLE void closeLinkPreview(int row);
private:
QPointer<NeoChatRoom> m_room;
const Quotient::RoomEvent *m_event = nullptr;
@@ -95,12 +102,14 @@ private:
QList<MessageComponent> m_components;
void updateComponents(bool isEditing = false);
QPointer<LinkPreviewer> m_linkPreviewer;
ItineraryModel *m_itineraryModel = nullptr;
QList<MessageComponent> componentsForType(MessageComponentType::Type type);
MessageComponent linkPreviewComponent(const QUrl &link);
void addLinkPreviews();
QList<QUrl> m_removedLinkPreviews;
void updateLinkPreviewer();
void updateItineraryModel();
bool m_emptyItinerary = false;