From de0f768e7f324f925ee8270278e24982e7dbb612 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 22 Jan 2026 21:00:43 +0300 Subject: [PATCH] Added new type to widget for userpics transfer. --- .../boxes/peers/replace_boost_box.cpp | 42 +++++++++++++++---- .../boxes/peers/replace_boost_box.h | 1 + 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp index 592e225f83..b63d5b9c1b 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.cpp @@ -593,10 +593,25 @@ object_ptr CreateUserpicsTransfer( const auto raw = result.data(); const auto right = CreateChild(raw, to, st->button); const auto overlay = CreateChild(raw); + const auto drawCornerPeer = (type == Type::ChannelFutureOwner) + ? [&]() -> PaintRoundImageCallback { + using Peers = std::vector>; + const auto snapshot = rpl::variable( + rpl::duplicate(from)).current(); + if (snapshot.size() == 2) { + return ForceRoundUserpicCallback(snapshot[1].get()); + } + return nullptr; + }() + : (PaintRoundImageCallback)(nullptr); const auto state = raw->lifetime().make_state(); - std::move( - from + ((type == Type::ChannelFutureOwner) + ? std::move(from) | rpl::map([=]( + const std::vector> &list) { + return std::vector>{ list.front() }; + }) + : std::move(from) ) | rpl::on_next([=]( const std::vector> &list) { auto was = base::take(state->from); @@ -662,7 +677,7 @@ object_ptr CreateUserpicsTransfer( } state->layer.fill(Qt::transparent); - auto q = QPainter(&state->layer); + auto q = Painter(&state->layer); auto hq = PainterHighQualityEnabler(q); const auto stroke = st->stroke; const auto half = stroke / 2.; @@ -691,13 +706,24 @@ object_ptr CreateUserpicsTransfer( const auto x = back->x() + back->width() - w + add.x(); const auto y = back->y() + back->height() - h + add.y(); - auto brush = QLinearGradient(QPointF(x + w, y + h), QPointF(x, y)); - brush.setStops(Ui::Premium::ButtonGradientStops()); - q.setBrush(brush); - pen.setWidthF(stroke); + pen.setWidthF(drawCornerPeer ? stroke * 2 : stroke); q.setPen(pen); q.drawEllipse(x - half, y - half, w + stroke, h + stroke); - icon.paint(q, x + skip, y + skip, outerw); + if (drawCornerPeer) { + drawCornerPeer( + q, + x - half, + y - half, + w + stroke, + w + stroke); + } else { + auto brush = QLinearGradient( + QPointF(x + w, y + h), + QPointF(x, y)); + brush.setStops(Ui::Premium::ButtonGradientStops()); + q.setBrush(brush); + icon.paint(q, x + skip, y + skip, outerw); + } } const auto size = st::boostReplaceArrow.size(); st::boostReplaceArrow.paint( diff --git a/Telegram/SourceFiles/boxes/peers/replace_boost_box.h b/Telegram/SourceFiles/boxes/peers/replace_boost_box.h index 1ad668ac81..2755dd5c71 100644 --- a/Telegram/SourceFiles/boxes/peers/replace_boost_box.h +++ b/Telegram/SourceFiles/boxes/peers/replace_boost_box.h @@ -65,6 +65,7 @@ enum class UserpicsTransferType { BoostReplace, StarRefJoin, AuctionRecipient, + ChannelFutureOwner, }; [[nodiscard]] object_ptr CreateUserpicsTransfer( not_null parent,