Moved Core::Settings:chatWide to Window::Adaptive.

This commit is contained in:
23rd 2021-05-27 03:44:12 +03:00
parent 80fe2f57e9
commit 9669a8a44a
17 changed files with 123 additions and 55 deletions

View File

@ -117,7 +117,7 @@ QByteArray Settings::serialize() const {
stream.setVersion(QDataStream::Qt_5_1);
stream
<< themesAccentColors
<< qint32(_adaptiveForWide ? 1 : 0)
<< qint32(_adaptiveForWide.current() ? 1 : 0)
<< qint32(_moderateModeEnabled ? 1 : 0)
<< qint32(qRound(_songVolume.current() * 1e6))
<< qint32(qRound(_videoVolume.current() * 1e6))
@ -211,7 +211,7 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
stream.setVersion(QDataStream::Qt_5_1);
QByteArray themesAccentColors;
qint32 adaptiveForWide = _adaptiveForWide ? 1 : 0;
qint32 adaptiveForWide = _adaptiveForWide.current() ? 1 : 0;
qint32 moderateModeEnabled = _moderateModeEnabled ? 1 : 0;
qint32 songVolume = qint32(qRound(_songVolume.current() * 1e6));
qint32 videoVolume = qint32(qRound(_videoVolume.current() * 1e6));
@ -522,11 +522,6 @@ void Settings::addFromSerialized(const QByteArray &serialized) {
_groupCallNoiseSuppression = (groupCallNoiseSuppression == 1);
}
bool Settings::chatWide() const {
return _adaptiveForWide
&& (Global::AdaptiveChatLayout() == Adaptive::ChatLayout::Wide);
}
QString Settings::getSoundPath(const QString &key) const {
auto it = _soundOverrides.find(key);
if (it != _soundOverrides.end()) {

View File

@ -69,9 +69,11 @@ public:
[[nodiscard]] QByteArray serialize() const;
void addFromSerialized(const QByteArray &serialized);
[[nodiscard]] bool chatWide() const;
[[nodiscard]] bool adaptiveForWide() const {
return _adaptiveForWide;
return _adaptiveForWide.current();
}
[[nodiscard]] rpl::producer<bool> adaptiveForWideValue() const {
return _adaptiveForWide.value();
}
void setAdaptiveForWide(bool value) {
_adaptiveForWide = value;
@ -573,7 +575,7 @@ private:
ushort rating = 0;
};
bool _adaptiveForWide = true;
rpl::variable<bool> _adaptiveForWide = true;
bool _moderateModeEnabled = false;
rpl::variable<float64> _songVolume = kDefaultVolume;
rpl::variable<float64> _videoVolume = kDefaultVolume;

View File

@ -626,6 +626,10 @@ void InnerWidget::elementSendBotCommand(
void InnerWidget::elementHandleViaClick(not_null<UserData*> bot) {
}
bool InnerWidget::elementIsChatWide() {
return _controller->adaptive().isChatWide();
}
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
memento->setFilter(std::move(_filter));
memento->setAdmins(std::move(_admins));
@ -941,14 +945,17 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
p.setOpacity(opacity);
const auto dateY = /*noFloatingDate ? itemtop :*/ (dateTop - st::msgServiceMargin.top());
const auto width = view->width();
const auto chatWide =
_controller->adaptive().isChatWide();
if (const auto date = view->Get<HistoryView::DateBadge>()) {
date->paint(p, dateY, width);
date->paint(p, dateY, width, chatWide);
} else {
HistoryView::ServiceMessagePainter::paintDate(
p,
view->dateTime(),
dateY,
width);
width,
chatWide);
}
}
}

View File

@ -120,6 +120,7 @@ public:
const QString &command,
const FullMsgId &context) override;
void elementHandleViaClick(not_null<UserData*> bot) override;
bool elementIsChatWide() override;
~InnerWidget();

View File

