Moved ScreenIsLocked variable from facades to application.

This commit is contained in:
23rd 2021-05-27 17:47:51 +03:00
parent 2ed3543b53
commit 16db8468fa
9 changed files with 20 additions and 15 deletions

View File

@ -590,6 +590,14 @@ void Application::startEmojiImageLoader() {
}, _lifetime);
}
void Application::setScreenIsLocked(bool locked) {
_screenIsLocked = locked;
}
bool Application::screenIsLocked() const {
return _screenIsLocked;
}
void Application::setDefaultFloatPlayerDelegate(
not_null<Media::Player::FloatDelegate*> delegate) {
Expects(!_defaultFloatPlayerDelegate == !_floatPlayers);

View File

@ -280,6 +280,10 @@ public:
void call_handleObservables();
// Global runtime variables.
void setScreenIsLocked(bool locked);
bool screenIsLocked() const;
protected:
bool eventFilter(QObject *object, QEvent *event) override;
@ -360,6 +364,7 @@ private:
const QImage _logoNoMargin;
rpl::variable<bool> _passcodeLock;
bool _screenIsLocked = false;
crl::time _shouldLockAt = 0;
base::Timer _autoLockTimer;

View File

@ -21,7 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session.h"
#include "main/main_app_config.h"
#include "mainwindow.h"
#include "facades.h" // Global::ScreenIsLocked.
namespace Core {
namespace {
@ -134,7 +133,7 @@ void UiIntegration::activationFromTopPanel() {
}
bool UiIntegration::screenIsLocked() {
return Global::ScreenIsLocked();
return Core::App().screenIsLocked();
}
QString UiIntegration::timeFormat() {

View File

@ -338,8 +338,6 @@ namespace Global {
namespace internal {
struct Data {
bool ScreenIsLocked = false;
bool TryIPv6 = !Platform::IsWindows();
std::vector<MTP::ProxyData> ProxiesList;
MTP::ProxyData SelectedProxy;
@ -370,8 +368,6 @@ void finish() {
GlobalData = nullptr;
}
DefineVar(Global, bool, ScreenIsLocked);
DefineVar(Global, bool, TryIPv6);
DefineVar(Global, std::vector<MTP::ProxyData>, ProxiesList);
DefineVar(Global, MTP::ProxyData, SelectedProxy);

View File

@ -95,8 +95,6 @@ bool started();
void start();
void finish();
DeclareVar(bool, ScreenIsLocked);
DeclareVar(bool, TryIPv6);
DeclareVar(std::vector<MTP::ProxyData>, ProxiesList);
DeclareVar(MTP::ProxyData, SelectedProxy);

View File

@ -192,11 +192,11 @@ private:
}
- (void) screenIsLocked:(NSNotification *)aNotification {
Global::SetScreenIsLocked(true);
Core::App().setScreenIsLocked(true);
}
- (void) screenIsUnlocked:(NSNotification *)aNotification {
Global::SetScreenIsLocked(false);
Core::App().setScreenIsLocked(false);
}
- (void) windowWillEnterFullScreen:(NSNotification *)aNotification {

View File

@ -19,7 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/core_settings.h"
#include "main/main_session.h"
#include "mainwindow.h"
#include "facades.h" // Global::ScreenIsLocked.
#include "windows_quiethours_h.h"
#include <Shobjidl.h>
@ -425,7 +424,7 @@ bool SkipAudioForCustom() {
return (UserNotificationState == QUNS_NOT_PRESENT)
|| (UserNotificationState == QUNS_PRESENTATION_MODE)
|| Global::ScreenIsLocked();
|| Core::App().screenIsLocked();
}
bool SkipToastForCustom() {

View File

@ -236,9 +236,9 @@ bool EventFilter::mainWindowEvent(
case WM_WTSSESSION_CHANGE: {
if (wParam == WTS_SESSION_LOGOFF || wParam == WTS_SESSION_LOCK) {
Global::SetScreenIsLocked(true);
Core::App().setScreenIsLocked(true);
} else if (wParam == WTS_SESSION_LOGON || wParam == WTS_SESSION_UNLOCK) {
Global::SetScreenIsLocked(false);
Core::App().setScreenIsLocked(false);
}
} return false;

View File

@ -745,7 +745,7 @@ void NativeManager::doShowNotification(
}
bool NativeManager::forceHideDetails() const {
return Global::ScreenIsLocked();
return Core::App().screenIsLocked();
}
System::~System() = default;