Removed Adaptive namespace from Dialogs::Widget.

This commit is contained in:
23rd 2021-05-27 00:00:12 +03:00
parent 65779ec37e
commit 019fd83c8a
1 changed files with 13 additions and 7 deletions

View File

@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/update_checker.h" #include "core/update_checker.h"
#include "boxes/peer_list_box.h" #include "boxes/peer_list_box.h"
#include "boxes/peers/edit_participants_box.h" #include "boxes/peers/edit_participants_box.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "window/window_slide_animation.h" #include "window/window_slide_animation.h"
#include "window/window_connecting_widget.h" #include "window/window_connecting_widget.h"
@ -265,7 +266,10 @@ Widget::Widget(
}, lifetime()); }, lifetime());
} }
subscribe(Adaptive::Changed(), [this] { updateForwardBar(); }); controller->adaptive().changed(
) | rpl::start_with_next([=] {
updateForwardBar();
}, lifetime());
_cancelSearch->setClickedCallback([this] { onCancelSearch(); }); _cancelSearch->setClickedCallback([this] { onCancelSearch(); });
_jumpToDate->entity()->setClickedCallback([this] { showJumpToDate(); }); _jumpToDate->entity()->setClickedCallback([this] { showJumpToDate(); });
@ -414,7 +418,7 @@ void Widget::setupConnectingWidget() {
_connecting = std::make_unique<Window::ConnectionState>( _connecting = std::make_unique<Window::ConnectionState>(
this, this,
&session().account(), &session().account(),
Window::AdaptiveIsOneColumn()); controller()->adaptive().oneColumnValue());
} }
void Widget::setupSupportMode() { void Widget::setupSupportMode() {
@ -1277,7 +1281,7 @@ void Widget::dragEnterEvent(QDragEnterEvent *e) {
const auto data = e->mimeData(); const auto data = e->mimeData();
_dragInScroll = false; _dragInScroll = false;
_dragForward = Adaptive::OneColumn() _dragForward = controller()->adaptive().isOneColumn()
? false ? false
: data->hasFormat(qsl("application/x-td-forward")); : data->hasFormat(qsl("application/x-td-forward"));
if (_dragForward) { if (_dragForward) {
@ -1630,7 +1634,8 @@ rpl::producer<> Widget::closeForwardBarRequests() const {
void Widget::updateForwardBar() { void Widget::updateForwardBar() {
auto selecting = controller()->selectingPeer(); auto selecting = controller()->selectingPeer();
auto oneColumnSelecting = (Adaptive::OneColumn() && selecting); auto oneColumnSelecting = (controller()->adaptive().isOneColumn()
&& selecting);
if (!oneColumnSelecting == !_forwardCancel) { if (!oneColumnSelecting == !_forwardCancel) {
return; return;
} }
@ -1750,7 +1755,7 @@ bool Widget::onCancelSearch() {
bool clearing = !_filter->getLastText().isEmpty(); bool clearing = !_filter->getLastText().isEmpty();
cancelSearchRequest(); cancelSearchRequest();
if (_searchInChat && !clearing) { if (_searchInChat && !clearing) {
if (Adaptive::OneColumn()) { if (controller()->adaptive().isOneColumn()) {
if (const auto peer = _searchInChat.peer()) { if (const auto peer = _searchInChat.peer()) {
Ui::showPeerHistory(peer, ShowAtUnreadMsgId); Ui::showPeerHistory(peer, ShowAtUnreadMsgId);
} else { } else {
@ -1769,8 +1774,9 @@ bool Widget::onCancelSearch() {
void Widget::onCancelSearchInChat() { void Widget::onCancelSearchInChat() {
cancelSearchRequest(); cancelSearchRequest();
const auto isOneColumn = controller()->adaptive().isOneColumn();
if (_searchInChat) { if (_searchInChat) {
if (Adaptive::OneColumn() if (isOneColumn
&& !controller()->selectingPeer() && !controller()->selectingPeer()
&& _filter->getLastText().trimmed().isEmpty()) { && _filter->getLastText().trimmed().isEmpty()) {
if (const auto peer = _searchInChat.peer()) { if (const auto peer = _searchInChat.peer()) {
@ -1782,7 +1788,7 @@ void Widget::onCancelSearchInChat() {
setSearchInChat(Key()); setSearchInChat(Key());
} }
applyFilterUpdate(true); applyFilterUpdate(true);
if (!Adaptive::OneColumn() && !controller()->selectingPeer()) { if (!isOneColumn && !controller()->selectingPeer()) {
cancelled(); cancelled();
} }
} }