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() { bool isLayerShown() {
if (auto w = App::wnd()) return w->ui_isLayerShown(); if (auto w = App::wnd()) return w->ui_isLayerShown();
return false; return false;

View file

@ -47,7 +47,6 @@ QPointer<BoxType> show(
} }
void hideLayer(anim::type animated = anim::type::normal); void hideLayer(anim::type animated = anim::type::normal);
void hideSettingsAndLayer(anim::type animated = anim::type::normal);
bool isLayerShown(); bool isLayerShown();
} // namespace Ui } // 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_participants_box.h"
#include "boxes/peers/edit_peer_info_box.h" #include "boxes/peers/edit_peer_info_box.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "window/window_controller.h"
#include "main/main_session.h" #include "main/main_session.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "apiwrap.h" #include "apiwrap.h"
@ -329,8 +330,12 @@ Fn<void()> AboutGigagroupCallback(
channel->inputChannel channel->inputChannel
)).done([=](const MTPUpdates &result) { )).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result); channel->session().api().applyUpdates(result);
Ui::hideSettingsAndLayer(); if (const auto strongController = weak.get()) {
Ui::Toast::Show(tr::lng_gigagroup_done(tr::now)); strongController->window().hideSettingsAndLayer();
Ui::Toast::Show(
strongController->widget(),
tr::lng_gigagroup_done(tr::now));
}
}).fail([=] { }).fail([=] {
*converting = false; *converting = false;
}).send(); }).send();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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