From 1656a9c3e26fc7bc5fae64bcd64b34202ba401ef Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 2 Jun 2024 10:55:09 +0400 Subject: [PATCH] Fix bot about title display. --- .../history/view/history_view_message.cpp | 8 ++--- .../history/view/media/history_view_gif.cpp | 35 +------------------ .../history/view/media/history_view_photo.cpp | 13 ------- 3 files changed, 5 insertions(+), 51 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index e8876c6e83..cd10f2399c 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1012,10 +1012,10 @@ QSize Message::performCountOptimalSize() { accumulate_max(maxWidth, entry->maxWidth()); minHeight += entry->minHeight(); } - if (withVisibleText && botTop) { - accumulate_max(maxWidth, botTop->maxWidth); - minHeight += botTop->height; - } + } + if (withVisibleText && botTop) { + accumulate_max(maxWidth, botTop->maxWidth); + minHeight += botTop->height; } accumulate_max(maxWidth, minWidthForMedia()); } else if (media) { diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index a781a3ecc4..a04ea9256f 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -265,10 +265,6 @@ QSize Gif::countOptimalSize() { minHeight = adjustHeightForLessCrop( scaled, { maxWidth, minHeight }); - if (const auto botTop = _parent->Get()) { - accumulate_max(maxWidth, botTop->maxWidth); - minHeight += botTop->height; - } } else if (isUnwrapped()) { const auto item = _parent->data(); auto via = item->Get(); @@ -310,9 +306,6 @@ QSize Gif::countCurrentSize(int newWidth) { newHeight = adjustHeightForLessCrop( scaled, { newWidth, newHeight }); - if (botTop) { - newHeight += botTop->height; - } } else if (isUnwrapped()) { accumulate_max(newWidth, _parent->reactionsOptimalWidth()); @@ -408,16 +401,10 @@ void Gif::draw(Painter &p, const PaintContext &context) const { const auto rightLayout = _parent->hasRightLayout(); const auto inWebPage = (_parent->media() != this); const auto isRound = _data->isVideoMessage(); - const auto botTop = _parent->Get(); const auto rounding = inWebPage ? std::optional() : adjustedBubbleRounding(); - if (bubble) { - if (botTop) { - painth -= botTop->height; - } - } auto usex = 0, usew = paintw; const auto unwrapped = isUnwrapped(); @@ -756,22 +743,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const { } } } - if (!unwrapped && bubble && !isBubbleBottom()) { - p.setPen(stm->historyTextFg); - auto top = painty + painth + st::mediaCaptionSkip; - if (botTop) { - auto captionw = paintw - - st::msgPadding.left() - - st::msgPadding.right(); - botTop->text.drawLeftElided( - p, - st::msgPadding.left(), - top, - captionw, - _parent->width()); - top += botTop->height; - } - } else if (!inWebPage && !skipDrawingSurrounding) { + if (!inWebPage && !skipDrawingSurrounding) { auto fullRight = paintx + usex + usew; auto fullBottom = painty + painth; auto maxRight = _parent->width() - st::msgMargin.left(); @@ -1032,11 +1004,6 @@ TextState Gif::textState(QPoint point, StateRequest request) const { auto paintx = 0, painty = 0, paintw = width(), painth = height(); auto bubble = _parent->hasBubble(); - if (bubble) { - if (const auto botTop = _parent->Get()) { - painth -= botTop->height; - } - } const auto rightLayout = _parent->hasRightLayout(); const auto inWebPage = (_parent->media() != this); const auto isRound = _data->isVideoMessage(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index c9721746ac..ed0ded0fea 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -196,10 +196,6 @@ QSize Photo::countOptimalSize() { minHeight = adjustHeightForLessCrop( dimensions, { maxWidth, minHeight }); - if (const auto botTop = _parent->Get()) { - accumulate_max(maxWidth, botTop->maxWidth); - minHeight += botTop->height; - } } return { maxWidth, minHeight }; } @@ -234,9 +230,6 @@ QSize Photo::countCurrentSize(int newWidth) { imageHeight = newHeight = adjustHeightForLessCrop( dimensions, { newWidth, newHeight }); - if (botTop) { - newHeight += botTop->height; - } } const auto enlargeInner = st::historyPageEnlargeSize; const auto enlargeOuter = 2 * st::historyPageEnlargeSkip + enlargeInner; @@ -609,12 +602,6 @@ TextState Photo::textState(QPoint point, StateRequest request) const { auto paintx = 0, painty = 0, paintw = width(), painth = height(); auto bubble = _parent->hasBubble(); - if (bubble) { - if (const auto botTop = _parent->Get()) { - painth -= botTop->height; - } - painth -= st::mediaCaptionSkip; - } if (QRect(paintx, painty, paintw, painth).contains(point)) { ensureDataMediaCreated(); result.link = (_spoiler && !_spoiler->revealed)