mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of ttl badges from voice messages with chat themes.
This commit is contained in:
parent
c43dfecec6
commit
6516c7aef3
1 changed files with 25 additions and 24 deletions
|
@ -45,28 +45,25 @@ namespace {
|
||||||
|
|
||||||
constexpr auto kAudioVoiceMsgUpdateView = crl::time(100);
|
constexpr auto kAudioVoiceMsgUpdateView = crl::time(100);
|
||||||
|
|
||||||
void DrawCornerBadgeTTL(
|
[[nodiscard]] QRect TTLRectFromInner(const QRect &inner) {
|
||||||
QPainter &p,
|
return QRect(
|
||||||
const style::color &bg,
|
rect::right(inner)
|
||||||
const style::color &fg,
|
|
||||||
const QRect &circleRect) {
|
|
||||||
p.save();
|
|
||||||
const auto partRect = QRectF(
|
|
||||||
rect::right(circleRect)
|
|
||||||
- st::dialogsTTLBadgeSize
|
- st::dialogsTTLBadgeSize
|
||||||
+ rect::m::sum::h(st::dialogsTTLBadgeInnerMargins),
|
+ rect::m::sum::h(st::dialogsTTLBadgeInnerMargins)
|
||||||
rect::bottom(circleRect)
|
- st::dialogsTTLBadgeSkip.x(),
|
||||||
|
rect::bottom(inner)
|
||||||
- st::dialogsTTLBadgeSize
|
- st::dialogsTTLBadgeSize
|
||||||
+ rect::m::sum::v(st::dialogsTTLBadgeInnerMargins),
|
+ rect::m::sum::v(st::dialogsTTLBadgeInnerMargins)
|
||||||
|
- st::dialogsTTLBadgeSkip.y(),
|
||||||
st::dialogsTTLBadgeSize,
|
st::dialogsTTLBadgeSize,
|
||||||
st::dialogsTTLBadgeSize);
|
st::dialogsTTLBadgeSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawCornerBadgeTTL(QPainter &p, const QColor &fg, const QRect &ttlRect) {
|
||||||
|
p.save();
|
||||||
auto hq = PainterHighQualityEnabler(p);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
p.setBrush(bg);
|
|
||||||
p.drawEllipse(partRect);
|
|
||||||
|
|
||||||
const auto innerRect = partRect - st::dialogsTTLBadgeInnerMargins;
|
const auto innerRect = QRectF(ttlRect - st::dialogsTTLBadgeInnerMargins);
|
||||||
const auto ttlText = u"1"_q;
|
const auto ttlText = u"1"_q;
|
||||||
|
|
||||||
p.setFont(st::dialogsScamFont);
|
p.setFont(st::dialogsScamFont);
|
||||||
|
@ -716,6 +713,11 @@ void Document::draw(
|
||||||
} else {
|
} else {
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
|
|
||||||
|
const auto hasTtlBadge = _parent->data()->media()
|
||||||
|
&& _parent->data()->media()->ttlSeconds()
|
||||||
|
&& _openl;
|
||||||
|
const auto ttlRect = hasTtlBadge ? TTLRectFromInner(inner) : QRect();
|
||||||
|
|
||||||
const auto coverDrawn = _data->isSongWithCover()
|
const auto coverDrawn = _data->isSongWithCover()
|
||||||
&& DrawThumbnailAsSongCover(
|
&& DrawThumbnailAsSongCover(
|
||||||
p,
|
p,
|
||||||
|
@ -740,9 +742,12 @@ void Document::draw(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PainterHighQualityEnabler hq(p);
|
auto hq = PainterHighQualityEnabler(p);
|
||||||
p.setBrush(stm->msgFileBg);
|
p.setBrush(stm->msgFileBg);
|
||||||
p.drawEllipse(inner);
|
p.drawEllipse(inner);
|
||||||
|
if (hasTtlBadge) {
|
||||||
|
p.drawEllipse(ttlRect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,6 +796,9 @@ void Document::draw(
|
||||||
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
|
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
|
||||||
_animation->radial.draw(q, rinner, st::msgFileRadialLine, stm->historyFileRadialFg);
|
_animation->radial.draw(q, rinner, st::msgFileRadialLine, stm->historyFileRadialFg);
|
||||||
}
|
}
|
||||||
|
if (hasTtlBadge) {
|
||||||
|
DrawCornerBadgeTTL(q, stm->historyFileRadialFg->c, ttlRect);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if (_data->isSongWithCover() || !usesBubblePattern(context)) {
|
if (_data->isSongWithCover() || !usesBubblePattern(context)) {
|
||||||
paintContent(p);
|
paintContent(p);
|
||||||
|
@ -799,7 +807,7 @@ void Document::draw(
|
||||||
p,
|
p,
|
||||||
context.viewport,
|
context.viewport,
|
||||||
context.bubblesPattern->pixmap,
|
context.bubblesPattern->pixmap,
|
||||||
inner,
|
hasTtlBadge ? inner.united(ttlRect) : inner,
|
||||||
paintContent,
|
paintContent,
|
||||||
_iconCache);
|
_iconCache);
|
||||||
}
|
}
|
||||||
|
@ -919,13 +927,6 @@ void Document::draw(
|
||||||
.highlight = highlightRequest ? &*highlightRequest : nullptr,
|
.highlight = highlightRequest ? &*highlightRequest : nullptr,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if ((_parent->data()->media() && _parent->data()->media()->ttlSeconds())
|
|
||||||
&& _openl) {
|
|
||||||
const auto &fg = context.outbg
|
|
||||||
? st::historyFileOutIconFg
|
|
||||||
: st::historyFileInIconFg;
|
|
||||||
DrawCornerBadgeTTL(p, stm->msgFileBg, fg, inner);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ui::BubbleRounding Document::thumbRounding(
|
Ui::BubbleRounding Document::thumbRounding(
|
||||||
|
|
Loading…
Add table
Reference in a new issue