mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Moved WorkMode global variable from facades to core settings.
This commit is contained in:
parent
16db8468fa
commit
5334372671
13 changed files with 64 additions and 36 deletions
|
@ -197,7 +197,8 @@ QByteArray Settings::serialize() const {
|
||||||
}
|
}
|
||||||
stream
|
stream
|
||||||
<< qint32(_disableOpenGL ? 1 : 0)
|
<< qint32(_disableOpenGL ? 1 : 0)
|
||||||
<< qint32(_groupCallNoiseSuppression ? 1 : 0);
|
<< qint32(_groupCallNoiseSuppression ? 1 : 0)
|
||||||
|
<< _workMode.current();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -275,6 +276,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
base::flat_map<QString, uint8> emojiVariants;
|
base::flat_map<QString, uint8> emojiVariants;
|
||||||
qint32 disableOpenGL = _disableOpenGL ? 1 : 0;
|
qint32 disableOpenGL = _disableOpenGL ? 1 : 0;
|
||||||
qint32 groupCallNoiseSuppression = _groupCallNoiseSuppression ? 1 : 0;
|
qint32 groupCallNoiseSuppression = _groupCallNoiseSuppression ? 1 : 0;
|
||||||
|
qint32 workMode = static_cast<qint32>(_workMode.current());
|
||||||
|
|
||||||
stream >> themesAccentColors;
|
stream >> themesAccentColors;
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
|
@ -409,6 +411,9 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
if (!stream.atEnd()) {
|
if (!stream.atEnd()) {
|
||||||
stream >> groupCallNoiseSuppression;
|
stream >> groupCallNoiseSuppression;
|
||||||
}
|
}
|
||||||
|
if (!stream.atEnd()) {
|
||||||
|
stream >> workMode;
|
||||||
|
}
|
||||||
if (stream.status() != QDataStream::Ok) {
|
if (stream.status() != QDataStream::Ok) {
|
||||||
LOG(("App Error: "
|
LOG(("App Error: "
|
||||||
"Bad data for Core::Settings::constructFromSerialized()"));
|
"Bad data for Core::Settings::constructFromSerialized()"));
|
||||||
|
@ -520,6 +525,12 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
|
||||||
|| Ui::Integration::Instance().openglLastCheckFailed());
|
|| Ui::Integration::Instance().openglLastCheckFailed());
|
||||||
}
|
}
|
||||||
_groupCallNoiseSuppression = (groupCallNoiseSuppression == 1);
|
_groupCallNoiseSuppression = (groupCallNoiseSuppression == 1);
|
||||||
|
const auto uncheckedWorkMode = static_cast<DBIWorkMode>(workMode);
|
||||||
|
switch (uncheckedWorkMode) {
|
||||||
|
case dbiwmWindowAndTray:
|
||||||
|
case dbiwmTrayOnly:
|
||||||
|
case dbiwmWindowOnly: _workMode = uncheckedWorkMode; break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::getSoundPath(const QString &key) const {
|
QString Settings::getSoundPath(const QString &key) const {
|
||||||
|
@ -779,6 +790,8 @@ void Settings::resetOnLastLogout() {
|
||||||
_recentEmojiPreload.clear();
|
_recentEmojiPreload.clear();
|
||||||
_recentEmoji.clear();
|
_recentEmoji.clear();
|
||||||
_emojiVariants.clear();
|
_emojiVariants.clear();
|
||||||
|
|
||||||
|
_workMode = dbiwmWindowAndTray;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::ThirdColumnByDefault() {
|
bool Settings::ThirdColumnByDefault() {
|
||||||
|
|
|
@ -521,6 +521,18 @@ public:
|
||||||
void setWindowPosition(const WindowPosition &position) {
|
void setWindowPosition(const WindowPosition &position) {
|
||||||
_windowPosition = position;
|
_windowPosition = position;
|
||||||
}
|
}
|
||||||
|
void setWorkMode(DBIWorkMode value) {
|
||||||
|
_workMode = value;
|
||||||
|
}
|
||||||
|
[[nodiscard]] DBIWorkMode workMode() const {
|
||||||
|
return _workMode.current();
|
||||||
|
}
|
||||||
|
[[nodiscard]] rpl::producer<DBIWorkMode> workModeValue() const {
|
||||||
|
return _workMode.value();
|
||||||
|
}
|
||||||
|
[[nodiscard]] rpl::producer<DBIWorkMode> workModeChanges() const {
|
||||||
|
return _workMode.changes();
|
||||||
|
}
|
||||||
|
|
||||||
struct RecentEmoji {
|
struct RecentEmoji {
|
||||||
EmojiPtr emoji = nullptr;
|
EmojiPtr emoji = nullptr;
|
||||||
|
@ -641,6 +653,7 @@ private:
|
||||||
rpl::variable<bool> _systemDarkModeEnabled = false;
|
rpl::variable<bool> _systemDarkModeEnabled = false;
|
||||||
WindowPosition _windowPosition; // per-window
|
WindowPosition _windowPosition; // per-window
|
||||||
bool _disableOpenGL = false;
|
bool _disableOpenGL = false;
|
||||||
|
rpl::variable<DBIWorkMode> _workMode = dbiwmWindowAndTray;
|
||||||
|
|
||||||
bool _tabbedReplacedWithInfo = false; // per-window
|
bool _tabbedReplacedWithInfo = false; // per-window
|
||||||
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
rpl::event_stream<bool> _tabbedReplacedWithInfoValue; // per-window
|
||||||
|
|
|
@ -344,8 +344,6 @@ struct Data {
|
||||||
MTP::ProxyData::Settings ProxySettings = MTP::ProxyData::Settings::System;
|
MTP::ProxyData::Settings ProxySettings = MTP::ProxyData::Settings::System;
|
||||||
bool UseProxyForCalls = false;
|
bool UseProxyForCalls = false;
|
||||||
base::Observable<void> ConnectionTypeChanged;
|
base::Observable<void> ConnectionTypeChanged;
|
||||||
|
|
||||||
base::Variable<DBIWorkMode> WorkMode = { dbiwmWindowAndTray };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
@ -375,6 +373,4 @@ DefineVar(Global, MTP::ProxyData::Settings, ProxySettings);
|
||||||
DefineVar(Global, bool, UseProxyForCalls);
|
DefineVar(Global, bool, UseProxyForCalls);
|
||||||
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
DefineRefVar(Global, base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
DefineRefVar(Global, base::Variable<DBIWorkMode>, WorkMode);
|
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
|
@ -102,6 +102,4 @@ DeclareVar(MTP::ProxyData::Settings, ProxySettings);
|
||||||
DeclareVar(bool, UseProxyForCalls);
|
DeclareVar(bool, UseProxyForCalls);
|
||||||
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
DeclareRefVar(base::Observable<void>, ConnectionTypeChanged);
|
||||||
|
|
||||||
DeclareRefVar(base::Variable<DBIWorkMode>, WorkMode);
|
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
|
@ -174,7 +174,8 @@ void MainWindow::createTrayIconMenu() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::applyInitialWorkMode() {
|
void MainWindow::applyInitialWorkMode() {
|
||||||
Global::RefWorkMode().setForced(Global::WorkMode().value(), true);
|
const auto workMode = Core::App().settings().workMode();
|
||||||
|
workmodeUpdated(workMode);
|
||||||
|
|
||||||
if (Core::App().settings().windowPosition().maximized) {
|
if (Core::App().settings().windowPosition().maximized) {
|
||||||
DEBUG_LOG(("Window Pos: First show, setting maximized."));
|
DEBUG_LOG(("Window Pos: First show, setting maximized."));
|
||||||
|
@ -187,8 +188,7 @@ void MainWindow::applyInitialWorkMode() {
|
||||||
const auto minimizeAndHide = [=] {
|
const auto minimizeAndHide = [=] {
|
||||||
DEBUG_LOG(("Window Pos: First show, setting minimized after."));
|
DEBUG_LOG(("Window Pos: First show, setting minimized after."));
|
||||||
setWindowState(windowState() | Qt::WindowMinimized);
|
setWindowState(windowState() | Qt::WindowMinimized);
|
||||||
if (Global::WorkMode().value() == dbiwmTrayOnly
|
if (workMode == dbiwmTrayOnly || workMode == dbiwmWindowAndTray) {
|
||||||
|| Global::WorkMode().value() == dbiwmWindowAndTray) {
|
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
#include "core/core_settings.h"
|
||||||
#include "core/sandbox.h"
|
#include "core/sandbox.h"
|
||||||
#include "boxes/peer_list_controllers.h"
|
#include "boxes/peer_list_controllers.h"
|
||||||
#include "boxes/about_box.h"
|
#include "boxes/about_box.h"
|
||||||
|
@ -28,7 +29,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/event_filter.h"
|
#include "base/event_filter.h"
|
||||||
#include "ui/widgets/popup_menu.h"
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "facades.h"
|
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
|
|
||||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||||
|
@ -809,7 +809,7 @@ void MainWindow::handleSNIHostRegistered() {
|
||||||
|
|
||||||
_sniAvailable = true;
|
_sniAvailable = true;
|
||||||
|
|
||||||
if (Global::WorkMode().value() == dbiwmWindowOnly) {
|
if (Core::App().settings().workMode() == dbiwmWindowOnly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,7 +825,7 @@ void MainWindow::handleSNIHostRegistered() {
|
||||||
|
|
||||||
SkipTaskbar(
|
SkipTaskbar(
|
||||||
windowHandle(),
|
windowHandle(),
|
||||||
Global::WorkMode().value() == dbiwmTrayOnly);
|
Core::App().settings().workMode() == dbiwmTrayOnly);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleSNIOwnerChanged(
|
void MainWindow::handleSNIOwnerChanged(
|
||||||
|
@ -834,7 +834,7 @@ void MainWindow::handleSNIOwnerChanged(
|
||||||
const QString &newOwner) {
|
const QString &newOwner) {
|
||||||
_sniAvailable = IsSNIAvailable();
|
_sniAvailable = IsSNIAvailable();
|
||||||
|
|
||||||
if (Global::WorkMode().value() == dbiwmWindowOnly) {
|
if (Core::App().settings().workMode() == dbiwmWindowOnly) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,7 +860,8 @@ void MainWindow::handleSNIOwnerChanged(
|
||||||
|
|
||||||
SkipTaskbar(
|
SkipTaskbar(
|
||||||
windowHandle(),
|
windowHandle(),
|
||||||
(Global::WorkMode().value() == dbiwmTrayOnly) && trayAvailable());
|
(Core::App().settings().workMode() == dbiwmTrayOnly)
|
||||||
|
&& trayAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::handleAppMenuOwnerChanged(
|
void MainWindow::handleAppMenuOwnerChanged(
|
||||||
|
@ -1330,7 +1331,7 @@ void MainWindow::handleNativeSurfaceChanged(bool exist) {
|
||||||
if (exist) {
|
if (exist) {
|
||||||
SkipTaskbar(
|
SkipTaskbar(
|
||||||
windowHandle(),
|
windowHandle(),
|
||||||
(Global::WorkMode().value() == dbiwmTrayOnly)
|
(Core::App().settings().workMode() == dbiwmTrayOnly)
|
||||||
&& trayAvailable());
|
&& trayAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "platform/mac/notifications_manager_mac.h"
|
#include "platform/mac/notifications_manager_mac.h"
|
||||||
|
|
||||||
|
#include "core/application.h"
|
||||||
|
#include "core/core_settings.h"
|
||||||
#include "base/platform/base_platform_info.h"
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "base/platform/mac/base_utilities_mac.h"
|
#include "base/platform/mac/base_utilities_mac.h"
|
||||||
|
@ -15,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/empty_userpic.h"
|
#include "ui/empty_userpic.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "facades.h"
|
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -172,7 +173,7 @@ void Create(Window::Notifications::System *system) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Manager::Private : public QObject, private base::Subscriber {
|
class Manager::Private : public QObject {
|
||||||
public:
|
public:
|
||||||
Private(Manager *manager);
|
Private(Manager *manager);
|
||||||
|
|
||||||
|
@ -224,20 +225,22 @@ private:
|
||||||
ClearFinish>;
|
ClearFinish>;
|
||||||
std::vector<ClearTask> _clearingTasks;
|
std::vector<ClearTask> _clearingTasks;
|
||||||
|
|
||||||
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Manager::Private::Private(Manager *manager)
|
Manager::Private::Private(Manager *manager)
|
||||||
: _managerId(openssl::RandomValue<uint64>())
|
: _managerId(openssl::RandomValue<uint64>())
|
||||||
, _managerIdString(QString::number(_managerId))
|
, _managerIdString(QString::number(_managerId))
|
||||||
, _delegate([[NotificationDelegate alloc] initWithManager:manager managerId:_managerId]) {
|
, _delegate([[NotificationDelegate alloc] initWithManager:manager managerId:_managerId]) {
|
||||||
updateDelegate();
|
Core::App().settings().workModeValue(
|
||||||
subscribe(Global::RefWorkMode(), [this](DBIWorkMode mode) {
|
) | rpl::start_with_next([=](DBIWorkMode mode) {
|
||||||
// We need to update the delegate _after_ the tray icon change was done in Qt.
|
// We need to update the delegate _after_ the tray icon change was done in Qt.
|
||||||
// Because Qt resets the delegate.
|
// Because Qt resets the delegate.
|
||||||
crl::on_main(this, [=] {
|
crl::on_main(this, [=] {
|
||||||
updateDelegate();
|
updateDelegate();
|
||||||
});
|
});
|
||||||
});
|
}, _lifetime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::Private::showNotification(
|
void Manager::Private::showNotification(
|
||||||
|
|
|
@ -343,7 +343,7 @@ void SetupSystemIntegrationContent(
|
||||||
};
|
};
|
||||||
if (Platform::TrayIconSupported()) {
|
if (Platform::TrayIconSupported()) {
|
||||||
const auto trayEnabled = [] {
|
const auto trayEnabled = [] {
|
||||||
const auto workMode = Global::WorkMode().value();
|
const auto workMode = Core::App().settings().workMode();
|
||||||
return (workMode == dbiwmTrayOnly)
|
return (workMode == dbiwmTrayOnly)
|
||||||
|| (workMode == dbiwmWindowAndTray);
|
|| (workMode == dbiwmWindowAndTray);
|
||||||
};
|
};
|
||||||
|
@ -352,7 +352,7 @@ void SetupSystemIntegrationContent(
|
||||||
trayEnabled());
|
trayEnabled());
|
||||||
|
|
||||||
const auto taskbarEnabled = [] {
|
const auto taskbarEnabled = [] {
|
||||||
const auto workMode = Global::WorkMode().value();
|
const auto workMode = Core::App().settings().workMode();
|
||||||
return (workMode == dbiwmWindowOnly)
|
return (workMode == dbiwmWindowOnly)
|
||||||
|| (workMode == dbiwmWindowAndTray);
|
|| (workMode == dbiwmWindowAndTray);
|
||||||
};
|
};
|
||||||
|
@ -369,10 +369,10 @@ void SetupSystemIntegrationContent(
|
||||||
: dbiwmTrayOnly)
|
: dbiwmTrayOnly)
|
||||||
: dbiwmWindowOnly;
|
: dbiwmWindowOnly;
|
||||||
if ((newMode == dbiwmWindowAndTray || newMode == dbiwmTrayOnly)
|
if ((newMode == dbiwmWindowAndTray || newMode == dbiwmTrayOnly)
|
||||||
&& Global::WorkMode().value() != newMode) {
|
&& Core::App().settings().workMode() != newMode) {
|
||||||
cSetSeenTrayTooltip(false);
|
cSetSeenTrayTooltip(false);
|
||||||
}
|
}
|
||||||
Global::RefWorkMode().set(newMode);
|
Core::App().settings().setWorkMode(newMode);
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -422,19 +422,21 @@ bool ReadSetting(
|
||||||
context.sessionSettings().addFromSerialized(v);
|
context.sessionSettings().addFromSerialized(v);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiWorkMode: {
|
case dbiWorkModeOld: {
|
||||||
qint32 v;
|
qint32 v;
|
||||||
stream >> v;
|
stream >> v;
|
||||||
if (!CheckStreamStatus(stream)) return false;
|
if (!CheckStreamStatus(stream)) return false;
|
||||||
|
|
||||||
auto newMode = [v] {
|
const auto newMode = [v] {
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case dbiwmTrayOnly: return dbiwmTrayOnly;
|
case dbiwmTrayOnly: return dbiwmTrayOnly;
|
||||||
case dbiwmWindowOnly: return dbiwmWindowOnly;
|
case dbiwmWindowOnly: return dbiwmWindowOnly;
|
||||||
};
|
};
|
||||||
return dbiwmWindowAndTray;
|
return dbiwmWindowAndTray;
|
||||||
};
|
}();
|
||||||
Global::RefWorkMode().set(newMode());
|
Core::App().settings().setWorkMode(newMode);
|
||||||
|
|
||||||
|
context.legacyRead = true;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiTxtDomainStringOldOld: {
|
case dbiTxtDomainStringOldOld: {
|
||||||
|
|
|
@ -86,7 +86,7 @@ enum {
|
||||||
dbiAutoStart = 0x06,
|
dbiAutoStart = 0x06,
|
||||||
dbiStartMinimized = 0x07,
|
dbiStartMinimized = 0x07,
|
||||||
dbiSoundFlashBounceNotifyOld = 0x08,
|
dbiSoundFlashBounceNotifyOld = 0x08,
|
||||||
dbiWorkMode = 0x09,
|
dbiWorkModeOld = 0x09,
|
||||||
dbiSeenTrayTooltip = 0x0a,
|
dbiSeenTrayTooltip = 0x0a,
|
||||||
dbiDesktopNotifyOld = 0x0b,
|
dbiDesktopNotifyOld = 0x0b,
|
||||||
dbiAutoUpdate = 0x0c,
|
dbiAutoUpdate = 0x0c,
|
||||||
|
|
|
@ -491,7 +491,6 @@ void writeSettings() {
|
||||||
data.stream << quint32(dbiAutoStart) << qint32(cAutoStart());
|
data.stream << quint32(dbiAutoStart) << qint32(cAutoStart());
|
||||||
data.stream << quint32(dbiStartMinimized) << qint32(cStartMinimized());
|
data.stream << quint32(dbiStartMinimized) << qint32(cStartMinimized());
|
||||||
data.stream << quint32(dbiSendToMenu) << qint32(cSendToMenu());
|
data.stream << quint32(dbiSendToMenu) << qint32(cSendToMenu());
|
||||||
data.stream << quint32(dbiWorkMode) << qint32(Global::WorkMode().value());
|
|
||||||
data.stream << quint32(dbiSeenTrayTooltip) << qint32(cSeenTrayTooltip());
|
data.stream << quint32(dbiSeenTrayTooltip) << qint32(cSeenTrayTooltip());
|
||||||
data.stream << quint32(dbiAutoUpdate) << qint32(cAutoUpdate());
|
data.stream << quint32(dbiAutoUpdate) << qint32(cAutoUpdate());
|
||||||
data.stream << quint32(dbiLastUpdateCheck) << qint32(cLastUpdateCheck());
|
data.stream << quint32(dbiLastUpdateCheck) << qint32(cLastUpdateCheck());
|
||||||
|
|
|
@ -178,9 +178,10 @@ MainWindow::MainWindow(not_null<Controller*> controller)
|
||||||
updateUnreadCounter();
|
updateUnreadCounter();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
subscribe(Global::RefWorkMode(), [=](DBIWorkMode mode) {
|
Core::App().settings().workModeChanges(
|
||||||
|
) | rpl::start_with_next([=](DBIWorkMode mode) {
|
||||||
workmodeUpdated(mode);
|
workmodeUpdated(mode);
|
||||||
});
|
}, lifetime());
|
||||||
|
|
||||||
Ui::Toast::SetDefaultParent(_body.data());
|
Ui::Toast::SetDefaultParent(_body.data());
|
||||||
|
|
||||||
|
@ -209,7 +210,8 @@ bool MainWindow::hideNoQuit() {
|
||||||
if (App::quitting()) {
|
if (App::quitting()) {
|
||||||
return false;
|
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 (minimizeToTray()) {
|
||||||
if (const auto controller = sessionController()) {
|
if (const auto controller = sessionController()) {
|
||||||
Ui::showChatsList(&controller->session());
|
Ui::showChatsList(&controller->session());
|
||||||
|
@ -314,7 +316,8 @@ void MainWindow::handleStateChanged(Qt::WindowState state) {
|
||||||
controller().updateIsActiveFocus();
|
controller().updateIsActiveFocus();
|
||||||
}
|
}
|
||||||
Core::App().updateNonIdle();
|
Core::App().updateNonIdle();
|
||||||
if (state == Qt::WindowMinimized && Global::WorkMode().value() == dbiwmTrayOnly) {
|
if (state == Qt::WindowMinimized
|
||||||
|
&& (Core::App().settings().workMode() == dbiwmTrayOnly)) {
|
||||||
minimizeToTray();
|
minimizeToTray();
|
||||||
}
|
}
|
||||||
savePosition(state);
|
savePosition(state);
|
||||||
|
|
|
@ -316,7 +316,7 @@ void Controller::updateIsActive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::minimize() {
|
void Controller::minimize() {
|
||||||
if (Global::WorkMode().value() == dbiwmTrayOnly) {
|
if (Core::App().settings().workMode() == dbiwmTrayOnly) {
|
||||||
_widget.minimizeToTray();
|
_widget.minimizeToTray();
|
||||||
} else {
|
} else {
|
||||||
_widget.setWindowState(_widget.windowState() | Qt::WindowMinimized);
|
_widget.setWindowState(_widget.windowState() | Qt::WindowMinimized);
|
||||||
|
|
Loading…
Add table
Reference in a new issue