diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.cpp b/Telegram/SourceFiles/dialogs/dialogs_row.cpp index 1bad0727ea176c..54ed560e802515 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_row.cpp @@ -7,6 +7,8 @@ For license and copyright information please follow this link: */ #include "dialogs/dialogs_row.h" +#include "rabbit/settings/rabbit_settings.h" + #include "ui/chat/chat_theme.h" // CountAverageColor. #include "ui/color_contrast.h" #include "ui/effects/outline_segments.h" @@ -308,11 +310,14 @@ void Row::updateCornerBadgeShown( } else if (peer->isChannel() && Data::ChannelHasActiveCall(peer->asChannel())) { return kTopLayer; + } else if (!peer->isForum() && (peer->isChat() || peer->isMegagroup()) && RabbitSettings::JsonSettings::GetBool("show_sender_userpic")){ + return kTopLayer; } else if (peer->messagesTTL()) { return kBottomLayer; } return kNoneLayer; }(); + const_cast(this)->_hasVideoCall = peer->isChannel() && Data::ChannelHasActiveCall(peer->asChannel()); setCornerBadgeShown(nextLayer, std::move(updateCallback)); if ((nextLayer == kTopLayer) && user) { peer->owner().watchForOffline(user, now); @@ -427,16 +432,41 @@ void Row::PaintCornerBadgeFrame( q.setBrush(data->active ? st::dialogsOnlineBadgeFgActive : st::dialogsOnlineBadgeFg); - q.drawEllipse(QRectF( - 46 - size - - (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 100 - ? skip.x() : -(stroke / 2)), - 46 - size - - (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 100 - ? skip.y() : -(stroke / 2)), - size, - size - ).marginsRemoved({ shrink, shrink, shrink, shrink })); + if ((peer->isChannel() && Data::ChannelHasActiveCall(peer->asChannel())) || online) { + if (!RabbitSettings::JsonSettings::GetBool("general_roundness")) { + q.drawEllipse( + QRectF( + (46 - size - + (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 + ? skip.x() + : -(stroke / 2))), + (46 - size - + (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 + ? skip.y() + : -(stroke / 2))), + size, + size + ).marginsRemoved({ shrink, shrink, shrink, shrink }) + ); + } else { + q.drawRoundedRect( + QRectF( + (46 - size - + (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 + ? skip.x() + : -(stroke / 2))), + (46 - size - + (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 + ? skip.y() + : -(stroke / 2))), + size, + size + ).marginsRemoved({ shrink, shrink, shrink, shrink }), + size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100, + size * RabbitSettings::JsonSettings::GetInt("userpic_roundness") / 100 + ); + } + } } void Row::paintUserpic( @@ -555,15 +585,19 @@ void Row::paintUserpic( p.setOpacity( _cornerBadgeUserpic->layersManager.progressForLayer(kTopLayer)); p.translate(context.st->padding.left(), context.st->padding.top()); - actionPainter->paintSpeaking( - p, - context.st->photoSize - size - (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 - ? skip.x() : -(stroke / 2)), - context.st->photoSize - size - (RabbitSettings::JsonSettings::GetInt("userpic_roundness") == 50 - ? skip.y() : -(stroke / 2)), - context.width, - bg, - context.now); + if(_hasVideoCall){ + actionPainter->paintSpeaking( + p, + context.st->photoSize - skip.x() - size, + context.st->photoSize - skip.y() - size, + context.width, + bg, + context.now); + } + else { + const auto lastMessageFrom = history->lastMessage()->from(); + lastMessageFrom->paintUserpic(p, userpicCornerView(), context.st->photoSize - skip.x() - size, context.st->photoSize - skip.y() - size, size); + } p.translate(-context.st->padding.left(), -context.st->padding.top()); p.setOpacity(1.); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_row.h b/Telegram/SourceFiles/dialogs/dialogs_row.h index 62f109fb54a1a8..13e3709049944f 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_row.h +++ b/Telegram/SourceFiles/dialogs/dialogs_row.h @@ -71,9 +71,13 @@ class BasicRow { [[nodiscard]] Ui::PeerUserpicView &userpicView() const { return _userpic; } + [[nodiscard]] Ui::PeerUserpicView &userpicCornerView() const { + return _userpicCorner; + } private: mutable Ui::PeerUserpicView _userpic; + mutable Ui::PeerUserpicView _userpicCorner; mutable std::unique_ptr _ripple; }; @@ -201,6 +205,7 @@ class Row final : public BasicRow { uint32 _index : 30 = 0; uint32 _cornerBadgeShown : 1 = 0; uint32 _topicJumpRipple : 1 = 0; + uint32 _hasVideoCall : 1 = 0; }; diff --git a/Telegram/SourceFiles/rabbit/settings/rabbit_settings.cpp b/Telegram/SourceFiles/rabbit/settings/rabbit_settings.cpp index 684dd0f15bffd3..3215ce94adc8d1 100644 --- a/Telegram/SourceFiles/rabbit/settings/rabbit_settings.cpp +++ b/Telegram/SourceFiles/rabbit/settings/rabbit_settings.cpp @@ -279,6 +279,9 @@ const std::map> DefinitionMap { { "show_seconds", { .type = SettingType::BoolSetting, .defaultValue = false, }}, + { "show_sender_userpic", { + .type = SettingType::BoolSetting, + .defaultValue = false, }}, { "comma_after_mention", { .type = SettingType::BoolSetting, .defaultValue = false, }}, diff --git a/Telegram/SourceFiles/rabbit/settings_menu/rabbit_settings_menu.cpp b/Telegram/SourceFiles/rabbit/settings_menu/rabbit_settings_menu.cpp index 1439d82c05925b..a892f5488495d0 100644 --- a/Telegram/SourceFiles/rabbit/settings_menu/rabbit_settings_menu.cpp +++ b/Telegram/SourceFiles/rabbit/settings_menu/rabbit_settings_menu.cpp @@ -264,6 +264,21 @@ namespace Settings { ::RabbitSettings::JsonSettings::Set("show_seconds", enabled); ::RabbitSettings::JsonSettings::Write(); }, container->lifetime()); + + AddButtonWithIcon( + container, + rktr("rtg_profile_mention_user"), + st::settingsButton, + IconDescriptor{ &st::menuIconDockBounce } + )->toggleOn( + rpl::single(::RabbitSettings::JsonSettings::GetBool("show_sender_userpic")) + )->toggledValue( + ) | rpl::filter([](bool enabled) { + return (enabled != ::RabbitSettings::JsonSettings::GetBool("show_sender_userpic")); + }) | rpl::start_with_next([](bool enabled) { + ::RabbitSettings::JsonSettings::Set("show_sender_userpic", enabled); + ::RabbitSettings::JsonSettings::Write(); + }, container->lifetime()); SettingsMenuJsonSwitch(rtg_settings_comma_after_mention, comma_after_mention); } diff --git a/Telegram/build/setup.iss b/Telegram/build/setup.iss index e7c2e764bea33c..dc82ee27fb49bf 100644 --- a/Telegram/build/setup.iss +++ b/Telegram/build/setup.iss @@ -8,7 +8,7 @@ #define MyAppId "4356CE01-4137-4C55-9F8B-FB4EEBB6EC0C" #define CurrentYear GetDateTimeString('yyyy','','') #define MyBuildTarget "win64" -#define MyAppVersionFull "4.15-24022024" +#define MyAppVersionFull "4.15-25022024" [Setup] ; NOTE: The value of AppId uniquely identifies this application.