Remove AddFullWidthButton helper.

This commit is contained in:
John Preston
2025-12-16 13:11:37 +04:00
parent 1ea2d936b5
commit 9496ebd19e
4 changed files with 8 additions and 47 deletions
@@ -223,18 +223,13 @@ void ConferenceCallJoinConfirm(
style::al_top
)->setTryMakeSimilarLines(true);
}
const auto joinAndClose = [=] {
box->addButton(tr::lng_confcall_join_button(), [=] {
join([weak = base::make_weak(box)] {
if (const auto strong = weak.get()) {
strong->closeBox();
}
});
};
Info::BotStarRef::AddFullWidthButton(
box,
tr::lng_confcall_join_button(),
joinAndClose,
&st::confcallLinkButton);
});
}
ConferenceCallLinkStyleOverrides DarkConferenceCallLinkStyle() {
@@ -340,34 +340,6 @@ not_null<Ui::AbstractButton*> AddViewListButton(
return button;
}
not_null<Ui::RoundButton*> AddFullWidthButton(
not_null<Ui::BoxContent*> box,
rpl::producer<QString> text,
Fn<void()> callback,
const style::RoundButton *stOverride) {
const auto &boxSt = box->getDelegate()->style();
const auto result = box->addButton(
std::move(text),
std::move(callback),
stOverride ? *stOverride : boxSt.button);
rpl::combine(
box->widthValue(),
result->widthValue()
) | rpl::on_next([=](int width, int buttonWidth) {
const auto correct = width
- boxSt.buttonPadding.left()
- boxSt.buttonPadding.right();
if (correct > 0 && buttonWidth != correct) {
result->resizeToWidth(correct);
result->moveToLeft(
boxSt.buttonPadding.left(),
boxSt.buttonPadding.top(),
width);
}
}, result->lifetime());
return result;
}
void AddFullWidthButtonFooter(
not_null<Ui::BoxContent*> box,
not_null<Ui::RpWidget*> button,
@@ -494,11 +466,11 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
};
};
preview->setClickedCallback(copy(false));
const auto button = AddFullWidthButton(
box,
const auto button = box->addButton(
tr::lng_star_ref_link_copy(),
copy(true),
&st::starrefCopyButton);
[=] { copy(true); },
st::starrefCopyButton);
const auto name = TextWithEntities{ bot->name() };
AddFullWidthButtonFooter(
box,
@@ -712,8 +684,7 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
show->showToast(u"Failed: "_q + error);
});
};
const auto button = AddFullWidthButton(
box,
const auto button = box->addButton(
tr::lng_star_ref_one_join(),
send);
AddFullWidthButtonFooter(
@@ -55,12 +55,6 @@ using ConnectedBots = std::vector<ConnectedBot>;
rpl::producer<QString> subtitle,
bool newBadge = false);
not_null<Ui::RoundButton*> AddFullWidthButton(
not_null<Ui::BoxContent*> box,
rpl::producer<QString> text,
Fn<void()> callback = nullptr,
const style::RoundButton *stOverride = nullptr);
void AddFullWidthButtonFooter(
not_null<Ui::BoxContent*> box,
not_null<Ui::RpWidget*> button,
@@ -494,6 +494,7 @@ starrefFooterButton: RoundButton(defaultActiveButton) {
starrefFooterBox: Box(defaultBox) {
buttonPadding: margins(22px, 11px, 22px, 54px);
buttonHeight: 42px;
buttonWide: true;
button: starrefFooterButton;
shadowIgnoreTopSkip: true;
}