From 01139e1b04de76e06d814244a61d8eb31d260c14 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 30 Nov 2022 16:55:51 +0400 Subject: [PATCH] Remove facades module. --- Telegram/CMakeLists.txt | 2 - Telegram/SourceFiles/apiwrap.cpp | 1 - .../SourceFiles/boxes/add_contact_box.cpp | 7 +- .../boxes/peer_list_controllers.cpp | 6 +- .../boxes/peers/add_bot_to_chat_box.cpp | 5 +- Telegram/SourceFiles/boxes/send_files_box.cpp | 4 +- Telegram/SourceFiles/core/application.cpp | 5 +- Telegram/SourceFiles/core/core_settings.cpp | 1 - .../data/data_document_resolver.cpp | 1 - Telegram/SourceFiles/data/data_photo.cpp | 1 - Telegram/SourceFiles/data/data_session.cpp | 1 - .../dialogs/dialogs_inner_widget.cpp | 4 +- .../SourceFiles/dialogs/dialogs_widget.cpp | 14 ++-- Telegram/SourceFiles/facades.cpp | 73 ------------------- Telegram/SourceFiles/facades.h | 49 ------------- .../admin_log/history_admin_log_inner.cpp | 10 +-- .../admin_log/history_admin_log_item.cpp | 5 +- .../admin_log/history_admin_log_section.cpp | 3 +- .../history/history_inner_widget.cpp | 14 ++-- .../SourceFiles/history/history_widget.cpp | 2 +- .../view/history_view_context_menu.cpp | 6 +- .../history/view/history_view_list_widget.cpp | 3 +- .../view/history_view_pinned_section.cpp | 3 +- .../view/history_view_replies_section.cpp | 3 +- .../view/history_view_scheduled_section.cpp | 3 +- .../info/media/info_media_list_widget.cpp | 6 +- .../info/profile/info_profile_actions.cpp | 6 +- .../inline_bots/inline_results_inner.cpp | 6 +- Telegram/SourceFiles/main/main_domain.cpp | 1 - Telegram/SourceFiles/mainwidget.cpp | 5 +- Telegram/SourceFiles/mainwindow.cpp | 6 +- Telegram/SourceFiles/mainwindow.h | 13 ++-- .../media/player/media_player_float.cpp | 1 - .../media/player/media_player_widget.cpp | 1 - .../platform/mac/main_window_mac.mm | 1 - .../SourceFiles/settings/settings_chat.cpp | 1 - .../SourceFiles/settings/settings_main.cpp | 3 +- .../settings/settings_notifications.cpp | 1 - .../settings/settings_privacy_controllers.cpp | 6 +- .../settings/settings_privacy_security.cpp | 1 - .../SourceFiles/support/support_helper.cpp | 3 +- Telegram/SourceFiles/window/main_window.cpp | 6 +- .../window/notifications_manager.cpp | 1 - .../window/notifications_manager_default.cpp | 1 - .../SourceFiles/window/section_widget.cpp | 4 +- .../window/themes/window_theme_editor.cpp | 3 +- .../SourceFiles/window/window_controller.cpp | 1 - .../window/window_lock_widgets.cpp | 3 +- .../window/window_session_controller.cpp | 10 ++- .../window/window_session_controller.h | 4 +- Telegram/lib_base | 2 +- 51 files changed, 93 insertions(+), 229 deletions(-) delete mode 100644 Telegram/SourceFiles/facades.cpp delete mode 100644 Telegram/SourceFiles/facades.h diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 5cf7685a9..a59a6440f 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -1344,8 +1344,6 @@ PRIVATE apiwrap.cpp apiwrap.h config.h - facades.cpp - facades.h logs.cpp logs.h main.cpp diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 11f564467..fa016ffb4 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -96,7 +96,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_shared_media.h" #include "storage/storage_media_prepare.h" #include "storage/storage_account.h" -#include "facades.h" namespace { diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index c160988dd..d6fe2a8db 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -42,7 +42,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_invite_links.h" #include "api/api_peer_photo.h" #include "main/main_session.h" -#include "facades.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" #include "styles/style_dialogs.h" @@ -98,7 +97,7 @@ void ChatCreateDone( chat, std::move(image)); } - Ui::showPeerHistory(chat, ShowAtUnreadMsgId); + navigation->showPeerHistory(chat); }; if (!success) { LOG(("API Error: chat not found in updates " @@ -398,7 +397,9 @@ void AddContactBox::save() { : extractUser(list.front()); if (user) { if (user->isContact() || user->session().supportMode()) { - Ui::showPeerHistory(user, ShowAtTheEndMsgId); + if (const auto window = user->session().tryResolveWindow()) { + window->showPeerHistory(user); + } } if (weak) { // showPeerHistory could close the box. getDelegate()->hideLayer(); diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index ffee0beb1..b1584b0f4 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_main_list.h" #include "window/window_session_controller.h" // showAddContact() #include "base/unixtime.h" -#include "facades.h" #include "styles/style_boxes.h" #include "styles/style_profile.h" #include "styles/style_dialogs.h" @@ -378,7 +377,10 @@ std::unique_ptr ContactsBoxController::createSearchRow( } void ContactsBoxController::rowClicked(not_null row) { - Ui::showPeerHistory(row->peer(), ShowAtUnreadMsgId); + const auto peer = row->peer(); + if (const auto window = peer->session().tryResolveWindow()) { + window->showPeerHistory(row->peer()); + } } void ContactsBoxController::setSortMode(SortMode mode) { diff --git a/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp b/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp index badb8b73e..6f11e0593 100644 --- a/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/add_bot_to_chat_box.cpp @@ -26,7 +26,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_chat_participants.h" #include "window/window_session_controller.h" #include "apiwrap.h" -#include "facades.h" #include "styles/style_boxes.h" namespace { @@ -406,5 +405,7 @@ void AddBotToGroup( } else { chat->session().api().chatParticipants().add(chat, { 1, bot }); } - Ui::showPeerHistory(chat, ShowAtUnreadMsgId); + if (const auto window = chat->session().tryResolveWindow()) { + window->showPeerHistory(chat); + } } diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index 058835dd8..bed83c42c 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/file_utilities.h" #include "core/mime_type.h" #include "base/event_filter.h" +#include "base/call_delayed.h" #include "boxes/premium_limits_box.h" #include "boxes/premium_preview_box.h" #include "ui/boxes/confirm_box.h" @@ -57,7 +58,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_session_controller.h" #include "core/application.h" #include "core/core_settings.h" -#include "facades.h" // App::LambdaDelayed. #include "styles/style_chat.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" @@ -353,7 +353,7 @@ void SendFilesBox::prepare() { _addFile = addLeftButton( tr::lng_stickers_featured_add(), - App::LambdaDelayed(st::historyAttach.ripple.hideDuration, this, [=] { + base::fn_delayed(st::historyAttach.ripple.hideDuration, this, [=] { openDialogToAddFileToAlbum(); })); setupDragArea(); diff --git a/Telegram/SourceFiles/core/application.cpp b/Telegram/SourceFiles/core/application.cpp index 399196ef6..bc561657f 100644 --- a/Telegram/SourceFiles/core/application.cpp +++ b/Telegram/SourceFiles/core/application.cpp @@ -1236,10 +1236,7 @@ void Application::closeChatFromWindows(not_null peer) { const auto primary = _primaryWindow->sessionController(); if ((primary->activeChatCurrent().peer() == peer) && (&primary->session() == &peer->session())) { - // showChatsList - primary->showPeerHistory( - PeerId(0), - Window::SectionShow::Way::ClearStack); + primary->clearSectionStack(); } if (const auto forum = primary->shownForum().current()) { if (peer->forum() == forum) { diff --git a/Telegram/SourceFiles/core/core_settings.cpp b/Telegram/SourceFiles/core/core_settings.cpp index 1a52fb906..f0ef543f5 100644 --- a/Telegram/SourceFiles/core/core_settings.cpp +++ b/Telegram/SourceFiles/core/core_settings.cpp @@ -17,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "media/player/media_player_instance.h" #include "ui/gl/gl_detection.h" #include "calls/group/calls_group_common.h" -#include "facades.h" namespace Core { namespace { diff --git a/Telegram/SourceFiles/data/data_document_resolver.cpp b/Telegram/SourceFiles/data/data_document_resolver.cpp index 70871d5b9..ebde49cb1 100644 --- a/Telegram/SourceFiles/data/data_document_resolver.cpp +++ b/Telegram/SourceFiles/data/data_document_resolver.cpp @@ -7,7 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #include "data/data_document_resolver.h" -#include "facades.h" #include "base/platform/base_platform_info.h" #include "ui/boxes/confirm_box.h" #include "core/application.h" diff --git a/Telegram/SourceFiles/data/data_photo.cpp b/Telegram/SourceFiles/data/data_photo.cpp index 6690246cb..146335b77 100644 --- a/Telegram/SourceFiles/data/data_photo.cpp +++ b/Telegram/SourceFiles/data/data_photo.cpp @@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwidget.h" #include "storage/file_download.h" #include "core/application.h" -#include "facades.h" namespace { diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 9e8c8f87e..28a559b75 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -77,7 +77,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/unixtime.h" #include "base/call_delayed.h" #include "base/random.h" -#include "facades.h" // Notify::switchInlineBotButtonReceived #include "styles/style_boxes.h" // st::backgroundSize namespace Data { diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index f28c8ec8c..d5728fb77 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -536,14 +536,14 @@ void InnerWidget::paintEvent(QPaintEvent *e) { p.setInactive( _controller->isGifPausedAtLeastFor(Window::GifPauseReason::Any)); - const auto r = e->rect(); - if (_controller->widget()->contentOverlapped(this, r)) { + if (_controller->contentOverlapped(this, e)) { return; } const auto activeEntry = _controller->activeChatEntryCurrent(); const auto videoPaused = _controller->isGifPausedAtLeastFor( Window::GifPauseReason::Any); auto fullWidth = width(); + const auto r = e->rect(); auto dialogsClip = r; const auto ms = crl::now(); const auto shownForum = _controller->shownForum().current(); diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 2650abb58..0534ecb91 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -62,7 +62,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_chat_filters.h" #include "info/downloads/info_downloads_widget.h" #include "info/info_memento.h" -#include "facades.h" #include "styles/style_dialogs.h" #include "styles/style_chat.h" #include "styles/style_info.h" @@ -745,12 +744,13 @@ void Widget::changeOpenedSubsection( if (isHidden()) { animated = anim::type::instant; } + auto cacheUnder = QPixmap(); + const auto showDirection = fromRight + ? Window::SlideDirection::FromRight + : Window::SlideDirection::FromLeft; if (animated == anim::type::normal) { _connecting->setForceHidden(true); - _cacheUnder = grabForFolderSlideAnimation(); - _showDirection = fromRight - ? Window::SlideDirection::FromRight - : Window::SlideDirection::FromLeft; + cacheUnder = grabForFolderSlideAnimation(); } _a_show.stop(); change(); @@ -760,7 +760,7 @@ void Widget::changeOpenedSubsection( _api.request(base::take(_topicSearchRequest)).cancel(); if (animated == anim::type::normal) { _connecting->setForceHidden(true); - _cacheOver = grabForFolderSlideAnimation(); + auto cacheOver = grabForFolderSlideAnimation(); _connecting->setForceHidden(false); startSlideAnimation(); } @@ -2297,7 +2297,7 @@ void Widget::keyPressEvent(QKeyEvent *e) { } void Widget::paintEvent(QPaintEvent *e) { - if (controller()->widget()->contentOverlapped(this, e)) { + if (controller()->contentOverlapped(this, e)) { return; } diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp deleted file mode 100644 index 5c3b43915..000000000 --- a/Telegram/SourceFiles/facades.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#include "facades.h" - -#include "api/api_bot.h" -#include "info/info_memento.h" -#include "inline_bots/bot_attach_web_view.h" -#include "core/click_handler_types.h" -#include "core/application.h" -#include "media/clip/media_clip_reader.h" -#include "window/window_session_controller.h" -#include "window/window_peer_menu.h" -#include "history/history_item_components.h" -#include "base/platform/base_platform_info.h" -#include "data/data_peer.h" -#include "data/data_user.h" -#include "mainwindow.h" -#include "mainwidget.h" -#include "apiwrap.h" -#include "main/main_session.h" -#include "main/main_domain.h" -#include "ui/boxes/confirm_box.h" -#include "boxes/url_auth_box.h" -#include "ui/layers/layer_widget.h" -#include "lang/lang_keys.h" -#include "history/history.h" -#include "history/history_item.h" -#include "history/view/media/history_view_media.h" -#include "payments/payments_checkout_process.h" -#include "data/data_session.h" -#include "styles/style_chat.h" - -namespace Ui { - -void showChatsList(not_null session) { - if (const auto window = session->tryResolveWindow()) { - window->clearSectionStack(); - } -} - -void showPeerHistory(not_null history, MsgId msgId) { - if (const auto window = history->session().tryResolveWindow()) { - window->showPeerHistory( - history, - ::Window::SectionShow::Way::ClearStack, - msgId); - } -} - -void showPeerHistory(not_null peer, MsgId msgId) { - if (const auto window = peer->session().tryResolveWindow()) { - window->showPeerHistory( - peer, - ::Window::SectionShow::Way::ClearStack, - msgId); - } -} - -bool skipPaintEvent(QWidget *widget, QPaintEvent *event) { - if (auto w = App::wnd()) { - if (w->contentOverlapped(widget, event)) { - return true; - } - } - return false; -} - -} // namespace Ui diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h deleted file mode 100644 index 1dee53a40..000000000 --- a/Telegram/SourceFiles/facades.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -This file is part of Telegram Desktop, -the official desktop application for the Telegram messaging service. - -For license and copyright information please follow this link: -https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL -*/ -#pragma once - -#include "base/type_traits.h" -#include "base/call_delayed.h" -#include "mtproto/mtproto_proxy_data.h" - -class History; - -namespace Main { -class Session; -} // namespace Main - -namespace Window { -class SessionController; -} // namespace Window - -namespace App { - -template -[[nodiscard]] inline auto LambdaDelayed(int duration, Guard &&object, Lambda &&lambda) { - auto guarded = crl::guard( - std::forward(object), - std::forward(lambda)); - return [saved = std::move(guarded), duration] { - auto copy = saved; - base::call_delayed(duration, std::move(copy)); - }; -} - -} // namespace App - -namespace Ui { - -// Legacy global methods. - -void showPeerHistory(not_null peer, MsgId msgId); -void showPeerHistory(not_null history, MsgId msgId); -void showChatsList(not_null session); - -bool skipPaintEvent(QWidget *widget, QPaintEvent *event); - -} // namespace Ui diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index e88bf30b4..fba616d02 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/base_platform_info.h" #include "base/qt/qt_key_modifiers.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "mainwindow.h" #include "mainwidget.h" #include "core/application.h" @@ -56,7 +57,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_cloud_file.h" #include "data/data_channel.h" #include "data/data_user.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_menu_icons.h" @@ -938,7 +938,7 @@ void InnerWidget::restoreScrollPosition() { } void InnerWidget::paintEvent(QPaintEvent *e) { - if (Ui::skipPaintEvent(this, e)) { + if (_controller->contentOverlapped(this, e)) { return; } @@ -1204,7 +1204,7 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { if (lnkPhoto) { const auto media = lnkPhoto->activeMediaView(); if (!lnkPhoto->isNull() && media && media->loaded()) { - _menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { + _menu->addAction(tr::lng_context_save_image(tr::now), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { savePhotoToFile(lnkPhoto); }), &st::menuIconSaveImage); _menu->addAction(tr::lng_context_copy_image(tr::now), [=] { @@ -1250,7 +1250,7 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { showContextInFolder(lnkDocument); }, &st::menuIconShowInFolder); } - _menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [this, lnkDocument] { + _menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [this, lnkDocument] { saveDocumentToFile(lnkDocument); }), &st::menuIconDownload); if (lnkDocument->hasAttachedStickers()) { @@ -1286,7 +1286,7 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { const auto mediaHasTextForCopy = media && media->hasTextForCopy(); if (const auto document = media ? media->getDocument() : nullptr) { if (document->sticker()) { - _menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [this, document] { + _menu->addAction(tr::lng_context_save_image(tr::now), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [this, document] { saveDocumentToFile(document); }), &st::menuIconDownload); } diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index a63deeb70..e9394469e 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "window/notifications_manager.h" #include "window/window_session_controller.h" -#include "facades.h" namespace AdminLog { namespace { @@ -1163,7 +1162,9 @@ void GenerateItems( Ui::Text::Link(now->name(), QString()), Ui::Text::WithEntities); const auto chatLink = std::make_shared([=] { - Ui::showPeerHistory(now, ShowAtUnreadMsgId); + if (const auto window = now->session().tryResolveWindow()) { + window->showPeerHistory(now); + } }); auto message = HistoryService::PreparedText{ text }; message.links.push_back(fromLink); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp index 87b9be0e2..b609966b2 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_section.cpp @@ -28,7 +28,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "data/data_session.h" #include "lang/lang_keys.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_window.h" #include "styles/style_info.h" @@ -462,7 +461,7 @@ void Widget::paintEvent(QPaintEvent *e) { if (animatingShow()) { SectionWidget::paintEvent(e); return; - } else if (Ui::skipPaintEvent(this, e)) { + } else if (controller()->contentOverlapped(this, e)) { return; } //if (hasPendingResizedItems()) { diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 8f834c83a..647037df9 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -60,6 +60,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/qt/qt_common_adapters.h" #include "base/qt/qt_key_modifiers.h" #include "base/unixtime.h" +#include "base/call_delayed.h" #include "mainwindow.h" #include "layout/layout_selection.h" #include "main/main_session.h" @@ -92,7 +93,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_sponsored_messages.h" #include "dialogs/ui/dialogs_video_userpic.h" #include "settings/settings_premium.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_window.h" // st::windowMinWidth #include "styles/style_menu_icons.h" @@ -906,10 +906,8 @@ Ui::ChatPaintContext HistoryInner::preparePaintContext( } void HistoryInner::paintEvent(QPaintEvent *e) { - if (Ui::skipPaintEvent(this, e)) { - return; - } - if (hasPendingResizedItems()) { + if (_controller->contentOverlapped(this, e) + || hasPendingResizedItems()) { return; } else if (_recountedAfterPendingResizedItems) { _recountedAfterPendingResizedItems = false; @@ -2152,7 +2150,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { const auto media = photo->activeMediaView(); const auto itemId = item ? item->fullId() : FullMsgId(); if (!photo->isNull() && media && media->loaded() && !hasCopyMediaRestriction(item)) { - _menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { + _menu->addAction(tr::lng_context_save_image(tr::now), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { savePhotoToFile(photo); }), &st::menuIconSaveImage); _menu->addAction(tr::lng_context_copy_image(tr::now), [=] { @@ -2208,7 +2206,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { item, document, controller); - _menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { + _menu->addAction(lnkIsVideo ? tr::lng_context_save_video(tr::now) : (lnkIsVoice ? tr::lng_context_save_audio(tr::now) : (lnkIsAudio ? tr::lng_context_save_audio_file(tr::now) : tr::lng_context_save_file(tr::now))), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { saveDocumentToFile(itemId, document); }), &st::menuIconDownload); } @@ -2393,7 +2391,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { }, isFaved ? &st::menuIconUnfave : &st::menuIconFave); } if (!hasCopyMediaRestriction(item)) { - _menu->addAction(tr::lng_context_save_image(tr::now), App::LambdaDelayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { + _menu->addAction(tr::lng_context_save_image(tr::now), base::fn_delayed(st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { saveDocumentToFile(itemId, document); }), &st::menuIconDownload); } diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 1132f3313..5a21257a2 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -7662,7 +7662,7 @@ bool HistoryWidget::paintShowAnimationFrame() { void HistoryWidget::paintEvent(QPaintEvent *e) { if (paintShowAnimationFrame() - || controller()->window().widget()->contentOverlapped(this, e)) { + || controller()->contentOverlapped(this, e)) { return; } if (hasPendingResizedItems()) { diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 41b90b309..fd8ba00ab 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -58,6 +58,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/file_utilities.h" #include "core/click_handler_types.h" #include "base/platform/base_platform_info.h" +#include "base/call_delayed.h" #include "window/window_peer_menu.h" #include "window/window_controller.h" #include "window/window_session_controller.h" @@ -66,7 +67,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "main/main_session_settings.h" #include "apiwrap.h" -#include "facades.h" // LambdaDelayed #include "styles/style_chat.h" #include "styles/style_menu_icons.h" @@ -151,7 +151,7 @@ void AddPhotoActions( if (!list->hasCopyMediaRestriction(item)) { menu->addAction( tr::lng_context_save_image(tr::now), - App::LambdaDelayed( + base::fn_delayed( st::defaultDropdownMenu.menu.ripple.hideDuration, &photo->session(), [=] { SavePhotoToFile(photo); }), @@ -236,7 +236,7 @@ void AddSaveDocumentAction( : (document->sticker() ? tr::lng_context_save_image(tr::now) : tr::lng_context_save_file(tr::now))))), - App::LambdaDelayed( + base::fn_delayed( st::defaultDropdownMenu.menu.ripple.hideDuration, &document->session(), save), diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 1b8c892e7..462a4f551 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -68,7 +68,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_file_click_handler.h" #include "data/data_message_reactions.h" #include "data/data_peer_values.h" -#include "facades.h" #include "styles/style_chat.h" #include @@ -2015,7 +2014,7 @@ void ListWidget::checkActivation() { } void ListWidget::paintEvent(QPaintEvent *e) { - if (Ui::skipPaintEvent(this, e)) { + if (_controller->contentOverlapped(this, e)) { return; } diff --git a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp index 575c0eee0..aca37e206 100644 --- a/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_pinned_section.cpp @@ -45,7 +45,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_account.h" #include "platform/platform_specific.h" #include "lang/lang_keys.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_window.h" #include "styles/style_info.h" @@ -391,7 +390,7 @@ void PinnedWidget::paintEvent(QPaintEvent *e) { if (animatingShow()) { SectionWidget::paintEvent(e); return; - } else if (Ui::skipPaintEvent(this, e)) { + } else if (controller()->contentOverlapped(this, e)) { return; } diff --git a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp index 58c28b845..b6e65e722 100644 --- a/Telegram/SourceFiles/history/view/history_view_replies_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_replies_section.cpp @@ -82,7 +82,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "inline_bots/inline_bot_result.h" #include "info/profile/info_profile_values.h" #include "lang/lang_keys.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_window.h" #include "styles/style_info.h" @@ -2185,7 +2184,7 @@ void RepliesWidget::paintEvent(QPaintEvent *e) { if (animatingShow()) { SectionWidget::paintEvent(e); return; - } else if (Ui::skipPaintEvent(this, e)) { + } else if (controller()->contentOverlapped(this, e)) { return; } diff --git a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp index da68f31fb..f319c1228 100644 --- a/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp +++ b/Telegram/SourceFiles/history/view/history_view_scheduled_section.cpp @@ -57,7 +57,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_account.h" #include "inline_bots/inline_bot_result.h" #include "lang/lang_keys.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_window.h" #include "styles/style_info.h" @@ -992,7 +991,7 @@ void ScheduledWidget::paintEvent(QPaintEvent *e) { if (animatingShow()) { SectionWidget::paintEvent(e); return; - } else if (Ui::skipPaintEvent(this, e)) { + } else if (controller()->contentOverlapped(this, e)) { return; } //if (hasPendingResizedItems()) { diff --git a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp index e5b5b95ca..d19c3131e 100644 --- a/Telegram/SourceFiles/info/media/info_media_list_widget.cpp +++ b/Telegram/SourceFiles/info/media/info_media_list_widget.cpp @@ -46,12 +46,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "mainwindow.h" #include "base/platform/base_platform_info.h" #include "base/weak_ptr.h" +#include "base/call_delayed.h" #include "media/player/media_player_instance.h" #include "boxes/delete_messages_box.h" #include "boxes/peer_list_controllers.h" #include "core/file_utilities.h" #include "core/application.h" -#include "facades.h" #include "styles/style_overview.h" #include "styles/style_info.h" #include "styles/style_layers.h" @@ -932,7 +932,7 @@ void ListWidget::showContextMenu( item, lnkDocument); if (!filepath.isEmpty()) { - auto handler = App::LambdaDelayed( + auto handler = base::fn_delayed( st::defaultDropdownMenu.menu.ripple.hideDuration, this, [filepath] { @@ -945,7 +945,7 @@ void ListWidget::showContextMenu( std::move(handler), &st::menuIconShowInFolder); } - auto handler = App::LambdaDelayed( + auto handler = base::fn_delayed( st::defaultDropdownMenu.menu.ripple.hideDuration, this, [=] { diff --git a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp index 51f2c5ab4..b05a4f6cd 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_actions.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_actions.cpp @@ -59,7 +59,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "settings/settings_common.h" #include "apiwrap.h" #include "api/api_blocked_peers.h" -#include "facades.h" #include "styles/style_info.h" #include "styles/style_boxes.h" #include "styles/style_menu_icons.h" @@ -876,7 +875,8 @@ void ActionsFiller::addReportAction() { } void ActionsFiller::addBlockAction(not_null user) { - const auto window = &_controller->parentController()->window(); + const auto controller = _controller->parentController(); + const auto window = &controller->window(); auto text = user->session().changes().peerFlagsValue( user, @@ -905,7 +905,7 @@ void ActionsFiller::addBlockAction(not_null user) { if (user->isBlocked()) { Window::PeerMenuUnblockUserWithBotRestart(user); if (user->isBot()) { - Ui::showPeerHistory(user, ShowAtUnreadMsgId); + controller->showPeerHistory(user); } } else if (user->isBot()) { user->session().api().blockedPeers().block(user); diff --git a/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp b/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp index 7a2b22d5c..96ad691e3 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_inner.cpp @@ -22,7 +22,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "layout/layout_position.h" #include "mainwindow.h" -#include "facades.h" #include "main/main_session.h" #include "window/window_session_controller.h" #include "ui/widgets/popup_menu.h" @@ -674,7 +673,10 @@ void Inner::switchPm() { if (_inlineBot && _inlineBot->isBot()) { _inlineBot->botInfo->startToken = _switchPmStartToken; _inlineBot->botInfo->inlineReturnTo = _currentDialogsEntryState; - Ui::showPeerHistory(_inlineBot, ShowAndStartBotMsgId); + _controller->showPeerHistory( + _inlineBot, + Window::SectionShow::Way::ClearStack, + ShowAndStartBotMsgId); } } diff --git a/Telegram/SourceFiles/main/main_domain.cpp b/Telegram/SourceFiles/main/main_domain.cpp index 63363e6aa..7ddc3dfff 100644 --- a/Telegram/SourceFiles/main/main_domain.cpp +++ b/Telegram/SourceFiles/main/main_domain.cpp @@ -24,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "export/export_settings.h" #include "window/notifications_manager.h" #include "data/data_peer_values.h" // Data::AmPremiumValue. -#include "facades.h" namespace Main { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index eee3fab7d..6c2365e5b 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -109,7 +109,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_facade.h" #include "storage/storage_shared_media.h" #include "storage/storage_user_photos.h" -#include "facades.h" #include "styles/style_dialogs.h" #include "styles/style_chat.h" #include "styles/style_boxes.h" @@ -737,7 +736,7 @@ void MainWidget::searchMessages(const QString &query, Dialogs::Key inChat) { } _dialogs->searchMessages(query, inChat); if (isOneColumn()) { - Ui::showChatsList(&session()); + _controller->clearSectionStack(); } else { _dialogs->setInnerFocus(); } @@ -2642,7 +2641,7 @@ void MainWidget::searchInChat(Dialogs::Key chat) { } _dialogs->searchInChat(chat); if (isOneColumn()) { - Ui::showChatsList(&session()); + _controller->clearSectionStack(); } else { _dialogs->setInnerFocus(); } diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index ff34347e1..c94832837 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -50,7 +50,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_controller.h" // App::wnd. #include "window/window_session_controller.h" #include "window/window_media_preview.h" -#include "facades.h" #include "styles/style_dialogs.h" #include "styles/style_layers.h" #include "styles/style_window.h" @@ -556,9 +555,8 @@ void MainWindow::checkActivation() { } bool MainWindow::contentOverlapped(const QRect &globalRect) { - if (_main && _main->contentOverlapped(globalRect)) return true; - if (_layer && _layer->contentOverlapped(globalRect)) return true; - return false; + return (_main && _main->contentOverlapped(globalRect)) + || (_layer && _layer->contentOverlapped(globalRect)); } void MainWindow::setInnerFocus() { diff --git a/Telegram/SourceFiles/mainwindow.h b/Telegram/SourceFiles/mainwindow.h index 4535cfbb0..9c3547045 100644 --- a/Telegram/SourceFiles/mainwindow.h +++ b/Telegram/SourceFiles/mainwindow.h @@ -69,12 +69,15 @@ public: void sendPaths(); - bool contentOverlapped(const QRect &globalRect); - bool contentOverlapped(QWidget *w, QPaintEvent *e) { - return contentOverlapped(QRect(w->mapToGlobal(e->rect().topLeft()), e->rect().size())); + [[nodiscard]] bool contentOverlapped(const QRect &globalRect); + [[nodiscard]] bool contentOverlapped(QWidget *w, QPaintEvent *e) { + return contentOverlapped( + QRect(w->mapToGlobal(e->rect().topLeft()), e->rect().size())); } - bool contentOverlapped(QWidget *w, const QRegion &r) { - return contentOverlapped(QRect(w->mapToGlobal(r.boundingRect().topLeft()), r.boundingRect().size())); + [[nodiscard]] bool contentOverlapped(QWidget *w, const QRegion &r) { + return contentOverlapped(QRect( + w->mapToGlobal(r.boundingRect().topLeft()), + r.boundingRect().size())); } void showMainMenu(); diff --git a/Telegram/SourceFiles/media/player/media_player_float.cpp b/Telegram/SourceFiles/media/player/media_player_float.cpp index 0b8bfc976..ee20a875d 100644 --- a/Telegram/SourceFiles/media/player/media_player_float.cpp +++ b/Telegram/SourceFiles/media/player/media_player_float.cpp @@ -27,7 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_account.h" #include "ui/painter.h" #include "ui/ui_utility.h" -#include "facades.h" #include "styles/style_media_player.h" #include "styles/style_chat.h" diff --git a/Telegram/SourceFiles/media/player/media_player_widget.cpp b/Telegram/SourceFiles/media/player/media_player_widget.cpp index d44c60b8d..772577ceb 100644 --- a/Telegram/SourceFiles/media/player/media_player_widget.cpp +++ b/Telegram/SourceFiles/media/player/media_player_widget.cpp @@ -36,7 +36,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "storage/storage_account.h" #include "main/main_session.h" -#include "facades.h" namespace Media { namespace Player { diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index 1772d0eaa..ab4554f65 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -36,7 +36,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "base/platform/mac/base_utilities_mac.h" #include "ui/widgets/input_fields.h" #include "ui/ui_utility.h" -#include "facades.h" #include #include diff --git a/Telegram/SourceFiles/settings/settings_chat.cpp b/Telegram/SourceFiles/settings/settings_chat.cpp index a6bce4edd..4c0fce9b9 100644 --- a/Telegram/SourceFiles/settings/settings_chat.cpp +++ b/Telegram/SourceFiles/settings/settings_chat.cpp @@ -64,7 +64,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session_settings.h" #include "mainwidget.h" #include "mainwindow.h" -#include "facades.h" #include "styles/style_chat_helpers.h" // stickersRemove #include "styles/style_settings.h" #include "styles/style_layers.h" diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 5168f3ad8..2251c2ec5 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -57,7 +57,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "base/call_delayed.h" #include "base/platform/base_platform_info.h" -#include "facades.h" #include "styles/style_settings.h" #include "styles/style_boxes.h" #include "styles/style_info.h" @@ -571,7 +570,7 @@ void SetupHelp( result.match([&](const MTPDhelp_support &data) { auto &owner = controller->session().data(); if (const auto user = owner.processUser(data.vuser())) { - Ui::showPeerHistory(user, ShowAtUnreadMsgId); + controller->showPeerHistory(user); } }); }).fail([=] { diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index fefd47e70..f9b8e0925 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp +++ b/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -37,7 +37,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/notify/data_notify_settings.h" #include "boxes/ringtones_box.h" #include "apiwrap.h" -#include "facades.h" #include "styles/style_settings.h" #include "styles/style_boxes.h" #include "styles/style_layers.h" diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index 53d8e5974..2cb3ddbe6 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -43,7 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "boxes/peer_list_controllers.h" #include "ui/boxes/confirm_box.h" #include "settings/settings_privacy_security.h" -#include "facades.h" #include "styles/style_chat.h" #include "styles/style_boxes.h" #include "styles/style_settings.h" @@ -354,8 +353,9 @@ void BlockedBoxController::loadMoreRows() { void BlockedBoxController::rowClicked(not_null row) { const auto peer = row->peer(); - crl::on_main(&peer->session(), [=] { - Ui::showPeerHistory(peer, ShowAtUnreadMsgId); + const auto window = _window; + crl::on_main(window, [=] { + window->showPeerHistory(peer); }); } diff --git a/Telegram/SourceFiles/settings/settings_privacy_security.cpp b/Telegram/SourceFiles/settings/settings_privacy_security.cpp index f4c270808..e21bbb045 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_security.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_security.cpp @@ -57,7 +57,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "storage/storage_domain.h" #include "window/window_session_controller.h" #include "apiwrap.h" -#include "facades.h" #include "styles/style_settings.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" diff --git a/Telegram/SourceFiles/support/support_helper.cpp b/Telegram/SourceFiles/support/support_helper.cpp index 6a238c40b..95d189590 100644 --- a/Telegram/SourceFiles/support/support_helper.cpp +++ b/Telegram/SourceFiles/support/support_helper.cpp @@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/core_settings.h" #include "main/main_session.h" #include "apiwrap.h" -#include "facades.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" @@ -597,7 +596,7 @@ QString InterpretSendPath( return "App Error: Could not find channel with id: " + QString::number(peerToChannel(toId).bare); } - Ui::showPeerHistory(history, ShowAtUnreadMsgId); + window->showPeerHistory(history); const auto premium = window->session().user()->isPremium(); history->session().api().sendFiles( Storage::PrepareMediaList( diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 3187b1928..3de694b61 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -23,6 +23,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "main/main_session.h" #include "main/main_session_settings.h" +#include "base/call_delayed.h" #include "base/crc32hash.h" #include "ui/toast/toast.h" #include "ui/widgets/shadow.h" @@ -32,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "mainwindow.h" #include "mainwidget.h" // session->content()->windowShown(). -#include "facades.h" #include "tray.h" #include "styles/style_widgets.h" #include "styles/style_window.h" @@ -375,7 +375,7 @@ bool MainWindow::hideNoQuit() { || workMode == Core::Settings::WorkMode::WindowAndTray) { if (minimizeToTray()) { if (const auto controller = sessionController()) { - Ui::showChatsList(&controller->session()); + controller->clearSectionStack(); } return true; } @@ -389,7 +389,7 @@ bool MainWindow::hideNoQuit() { controller().updateIsActiveBlur(); updateGlobalMenu(); if (const auto controller = sessionController()) { - Ui::showChatsList(&controller->session()); + controller->clearSectionStack(); } return true; } diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index c9896d7b7..5029eb968 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -36,7 +36,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "main/main_domain.h" #include "ui/text/text_utilities.h" -#include "facades.h" #include diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index d2ac7f26e..67f03b7c3 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -35,7 +35,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/view/history_view_item_preview.h" #include "base/platform/base_platform_last_input.h" #include "base/call_delayed.h" -#include "facades.h" #include "styles/style_dialogs.h" #include "styles/style_layers.h" #include "styles/style_window.h" diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index 8ae9e1b38..38a8507cf 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -143,7 +143,9 @@ void SectionWidget::setGeometryWithTopMoved( void SectionWidget::showAnimated( SlideDirection direction, const SectionSlideParams ¶ms) { - if (_showAnimation) return; + if (_showAnimation) { + return; + } showChildren(); auto myContentCache = grabForShowAnimation(params); diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index 961e1ddd8..1d366233d 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/application.h" #include "boxes/edit_color_box.h" #include "lang/lang_keys.h" -#include "facades.h" #include "styles/style_window.h" #include "styles/style_dialogs.h" #include "styles/style_layers.h" @@ -675,7 +674,7 @@ Editor::Editor( _inner = _scroll->setOwnedWidget(object_ptr(this, path)); - _save->setClickedCallback(App::LambdaDelayed( + _save->setClickedCallback(base::fn_delayed( st::defaultRippleAnimation.hideDuration, this, [=] { save(); })); diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index d746dcd9b..bf995cc77 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -33,7 +33,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_peer.h" #include "mainwindow.h" #include "apiwrap.h" // ApiWrap::acceptTerms. -#include "facades.h" #include "styles/style_layers.h" #include diff --git a/Telegram/SourceFiles/window/window_lock_widgets.cpp b/Telegram/SourceFiles/window/window_lock_widgets.cpp index 5cff225b7..c58c05127 100644 --- a/Telegram/SourceFiles/window/window_lock_widgets.cpp +++ b/Telegram/SourceFiles/window/window_lock_widgets.cpp @@ -23,7 +23,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "window/window_slide_animation.h" #include "window/window_session_controller.h" #include "main/main_domain.h" -#include "facades.h" #include "styles/style_layers.h" #include "styles/style_boxes.h" @@ -77,7 +76,7 @@ void LockWidget::showFinished() { showChildren(); _window->widget()->setInnerFocus(); if (const auto controller = _window->sessionController()) { - Ui::showChatsList(&controller->session()); + controller->clearSectionStack(); } _cacheUnder = _cacheOver = QPixmap(); } diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index b46541a3d..73a87af23 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -79,7 +79,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "api/api_blocked_peers.h" #include "support/support_helper.h" #include "storage/file_upload.h" -#include "facades.h" #include "window/themes/window_theme.h" #include "window/window_peer_menu.h" #include "settings/settings_main.h" @@ -1124,7 +1123,10 @@ bool SessionController::chatEntryHistoryMove(int steps) { bool SessionController::jumpToChatListEntry(Dialogs::RowDescriptor row) { if (const auto history = row.key.history()) { - Ui::showPeerHistory(history, row.fullId.msg); + showPeerHistory( + history, + SectionShow::Way::ClearStack, + row.fullId.msg); return true; } return false; @@ -2153,6 +2155,10 @@ QString SessionController::premiumRef() const { return _premiumRef; } +bool SessionController::contentOverlapped(QWidget *w, QPaintEvent *e) { + return widget()->contentOverlapped(w, e); +} + SessionController::~SessionController() { resetFakeUnreadWhileOpened(); } diff --git a/Telegram/SourceFiles/window/window_session_controller.h b/Telegram/SourceFiles/window/window_session_controller.h index fb9dcced1..71dea7fef 100644 --- a/Telegram/SourceFiles/window/window_session_controller.h +++ b/Telegram/SourceFiles/window/window_session_controller.h @@ -554,7 +554,9 @@ public: void setPremiumRef(const QString &ref); [[nodiscard]] QString premiumRef() const; - rpl::lifetime &lifetime() { + [[nodiscard]] bool contentOverlapped(QWidget *w, QPaintEvent *e); + + [[nodiscard]] rpl::lifetime &lifetime() { return _lifetime; } diff --git a/Telegram/lib_base b/Telegram/lib_base index 2f3c34c39..71959afea 160000 --- a/Telegram/lib_base +++ b/Telegram/lib_base @@ -1 +1 @@ -Subproject commit 2f3c34c397f6c6f03c676ba6782db5f50fdfbd59 +Subproject commit 71959afeaf0370ec994293ecb1907cdbd015ccd8