diff options
author | Joseph Donofry <joedonofry@gmail.com> | 2021-01-26 17:23:28 -0500 |
---|---|---|
committer | Joseph Donofry <joedonofry@gmail.com> | 2021-01-26 17:23:28 -0500 |
commit | bfeb766a91e259dce7924fb0bbcfcac85b91092b (patch) | |
tree | f9423ca7fa9dbb324ba9372a29c292777a87c6cd /src/timeline | |
parent | Fix formatting (diff) | |
download | nheko-bfeb766a91e259dce7924fb0bbcfcac85b91092b.tar.xz |
Implement Privacy Screen
* Add handles for window focus gained / focus lossed and connect to timer * Clean up some of the PrivacyScreen.qml code * Connect settings to PrivacyScreen visibility
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineViewManager.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 23a960b8..74128865 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -36,6 +36,8 @@ class TimelineViewManager : public QObject bool isInitialSync MEMBER isInitialSync_ READ isInitialSync NOTIFY initialSyncChanged) Q_PROPERTY( bool isNarrowView MEMBER isNarrowView_ READ isNarrowView NOTIFY narrowViewChanged) + Q_PROPERTY( + bool isWindowFocused MEMBER isWindowFocused_ READ isWindowFocused NOTIFY focusChanged) public: TimelineViewManager(CallManager *callManager, ChatPage *parent = nullptr); @@ -54,6 +56,7 @@ public: Q_INVOKABLE TimelineModel *activeTimeline() const { return timeline_; } Q_INVOKABLE bool isInitialSync() const { return isInitialSync_; } bool isNarrowView() const { return isNarrowView_; } + bool isWindowFocused() const { return isWindowFocused_; } Q_INVOKABLE void openImageOverlay(QString mxcUrl, QString eventId) const; Q_INVOKABLE QColor userColor(QString id, QColor background); Q_INVOKABLE QString escapeEmoji(QString str) const; @@ -83,11 +86,17 @@ signals: void inviteUsers(QStringList users); void showRoomList(); void narrowViewChanged(); + void focusChanged(); public slots: void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids); void receivedSessionKey(const std::string &room_id, const std::string &session_id); void initWithMessages(const std::vector<QString> &roomIds); + void chatFocusChanged(bool focused) + { + isWindowFocused_ = focused; + emit focusChanged(); + } void setHistoryView(const QString &room_id); TimelineModel *getHistoryView(const QString &room_id) @@ -145,8 +154,9 @@ private: TimelineModel *timeline_ = nullptr; CallManager *callManager_ = nullptr; - bool isInitialSync_ = true; - bool isNarrowView_ = false; + bool isInitialSync_ = true; + bool isNarrowView_ = false; + bool isWindowFocused_ = false; QHash<QString, QColor> userColors; |