diff --git a/Telegram/Resources/icons/chat/mini_media_once.png b/Telegram/Resources/icons/chat/mini_media_once.png new file mode 100644 index 000000000..8984491b7 Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_media_once.png differ diff --git a/Telegram/Resources/icons/chat/mini_media_once@2x.png b/Telegram/Resources/icons/chat/mini_media_once@2x.png new file mode 100644 index 000000000..f8514d3af Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_media_once@2x.png differ diff --git a/Telegram/Resources/icons/chat/mini_media_once@3x.png b/Telegram/Resources/icons/chat/mini_media_once@3x.png new file mode 100644 index 000000000..3900061be Binary files /dev/null and b/Telegram/Resources/icons/chat/mini_media_once@3x.png differ diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index cf5560009..f6e60f877 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -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 lifetime, Fn 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)) { diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 378393643..1b463cf50 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -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; diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index 4acf416ba..88f5ddd38 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -536,6 +536,12 @@ ChatStyle::ChatStyle(rpl::producer colorIndices) { &MessageImageStyle::historyPageEnlarge, st::historyPageEnlarge, st::historyPageEnlargeSelected); + make( + &MessageStyle::historyVoiceMessageTTL, + st::historyVoiceMessageInTTL, + st::historyVoiceMessageInTTLSelected, + st::historyVoiceMessageOutTTL, + st::historyVoiceMessageOutTTLSelected); updateDarkValue(); } diff --git a/Telegram/SourceFiles/ui/chat/chat_style.h b/Telegram/SourceFiles/ui/chat/chat_style.h index 11890a061..dca47f0f8 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.h +++ b/Telegram/SourceFiles/ui/chat/chat_style.h @@ -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, kColorPatternsCount> quoteCache;