Linkpreviewer Improvements

- Have LinkPreviewers stored in NeoChatConnection so that they don't have to be reloaded everytime the MessageContentModel is refreshed
- This means the link is never changed (it will be swiched for a new previewer with the new link)
- LinkPreviewers are stored by URL so they can be re-used by any event with the same URL

BUG: 484927  (because the offending code is ripped out)
This commit is contained in:
James Graham
2024-04-09 18:35:16 +00:00
parent 554c086aba
commit 1a96899336
7 changed files with 93 additions and 71 deletions

View File

@@ -9,6 +9,8 @@
#include <QCoroTask>
#include <Quotient/connection.h>
class LinkPreviewer;
class NeoChatConnection : public Quotient::Connection
{
Q_OBJECT
@@ -147,6 +149,8 @@ public:
bool isOnline() const;
LinkPreviewer *previewerForLink(const QUrl &link);
Q_SIGNALS:
void labelChanged();
void directChatNotificationsChanged();
@@ -166,4 +170,6 @@ private:
void connectSignals();
int m_badgeNotificationCount = 0;
QHash<QUrl, LinkPreviewer *> m_linkPreviewers;
};