@ -209,6 +209,11 @@ HistoryInner::HistoryInner(
) | rpl::start_with_next([=] {
update();
}, lifetime());
controller->adaptive().chatWideValue(
) | rpl::start_with_next([=](bool wide) {
_isChatWide = wide;
}, lifetime());
}
Main::Session &HistoryInner::session() const {
@ -358,7 +363,7 @@ bool HistoryInner::canHaveFromUserpics() const {
if (_peer->isUser()
&& !_peer->isSelf()
&& !_peer->isRepliesChat()
&& !Core::App().settings().chatWide()) {
&& !_isChatWide) {
return false;
} else if (_peer->isChannel() && !_peer->isMegagroup()) {
return false;
@ -772,13 +777,14 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
? itemtop
: (dateTop - st::msgServiceMargin.top());
if (const auto date = view->Get<HistoryView::DateBadge>()) {
date->paint(p, dateY, _contentWidth);
date->paint(p, dateY, _contentWidth, _isChatWide);
} else {
HistoryView::ServiceMessagePainter::paintDate(
p,
view->dateTime(),
dateY,
_contentWidth);
_contentWidth,
_isChatWide);
}
}
}
@ -2163,7 +2169,7 @@ void HistoryInner::recountHistoryGeometry() {
: (st::msgNameFont->height + st::botDescSkip);
int32 descH = st::msgMargin.top() + st::msgPadding.top() + descriptionHeight + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
int32 descMaxWidth = _scroll->width();
if (Core::App().settings().chatWide()) {
if (_isChatWide) {
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
@ -2370,7 +2376,7 @@ void HistoryInner::updateSize() {
: (st::msgNameFont->height + st::botDescSkip);
int32 descH = st::msgMargin.top() + st::msgPadding.top() + descriptionHeight + _botAbout->height + st::msgPadding.bottom() + st::msgMargin.bottom();
int32 descMaxWidth = _scroll->width();
if (Core::App().settings().chatWide()) {
if (_isChatWide) {
descMaxWidth = qMin(descMaxWidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
int32 descAtX = (descMaxWidth - _botAbout->width) / 2 - st::msgPadding.left();
@ -2593,6 +2599,10 @@ void HistoryInner::elementHandleViaClick(not_null<UserData*> bot) {
App::insertBotCommand('@' + bot->username);
}
bool HistoryInner::elementIsChatWide() {
return _isChatWide;
}
auto HistoryInner::getSelectionState() const
-> HistoryView::TopBarWidget::SelectedState {
auto result = HistoryView::TopBarWidget::SelectedState {};
@ -2749,7 +2759,7 @@ void HistoryInner::mouseActionUpdate() {
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
auto dateLeft = st::msgServiceMargin.left();
auto maxwidth = _contentWidth;
if (Core::App().settings().chatWide()) {
if (_isChatWide) {
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
@ -3463,6 +3473,11 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
Instance->elementHandleViaClick(bot);
}
}
bool elementIsChatWide() override {
return Instance
? Instance->elementIsChatWide()
: false;
}
};
static Result result;

View File

@ -96,6 +96,7 @@ public:
const QString &command,
const FullMsgId &context);
void elementHandleViaClick(not_null<UserData*> bot);
bool elementIsChatWide();
void updateBotInfo(bool recount = true);
@ -356,6 +357,8 @@ private:
SelectedItems _selected;
std::optional<Ui::ReportReason> _chooseForReportReason;
bool _isChatWide = false;
base::flat_set<not_null<const HistoryItem*>> _animatedStickersPlayed;
base::flat_map<
not_null<PeerData*>,

View File

@ -133,6 +133,10 @@ void SimpleElementDelegate::elementSendBotCommand(
void SimpleElementDelegate::elementHandleViaClick(not_null<UserData*> bot) {
}
bool SimpleElementDelegate::elementIsChatWide() {
return false;
}
TextSelection UnshiftItemSelection(
TextSelection selection,
uint16 byLength) {
@ -220,7 +224,7 @@ int UnreadBar::marginTop() {
return st::lineWidth + st::historyUnreadBarMargin;
}
void UnreadBar::paint(Painter &p, int y, int w) const {
void UnreadBar::paint(Painter &p, int y, int w, bool chatWide) const {
const auto bottom = y + height();
y += marginTop();
p.fillRect(
@ -240,7 +244,7 @@ void UnreadBar::paint(Painter &p, int y, int w) const {
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Core::App().settings().chatWide()) {
if (chatWide) {
maxwidth = qMin(
maxwidth,
st::msgMaxWidth
@ -272,8 +276,8 @@ int DateBadge::height() const {
+ st::msgServiceMargin.bottom();
}
void DateBadge::paint(Painter &p, int y, int w) const {
ServiceMessagePainter::paintDate(p, text, width, y, w);
void DateBadge::paint(Painter &p, int y, int w, bool chatWide) const {
ServiceMessagePainter::paintDate(p, text, width, y, w, chatWide);
}
Element::Element(

View File

@ -70,6 +70,7 @@ public:
const QString &command,
const FullMsgId &context) = 0;
virtual void elementHandleViaClick(not_null<UserData*> bot) = 0;
virtual bool elementIsChatWide() = 0;
};
@ -106,6 +107,7 @@ public:
const QString &command,
const FullMsgId &context) override;
void elementHandleViaClick(not_null<UserData*> bot) override;
bool elementIsChatWide() override;
private:
const not_null<Window::SessionController*> _controller;
@ -135,7 +137,7 @@ struct UnreadBar : public RuntimeComponent<UnreadBar, Element> {
static int height();
static int marginTop();
void paint(Painter &p, int y, int w) const;
void paint(Painter &p, int y, int w, bool chatWide) const;
QString text;
int width = 0;
@ -149,7 +151,7 @@ struct DateBadge : public RuntimeComponent<DateBadge, Element> {
void init(const QString &date);
int height() const;
void paint(Painter &p, int y, int w) const;
void paint(Painter &p, int y, int w, bool chatWide) const;
QString text;
int width = 0;

View File

@ -21,7 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/message_field.h"
#include "mainwindow.h"
#include "mainwidget.h"
#include "core/application.h"
#include "core/click_handler_types.h"
#include "apiwrap.h"
#include "layout.h"
@ -312,6 +311,11 @@ ListWidget::ListWidget(
}
}
});
controller->adaptive().chatWideValue(
) | rpl::start_with_next([=](bool wide) {
_isChatWide = wide;
}, lifetime());
}
Main::Session &ListWidget::session() const {
@ -1323,6 +1327,10 @@ void ListWidget::elementHandleViaClick(not_null<UserData*> bot) {
_delegate->listHandleViaClick(bot);
}
bool ListWidget::elementIsChatWide() {
return _isChatWide;
}
void ListWidget::saveState(not_null<ListMemento*> memento) {
memento->setAroundPosition(_aroundPosition);
auto state = countScrollState();
@ -1558,13 +1566,14 @@ void ListWidget::paintEvent(QPaintEvent *e) {
int dateY = /*noFloatingDate ? itemtop :*/ (dateTop - st::msgServiceMargin.top());
int width = view->width();
if (const auto date = view->Get<HistoryView::DateBadge>()) {
date->paint(p, dateY, width);
date->paint(p, dateY, width, _isChatWide);
} else {
ServiceMessagePainter::paintDate(
p,
ItemDateText(view->data(), IsItemScheduledUntilOnline(view->data())),
dateY,
width);
width,
_isChatWide);
}
}
}
@ -2348,7 +2357,7 @@ void ListWidget::mouseActionUpdate() {
dateWidth += st::msgServicePadding.left() + st::msgServicePadding.right();
auto dateLeft = st::msgServiceMargin.left();
auto maxwidth = view->width();
if (Core::App().settings().chatWide()) {
if (_isChatWide) {
maxwidth = qMin(maxwidth, int32(st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
auto widthForDate = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();

View File

@ -244,6 +244,7 @@ public:
const QString &command,
const FullMsgId &context) override;
void elementHandleViaClick(not_null<UserData*> bot) override;
bool elementIsChatWide() override;
~ListWidget();
@ -546,6 +547,8 @@ private:
bool _wasSelectedText = false;
Qt::CursorShape _cursor = style::cur_default;
bool _isChatWide = false;
base::unique_qptr<Ui::PopupMenu> _menu;
QPoint _trippleClickPoint;

View File

@ -16,8 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history.h"
#include "ui/effects/ripple_animation.h"
#include "base/unixtime.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "ui/toast/toast.h"
#include "ui/text/text_utilities.h"
#include "ui/text/text_entity.h"
@ -564,7 +562,7 @@ void Message::draw(
auto unreadbarh = bar->height();
if (clip.intersects(QRect(0, dateh, width(), unreadbarh))) {
p.translate(0, dateh);
bar->paint(p, 0, width());
bar->paint(p, 0, width(), delegate()->elementIsChatWide());
p.translate(0, -dateh);
}
}
@ -644,7 +642,7 @@ void Message::draw(
|| (context() == Context::Replies && data()->isDiscussionPost());
auto displayTail = skipTail
? RectPart::None
: (outbg && !Core::App().settings().chatWide())
: (outbg && !delegate()->elementIsChatWide())
? RectPart::Right
: RectPart::Left;
PaintBubble(
@ -1207,7 +1205,7 @@ bool Message::hasFromPhoto() const {
|| item->isEmpty()
|| (context() == Context::Replies && item->isDiscussionPost())) {
return false;
} else if (Core::App().settings().chatWide()) {
} else if (delegate()->elementIsChatWide()) {
return true;
} else if (const auto forwarded = item->Get<HistoryMessageForwarded>()) {
const auto peer = item->history()->peer;
@ -2517,7 +2515,7 @@ QRect Message::countGeometry() const {
const auto availableWidth = width()
- st::msgMargin.left()
- (commentsRoot ? st::msgMargin.left() : st::msgMargin.right());
auto contentLeft = (outbg && !Core::App().settings().chatWide())
auto contentLeft = (outbg && !delegate()->elementIsChatWide())
? st::msgMargin.right()
: st::msgMargin.left();
auto contentWidth = availableWidth;
@ -2540,7 +2538,7 @@ QRect Message::countGeometry() const {
contentWidth = mediaWidth;
}
}
if (contentWidth < availableWidth && !Core::App().settings().chatWide()) {
if (contentWidth < availableWidth && !delegate()->elementIsChatWide()) {
if (outbg) {
contentLeft += availableWidth - contentWidth;
} else if (commentsRoot) {

View File

@ -16,8 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_chat.h"
#include "data/data_channel.h"
#include "ui/text/text_options.h"
#include "core/core_settings.h"
#include "core/application.h"
#include "mainwidget.h"
#include "layout.h"
#include "lang/lang_keys.h"
@ -216,13 +214,13 @@ void paintPreparedDate(
int dateTextWidth,
int y,
int w,
bool chatWide,
const style::color &bg,
const style::color &fg) {
int left = st::msgServiceMargin.left();
int maxwidth = w;
if (Core::App().settings().chatWide()) {
maxwidth = qMin(maxwidth, WideChatWidth());
}
const auto maxwidth = chatWide
? std::min(w, WideChatWidth())
: w;
w = maxwidth - st::msgServiceMargin.left() - st::msgServiceMargin.left();
left += (w - dateTextWidth - st::msgServicePadding.left() - st::msgServicePadding.right()) / 2;
@ -262,11 +260,12 @@ void ServiceMessagePainter::paintDate(
const QDateTime &date,
int y,
int w,
bool chatWide,
const style::color &bg,
const style::color &fg) {
const auto dateText = langDayOfMonthFull(date.date());
const auto dateTextWidth = st::msgServiceFont->width(dateText);
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg, fg);
paintPreparedDate(p, dateText, dateTextWidth, y, w, chatWide, bg, fg);
}
void ServiceMessagePainter::paintDate(
@ -274,6 +273,7 @@ void ServiceMessagePainter::paintDate(
const QString &dateText,
int y,
int w,
bool chatWide,
const style::color &bg,
const style::color &fg) {
paintPreparedDate(
@ -282,6 +282,7 @@ void ServiceMessagePainter::paintDate(
st::msgServiceFont->width(dateText),
y,
w,
chatWide,
bg,
fg);
}
@ -292,9 +293,10 @@ void ServiceMessagePainter::paintDate(
int dateTextWidth,
int y,
int w,
bool chatWide,
const style::color &bg,
const style::color &fg) {
paintPreparedDate(p, dateText, dateTextWidth, y, w, bg, fg);
paintPreparedDate(p, dateText, dateTextWidth, y, w, chatWide, bg, fg);
}
void ServiceMessagePainter::paintBubble(
@ -439,7 +441,7 @@ not_null<HistoryService*> Service::message() const {
QRect Service::countGeometry() const {
auto result = QRect(0, 0, width(), height());
if (Core::App().settings().chatWide()) {
if (delegate()->elementIsChatWide()) {
result.setWidth(qMin(result.width(), st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left()));
}
return result.marginsRemoved(st::msgServiceMargin);
@ -462,7 +464,7 @@ QSize Service::performCountCurrentSize(int newWidth) {
item->_textHeight = 0;
} else {
auto contentWidth = newWidth;
if (Core::App().settings().chatWide()) {
if (delegate()->elementIsChatWide()) {
accumulate_min(contentWidth, st::msgMaxWidth + 2 * st::msgPhotoSkip + 2 * st::msgMargin.left());
}
contentWidth -= st::msgServiceMargin.left() + st::msgServiceMargin.left(); // two small margins
@ -536,7 +538,7 @@ void Service::draw(
if (const auto bar = Get<UnreadBar>()) {
unreadbarh = bar->height();
if (clip.intersects(QRect(0, 0, width(), unreadbarh))) {
bar->paint(p, 0, width());
bar->paint(p, 0, width(), delegate()->elementIsChatWide());
}
p.translate(0, unreadbarh);
clip.translate(0, -unreadbarh);

View File

@ -68,6 +68,7 @@ public:
const QDateTime &date,
int y,
int w,
bool chatWide,
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);
static void paintDate(
@ -75,6 +76,7 @@ public:
const QString &dateText,
int y,
int w,
bool chatWide,
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);
static void paintDate(
@ -83,6 +85,7 @@ public:
int dateTextWidth,
int y,
int w,
bool chatWide,
const style::color &bg = st::msgServiceBg,
const style::color &fg = st::msgServiceFg);

View File

@ -13,8 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h"
#include "history/history_item_components.h"
#include "lottie/lottie_single_player.h"
#include "core/application.h"
#include "core/core_settings.h"
#include "ui/cached_round_corners.h"
#include "layout.h"
#include "styles/style_chat.h"
@ -95,7 +93,8 @@ QSize UnwrappedMedia::countCurrentSize(int newWidth) {
}
}
auto newHeight = minHeight();
if (_parent->hasOutLayout() && !Core::App().settings().chatWide()) {
if (_parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide()) {
// Add some height to isolated emoji for the timestamp info.
const auto infoHeight = st::msgDateImgPadding.y() * 2
+ st::msgDateFont->height;
@ -117,7 +116,8 @@ void UnwrappedMedia::draw(
}
bool selected = (selection == FullSelection);
const auto rightAligned = _parent->hasOutLayout() && !Core::App().settings().chatWide();
const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide();
const auto inWebPage = (_parent->media() != this);
const auto item = _parent->data();
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
@ -185,7 +185,8 @@ void UnwrappedMedia::drawSurrounding(
const HistoryMessageVia *via,
const HistoryMessageReply *reply,
const HistoryMessageForwarded *forwarded) const {
const auto rightAligned = _parent->hasOutLayout() && !Core::App().settings().chatWide();
const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide();
const auto rightActionSize = _parent->rightActionSize();
const auto fullRight = calculateFullRight(inner);
auto fullBottom = height();
@ -245,7 +246,8 @@ PointState UnwrappedMedia::pointState(QPoint point) const {
return PointState::Outside;
}
const auto rightAligned = _parent->hasOutLayout() && !Core::App().settings().chatWide();
const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide();
const auto inWebPage = (_parent->media() != this);
const auto item = _parent->data();
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
@ -285,7 +287,8 @@ TextState UnwrappedMedia::textState(QPoint point, StateRequest request) const {
return result;
}
const auto rightAligned = _parent->hasOutLayout() && !Core::App().settings().chatWide();
const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide();
const auto inWebPage = (_parent->media() != this);
const auto item = _parent->data();
const auto via = inWebPage ? nullptr : item->Get<HistoryMessageVia>();
@ -398,7 +401,8 @@ std::unique_ptr<Lottie::SinglePlayer> UnwrappedMedia::stickerTakeLottie(
}
int UnwrappedMedia::calculateFullRight(const QRect &inner) const {
const auto rightAligned = _parent->hasOutLayout() && !Core::App().settings().chatWide();
const auto rightAligned = _parent->hasOutLayout()
&& !_parent->delegate()->elementIsChatWide();
const auto infoWidth = _parent->infoWidth()
+ st::msgDateImgPadding.x() * 2
+ st::msgReplyPadding.left();
@ -444,7 +448,7 @@ bool UnwrappedMedia::needInfoDisplay() const {
|| (_parent->rightActionSize())
|| (_parent->isLastAndSelfMessage())
|| (_parent->hasOutLayout()
&& !Core::App().settings().chatWide()
&& !_parent->delegate()->elementIsChatWide()
&& _content->alwaysShowOutTimestamp());
}

View File

@ -1338,6 +1338,7 @@ void ListWidget::paintEvent(QPaintEvent *e) {
_dateBadge.text,
_visibleTop,
outerWidth,
false,
st::roundedBg,
st::roundedFg);
}

View File

@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "history/history_item.h"
#include "data/data_media_types.h"
#include "data/data_session.h"
#include "core/application.h"
#include "core/core_settings.h"
namespace Window {
@ -25,6 +27,7 @@ void AdaptiveModern::setChatLayout(ChatLayout value) {
rpl::producer<> AdaptiveModern::changed() const {
return rpl::merge(
Core::App().settings().adaptiveForWideValue() | rpl::to_empty,
_chatLayout.changes() | rpl::to_empty,
_layout.changes() | rpl::to_empty);
}
@ -52,4 +55,17 @@ bool AdaptiveModern::isThreeColumn() const {
return _layout.current() == WindowLayout::ThreeColumn;
}
rpl::producer<bool> AdaptiveModern::chatWideValue() const {
return rpl::combine(
_chatLayout.value(
) | rpl::map(rpl::mappers::_1 == AdaptiveModern::ChatLayout::Wide),
Core::App().settings().adaptiveForWideValue()
) | rpl::map(rpl::mappers::_1 && rpl::mappers::_2);
}
bool AdaptiveModern::isChatWide() const {
return Core::App().settings().adaptiveForWide()
&& (_chatLayout.current() == AdaptiveModern::ChatLayout::Wide);
}
} // namespace Window

View File

@ -35,6 +35,9 @@ public:
[[nodiscard]] bool isNormal() const;
[[nodiscard]] bool isThreeColumn() const;
[[nodiscard]] rpl::producer<bool> chatWideValue() const;
[[nodiscard]] bool isChatWide() const;
private:
rpl::variable<ChatLayout> _chatLayout;
rpl::variable<WindowLayout> _layout;