2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Remove some App::wnd() calls.

This commit is contained in:
John Preston
2021-02-25 19:12:51 +04:00
parent 204dd0a869
commit 54f06740d5
27 changed files with 137 additions and 106 deletions

View File

@@ -928,8 +928,8 @@ void MainWindow::createGlobalMenu() {
auto quit = file->addAction(
tr::lng_mac_menu_quit_telegram(tr::now, lt_telegram, qsl("Telegram")),
App::wnd(),
[=] { App::wnd()->quitFromTray(); },
this,
[=] { quitFromTray(); },
QKeySequence::Quit);
quit->setMenuRole(QAction::QuitRole);
@@ -1037,7 +1037,7 @@ void MainWindow::createGlobalMenu() {
tr::lng_mac_menu_contacts(tr::now),
crl::guard(this, [=] {
if (isHidden()) {
App::wnd()->showFromTray();
showFromTray();
}
if (!sessionController()) {
@@ -1154,7 +1154,9 @@ void MainWindow::psLinuxClearFormat() {
}
void MainWindow::updateGlobalMenuHook() {
if (!App::wnd() || !positionInited()) return;
if (!positionInited()) {
return;
}
const auto focused = QApplication::focusWidget();
auto canUndo = false;
@@ -1189,7 +1191,7 @@ void MainWindow::updateGlobalMenuHook() {
canCopy = list->canCopySelected();
canDelete = list->canDeleteSelected();
}
App::wnd()->updateIsActive();
updateIsActive();
const auto logged = (sessionController() != nullptr);
const auto inactive = !logged || controller().locked();
const auto support = logged && account().session().supportMode();

View File

@@ -545,7 +545,7 @@ std::optional<bool> IsDarkMode() {
if (integration->checkVersion(3, 0, 0)) {
const auto preferDarkTheme = integration->getBoolSetting(
qsl("gtk-application-prefer-dark-theme"));
if (!preferDarkTheme.has_value()) {
return std::nullopt;
} else if (*preferDarkTheme) {
@@ -588,17 +588,6 @@ bool SkipTaskbarSupported() {
} // namespace Platform
QRect psDesktopRect() {
static QRect _monitorRect;
static auto _monitorLastGot = 0LL;
auto tnow = crl::now();
if (tnow > _monitorLastGot + 1000LL || tnow < _monitorLastGot) {
_monitorLastGot = tnow;
_monitorRect = QApplication::desktop()->availableGeometry(App::wnd());
}
return _monitorRect;
}
void psWriteDump() {
}

View File

@@ -48,8 +48,6 @@ QString psAppDataPath();
void psAutoStart(bool start, bool silent = false);
void psSendToMenu(bool send, bool silent = false);
QRect psDesktopRect();
int psCleanup();
int psFixPrevious();