From bfeb766a91e259dce7924fb0bbcfcac85b91092b Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Tue, 26 Jan 2021 17:23:28 -0500 Subject: 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 --- src/MainWindow.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/MainWindow.cpp') 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() { -- cgit 1.5.1 From 1127aa7c91718ceec82ac0a775935b62b5220724 Mon Sep 17 00:00:00 2001 From: Joseph Donofry Date: Mon, 1 Feb 2021 18:57:59 -0500 Subject: Small UX fixes --- resources/qml/PrivacyScreen.qml | 4 +++- src/MainWindow.cpp | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/MainWindow.cpp') diff --git a/resources/qml/PrivacyScreen.qml b/resources/qml/PrivacyScreen.qml index 14a175f9..f3e388ce 100644 --- a/resources/qml/PrivacyScreen.qml +++ b/resources/qml/PrivacyScreen.qml @@ -18,7 +18,9 @@ Item { screenSaverTimer.stop(); screenSaver.state = "Invisible"; } else { - screenSaverTimer.start(); + if (timelineRoot.visible) { + screenSaverTimer.start(); + } } } } diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 8fd5c7e2..ab3c2cf2 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -59,6 +59,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , userSettings_{UserSettings::instance()} { + instance_ = this; + setWindowTitle(0); setObjectName("MainWindow"); @@ -312,8 +314,6 @@ MainWindow::showChatPage() &Cache::secretChanged, userSettingsPage_, &UserSettingsPage::updateSecretStatus); - - instance_ = this; } void -- cgit 1.5.1