Removed Adaptive namespace from HistoryWidget.

This commit is contained in:
23rd 2021-05-27 00:06:39 +03:00
parent 7cf79e1f8a
commit 1af8e89eb9
2 changed files with 24 additions and 27 deletions

View file

@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/ui_utility.h" #include "ui/ui_utility.h"
#include "ui/cached_round_corners.h" #include "ui/cached_round_corners.h"
#include "ui/inactive_press.h" #include "ui/inactive_press.h"
#include "window/window_adaptive.h"
#include "window/window_session_controller.h" #include "window/window_session_controller.h"
#include "window/window_peer_menu.h" #include "window/window_peer_menu.h"
#include "window/window_controller.h" #include "window/window_controller.h"
@ -1210,7 +1211,7 @@ std::unique_ptr<QMimeData> HistoryInner::prepareDrag() {
_widget->noSelectingScroll(); _widget->noSelectingScroll();
if (!urls.isEmpty()) mimeData->setUrls(urls); if (!urls.isEmpty()) mimeData->setUrls(urls);
if (uponSelected && !Adaptive::OneColumn()) { if (uponSelected && !_controller->adaptive().isOneColumn()) {
auto selectedState = getSelectionState(); auto selectedState = getSelectionState();
if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) { if (selectedState.count > 0 && selectedState.count == selectedState.canForwardCount) {
session().data().setMimeForwardIds(getSelectedItems()); session().data().setMimeForwardIds(getSelectedItems());

View file

@ -113,6 +113,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "main/main_session_settings.h" #include "main/main_session_settings.h"
#include "window/themes/window_theme.h" #include "window/themes/window_theme.h"
#include "window/notifications_manager.h" #include "window/notifications_manager.h"
#include "window/window_adaptive.h"
#include "window/window_controller.h" #include "window/window_controller.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"
@ -412,7 +413,8 @@ HistoryWidget::HistoryWidget(
Window::ActivateWindow(controller); Window::ActivateWindow(controller);
}); });
subscribe(Adaptive::Changed(), [=] { controller->adaptive().changed(
) | rpl::start_with_next([=] {
if (_history) { if (_history) {
_history->forceFullResize(); _history->forceFullResize();
if (_migrated) { if (_migrated) {
@ -421,7 +423,7 @@ HistoryWidget::HistoryWidget(
updateHistoryGeometry(); updateHistoryGeometry();
update(); update();
} }
}); }, lifetime());
session().data().unreadItemAdded( session().data().unreadItemAdded(
) | rpl::start_with_next([=](not_null<HistoryItem*> item) { ) | rpl::start_with_next([=](not_null<HistoryItem*> item) {
@ -4068,7 +4070,8 @@ void HistoryWidget::toggleTabbedSelectorMode() {
return; return;
} }
if (_tabbedPanel) { if (_tabbedPanel) {
if (controller()->canShowThirdSection() && !Adaptive::OneColumn()) { if (controller()->canShowThirdSection()
&& !controller()->adaptive().isOneColumn()) {
Core::App().settings().setTabbedSelectorSectionEnabled(true); Core::App().settings().setTabbedSelectorSectionEnabled(true);
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
pushTabbedSelectorToThirdSection( pushTabbedSelectorToThirdSection(
@ -4083,13 +4086,10 @@ void HistoryWidget::toggleTabbedSelectorMode() {
} }
void HistoryWidget::recountChatWidth() { void HistoryWidget::recountChatWidth() {
auto layout = (width() < st::adaptiveChatWideWidth) const auto layout = (width() < st::adaptiveChatWideWidth)
? Adaptive::ChatLayout::Normal ? Window::AdaptiveModern::ChatLayout::Normal
: Adaptive::ChatLayout::Wide; : Window::AdaptiveModern::ChatLayout::Wide;
if (layout != Global::AdaptiveChatLayout()) { controller()->adaptive().setChatLayout(layout);
Global::SetAdaptiveChatLayout(layout);
Adaptive::Changed().notify(true);
}
} }
void HistoryWidget::moveFieldControls() { void HistoryWidget::moveFieldControls() {
@ -4639,8 +4639,14 @@ void HistoryWidget::updateControlsGeometry() {
_membersDropdown->setMaxHeight(countMembersDropdownHeightMax()); _membersDropdown->setMaxHeight(countMembersDropdownHeightMax());
} }
auto topShadowLeft = (Adaptive::OneColumn() || _inGrab) ? 0 : st::lineWidth; const auto isOneColumn = controller()->adaptive().isOneColumn();
auto topShadowRight = (Adaptive::ThreeColumn() && !_inGrab && _peer) ? st::lineWidth : 0; const auto isThreeColumn = controller()->adaptive().isThreeColumn();
const auto topShadowLeft = (isOneColumn || _inGrab)
? 0
: st::lineWidth;
const auto topShadowRight = (isThreeColumn && !_inGrab && _peer)
? st::lineWidth
: 0;
_topShadow->setGeometryToLeft( _topShadow->setGeometryToLeft(
topShadowLeft, topShadowLeft,
_topBar->bottomNoMargins(), _topBar->bottomNoMargins(),
@ -5479,13 +5485,8 @@ void HistoryWidget::checkPinnedBarState() {
refreshPinnedBarButton(many); refreshPinnedBarButton(many);
}, _pinnedBar->lifetime()); }, _pinnedBar->lifetime());
rpl::single( controller()->adaptive().oneColumnValue(
rpl::empty_value() ) | rpl::start_with_next([=](bool one) {
) | rpl::then(
base::ObservableViewer(Adaptive::Changed())
) | rpl::map([] {
return Adaptive::OneColumn();
}) | rpl::start_with_next([=](bool one) {
_pinnedBar->setShadowGeometryPostprocess([=](QRect geometry) { _pinnedBar->setShadowGeometryPostprocess([=](QRect geometry) {
if (!one) { if (!one) {
geometry.setLeft(geometry.left() + st::lineWidth); geometry.setLeft(geometry.left() + st::lineWidth);
@ -5608,13 +5609,8 @@ void HistoryWidget::setupGroupCallTracker() {
_groupCallTracker->content(), _groupCallTracker->content(),
Core::App().appDeactivatedValue()); Core::App().appDeactivatedValue());
rpl::single( controller()->adaptive().oneColumnValue(
rpl::empty_value() ) | rpl::start_with_next([=](bool one) {
) | rpl::then(
base::ObservableViewer(Adaptive::Changed())
) | rpl::map([] {
return Adaptive::OneColumn();
}) | rpl::start_with_next([=](bool one) {
_groupCallBar->setShadowGeometryPostprocess([=](QRect geometry) { _groupCallBar->setShadowGeometryPostprocess([=](QRect geometry) {
if (!one) { if (!one) {
geometry.setLeft(geometry.left() + st::lineWidth); geometry.setLeft(geometry.left() + st::lineWidth);