diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index f6b6c9e5c..8edbfd39b 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -724,14 +724,16 @@ void MainWidget::showForwardLayer(MessageIdsList &&items) { hiderLayer(base::make_unique_q( this, tr::lng_forward_choose(tr::now), - std::move(callback))); + std::move(callback), + _controller->adaptive().oneColumnValue())); } void MainWidget::showSendPathsLayer() { hiderLayer(base::make_unique_q( this, tr::lng_forward_choose(tr::now), - [=](PeerId peer) { return sendPaths(peer); })); + [=](PeerId peer) { return sendPaths(peer); }, + _controller->adaptive().oneColumnValue())); if (_hider) { connect(_hider, &QObject::destroyed, [] { cSetSendPaths(QStringList()); @@ -788,7 +790,8 @@ void MainWidget::shareUrlLayer(const QString &url, const QString &text) { hiderLayer(base::make_unique_q( this, tr::lng_forward_choose(tr::now), - std::move(callback))); + std::move(callback), + _controller->adaptive().oneColumnValue())); } void MainWidget::inlineSwitchLayer(const QString &botAndQuery) { @@ -798,7 +801,8 @@ void MainWidget::inlineSwitchLayer(const QString &botAndQuery) { hiderLayer(base::make_unique_q( this, tr::lng_inline_switch_choose(tr::now), - std::move(callback))); + std::move(callback), + _controller->adaptive().oneColumnValue())); } bool MainWidget::selectingPeer() const { diff --git a/Telegram/SourceFiles/window/window_history_hider.cpp b/Telegram/SourceFiles/window/window_history_hider.cpp index d8faefbfb..d8fcf4c92 100644 --- a/Telegram/SourceFiles/window/window_history_hider.cpp +++ b/Telegram/SourceFiles/window/window_history_hider.cpp @@ -12,7 +12,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/widgets/shadow.h" #include "ui/cached_round_corners.h" #include "mainwidget.h" -#include "facades.h" #include "styles/style_layers.h" #include "styles/style_chat.h" @@ -21,7 +20,8 @@ namespace Window { HistoryHider::HistoryHider( QWidget *parent, const QString &text, - Fn confirm) + Fn confirm, + rpl::producer oneColumnValue) : RpWidget(parent) , _text(text) , _confirm(std::move(confirm)) { @@ -34,6 +34,12 @@ HistoryHider::HistoryHider( resizeEvent(0); _a_opacity.start([this] { update(); }, 0., 1., st::boxDuration); + + std::move( + oneColumnValue + ) | rpl::start_with_next([=](bool oneColumn) { + _isOneColumn = oneColumn; + }, lifetime()); } void HistoryHider::refreshLang() { @@ -79,7 +85,7 @@ void HistoryHider::startHide() { if (_hiding) return; _hiding = true; - if (Adaptive::OneColumn()) { + if (_isOneColumn) { crl::on_main(this, [=] { _hidden.fire({}); }); } else { _a_opacity.start([=] { animationCallback(); }, 1., 0., st::boxDuration); diff --git a/Telegram/SourceFiles/window/window_history_hider.h b/Telegram/SourceFiles/window/window_history_hider.h index 19b2bcb88..74d37d216 100644 --- a/Telegram/SourceFiles/window/window_history_hider.h +++ b/Telegram/SourceFiles/window/window_history_hider.h @@ -33,7 +33,8 @@ public: HistoryHider( QWidget *parent, const QString &text, - Fn confirm); + Fn confirm, + rpl::producer oneColumnValue); void offerPeer(PeerId peer); @@ -61,6 +62,7 @@ private: QRect _box; bool _hiding = false; + bool _isOneColumn = false; int _chooseWidth = 0;