Improve the handling of switching link preivews on and off.

First make sure that the global setting is tied into the room setting, previously it was a bit of a patchwork that worked more by luck than judgement. The two levels of global and room level are properly tied together in a hierarchy.

Add a message in the room when global notifcations re turned off. This has caused confusion in the past when people don't realise there are 2 levels.
This commit is contained in:
James Graham
2025-02-27 16:37:33 +00:00
parent 77cedef5bb
commit 4af4bfd55f
7 changed files with 57 additions and 6 deletions

View File

@@ -32,6 +32,11 @@ class NeoChatConnection : public Quotient::Connection
*/
Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
/**
* @brief Whether URL previews are enabled globally.
*/
Q_PROPERTY(bool globalUrlPreviewEnabled READ globalUrlPreviewEnabled WRITE setGlobalUrlPreviewEnabled NOTIFY globalUrlPreviewEnabledChanged)
/**
* @brief The model with the account's 3PIDs.
*/
@@ -182,6 +187,9 @@ public:
int badgeNotificationCount() const;
void refreshBadgeNotificationCount();
bool globalUrlPreviewEnabled();
void setGlobalUrlPreviewEnabled(bool newState);
bool directChatInvites() const;
// note: this is intentionally a copied QString because
@@ -196,6 +204,7 @@ public:
LinkPreviewer *previewerForLink(const QUrl &link);
Q_SIGNALS:
void globalUrlPreviewEnabledChanged();
void labelChanged();
void identityServerChanged();
void directChatNotificationsChanged();
@@ -230,6 +239,7 @@ private:
void connectSignals();
int m_badgeNotificationCount = 0;
bool m_globalUrlPreviewEnabled = true;
QCache<QUrl, LinkPreviewer> m_linkPreviewers;