2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Moved WorkMode global variable from facades to core settings.

This commit is contained in:
23rd
2021-05-27 22:45:52 +03:00
parent 16db8468fa
commit 5334372671
13 changed files with 64 additions and 36 deletions

View File

@@ -178,9 +178,10 @@ MainWindow::MainWindow(not_null<Controller*> controller)
updateUnreadCounter();
}, lifetime());
subscribe(Global::RefWorkMode(), [=](DBIWorkMode mode) {
Core::App().settings().workModeChanges(
) | rpl::start_with_next([=](DBIWorkMode mode) {
workmodeUpdated(mode);
});
}, lifetime());
Ui::Toast::SetDefaultParent(_body.data());
@@ -209,7 +210,8 @@ bool MainWindow::hideNoQuit() {
if (App::quitting()) {
return false;
}
if (Global::WorkMode().value() == dbiwmTrayOnly || Global::WorkMode().value() == dbiwmWindowAndTray) {
const auto workMode = Core::App().settings().workMode();
if (workMode == dbiwmTrayOnly || workMode == dbiwmWindowAndTray) {
if (minimizeToTray()) {
if (const auto controller = sessionController()) {
Ui::showChatsList(&controller->session());
@@ -314,7 +316,8 @@ void MainWindow::handleStateChanged(Qt::WindowState state) {
controller().updateIsActiveFocus();
}
Core::App().updateNonIdle();
if (state == Qt::WindowMinimized && Global::WorkMode().value() == dbiwmTrayOnly) {
if (state == Qt::WindowMinimized
&& (Core::App().settings().workMode() == dbiwmTrayOnly)) {
minimizeToTray();
}
savePosition(state);