From 5b9e24f3f4ba34662a29b858c775afd0f2a88f3c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Thu, 22 May 2025 15:44:09 +0300 Subject: [PATCH] Slightly improved box for writing captions to be more generic. --- .../boxes/send_gif_with_caption_box.cpp | 25 ++++++++++++------- .../boxes/send_gif_with_caption_box.h | 6 +++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp index b271028766..310f8fbd8e 100644 --- a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.cpp @@ -226,9 +226,8 @@ namespace { } // namespace -void SendGifWithCaptionBox( +void CaptionBox( not_null box, - not_null document, not_null peer, const SendMenu::Details &details, Fn done) { @@ -237,17 +236,10 @@ void SendGifWithCaptionBox( if (!controller) { return; } - box->setTitle(tr::lng_send_gif_with_caption()); box->setWidth(st::boxWidth); box->getDelegate()->setStyle(st::sendGifBox); const auto container = box->verticalLayout(); - [[maybe_unused]] const auto gifWidget = AddGifWidget( - container, - document, - st::boxWidth); - - Ui::AddSkip(container); const auto input = AddInputField(box, controller); box->setFocusCallback([=] { @@ -339,4 +331,19 @@ void SendGifWithCaptionBox( ) | rpl::start_with_next([=] { send({}); }, input->lifetime()); } +void SendGifWithCaptionBox( + not_null box, + not_null document, + not_null peer, + const SendMenu::Details &details, + Fn done) { + box->setTitle(tr::lng_send_gif_with_caption()); + [[maybe_unused]] const auto gifWidget = AddGifWidget( + box->verticalLayout(), + document, + st::boxWidth); + Ui::AddSkip(box->verticalLayout()); + CaptionBox(box, peer, details, std::move(done)); +} + } // namespace Ui diff --git a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.h b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.h index 0247cf5e3d..74f6594b59 100644 --- a/Telegram/SourceFiles/boxes/send_gif_with_caption_box.h +++ b/Telegram/SourceFiles/boxes/send_gif_with_caption_box.h @@ -22,6 +22,12 @@ namespace Ui { class GenericBox; +void CaptionBox( + not_null box, + not_null peer, + const SendMenu::Details &details, + Fn done); + void SendGifWithCaptionBox( not_null box, not_null document,