mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Slightly improved style of ttl badge in voice messages.
This commit is contained in:
parent
268613e1db
commit
c686ac8603
7 changed files with 21 additions and 32 deletions
BIN
Telegram/Resources/icons/chat/mini_media_once.png
Normal file
BIN
Telegram/Resources/icons/chat/mini_media_once.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 561 B |
BIN
Telegram/Resources/icons/chat/mini_media_once@2x.png
Normal file
BIN
Telegram/Resources/icons/chat/mini_media_once@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,011 B |
BIN
Telegram/Resources/icons/chat/mini_media_once@3x.png
Normal file
BIN
Telegram/Resources/icons/chat/mini_media_once@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -59,37 +59,6 @@ constexpr auto kAudioVoiceMsgUpdateView = crl::time(100);
|
|||
st::dialogsTTLBadgeSize);
|
||||
}
|
||||
|
||||
void DrawCornerBadgeTTL(QPainter &p, const QColor &fg, const QRect &ttlRect) {
|
||||
p.save();
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
|
||||
const auto innerRect = QRectF(ttlRect - st::dialogsTTLBadgeInnerMargins);
|
||||
const auto ttlText = u"1"_q;
|
||||
|
||||
p.setFont(st::dialogsScamFont);
|
||||
p.setPen(fg);
|
||||
p.drawText(innerRect, ttlText, style::al_center);
|
||||
|
||||
constexpr auto kPenWidth = 1.5;
|
||||
|
||||
const auto penWidth = style::ConvertScaleExact(kPenWidth);
|
||||
auto pen = QPen(fg);
|
||||
pen.setJoinStyle(Qt::RoundJoin);
|
||||
pen.setCapStyle(Qt::RoundCap);
|
||||
pen.setWidthF(penWidth);
|
||||
|
||||
p.setPen(pen);
|
||||
p.setBrush(Qt::NoBrush);
|
||||
p.drawArc(innerRect, arc::kQuarterLength, arc::kHalfLength);
|
||||
|
||||
p.setClipRect(innerRect
|
||||
- QMarginsF(innerRect.width() / 2, -penWidth, -penWidth, -penWidth));
|
||||
pen.setStyle(Qt::DotLine);
|
||||
p.setPen(pen);
|
||||
p.drawEllipse(innerRect);
|
||||
p.restore();
|
||||
}
|
||||
|
||||
[[nodiscard]] HistoryView::TtlPaintCallback CreateTtlPaintCallback(
|
||||
std::shared_ptr<rpl::lifetime> lifetime,
|
||||
Fn<void()> update) {
|
||||
|
@ -797,7 +766,15 @@ void Document::draw(
|
|||
_animation->radial.draw(q, rinner, st::msgFileRadialLine, stm->historyFileRadialFg);
|
||||
}
|
||||
if (hasTtlBadge) {
|
||||
DrawCornerBadgeTTL(q, stm->historyFileRadialFg->c, ttlRect);
|
||||
{
|
||||
auto hq = PainterHighQualityEnabler(q);
|
||||
auto pen = stm->msgBg->p;
|
||||
pen.setWidthF(style::ConvertScaleExact(1.5));
|
||||
q.setPen(pen);
|
||||
q.setBrush(Qt::NoBrush);
|
||||
q.drawEllipse(ttlRect);
|
||||
}
|
||||
stm->historyVoiceMessageTTL.paintInCenter(q, ttlRect);
|
||||
}
|
||||
};
|
||||
if (_data->isSongWithCover() || !usesBubblePattern(context)) {
|
||||
|
|
|
@ -513,6 +513,11 @@ msgWaveformSkip: 1px;
|
|||
msgWaveformMin: 3px;
|
||||
msgWaveformMax: 17px;
|
||||
|
||||
historyVoiceMessageInTTL: icon {{ "chat/mini_media_once", historyFileInIconFg }};
|
||||
historyVoiceMessageInTTLSelected: icon {{ "chat/mini_media_once", historyFileInIconFgSelected }};
|
||||
historyVoiceMessageOutTTL: icon {{ "chat/mini_media_once", historyFileOutIconFg }};
|
||||
historyVoiceMessageOutTTLSelected: icon {{ "chat/mini_media_once", historyFileOutIconFgSelected }};
|
||||
|
||||
historyTranscribeSkip: 10px;
|
||||
historyTranscribeSize: size(28px, 22px);
|
||||
historyTranscribeRadius: 4px;
|
||||
|
|
|
@ -536,6 +536,12 @@ ChatStyle::ChatStyle(rpl::producer<ColorIndicesCompressed> colorIndices) {
|
|||
&MessageImageStyle::historyPageEnlarge,
|
||||
st::historyPageEnlarge,
|
||||
st::historyPageEnlargeSelected);
|
||||
make(
|
||||
&MessageStyle::historyVoiceMessageTTL,
|
||||
st::historyVoiceMessageInTTL,
|
||||
st::historyVoiceMessageInTTLSelected,
|
||||
st::historyVoiceMessageOutTTL,
|
||||
st::historyVoiceMessageOutTTLSelected);
|
||||
|
||||
updateDarkValue();
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ struct MessageStyle {
|
|||
style::icon historyTranscribeIcon = { Qt::Uninitialized };
|
||||
style::icon historyTranscribeLock = { Qt::Uninitialized };
|
||||
style::icon historyTranscribeHide = { Qt::Uninitialized };
|
||||
style::icon historyVoiceMessageTTL = { Qt::Uninitialized };
|
||||
std::array<
|
||||
std::unique_ptr<Text::QuotePaintCache>,
|
||||
kColorPatternsCount> quoteCache;
|
||||
|
|
Loading…
Add table
Reference in a new issue