diff --git a/Telegram/SourceFiles/data/data_forum_topic.cpp b/Telegram/SourceFiles/data/data_forum_topic.cpp index a8922b65a..b069dce95 100644 --- a/Telegram/SourceFiles/data/data_forum_topic.cpp +++ b/Telegram/SourceFiles/data/data_forum_topic.cpp @@ -444,8 +444,16 @@ void ForumTopic::paintUserpic( std::shared_ptr &view, const Dialogs::Ui::PaintContext &context) const { const auto &st = context.st; - const auto position = QPoint(st->padding.left(), st->padding.top()); + auto position = QPoint(st->padding.left(), st->padding.top()); if (_icon) { + if (context.narrow) { + const auto ratio = style::DevicePixelRatio(); + const auto tag = Data::CustomEmojiManager::SizeTag::Normal; + const auto size = Data::FrameSizeFromTag(tag) / ratio; + position = QPoint( + (context.width - size) / 2, + (st->height - size) / 2); + } _icon->paint(p, { .preview = st::windowBgOver->c, .now = context.now, @@ -455,11 +463,16 @@ void ForumTopic::paintUserpic( } else { validateDefaultIcon(); const auto size = st::defaultForumTopicIcon.size; - const auto esize = st::emojiSize; - const auto shift = (esize - size) / 2; - p.drawImage( - position + st::forumTopicIconPosition + QPoint(shift, 0), - _defaultIcon); + if (context.narrow) { + position = QPoint( + (context.width - size) / 2, + (st->height - size) / 2); + } else { + const auto esize = st::emojiSize; + const auto shift = (esize - size) / 2; + position += st::forumTopicIconPosition + QPoint(shift, 0); + } + p.drawImage(position, _defaultIcon); } } diff --git a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp index 96d77e543..e7da0399d 100644 --- a/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp +++ b/Telegram/SourceFiles/dialogs/ui/dialogs_layout.cpp @@ -309,7 +309,7 @@ void PaintRow( } auto nameleft = context.st->nameLeft; - if (context.width <= nameleft) { + if (context.narrow) { if (!draft && item && !item->isEmpty()) { PaintNarrowCounter(p, context, badgesState); } diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp index 5c944d732..a928104e8 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.cpp @@ -434,7 +434,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) { } void TopBarWidget::paintTopBar(Painter &p) { - if (!_activeChat.key) { + if (!_activeChat.key || _narrowMode) { return; } auto nameleft = _leftTaken; @@ -855,6 +855,12 @@ void TopBarWidget::refreshInfoButton() { } void TopBarWidget::resizeEvent(QResizeEvent *e) { + const auto narrowMode = (_activeChat.section == Section::ChatsList) + && (width() < _back->width() + _search->width()); + if (_narrowMode != narrowMode) { + _narrowMode = narrowMode; + updateControlsVisibility(); + } updateSearchVisibility(); updateControlsGeometry(); } @@ -865,11 +871,7 @@ int TopBarWidget::countSelectedButtonsTop(float64 selectedShown) { void TopBarWidget::updateSearchVisibility() { const auto historyMode = (_activeChat.section == Section::History); - const auto smallDialogsColumn = _activeChat.key.folder() - && (width() < _back->width() + _search->width()); - _search->setVisible(historyMode - && !smallDialogsColumn - && !_chooseForReportReason); + _search->setVisible(historyMode && !_chooseForReportReason); } void TopBarWidget::updateControlsGeometry() { @@ -915,9 +917,7 @@ void TopBarWidget::updateControlsGeometry() { } else if (_back->isHidden()) { _leftTaken = st::topBarArrowPadding.right(); } else { - const auto smallDialogsColumn = _activeChat.key.folder() - && (width() < _back->width() + _search->width()); - _leftTaken = smallDialogsColumn ? (width() - _back->width()) / 2 : 0; + _leftTaken = _narrowMode ? (width() - _back->width()) / 2 : 0; _back->moveToLeft(_leftTaken, otherButtonsTop); _leftTaken += _back->width(); } @@ -1005,7 +1005,9 @@ void TopBarWidget::updateControlsVisibility() { ? (_activeChat.key.peer() && _activeChat.key.peer()->isForum()) : false); updateSearchVisibility(); - _menuToggle->setVisible(hasMenu && !_chooseForReportReason); + _menuToggle->setVisible(hasMenu + && !_chooseForReportReason + && !_narrowMode); _infoToggle->setVisible(historyMode && !_activeChat.key.folder() && !isOneColumn diff --git a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h index 5052c89b9..ee7bfe741 100644 --- a/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h +++ b/Telegram/SourceFiles/history/view/history_view_top_bar_widget.h @@ -195,6 +195,7 @@ private: int _leftTaken = 0; int _rightTaken = 0; bool _animatingMode = false; + bool _narrowMode = false; std::unique_ptr _connecting; SendActionPainter *_sendAction = nullptr;