2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 14:08:41 +00:00

Slightly improved box for writing captions to be more generic.

This commit is contained in:
23rd
2025-05-22 15:44:09 +03:00
parent 0e44de2fe3
commit 5b9e24f3f4
2 changed files with 22 additions and 9 deletions

View File

@@ -226,9 +226,8 @@ namespace {
} // namespace } // namespace
void SendGifWithCaptionBox( void CaptionBox(
not_null<Ui::GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document,
not_null<PeerData*> peer, not_null<PeerData*> peer,
const SendMenu::Details &details, const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> done) { Fn<void(Api::SendOptions, TextWithTags)> done) {
@@ -237,17 +236,10 @@ void SendGifWithCaptionBox(
if (!controller) { if (!controller) {
return; return;
} }
box->setTitle(tr::lng_send_gif_with_caption());
box->setWidth(st::boxWidth); box->setWidth(st::boxWidth);
box->getDelegate()->setStyle(st::sendGifBox); box->getDelegate()->setStyle(st::sendGifBox);
const auto container = box->verticalLayout(); const auto container = box->verticalLayout();
[[maybe_unused]] const auto gifWidget = AddGifWidget(
container,
document,
st::boxWidth);
Ui::AddSkip(container);
const auto input = AddInputField(box, controller); const auto input = AddInputField(box, controller);
box->setFocusCallback([=] { box->setFocusCallback([=] {
@@ -339,4 +331,19 @@ void SendGifWithCaptionBox(
) | rpl::start_with_next([=] { send({}); }, input->lifetime()); ) | rpl::start_with_next([=] { send({}); }, input->lifetime());
} }
void SendGifWithCaptionBox(
not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document,
not_null<PeerData*> peer,
const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> 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 } // namespace Ui

View File

@@ -22,6 +22,12 @@ namespace Ui {
class GenericBox; class GenericBox;
void CaptionBox(
not_null<Ui::GenericBox*> box,
not_null<PeerData*> peer,
const SendMenu::Details &details,
Fn<void(Api::SendOptions, TextWithTags)> done);
void SendGifWithCaptionBox( void SendGifWithCaptionBox(
not_null<Ui::GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<DocumentData*> document, not_null<DocumentData*> document,