Removed Adaptive namespace from sections.

This commit is contained in:
23rd 2021-05-27 00:04:18 +03:00
parent 019fd83c8a
commit 7cf79e1f8a
6 changed files with 55 additions and 34 deletions

View File

@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "mainwindow.h"
#include "apiwrap.h"
#include "window/themes/window_theme.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "boxes/confirm_box.h"
#include "base/timer.h"
@ -295,8 +296,14 @@ Widget::Widget(
_fixedBar->show();
_fixedBarShadow->raise();
updateAdaptiveLayout();
subscribe(Adaptive::Changed(), [this] { updateAdaptiveLayout(); });
rpl::single(
rpl::empty_value()
) | rpl::then(
controller->adaptive().changed()
) | rpl::start_with_next([=] {
updateAdaptiveLayout();
}, lifetime());
_inner = _scroll->setOwnedWidget(object_ptr<InnerWidget>(this, controller, channel));
_inner->showSearchSignal(
@ -334,7 +341,11 @@ void Widget::showFilter() {
}
void Widget::updateAdaptiveLayout() {
_fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height());
_fixedBarShadow->moveToLeft(
controller()->adaptive().isOneColumn()
? 0
: st::lineWidth,
_fixedBar->height());
}
not_null<ChannelData*> Widget::channel() const {

View File

@ -30,7 +30,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/stickers/data_stickers.h"
#include "data/data_web_page.h"
#include "storage/storage_account.h"
#include "facades.h"
#include "apiwrap.h"
#include "boxes/confirm_box.h"
#include "history/history.h"
@ -52,6 +51,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/controls/emoji_button.h"
#include "ui/controls/send_button.h"
#include "ui/special_buttons.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "mainwindow.h"
@ -1919,7 +1919,8 @@ void ComposeControls::toggleTabbedSelectorMode() {
return;
}
if (_tabbedPanel) {
if (_window->canShowThirdSection() && !Adaptive::OneColumn()) {
if (_window->canShowThirdSection()
&& !_window->adaptive().isOneColumn()) {
Core::App().settings().setTabbedSelectorSectionEnabled(true);
Core::App().saveSettingsDelayed();
pushTabbedSelectorToThirdSection(

View File

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "core/click_handler_types.h"
#include "apiwrap.h"
#include "layout.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "window/window_peer_menu.h"
#include "main/main_session.h"
@ -2504,7 +2505,7 @@ std::unique_ptr<QMimeData> ListWidget::prepareDrag() {
if (!urls.isEmpty()) {
mimeData->setUrls(urls);
}
if (uponSelected && !Adaptive::OneColumn()) {
if (uponSelected && !_controller->adaptive().isOneColumn()) {
const auto canForwardAll = [&] {
for (const auto &[itemId, data] : _selected) {
if (!data.canForward) {

View File

@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/toasts/common_toasts.h"
#include "base/timer_rpl.h"
#include "apiwrap.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "window/window_peer_menu.h"
#include "base/event_filter.h"
@ -127,8 +128,13 @@ PinnedWidget::PinnedWidget(
}, _topBar->lifetime());
_topBarShadow->raise();
updateAdaptiveLayout();
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
rpl::single(
rpl::empty_value()
) | rpl::then(
controller->adaptive().changed()
) | rpl::start_with_next([=] {
updateAdaptiveLayout();
}, lifetime());
_inner = _scroll->setOwnedWidget(object_ptr<ListWidget>(
this,
@ -297,7 +303,7 @@ void PinnedWidget::scrollDownAnimationFinish() {
void PinnedWidget::updateAdaptiveLayout() {
_topBarShadow->moveToLeft(
Adaptive::OneColumn() ? 0 : st::lineWidth,
controller()->adaptive().isOneColumn() ? 0 : st::lineWidth,
_topBar->height());
}
@ -387,12 +393,9 @@ void PinnedWidget::resizeEvent(QResizeEvent *e) {
void PinnedWidget::recountChatWidth() {
auto layout = (width() < st::adaptiveChatWideWidth)
? Adaptive::ChatLayout::Normal
: Adaptive::ChatLayout::Wide;
if (layout != Global::AdaptiveChatLayout()) {
Global::SetAdaptiveChatLayout(layout);
Adaptive::Changed().notify(true);
}
? Window::AdaptiveModern::ChatLayout::Normal
: Window::AdaptiveModern::ChatLayout::Wide;
controller()->adaptive().setChatLayout(layout);
}
void PinnedWidget::setMessagesCount(int count) {

View File

@ -39,6 +39,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_box.h"
#include "boxes/edit_caption_box.h"
#include "boxes/send_files_box.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "window/window_peer_menu.h"
#include "base/event_filter.h"
@ -191,8 +192,14 @@ RepliesWidget::RepliesWidget(
_rootView->raise();
_topBarShadow->raise();
updateAdaptiveLayout();
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
rpl::single(
rpl::empty_value()
) | rpl::then(
controller->adaptive().changed()
) | rpl::start_with_next([=] {
updateAdaptiveLayout();
}, lifetime());
_inner = _scroll->setOwnedWidget(object_ptr<ListWidget>(
this,
@ -327,13 +334,8 @@ void RepliesWidget::setupRootView() {
});
_rootView = std::make_unique<Ui::PinnedBar>(this, std::move(content));
rpl::single(
rpl::empty_value()
) | rpl::then(
base::ObservableViewer(Adaptive::Changed())
) | rpl::map([] {
return Adaptive::OneColumn();
}) | rpl::start_with_next([=](bool one) {
controller()->adaptive().oneColumnValue(
) | rpl::start_with_next([=](bool one) {
_rootView->setShadowGeometryPostprocess([=](QRect geometry) {
if (!one) {
geometry.setLeft(geometry.left() + st::lineWidth);
@ -1284,7 +1286,7 @@ void RepliesWidget::scrollDownAnimationFinish() {
void RepliesWidget::updateAdaptiveLayout() {
_topBarShadow->moveToLeft(
Adaptive::OneColumn() ? 0 : st::lineWidth,
controller()->adaptive().isOneColumn() ? 0 : st::lineWidth,
_topBar->height());
}
@ -1462,12 +1464,9 @@ void RepliesWidget::resizeEvent(QResizeEvent *e) {
void RepliesWidget::recountChatWidth() {
auto layout = (width() < st::adaptiveChatWideWidth)
? Adaptive::ChatLayout::Normal
: Adaptive::ChatLayout::Wide;
if (layout != Global::AdaptiveChatLayout()) {
Global::SetAdaptiveChatLayout(layout);
Adaptive::Changed().notify(true);
}
? Window::AdaptiveModern::ChatLayout::Normal
: Window::AdaptiveModern::ChatLayout::Wide;
controller()->adaptive().setChatLayout(layout);
}
void RepliesWidget::updateControlsGeometry() {

View File

@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/confirm_box.h"
#include "boxes/edit_caption_box.h"
#include "boxes/send_files_box.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h"
#include "window/window_peer_menu.h"
#include "base/event_filter.h"
@ -125,8 +126,13 @@ ScheduledWidget::ScheduledWidget(
}, _topBar->lifetime());
_topBarShadow->raise();
updateAdaptiveLayout();
subscribe(Adaptive::Changed(), [=] { updateAdaptiveLayout(); });
rpl::single(
rpl::empty_value()
) | rpl::then(
controller->adaptive().changed()
) | rpl::start_with_next([=] {
updateAdaptiveLayout();
}, lifetime());
_inner = _scroll->setOwnedWidget(object_ptr<ListWidget>(
this,
@ -855,7 +861,7 @@ void ScheduledWidget::scrollDownAnimationFinish() {
void ScheduledWidget::updateAdaptiveLayout() {
_topBarShadow->moveToLeft(
Adaptive::OneColumn() ? 0 : st::lineWidth,
controller()->adaptive().isOneColumn() ? 0 : st::lineWidth,
_topBar->height());
}