Removed Ui::hideSettingsAndLayer().

This commit is contained in:
23rd 2022-02-20 14:00:36 +03:00
parent bc6d69319c
commit 3ebb9af8f8
12 changed files with 30 additions and 24 deletions

View file

@ -33,12 +33,6 @@ void hideLayer(anim::type animated) {
}
}
void hideSettingsAndLayer(anim::type animated) {
if (auto w = App::wnd()) {
w->ui_hideSettingsAndLayer(animated);
}
}
bool isLayerShown() {
if (auto w = App::wnd()) return w->ui_isLayerShown();
return false;

View file

@ -47,7 +47,6 @@ QPointer<BoxType> show(
}
void hideLayer(anim::type animated = anim::type::normal);
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
bool isLayerShown();
} // namespace Ui

View file

@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/peers/edit_participants_box.h"
#include "boxes/peers/edit_peer_info_box.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "main/main_session.h"
#include "mainwindow.h"
#include "apiwrap.h"
@ -329,8 +330,12 @@ Fn<void()> AboutGigagroupCallback(
channel->inputChannel
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);
Ui::hideSettingsAndLayer();
Ui::Toast::Show(tr::lng_gigagroup_done(tr::now));
if (const auto strongController = weak.get()) {
strongController->window().hideSettingsAndLayer();
Ui::Toast::Show(
strongController->widget(),
tr::lng_gigagroup_done(tr::now));
}
}).fail([=] {
*converting = false;
}).send();

View file

@ -34,6 +34,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/stickers_lottie.h"
#include "media/clip/media_clip_reader.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "base/unixtime.h"
#include "main/main_session.h"
#include "apiwrap.h"
@ -669,7 +670,7 @@ void StickerSetBox::Inner::send(
const auto controller = _controller;
Ui::PostponeCall(controller, [=] {
if (controller->content()->sendExistingDocument(sticker, options)) {
Ui::hideSettingsAndLayer();
controller->window().hideSettingsAndLayer();
}
});
}

View file

@ -3102,7 +3102,7 @@ void InnerWidget::setupShortcuts() {
Data::Folder::kId);
if (folder && !folder->chatsList()->empty()) {
_controller->openFolder(folder);
Ui::hideSettingsAndLayer();
_controller->window().hideSettingsAndLayer();
return true;
}
return false;

View file

@ -1372,7 +1372,7 @@ void MainWidget::ui_showPeerHistory(
const auto wasActivePeer = _controller->activeChatCurrent().peer();
if (params.activation != anim::activation::background) {
Ui::hideSettingsAndLayer();
controller()->window().hideSettingsAndLayer();
}
if (_hider) {
_hider->startHide();
@ -1649,7 +1649,7 @@ void MainWidget::showNewSection(
}
if (params.activation != anim::activation::background) {
Ui::hideSettingsAndLayer();
controller()->window().hideSettingsAndLayer();
}
_controller->dialogsListFocused().set(false, true);

View file

@ -242,7 +242,7 @@ void MainWindow::setupPasscodeLock() {
updateControlsGeometry();
Core::App().hideMediaView();
Ui::hideSettingsAndLayer(anim::type::instant);
ui_hideSettingsAndLayer(anim::type::instant);
if (_main) {
_main->hide();
}
@ -841,7 +841,7 @@ void MainWindow::sendPaths() {
return;
}
Core::App().hideMediaView();
Ui::hideSettingsAndLayer(anim::type::instant);
ui_hideSettingsAndLayer(anim::type::instant);
if (_main) {
_main->activate();
}

View file

@ -827,7 +827,7 @@ void SetupExport(
st::settingsButtonNoIcon
)->addClickHandler([=] {
const auto session = &controller->session();
Ui::hideSettingsAndLayer();
controller->window().hideSettingsAndLayer();
base::call_delayed(
st::boxDuration,
session,

View file

@ -190,7 +190,7 @@ private:
void setInnerWidget(object_ptr<Ui::RpWidget> content);
void showContent(not_null<Window::Controller*> window);
rpl::producer<bool> topShadowToggledValue() const;
void createTopBar();
void createTopBar(not_null<Window::Controller*> window);
void applyAdditionalScroll(int additionalScroll);
rpl::variable<int> _scrollTopSkip = -1;
@ -226,7 +226,7 @@ IntroWidget::IntroWidget(
updateControlsGeometry();
}, lifetime());
createTopBar();
createTopBar(window);
showContent(window);
_topShadow->toggleOn(
topShadowToggledValue(
@ -273,15 +273,15 @@ void IntroWidget::forceContentRepaint() {
}
}
void IntroWidget::createTopBar() {
void IntroWidget::createTopBar(not_null<Window::Controller*> window) {
_topBar.create(this, st::infoLayerTopBar);
_topBar->setTitle(tr::lng_menu_settings());
auto close = _topBar->addButton(
base::make_unique_q<Ui::IconButton>(
_topBar,
st::infoLayerTopBarClose));
close->addClickHandler([] {
Ui::hideSettingsAndLayer();
close->addClickHandler([=] {
window->hideSettingsAndLayer();
});
_topBar->lower();

View file

@ -165,7 +165,7 @@ void Controller::checkLockByTerms() {
}
return;
}
Ui::hideSettingsAndLayer(anim::type::instant);
hideSettingsAndLayer(anim::type::instant);
const auto box = show(Box<TermsBox>(
*data,
tr::lng_terms_agree(),
@ -327,6 +327,10 @@ void Controller::showRightColumn(object_ptr<TWidget> widget) {
_widget.showRightColumn(std::move(widget));
}
void Controller::hideSettingsAndLayer(anim::type animated) {
_widget.ui_hideSettingsAndLayer(animated);
}
void Controller::sideBarChanged() {
_widget.recountGeometryConstraints();
}

View file

@ -83,6 +83,8 @@ public:
void showRightColumn(object_ptr<TWidget> widget);
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
void activate();
void reActivate();
void updateIsActiveFocus();

View file

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "window/themes/window_theme.h"
#include "window/window_peer_menu.h"
#include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "ui/chat/chat_theme.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/labels.h"
@ -666,7 +667,7 @@ void MainMenu::setupArchive() {
const auto showArchive = [=] {
if (const auto f = folder()) {
controller->openFolder(f);
Ui::hideSettingsAndLayer();
controller->window().hideSettingsAndLayer();
}
};
const auto checkArchive = [=] {
@ -716,7 +717,7 @@ void MainMenu::setupArchive() {
const auto hide = [=] {
controller->session().settings().setArchiveInMainMenu(false);
controller->session().saveSettingsDelayed();
Ui::hideSettingsAndLayer();
controller->window().hideSettingsAndLayer();
};
addAction(
tr::lng_context_archive_to_list(tr::now),