Fix bot about title display.

This commit is contained in:
John Preston 2024-06-02 10:55:09 +04:00
parent 47e06cf385
commit 1656a9c3e2
3 changed files with 5 additions and 51 deletions

View file

@ -1012,10 +1012,10 @@ QSize Message::performCountOptimalSize() {
accumulate_max(maxWidth, entry->maxWidth()); accumulate_max(maxWidth, entry->maxWidth());
minHeight += entry->minHeight(); minHeight += entry->minHeight();
} }
if (withVisibleText && botTop) { }
accumulate_max(maxWidth, botTop->maxWidth); if (withVisibleText && botTop) {
minHeight += botTop->height; accumulate_max(maxWidth, botTop->maxWidth);
} minHeight += botTop->height;
} }
accumulate_max(maxWidth, minWidthForMedia()); accumulate_max(maxWidth, minWidthForMedia());
} else if (media) { } else if (media) {

View file

@ -265,10 +265,6 @@ QSize Gif::countOptimalSize() {
minHeight = adjustHeightForLessCrop( minHeight = adjustHeightForLessCrop(
scaled, scaled,
{ maxWidth, minHeight }); { maxWidth, minHeight });
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
} else if (isUnwrapped()) { } else if (isUnwrapped()) {
const auto item = _parent->data(); const auto item = _parent->data();
auto via = item->Get<HistoryMessageVia>(); auto via = item->Get<HistoryMessageVia>();
@ -310,9 +306,6 @@ QSize Gif::countCurrentSize(int newWidth) {
newHeight = adjustHeightForLessCrop( newHeight = adjustHeightForLessCrop(
scaled, scaled,
{ newWidth, newHeight }); { newWidth, newHeight });
if (botTop) {
newHeight += botTop->height;
}
} else if (isUnwrapped()) { } else if (isUnwrapped()) {
accumulate_max(newWidth, _parent->reactionsOptimalWidth()); 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 rightLayout = _parent->hasRightLayout();
const auto inWebPage = (_parent->media() != this); const auto inWebPage = (_parent->media() != this);
const auto isRound = _data->isVideoMessage(); const auto isRound = _data->isVideoMessage();
const auto botTop = _parent->Get<FakeBotAboutTop>();
const auto rounding = inWebPage const auto rounding = inWebPage
? std::optional<Ui::BubbleRounding>() ? std::optional<Ui::BubbleRounding>()
: adjustedBubbleRounding(); : adjustedBubbleRounding();
if (bubble) {
if (botTop) {
painth -= botTop->height;
}
}
auto usex = 0, usew = paintw; auto usex = 0, usew = paintw;
const auto unwrapped = isUnwrapped(); const auto unwrapped = isUnwrapped();
@ -756,22 +743,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
} }
} }
} }
if (!unwrapped && bubble && !isBubbleBottom()) { if (!inWebPage && !skipDrawingSurrounding) {
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) {
auto fullRight = paintx + usex + usew; auto fullRight = paintx + usex + usew;
auto fullBottom = painty + painth; auto fullBottom = painty + painth;
auto maxRight = _parent->width() - st::msgMargin.left(); 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 paintx = 0, painty = 0, paintw = width(), painth = height();
auto bubble = _parent->hasBubble(); auto bubble = _parent->hasBubble();
if (bubble) {
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
painth -= botTop->height;
}
}
const auto rightLayout = _parent->hasRightLayout(); const auto rightLayout = _parent->hasRightLayout();
const auto inWebPage = (_parent->media() != this); const auto inWebPage = (_parent->media() != this);
const auto isRound = _data->isVideoMessage(); const auto isRound = _data->isVideoMessage();

View file

@ -196,10 +196,6 @@ QSize Photo::countOptimalSize() {
minHeight = adjustHeightForLessCrop( minHeight = adjustHeightForLessCrop(
dimensions, dimensions,
{ maxWidth, minHeight }); { maxWidth, minHeight });
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
} }
return { maxWidth, minHeight }; return { maxWidth, minHeight };
} }
@ -234,9 +230,6 @@ QSize Photo::countCurrentSize(int newWidth) {
imageHeight = newHeight = adjustHeightForLessCrop( imageHeight = newHeight = adjustHeightForLessCrop(
dimensions, dimensions,
{ newWidth, newHeight }); { newWidth, newHeight });
if (botTop) {
newHeight += botTop->height;
}
} }
const auto enlargeInner = st::historyPageEnlargeSize; const auto enlargeInner = st::historyPageEnlargeSize;
const auto enlargeOuter = 2 * st::historyPageEnlargeSkip + enlargeInner; 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 paintx = 0, painty = 0, paintw = width(), painth = height();
auto bubble = _parent->hasBubble(); auto bubble = _parent->hasBubble();
if (bubble) {
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
painth -= botTop->height;
}
painth -= st::mediaCaptionSkip;
}
if (QRect(paintx, painty, paintw, painth).contains(point)) { if (QRect(paintx, painty, paintw, painth).contains(point)) {
ensureDataMediaCreated(); ensureDataMediaCreated();
result.link = (_spoiler && !_spoiler->revealed) result.link = (_spoiler && !_spoiler->revealed)