Remove facades module.

This commit is contained in:
John Preston 2022-11-30 16:55:51 +04:00
parent eaed91263e
commit 01139e1b04
51 changed files with 93 additions and 229 deletions

View File

@ -1344,8 +1344,6 @@ PRIVATE
apiwrap.cpp
apiwrap.h
config.h
facades.cpp
facades.h
logs.cpp
logs.h
main.cpp

View File

@ -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 {

View File

@ -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();

View File

@ -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<PeerListRow> ContactsBoxController::createSearchRow(
}
void ContactsBoxController::rowClicked(not_null<PeerListRow*> 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) {

View File

@ -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);
}
}

View File

@ -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();

View File

@ -1236,10 +1236,7 @@ void Application::closeChatFromWindows(not_null<PeerData*> 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) {

View File

@ -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 {

View File

@ -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"

View File

@ -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 {

View File

@ -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 {

View File

@ -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();

View File

@ -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;
}

View File

@ -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<Main::Session*> session) {
if (const auto window = session->tryResolveWindow()) {
window->clearSectionStack();
}
}
void showPeerHistory(not_null<History*> history, MsgId msgId) {
if (const auto window = history->session().tryResolveWindow()) {
window->showPeerHistory(
history,
::Window::SectionShow::Way::ClearStack,
msgId);
}
}
void showPeerHistory(not_null<PeerData*> 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

View File

@ -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 <typename Guard, typename Lambda>
[[nodiscard]] inline auto LambdaDelayed(int duration, Guard &&object, Lambda &&lambda) {
auto guarded = crl::guard(
std::forward<Guard>(object),
std::forward<Lambda>(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<PeerData*> peer, MsgId msgId);
void showPeerHistory(not_null<History*> history, MsgId msgId);
void showChatsList(not_null<Main::Session*> session);
bool skipPaintEvent(QWidget *widget, QPaintEvent *event);
} // namespace Ui

View File

@ -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);
}

View File

@ -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<LambdaClickHandler>([=] {
Ui::showPeerHistory(now, ShowAtUnreadMsgId);
if (const auto window = now->session().tryResolveWindow()) {
window->showPeerHistory(now);
}
});
auto message = HistoryService::PreparedText{ text };
message.links.push_back(fromLink);

View File

@ -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()) {

View File

@ -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);
}

View File

@ -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()) {

View File

@ -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),

View File

@ -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 <QtWidgets/QApplication>
@ -2015,7 +2014,7 @@ void ListWidget::checkActivation() {
}
void ListWidget::paintEvent(QPaintEvent *e) {
if (Ui::skipPaintEvent(this, e)) {
if (_controller->contentOverlapped(this, e)) {
return;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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()) {

View File

@ -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,
[=] {

View File

@ -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<UserData*> 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<UserData*> 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);

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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();
}

View File

@ -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() {

View File

@ -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();

View File

@ -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"

View File

@ -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 {

View File

@ -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 <QtWidgets/QApplication>
#include <QtGui/QClipboard>

View File

@ -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"

View File

@ -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([=] {

View File

@ -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"

View File

@ -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<PeerListRow*> 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);
});
}

View File

@ -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"

View File

@ -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(

View File

@ -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;
}

View File

@ -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 <QtGui/QWindow>

View File

@ -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"

View File

@ -143,7 +143,9 @@ void SectionWidget::setGeometryWithTopMoved(
void SectionWidget::showAnimated(
SlideDirection direction,
const SectionSlideParams &params) {
if (_showAnimation) return;
if (_showAnimation) {
return;
}
showChildren();
auto myContentCache = grabForShowAnimation(params);

View File

@ -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<Inner>(this, path));
_save->setClickedCallback(App::LambdaDelayed(
_save->setClickedCallback(base::fn_delayed(
st::defaultRippleAnimation.hideDuration,
this,
[=] { save(); }));

View File

@ -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 <QtGui/QWindow>

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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;
}

@ -1 +1 @@
Subproject commit 2f3c34c397f6c6f03c676ba6782db5f50fdfbd59
Subproject commit 71959afeaf0370ec994293ecb1907cdbd015ccd8