summary refs log tree commit diff
path: root/src/MainWindow.cpp
diff options
context:
space:
mode:
authorJoseph Donofry <joedonofry@gmail.com>2021-01-26 17:23:28 -0500
committerJoseph Donofry <joedonofry@gmail.com>2021-01-26 17:23:28 -0500
commitbfeb766a91e259dce7924fb0bbcfcac85b91092b (patch)
treef9423ca7fa9dbb324ba9372a29c292777a87c6cd /src/MainWindow.cpp
parentFix formatting (diff)
downloadnheko-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/MainWindow.cpp')
-rw-r--r--src/MainWindow.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 77269008..8fd5c7e2 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -130,6 +130,9 @@ MainWindow::MainWindow(QWidget *parent)
                 SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
 
         connect(chat_page_, SIGNAL(contentLoaded()), this, SLOT(removeOverlayProgressBar()));
+
+        connect(this, &MainWindow::focusChanged, chat_page_, &ChatPage::chatFocusChanged);
+
         connect(
           chat_page_, &ChatPage::showUserSettingsPage, this, &MainWindow::showUserSettingsPage);
 
@@ -204,6 +207,19 @@ MainWindow::resizeEvent(QResizeEvent *event)
         QMainWindow::resizeEvent(event);
 }
 
+bool
+MainWindow::event(QEvent *event)
+{
+        auto type = event->type();
+        if (type == QEvent::WindowActivate) {
+                emit focusChanged(true);
+        } else if (type == QEvent::WindowDeactivate) {
+                emit focusChanged(false);
+        }
+
+        return QMainWindow::event(event);
+}
+
 void
 MainWindow::adjustSideBars()
 {