diff --git a/Telegram/Resources/icons/replies_userpic.png b/Telegram/Resources/icons/replies_userpic.png new file mode 100644 index 0000000000..88d5e84192 Binary files /dev/null and b/Telegram/Resources/icons/replies_userpic.png differ diff --git a/Telegram/Resources/icons/replies_userpic@2x.png b/Telegram/Resources/icons/replies_userpic@2x.png new file mode 100644 index 0000000000..a9d00481fb Binary files /dev/null and b/Telegram/Resources/icons/replies_userpic@2x.png differ diff --git a/Telegram/Resources/icons/replies_userpic@3x.png b/Telegram/Resources/icons/replies_userpic@3x.png new file mode 100644 index 0000000000..a0a8a1b0f5 Binary files /dev/null and b/Telegram/Resources/icons/replies_userpic@3x.png differ diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 52e1bcdf33..0ac70fd9fa 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1357,7 +1357,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_comments_open_count#one" = "{count} comment"; "lng_comments_open_count#other" = "{count} comments"; "lng_comments_open_none" = "Leave a comment"; -"lng_replies_view_original" = "View reply"; +"lng_replies_view_original" = "View in chat"; "lng_replies_messages" = "Replies"; "lng_archived_name" = "Archived chats"; diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 8ec8e0fff8..a9dcfc89d6 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -191,6 +191,7 @@ dialogsBotIconActive: icon {{ "dialogs_bot", dialogsChatIconFgActive, point(1px, //dialogsFeedIconOver: icon {{ "dialogs_feed", dialogsChatIconFgOver, point(4px, 4px) }}; //dialogsFeedIconActive: icon {{ "dialogs_feed", dialogsChatIconFgActive, point(4px, 4px) }}; dialogsArchiveUserpic: icon {{ "archive_userpic", historyPeerUserpicFg }}; +dialogsRepliesUserpic: icon {{ "replies_userpic", historyPeerUserpicFg }}; dialogsSendStateSkip: 20px; dialogsSendingIcon: icon {{ "dialogs_sending", dialogsSendingIconFg, point(8px, 4px) }}; diff --git a/Telegram/SourceFiles/ui/empty_userpic.cpp b/Telegram/SourceFiles/ui/empty_userpic.cpp index 8db3cf24f2..ba07e0cc2d 100644 --- a/Telegram/SourceFiles/ui/empty_userpic.cpp +++ b/Telegram/SourceFiles/ui/empty_userpic.cpp @@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/effects/animation_value.h" #include "app.h" #include "styles/style_history.h" +#include "styles/style_dialogs.h" namespace Ui { namespace { @@ -98,66 +99,24 @@ void PaintRepliesMessagesInner( int size, const style::color &bg, const style::color &fg) { - // |<---width--->| - // - // X --- - // XX | - // X X | - // X XXXXXXX | - // X XX height - // X XXXXX X | - // X X XXX X | - // XX XXX | - // X X --- - - const auto thinkness = std::round(size * 0.055); - const auto increment = int(thinkness) % 2 + (size % 2); - const auto width = std::round(size * 0.2) * 2 + increment; - const auto arrow = std::round(width * 27. / 57.); - const auto height = 2 * arrow; - const auto tail = std::round(height / 5.); - const auto add = std::round(size * 0.064); - - const auto left = x + (size - width) / 2; - const auto top = y + (size - height) / 2; - const auto right = left + width; - const auto bottom = top + height; - const auto middle = (left + arrow); - const auto half = (top + bottom) / 2; - const auto tailtop = half - tail; - const auto tailbottom = half + tail; - const auto starttop = (top + tailtop) / 2; - - const auto bottomcsize = (bottom - tailbottom); - const auto bottomc1x = middle + bottomcsize; - const auto bottomc1y = tailbottom; - const auto bottomc2x = right - bottomcsize / 1.42; - const auto bottomc2y = bottom - bottomcsize / 1.42; - - const auto topcsize = (bottom - tailbottom) * 1.5; - const auto topc1x = middle + topcsize; - const auto topc1y = tailtop; - const auto topc2x = right; - const auto topc2y = bottom - topcsize; - - p.setBrush(Qt::NoBrush); - auto pen = fg->p; - pen.setWidthF(thinkness); - pen.setCapStyle(Qt::FlatCap); - - { - pen.setJoinStyle(Qt::MiterJoin); - p.setPen(pen); - QPainterPath path; - path.moveTo(middle, starttop); - path.lineTo(middle, top); - path.lineTo(left, half); - path.lineTo(middle, bottom); - path.lineTo(middle, tailbottom); - path.cubicTo(bottomc1x, bottomc1y, bottomc2x, bottomc2y, right, bottom); - path.cubicTo(topc2x, topc2y, topc1x, topc1y, middle, tailtop); - path.lineTo(middle, starttop); - p.drawPath(path); + if (size == st::dialogsPhotoSize) { + const auto rect = QRect{ x, y, size, size }; + st::dialogsRepliesUserpic.paintInCenter( + p, + rect, + fg->c); + } else { + p.save(); + const auto ratio = size / float64(st::dialogsPhotoSize); + p.translate(x + size / 2., y + size / 2.); + p.scale(ratio, ratio); + const auto skip = st::dialogsPhotoSize; + const auto rect = QRect{ -skip, -skip, 2 * skip, 2 * skip }; + st::dialogsRepliesUserpic.paintInCenter( + p, + rect, + fg->c); + p.restore(); } }