Removed Adaptive namespace from Window::HistoryHider.

This commit is contained in:
23rd 2021-05-27 00:54:39 +03:00
parent 9b488f03a1
commit bf7f117323
3 changed files with 20 additions and 8 deletions

View file

@ -724,14 +724,16 @@ void MainWidget::showForwardLayer(MessageIdsList &&items) {
hiderLayer(base::make_unique_q<Window::HistoryHider>(
this,
tr::lng_forward_choose(tr::now),
std::move(callback)));
std::move(callback),
_controller->adaptive().oneColumnValue()));
}
void MainWidget::showSendPathsLayer() {
hiderLayer(base::make_unique_q<Window::HistoryHider>(
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<Window::HistoryHider>(
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<Window::HistoryHider>(
this,
tr::lng_inline_switch_choose(tr::now),
std::move(callback)));
std::move(callback),
_controller->adaptive().oneColumnValue()));
}
bool MainWidget::selectingPeer() const {

View file

@ -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<bool(PeerId)> confirm)
Fn<bool(PeerId)> confirm,
rpl::producer<bool> 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);

View file

@ -33,7 +33,8 @@ public:
HistoryHider(
QWidget *parent,
const QString &text,
Fn<bool(PeerId)> confirm);
Fn<bool(PeerId)> confirm,
rpl::producer<bool> oneColumnValue);
void offerPeer(PeerId peer);
@ -61,6 +62,7 @@ private:
QRect _box;
bool _hiding = false;
bool _isOneColumn = false;
int _chooseWidth = 0;