diff --git a/Telegram/Resources/icons/ayu/channel.png b/Telegram/Resources/icons/ayu/channel.png new file mode 100644 index 000000000..00c56934e Binary files /dev/null and b/Telegram/Resources/icons/ayu/channel.png differ diff --git a/Telegram/Resources/icons/ayu/channel@2x.png b/Telegram/Resources/icons/ayu/channel@2x.png new file mode 100644 index 000000000..b104817e0 Binary files /dev/null and b/Telegram/Resources/icons/ayu/channel@2x.png differ diff --git a/Telegram/Resources/icons/ayu/channel@3x.png b/Telegram/Resources/icons/ayu/channel@3x.png new file mode 100644 index 000000000..756b3d38e Binary files /dev/null and b/Telegram/Resources/icons/ayu/channel@3x.png differ diff --git a/Telegram/SourceFiles/ayu/ui/ayu_icons.style b/Telegram/SourceFiles/ayu/ui/ayu_icons.style index 59199295b..1d82087e1 100644 --- a/Telegram/SourceFiles/ayu/ui/ayu_icons.style +++ b/Telegram/SourceFiles/ayu/ui/ayu_icons.style @@ -17,4 +17,9 @@ ayuLReadMenuIcon: icon {{ "ayu/lread", menuIconColor }}; ayuSReadMenuIcon: icon {{ "ayu/sread", menuIconColor }}; ayuStreamerModeMenuIcon: icon {{ "ayu/streamer", menuIconColor }}; +inChannelBadgeIcon: icon {{ "ayu/channel", msgInDateFg }}; +inChannelBadgeSelectedIcon: icon {{ "ayu/channel", msgInDateFgSelected }}; +outChannelBadgeIcon: icon {{ "ayu/channel", msgOutDateFg }}; +outChannelBadgeSelectedIcon: icon {{ "ayu/channel", msgOutDateFgSelected }}; + infoExteraBadge: icon {{ "ayu/exterabadge", profileVerifiedCheckBg }}; diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 5ee5599b0..8012e7822 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -46,6 +46,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/features/messageshot/message_shot.h" +#include "styles/style_ayu_icons.h" namespace HistoryView { @@ -468,6 +469,8 @@ void Message::refreshRightBadge() { Assert(msgsigned->isAnonymousRank); return msgsigned->postAuthor; } + } else if (data()->history()->peer->isMegagroup() && data()->author()->isChannel() && !data()->out()) { + return tr::lng_channel_badge(tr::now); } const auto channel = data()->history()->peer->asMegagroup(); const auto user = data()->author()->asUser(); @@ -773,7 +776,8 @@ QSize Message::performCountOptimalSize() { ? st::msgFont->width(FastReplyText()) : 0; if (!_rightBadge.isEmpty()) { - const auto badgeWidth = _rightBadge.maxWidth(); + const auto badgeWidth = + _rightBadge.toString() == tr::lng_channel_badge(tr::now) ? st::inChannelBadgeIcon.width() : _rightBadge.maxWidth(); namew += st::msgPadding.right() + std::max(badgeWidth, replyWidth); } else if (replyWidth) { @@ -1399,7 +1403,8 @@ void Message::paintFromName( if (!displayFromName()) { return; } - const auto badgeWidth = _rightBadge.isEmpty() ? 0 : _rightBadge.maxWidth(); + const auto badgeWidth = _rightBadge.isEmpty() ? 0 : + _rightBadge.toString() == tr::lng_channel_badge(tr::now) ? context.messageStyle()->channelBadgeIcon.width() : _rightBadge.maxWidth(); const auto replyWidth = [&] { if (isUnderCursor() && displayFastReply()) { return st::msgFont->width(FastReplyText()); @@ -1499,11 +1504,19 @@ void Message::paintFromName( trect.top() + st::msgFont->ascent, FastReplyText()); } else { - _rightBadge.draw( - p, - trect.left() + trect.width() - rightWidth, - trect.top(), - rightWidth); + if (_rightBadge.toString() == tr::lng_channel_badge(tr::now)) { + stm->channelBadgeIcon.paint( + p, + trect.left() + trect.width() - rightWidth, + trect.top() + (_rightBadge.minHeight() - stm->channelBadgeIcon.height()) / 2, + rightWidth); + } else { + _rightBadge.draw( + p, + trect.left() + trect.width() - rightWidth, + trect.top(), + rightWidth); + } } } trect.setY(trect.y() + st::msgNameFont->height); diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index 777818484..2aead249a 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL // AyuGram includes #include "ayu/ayu_settings.h" +#include "styles/style_ayu_icons.h" namespace Ui { @@ -322,6 +323,14 @@ ChatStyle::ChatStyle(rpl::producer colorIndices) { st::historyBubbleTailInRightSelected, st::historyBubbleTailOutRight, st::historyBubbleTailOutRightSelected); + + make( + &MessageStyle::channelBadgeIcon, + st::inChannelBadgeIcon, + st::inChannelBadgeSelectedIcon, + st::outChannelBadgeIcon, + st::outChannelBadgeSelectedIcon); + make( &MessageStyle::historyRepliesIcon, st::historyRepliesInIcon, diff --git a/Telegram/SourceFiles/ui/chat/chat_style.h b/Telegram/SourceFiles/ui/chat/chat_style.h index dca47f0f8..96cbcd8b8 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.h +++ b/Telegram/SourceFiles/ui/chat/chat_style.h @@ -61,6 +61,9 @@ struct MessageStyle { style::TextPalette semiboldPalette; style::TextPalette fwdTextPalette; style::TextPalette replyTextPalette; + + style::icon channelBadgeIcon = { Qt::Uninitialized }; + style::icon tailLeft = { Qt::Uninitialized }; style::icon tailRight = { Qt::Uninitialized }; style::icon historyRepliesIcon = { Qt::Uninitialized };