mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
[ttl-media] Added single view badge to covered bubbles.
This commit is contained in:
@@ -805,6 +805,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
|
||||
st::msgFileRadialLine,
|
||||
sti->historyFileThumbRadialFg,
|
||||
context.paused);
|
||||
PaintTtlSingleViewBadge(p, inner, _realParent, context);
|
||||
} else if (icon) {
|
||||
icon->paintInCenter(p, inner);
|
||||
}
|
||||
|
||||
@@ -184,6 +184,31 @@ void PaintTtlLabel(
|
||||
p.drawTextLeft(left, top, outerWidth, text, width - 2 * padding.x());
|
||||
}
|
||||
|
||||
void PaintTtlSingleViewBadge(
|
||||
QPainter &p,
|
||||
QRect inner,
|
||||
not_null<HistoryItem*> item,
|
||||
const Ui::ChatPaintContext &context) {
|
||||
const auto media = item->media();
|
||||
if (!media || !media->ttlSecondsSingleView()) {
|
||||
return;
|
||||
}
|
||||
const auto sti = context.imageStyle();
|
||||
const auto &icon = sti->historyVideoMessageTtlIcon;
|
||||
const auto rect = QRect(
|
||||
rect::right(inner) - (icon.width() * 3 / 4),
|
||||
rect::bottom(inner) - (icon.height() * 3 / 4),
|
||||
icon.width(),
|
||||
icon.height());
|
||||
{
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
p.setPen(Qt::NoPen);
|
||||
p.setBrush(sti->msgDateImgBg);
|
||||
p.drawEllipse(rect);
|
||||
}
|
||||
icon.paintInCenter(p, rect);
|
||||
}
|
||||
|
||||
std::unique_ptr<Media> CreateAttach(
|
||||
not_null<Element*> parent,
|
||||
DocumentData *document,
|
||||
|
||||
@@ -63,6 +63,12 @@ void PaintTtlLabel(
|
||||
not_null<HistoryItem*> item,
|
||||
const Ui::ChatPaintContext &context);
|
||||
|
||||
void PaintTtlSingleViewBadge(
|
||||
QPainter &p,
|
||||
QRect inner,
|
||||
not_null<HistoryItem*> item,
|
||||
const Ui::ChatPaintContext &context);
|
||||
|
||||
[[nodiscard]] std::unique_ptr<Media> CreateAttach(
|
||||
not_null<Element*> parent,
|
||||
DocumentData *document,
|
||||
|
||||
@@ -439,6 +439,7 @@ void Photo::draw(Painter &p, const PaintContext &context) const {
|
||||
sti->historyFileThumbCancel.paintInCenter(p, inner);
|
||||
} else if (ttlCovered) {
|
||||
paintTtlFire(p, inner);
|
||||
PaintTtlSingleViewBadge(p, inner, _realParent, context);
|
||||
} else {
|
||||
sti->historyFileThumbDownload.paintInCenter(p, inner);
|
||||
}
|
||||
@@ -919,6 +920,7 @@ void Photo::drawGrouped(
|
||||
&& !_data->waitingForAlbum();
|
||||
if (ttlIdle) {
|
||||
paintTtlFire(p, inner);
|
||||
PaintTtlSingleViewBadge(p, inner, _realParent, context);
|
||||
} else if (previous && radialOpacity > 0. && radialOpacity < 1.) {
|
||||
PaintInterpolatedIcon(p, icon, *previous, radialOpacity, inner);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user