2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-29 13:39:06 +00:00

Attempt to fix the naturalWidth feature.

This commit is contained in:
John Preston 2025-08-11 19:25:01 +04:00
parent c939eda7bb
commit b2fb2d5821
42 changed files with 414 additions and 388 deletions

View File

@ -215,15 +215,13 @@ void ConfirmSubscriptionBox(
2.); 2.);
box->addRow( box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_channel_invite_subscription_title(), tr::lng_channel_invite_subscription_title(),
st::inviteLinkSubscribeBoxTitle))); st::inviteLinkSubscribeBoxTitle),
st::boxRowPadding,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_channel_invite_subscription_about( tr::lng_channel_invite_subscription_about(
@ -235,11 +233,11 @@ void ConfirmSubscriptionBox(
rpl::single(amount) | tr::to_count(), rpl::single(amount) | tr::to_count(),
Ui::Text::Bold), Ui::Text::Bold),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::inviteLinkSubscribeBoxAbout))); st::inviteLinkSubscribeBoxAbout),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow( box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_channel_invite_subscription_terms( tr::lng_channel_invite_subscription_terms(
@ -251,7 +249,9 @@ void ConfirmSubscriptionBox(
return Ui::Text::Link(text, url); return Ui::Text::Link(text, url);
}), }),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
st::inviteLinkSubscribeBoxTerms))); st::inviteLinkSubscribeBoxTerms),
st::boxRowPadding,
style::al_top);
{ {
const auto balance = Settings::AddBalanceWidget( const auto balance = Settings::AddBalanceWidget(

View File

@ -538,8 +538,6 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
const auto isStatic = _filterTitle.isStatic; const auto isStatic = _filterTitle.isStatic;
verticalLayout->add( verticalLayout->add(
object_ptr<Ui::CenterWrap<>>(
verticalLayout,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
verticalLayout, verticalLayout,
(_data.url.isEmpty() (_data.url.isEmpty()
@ -555,8 +553,9 @@ void LinkController::addHeader(not_null<Ui::VerticalLayout*> container) {
Core::TextContext({ Core::TextContext({
.session = &_window->session(), .session = &_window->session(),
.customEmojiLoopLimit = isStatic ? -1 : 0, .customEmojiLoopLimit = isStatic ? -1 : 0,
}))), })),
st::filterLinkDividerLabelPadding); st::filterLinkDividerLabelPadding,
style::al_top)->setTryMakeSimilarLines(true);
verticalLayout->geometryValue( verticalLayout->geometryValue(
) | rpl::start_with_next([=](const QRect &r) { ) | rpl::start_with_next([=](const QRect &r) {

View File

@ -78,8 +78,6 @@ void GiftCreditsBox(
u"internal:stars_examples"_q); u"internal:stars_examples"_q);
}); });
content->add( content->add(
object_ptr<Ui::CenterWrap<>>(
content,
Ui::CreateLabelWithCustomEmoji( Ui::CreateLabelWithCustomEmoji(
content, content,
tr::lng_credits_box_history_entry_gift_out_about( tr::lng_credits_box_history_entry_gift_out_about(
@ -89,8 +87,9 @@ void GiftCreditsBox(
std::move(link), std::move(link),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
Core::TextContext({ .session = &peer->session() }), Core::TextContext({ .session = &peer->session() }),
st::creditsBoxAbout)), st::creditsBoxAbout),
st::boxRowPadding); st::boxRowPadding,
style::al_top);
} }
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(box->verticalLayout()); Ui::AddSkip(box->verticalLayout());

View File

@ -741,7 +741,8 @@ void GiftCodeBox(
std::move(shareLink), std::move(shareLink),
Ui::Text::WithEntities)), Ui::Text::WithEntities)),
st::giveawayGiftCodeFooter), st::giveawayGiftCodeFooter),
st::giveawayGiftCodeFooterMargin); st::giveawayGiftCodeFooterMargin,
style::al_top);
footer->setClickHandlerFilter([=](const auto &...) { footer->setClickHandlerFilter([=](const auto &...) {
ShareWithFriend(controller, slug); ShareWithFriend(controller, slug);
return false; return false;
@ -883,7 +884,8 @@ void GiftCodePendingBox(
box, box,
tr::lng_gift_link_pending_footer(), tr::lng_gift_link_pending_footer(),
st::giveawayGiftCodeFooter), st::giveawayGiftCodeFooter),
st::giveawayGiftCodeFooterMargin); st::giveawayGiftCodeFooterMargin,
style::al_top);
const auto close = Ui::CreateChild<Ui::IconButton>( const auto close = Ui::CreateChild<Ui::IconButton>(
box.get(), box.get(),
@ -1186,7 +1188,8 @@ void GiveawayInfoBox(
: tr::lng_prizes_cancelled()), : tr::lng_prizes_cancelled()),
st::giveawayRefundedLabel), st::giveawayRefundedLabel),
st::giveawayRefundedPadding), st::giveawayRefundedPadding),
{ padding.left(), 0, padding.right(), padding.bottom() }); { padding.left(), 0, padding.right(), padding.bottom() },
style::al_top);
const auto bg = wrap->lifetime().make_state<Ui::RoundRect>( const auto bg = wrap->lifetime().make_state<Ui::RoundRect>(
st::boxRadius, st::boxRadius,
st::attentionBoxButton.textBgOver); st::attentionBoxButton.textBgOver);

View File

@ -233,7 +233,8 @@ void FillUpgradeToPremiumCover(
container, container,
rpl::single(text), rpl::single(text),
st::inviteForbiddenInfo), st::inviteForbiddenInfo),
st::inviteForbiddenInfoPadding); st::inviteForbiddenInfoPadding,
style::al_top);
} }
void SimpleForbiddenBox( void SimpleForbiddenBox(
@ -511,7 +512,8 @@ void InviteForbiddenController::setComplexCover() {
if (_can) { if (_can) {
container->add( container->add(
MakeShowOrLabel(container, tr::lng_invite_upgrade_or()), MakeShowOrLabel(container, tr::lng_invite_upgrade_or()),
st::inviteForbiddenOrLabelPadding); st::inviteForbiddenOrLabelPadding,
style::al_top);
} }
container->add( container->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
@ -520,7 +522,8 @@ void InviteForbiddenController::setComplexCover() {
? tr::lng_invite_upgrade_via_title() ? tr::lng_invite_upgrade_via_title()
: tr::lng_via_link_cant()), : tr::lng_via_link_cant()),
st::inviteForbiddenTitle), st::inviteForbiddenTitle),
st::inviteForbiddenTitlePadding); st::inviteForbiddenTitlePadding,
style::al_top);
const auto about = _can const auto about = _can
? (_peer->isBroadcast() ? (_peer->isBroadcast()
@ -544,7 +547,8 @@ void InviteForbiddenController::setComplexCover() {
container, container,
rpl::single(about), rpl::single(about),
st::inviteForbiddenInfo), st::inviteForbiddenInfo),
st::inviteForbiddenInfoPadding); st::inviteForbiddenInfoPadding,
style::al_top);
} }
delegate()->peerListSetAboveWidget(std::move(cover)); delegate()->peerListSetAboveWidget(std::move(cover));
} }

View File

@ -81,7 +81,6 @@ public:
bool selected); bool selected);
[[nodiscard]] uint8 index() const; [[nodiscard]] uint8 index() const;
int naturalWidth() const override;
void setSelected(bool selected); void setSelected(bool selected);
@ -181,6 +180,15 @@ ColorSample::ColorSample(
colorIndex colorIndex
) | rpl::start_with_next([=](uint8 index) { ) | rpl::start_with_next([=](uint8 index) {
_index = index; _index = index;
setNaturalWidth([&] {
if (_name.isEmpty() || _style->colorPatternIndex(_index)) {
return st::settingsColorSampleSize;
}
const auto padding = st::settingsColorSamplePadding;
return std::max(
padding.left() + _name.maxWidth() + padding.right(),
padding.top() + st::semiboldFont->height + padding.bottom());
}());
update(); update();
}, lifetime()); }, lifetime());
} }
@ -195,6 +203,7 @@ ColorSample::ColorSample(
, _index(colorIndex) , _index(colorIndex)
, _selected(selected) , _selected(selected)
, _simple(true) { , _simple(true) {
setNaturalWidth(st::settingsColorSampleSize);
} }
void ColorSample::setSelected(bool selected) { void ColorSample::setSelected(bool selected) {
@ -276,16 +285,6 @@ uint8 ColorSample::index() const {
return _index; return _index;
} }
int ColorSample::naturalWidth() const {
if (_name.isEmpty() || _style->colorPatternIndex(_index)) {
return st::settingsColorSampleSize;
}
const auto padding = st::settingsColorSamplePadding;
return std::max(
padding.left() + _name.maxWidth() + padding.right(),
padding.top() + st::semiboldFont->height + padding.bottom());
}
PreviewWrap::PreviewWrap( PreviewWrap::PreviewWrap(
not_null<Ui::GenericBox*> box, not_null<Ui::GenericBox*> box,
std::shared_ptr<Ui::ChatStyle> style, std::shared_ptr<Ui::ChatStyle> style,

View File

@ -976,21 +976,22 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_credits_box_subscription_title(), tr::lng_credits_box_subscription_title(),
st::creditsBoxAboutTitle))); st::creditsBoxAboutTitle),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content); Ui::AddSkip(content);
const auto subtitle1 = box->addRow( const auto subtitle1 = box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
st::creditsTopupPrice)))->entity(); st::creditsTopupPrice),
st::boxRowPadding,
style::al_top);
subtitle1->setMarkedText( subtitle1->setMarkedText(
tr::lng_credits_subscription_subtitle( tr::lng_credits_subscription_subtitle(
tr::now, tr::now,
@ -1027,8 +1028,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_credits_box_out_about( tr::lng_credits_box_out_about(
@ -1037,7 +1037,9 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
) | Ui::Text::ToLink( ) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)), tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::creditsBoxAboutDivider))); st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
const auto button = box->addButton(tr::lng_box_ok(), [=] { const auto button = box->addButton(tr::lng_box_ok(), [=] {
box->closeBox(); box->closeBox();

View File

@ -221,7 +221,8 @@ void Controller::prepare() {
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
st::boostReassignText), st::boostReassignText),
st::boxRowPadding); st::boxRowPadding,
style::al_top);
delegate()->peerListSetAboveWidget(std::move(above)); delegate()->peerListSetAboveWidget(std::move(above));
const auto now = base::unixtime::now(); const auto now = base::unixtime::now();

View File

@ -1079,26 +1079,21 @@ void PreviewBox(
auto text = state->selected.value( auto text = state->selected.value(
) | rpl::map(SectionAbout) | rpl::flatten_latest(); ) | rpl::map(SectionAbout) | rpl::flatten_latest();
const auto padding = st::premiumPreviewAboutPadding; box->addRow(
const auto available = size.width() - padding.left() - padding.right(); object_ptr<Ui::FlatLabel>(
auto titleLabel = object_ptr<Ui::FlatLabel>(
box, box,
std::move(title), std::move(title),
st::premiumPreviewAboutTitle); st::premiumPreviewAboutTitle),
titleLabel->resizeToWidth(available); st::premiumPreviewAboutTitlePadding,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>( object_ptr<Ui::FlatLabel>(
box,
std::move(titleLabel)),
st::premiumPreviewAboutTitlePadding);
auto textLabel = object_ptr<Ui::FlatLabel>(
box, box,
std::move(text), std::move(text),
st::premiumPreviewAbout); st::premiumPreviewAbout),
textLabel->resizeToWidth(available); st::premiumPreviewAboutPadding,
box->addRow( style::al_top
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(box, std::move(textLabel)), )->setTryMakeSimilarLines(true);
padding);
box->addRow( box->addRow(
CreateSwitch(box->verticalLayout(), &state->selected, state->order), CreateSwitch(box->verticalLayout(), &state->selected, state->order),
st::premiumDotsMargin); st::premiumDotsMargin);

View File

@ -364,14 +364,15 @@ void SendCreditsBox(
} }
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
form->invoice.subscriptionPeriod form->invoice.subscriptionPeriod
? rpl::single(form->title) ? rpl::single(form->title)
: tr::lng_credits_box_out_title(), : tr::lng_credits_box_out_title(),
st::settingsPremiumUserTitle))); st::settingsPremiumUserTitle),
st::boxRowPadding,
style::al_top);
if (form->invoice.subscriptionPeriod && form->botId && form->photo) { if (form->invoice.subscriptionPeriod && form->botId && form->photo) {
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(content); Ui::AddSkip(content);
@ -383,12 +384,13 @@ void SendCreditsBox(
Ui::AddSkip(content); Ui::AddSkip(content);
} }
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
SendCreditsConfirmText(session, form.get()), SendCreditsConfirmText(session, form.get()),
st::creditsBoxAbout))); st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(content); Ui::AddSkip(content);

View File

@ -2981,13 +2981,15 @@ void AddBlock(
content, content,
std::move(args.subtitle), std::move(args.subtitle),
st::giftBoxSubtitle), st::giftBoxSubtitle),
st::giftBoxSubtitleMargin); st::giftBoxSubtitleMargin,
style::al_top);
const auto about = content->add( const auto about = content->add(
object_ptr<FlatLabel>( object_ptr<FlatLabel>(
content, content,
std::move(args.about), std::move(args.about),
st::giftBoxAbout), st::giftBoxAbout),
st::giftBoxAboutMargin); st::giftBoxAboutMargin,
style::al_top);
about->setClickHandlerFilter(std::move(args.aboutFilter)); about->setClickHandlerFilter(std::move(args.aboutFilter));
content->add(std::move(args.content)); content->add(std::move(args.content));
} }
@ -4381,13 +4383,15 @@ void ShowUniqueGiftWearBox(
lt_name, lt_name,
rpl::single(UniqueGiftName(gift))), rpl::single(UniqueGiftName(gift))),
st.title ? *st.title : st::uniqueGiftTitle), st.title ? *st.title : st::uniqueGiftTitle),
st::settingsPremiumRowTitlePadding); st::settingsPremiumRowTitlePadding,
style::al_top);
content->add( content->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
tr::lng_gift_wear_about(), tr::lng_gift_wear_about(),
st.subtitle ? *st.subtitle : st::uniqueGiftSubtitle), st.subtitle ? *st.subtitle : st::uniqueGiftSubtitle),
st::settingsPremiumRowAboutPadding); st::settingsPremiumRowAboutPadding,
style::al_top);
infoRow( infoRow(
tr::lng_gift_wear_badge_title(), tr::lng_gift_wear_badge_title(),
(channel (channel

View File

@ -136,7 +136,8 @@ void ConferenceCallJoinConfirm(
Ui::Text::RichLangValue) Ui::Text::RichLangValue)
: tr::lng_confcall_join_text(Ui::Text::RichLangValue)), : tr::lng_confcall_join_text(Ui::Text::RichLangValue)),
st::confcallLinkCenteredText), st::confcallLinkCenteredText),
st::boxRowPadding st::boxRowPadding,
style::al_top
)->setTryMakeSimilarLines(true); )->setTryMakeSimilarLines(true);
const auto &participants = call->participants(); const auto &participants = call->participants();
@ -209,7 +210,8 @@ void ConferenceCallJoinConfirm(
box, box,
std::move(text), std::move(text),
st::confcallLinkCenteredText), st::confcallLinkCenteredText),
st::boxRowPadding st::boxRowPadding,
style::al_top
)->setTryMakeSimilarLines(true); )->setTryMakeSimilarLines(true);
} }
const auto joinAndClose = [=] { const auto joinAndClose = [=] {
@ -335,7 +337,8 @@ void ShowConferenceCallLinkBox(
(st.centerLabel (st.centerLabel
? *st.centerLabel ? *st.centerLabel
: st::confcallLinkCenteredText)), : st::confcallLinkCenteredText)),
st::boxRowPadding st::boxRowPadding,
style::al_top
)->setTryMakeSimilarLines(true); )->setTryMakeSimilarLines(true);
Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 2); Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 2);

View File

@ -1054,7 +1054,8 @@ not_null<Ui::RpWidget*> CreateReActivateHeader(not_null<QWidget*> parent) {
result, result,
tr::lng_confcall_inactive_about(), tr::lng_confcall_inactive_about(),
st::confcallLinkCenteredText), st::confcallLinkCenteredText),
st::boxRowPadding + st::confcallLinkTitlePadding st::boxRowPadding + st::confcallLinkTitlePadding,
style::al_top
)->setTryMakeSimilarLines(true); )->setTryMakeSimilarLines(true);
Ui::AddDivider(result); Ui::AddDivider(result);

View File

@ -196,22 +196,13 @@ void RecordingInfo::prepareVideo() {
} }
void RecordingInfo::setLabel(const QString &text) { void RecordingInfo::setLabel(const QString &text) {
const auto label = _container->add( _container->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_container, _container,
text, text,
st::groupCallRecordingSubLabel), st::groupCallRecordingSubLabel),
st::groupCallRecordingSubLabelMargins); st::groupCallRecordingSubLabelMargins,
style::al_top);
rpl::combine(
sizeValue(),
label->sizeValue()
) | rpl::start_with_next([=](QSize my, QSize labelSize) {
label->moveToLeft(
(my.width() - labelSize.width()) / 2,
label->y(),
my.width());
}, label->lifetime());
} }
RecordingType RecordingInfo::type() const { RecordingType RecordingInfo::type() const {

View File

@ -1467,7 +1467,8 @@ void FrozenInfoBox(
content, content,
tr::lng_frozen_title(), tr::lng_frozen_title(),
st.title ? *st.title : st::uniqueGiftTitle), st.title ? *st.title : st::uniqueGiftTitle),
st::settingsPremiumRowTitlePadding); st::settingsPremiumRowTitlePadding,
style::al_top);
Ui::AddSkip(content, st::defaultVerticalListSkip * 3); Ui::AddSkip(content, st::defaultVerticalListSkip * 3);

View File

@ -4147,14 +4147,15 @@ void InnerWidget::refreshEmpty() {
.name = u"no_chats"_q, .name = u"no_chats"_q,
.sizeOverride = Size(st::changePhoneIconSize), .sizeOverride = Size(st::changePhoneIconSize),
}); });
_emptyList->add( _emptyList->add(std::move(icon.widget), {}, style::al_top);
object_ptr<Ui::CenterWrap<>>(_emptyList, std::move(icon.widget)));
Ui::AddSkip(_emptyList); Ui::AddSkip(_emptyList);
_emptyList->add( _emptyList->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_emptyList, _emptyList,
tr::lng_no_conversations(), tr::lng_no_conversations(),
st::dialogEmptyButtonLabel)); st::dialogEmptyButtonLabel),
{},
style::al_top);
if (_state == WidgetState::Default) { if (_state == WidgetState::Default) {
icon.animate(anim::repeat::once); icon.animate(anim::repeat::once);
} }

View File

@ -170,30 +170,32 @@ void PostsSearchIntro::setup() {
_content.get(), _content.get(),
std::move(title), std::move(title),
st::postsSearchIntroTitle), st::postsSearchIntroTitle),
st::postsSearchIntroTitleMargin); st::postsSearchIntroTitleMargin,
style::al_top);
_title->setTryMakeSimilarLines(true); _title->setTryMakeSimilarLines(true);
_subtitle = _content->add( _subtitle = _content->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_content.get(), _content.get(),
std::move(subtitle), std::move(subtitle),
st::postsSearchIntroSubtitle), st::postsSearchIntroSubtitle),
st::postsSearchIntroSubtitleMargin); st::postsSearchIntroSubtitleMargin,
style::al_top);
_subtitle->setTryMakeSimilarLines(true); _subtitle->setTryMakeSimilarLines(true);
_button = _content->add( _button = _content->add(
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
_content.get(),
object_ptr<Ui::RoundButton>( object_ptr<Ui::RoundButton>(
_content.get(), _content.get(),
rpl::single(QString()), rpl::single(QString()),
st::postsSearchIntroButton)) st::postsSearchIntroButton),
)->entity(); {},
style::al_top);
_button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); _button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
_footer = _content->add( _footer = _content->add(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_content.get(), _content.get(),
std::move(footer), std::move(footer),
st::postsSearchIntroFooter), st::postsSearchIntroFooter),
st::postsSearchIntroFooterMargin); st::postsSearchIntroFooterMargin,
style::al_top);
_footer->setTryMakeSimilarLines(true); _footer->setTryMakeSimilarLines(true);
_state.value( _state.value(

View File

@ -389,12 +389,13 @@ void ChooseSuggestPriceBox(
box->setNoContentMargin(true); box->setNoContentMargin(true);
Ui::AddSkip(container, st::boxTitleHeight * 1.1); Ui::AddSkip(container, st::boxTitleHeight * 1.1);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
std::move(title), std::move(title),
st::settingsPremiumUserTitle))); st::settingsPremiumUserTitle),
st::boxRowPadding,
style::al_top);
} }
state->buttons.push_back({ state->buttons.push_back({
@ -667,7 +668,7 @@ void ChooseSuggestPriceBox(
return tr::lng_suggest_options_offer( return tr::lng_suggest_options_offer(
tr::now, tr::now,
lt_amount, lt_amount,
TextWithEntities{ coloredTonIcon }.append( Ui::Text::IconEmoji(&st::tonIconEmoji).append(
Lang::FormatCreditsAmountDecimal(price)), Lang::FormatCreditsAmountDecimal(price)),
Ui::Text::WithEntities); Ui::Text::WithEntities);
} }
@ -786,19 +787,19 @@ void InsufficientTonBox(
const auto nano = add.whole() * Ui::kNanosInOne + add.nano(); const auto nano = add.whole() * Ui::kNanosInOne + add.nano();
const auto amount = Ui::FormatTonAmount(nano).full; const auto amount = Ui::FormatTonAmount(nano).full;
box->addRow( box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_suggest_low_ton_title(tr::now, lt_amount, amount), tr::lng_suggest_low_ton_title(tr::now, lt_amount, amount),
st::boxTitle)), st::boxTitle),
st::boxRowPadding + st::lowTonTitlePadding); st::boxRowPadding + st::lowTonTitlePadding,
style::al_top);
const auto label = box->addRow( const auto label = box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_suggest_low_ton_text(Ui::Text::RichLangValue), tr::lng_suggest_low_ton_text(Ui::Text::RichLangValue),
st::lowTonText), st::lowTonText),
st::boxRowPadding + st::lowTonTextPadding); st::boxRowPadding + st::lowTonTextPadding,
style::al_top);
label->setTryMakeSimilarLines(true); label->setTryMakeSimilarLines(true);
label->resizeToWidth( label->resizeToWidth(
st::boxWidth - st::boxRowPadding.left() - st::boxRowPadding.right()); st::boxWidth - st::boxRowPadding.left() - st::boxRowPadding.right());

View File

@ -354,19 +354,22 @@ void ShowAgeVerification(
box, box,
tr::lng_age_verify_title(), tr::lng_age_verify_title(),
st::settingsAgeVerifyTitle), st::settingsAgeVerifyTitle),
st::boxRowPadding + st::settingsAgeVerifyMargin); st::boxRowPadding + st::settingsAgeVerifyMargin,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
AgeVerifyAbout(&bot->session()), AgeVerifyAbout(&bot->session()),
st::settingsAgeVerifyText), st::settingsAgeVerifyText),
st::boxRowPadding + st::settingsAgeVerifyMargin); st::boxRowPadding + st::settingsAgeVerifyMargin,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_age_verify_here(Ui::Text::RichLangValue), tr::lng_age_verify_here(Ui::Text::RichLangValue),
st::settingsAgeVerifyText), st::settingsAgeVerifyText),
st::boxRowPadding + st::settingsAgeVerifyMargin); st::boxRowPadding + st::settingsAgeVerifyMargin,
style::al_top);
const auto weak = QPointer<Ui::GenericBox>(box); const auto weak = QPointer<Ui::GenericBox>(box);
const auto done = crl::guard(&bot->session(), [=](int age) { const auto done = crl::guard(&bot->session(), [=](int age) {
@ -446,13 +449,15 @@ void ShowAgeVerificationMobile(
box, box,
AgeVerifyAbout(session), AgeVerifyAbout(session),
st::settingsAgeVerifyText), st::settingsAgeVerifyText),
st::boxRowPadding + st::settingsAgeVerifyMargin); st::boxRowPadding + st::settingsAgeVerifyMargin,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_age_verify_mobile(Ui::Text::RichLangValue), tr::lng_age_verify_mobile(Ui::Text::RichLangValue),
st::settingsAgeVerifyText), st::settingsAgeVerifyText),
st::boxRowPadding + st::settingsAgeVerifyMargin); st::boxRowPadding + st::settingsAgeVerifyMargin,
style::al_top);
box->addButton(tr::lng_box_ok(), [=] { box->addButton(tr::lng_box_ok(), [=] {
box->closeBox(); box->closeBox();

View File

@ -470,7 +470,8 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
FormatForProgramDuration(program.durationMonths), FormatForProgramDuration(program.durationMonths),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::starrefCenteredText), st::starrefCenteredText),
st::boxRowPadding); st::boxRowPadding,
style::al_top);
Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3); Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3);
@ -478,7 +479,9 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_star_ref_link_recipient(), tr::lng_star_ref_link_recipient(),
st::starrefCenteredText)); st::starrefCenteredText),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(box->verticalLayout()); Ui::AddSkip(box->verticalLayout());
box->addRow(object_ptr<Ui::AbstractButton>::fromRaw( box->addRow(object_ptr<Ui::AbstractButton>::fromRaw(
MakePeerBubbleButton(box, peer).release() MakePeerBubbleButton(box, peer).release()
@ -596,7 +599,8 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
FormatForProgramDuration(program.durationMonths), FormatForProgramDuration(program.durationMonths),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::starrefCenteredText), st::starrefCenteredText),
st::boxRowPadding); st::boxRowPadding,
style::al_top);
Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3); Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3);
if (const auto average = program.revenuePerUser) { if (const auto average = program.revenuePerUser) {
@ -613,7 +617,8 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::starrefRevenueText, st::starrefRevenueText,
st::defaultPopupMenu), st::defaultPopupMenu),
st::boxRowPadding); st::boxRowPadding,
style::al_top);
Ui::AddSkip(layout, st::defaultVerticalListSkip); Ui::AddSkip(layout, st::defaultVerticalListSkip);
} }
@ -635,7 +640,9 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_star_ref_link_recipient(), tr::lng_star_ref_link_recipient(),
st::starrefCenteredText)); st::starrefCenteredText),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(box->verticalLayout()); Ui::AddSkip(box->verticalLayout());
const auto recipientWrap = box->addRow( const auto recipientWrap = box->addRow(
object_ptr<Ui::VerticalLayout>(box), object_ptr<Ui::VerticalLayout>(box),

View File

@ -829,7 +829,7 @@ rpl::producer<int> WrapWidget::desiredHeightValue() const {
QRect WrapWidget::contentGeometry() const { QRect WrapWidget::contentGeometry() const {
const auto top = _topBar ? _topBar->height() : 0; const auto top = _topBar ? _topBar->height() : 0;
return rect().marginsRemoved({ 0, top, 0, 0 }); return rect().marginsRemoved({ 0, std::min(top, height()), 0, 0});
} }
bool WrapWidget::returnToFirstStackFrame( bool WrapWidget::returnToFirstStackFrame(

View File

@ -1009,13 +1009,15 @@ void SelectGiftToUnpin(
box, box,
tr::lng_gift_many_pinned_title(), tr::lng_gift_many_pinned_title(),
st::giftBoxSubtitle), st::giftBoxSubtitle),
st::giftBoxSubtitleMargin); st::giftBoxSubtitleMargin,
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_gift_many_pinned_choose(), tr::lng_gift_many_pinned_choose(),
st::giftTooManyPinnedChoose), st::giftTooManyPinnedChoose),
st::giftBoxAboutMargin); st::giftBoxAboutMargin,
style::al_top);
const auto gifts = box->addRow( const auto gifts = box->addRow(
object_ptr<Ui::RpWidget>(box), object_ptr<Ui::RpWidget>(box),

View File

@ -25,14 +25,10 @@ FloatingIcon::FloatingIcon(
: RpWidget(parent) : RpWidget(parent)
, _icon(&icon) , _icon(&icon)
, _point(position) { , _point(position) {
resize( setGeometry(QRect(
_point.x() + _icon->width(), QPoint(0, 0),
_point.y() + _icon->height()); QSize(_point.x() + _icon->width(), _point.y() + _icon->height())));
setAttribute(Qt::WA_TransparentForMouseEvents); setAttribute(Qt::WA_TransparentForMouseEvents);
parent->widthValue(
) | rpl::start_with_next(
[this] { moveToLeft(0, 0); },
lifetime());
} }
void FloatingIcon::paintEvent(QPaintEvent *e) { void FloatingIcon::paintEvent(QPaintEvent *e) {

View File

@ -131,7 +131,8 @@ void Widget::restoreState(not_null<Memento*> memento) {
void Widget::refreshBottom() { void Widget::refreshBottom() {
const auto albumId = _albumId.current(); const auto albumId = _albumId.current();
const auto withButton = albumId const auto withButton = (albumId != Data::kStoriesAlbumIdSaved)
&& (albumId != Data::kStoriesAlbumIdArchive)
&& controller()->storiesPeer()->canEditStories(); && controller()->storiesPeer()->canEditStories();
const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0; const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0;
delete _pinnedToBottom.data(); delete _pinnedToBottom.data();

View File

@ -511,7 +511,8 @@ void ConfirmEmojiStatusAccessBox(
AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip); AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip);
auto name = Ui::Text::Bold(bot->name()); auto name = Ui::Text::Bold(bot->name());
box->addRow(object_ptr<Ui::FlatLabel>( box->addRow(
object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_bot_emoji_status_access_text( tr::lng_bot_emoji_status_access_text(
lt_bot, lt_bot,
@ -519,7 +520,9 @@ void ConfirmEmojiStatusAccessBox(
lt_name, lt_name,
rpl::single(name), rpl::single(name),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
st::botEmojiStatusText)); st::botEmojiStatusText),
st::boxRowPadding,
style::al_top);
box->addButton(tr::lng_bot_emoji_status_access_allow(), [=] { box->addButton(tr::lng_bot_emoji_status_access_allow(), [=] {
if (!CheckEmojiStatusPremium(bot)) { if (!CheckEmojiStatusPremium(bot)) {
@ -557,19 +560,25 @@ void ConfirmEmojiStatusBox(
box->closeBox(); box->closeBox();
}); });
box->addRow(object_ptr<Ui::FlatLabel>( box->addRow(
object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_bot_emoji_status_title(), tr::lng_bot_emoji_status_title(),
st::botEmojiStatusTitle)); st::botEmojiStatusTitle),
st::boxRowPadding,
style::al_top);
AddSkip(box->verticalLayout()); AddSkip(box->verticalLayout());
box->addRow(object_ptr<Ui::FlatLabel>( box->addRow(
object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_bot_emoji_status_text( tr::lng_bot_emoji_status_text(
lt_bot, lt_bot,
rpl::single(Ui::Text::Bold(bot->name())), rpl::single(Ui::Text::Bold(bot->name())),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
st::botEmojiStatusText)); st::botEmojiStatusText),
st::boxRowPadding,
style::al_top);
AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip); AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip);

View File

@ -327,8 +327,11 @@ struct Feature {
box->setWidth(st::boxWideWidth); box->setWidth(st::boxWideWidth);
box->setStyle(st::storiesStealthBox); box->setStyle(st::storiesStealthBox);
box->addRow(MakeLogo(box)); box->addRow(MakeLogo(box));
box->addRow(MakeTitle(box)); box->addRow(MakeTitle(box), st::boxRowPadding, style::al_top);
box->addRow(MakeAbout(box, data->state.value())); box->addRow(
MakeAbout(box, data->state.value()),
st::boxRowPadding,
style::al_top);
box->addRow(MakeFeature(box, FeaturePast())); box->addRow(MakeFeature(box, FeaturePast()));
box->addRow( box->addRow(
MakeFeature(box, FeatureNext()), MakeFeature(box, FeatureNext()),

View File

@ -81,22 +81,20 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
}, _userpic->lifetime()); }, _userpic->lifetime());
_about1 = inner->add( _about1 = inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
inner, inner,
tr::lng_passport_request1(tr::now, lt_bot, bot->name()), tr::lng_passport_request1(tr::now, lt_bot, bot->name()),
st::passportPasswordLabelBold)), st::passportPasswordLabelBold),
st::passportFormAbout1Padding)->entity(); st::passportFormAbout1Padding,
style::al_top);
_about2 = inner->add( _about2 = inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
inner, inner,
tr::lng_passport_request2(tr::now), tr::lng_passport_request2(tr::now),
st::passportPasswordLabel)), st::passportPasswordLabel),
st::passportFormAbout2Padding)->entity(); st::passportFormAbout2Padding,
style::al_top);
inner->add(object_ptr<Ui::BoxContentDivider>( inner->add(object_ptr<Ui::BoxContentDivider>(
inner, inner,

View File

@ -171,25 +171,23 @@ void PanelNoPassword::setupContent() {
}, _inner->lifetime()); }, _inner->lifetime());
_inner->add( _inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
_inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_inner, _inner,
tr::lng_passport_request1( tr::lng_passport_request1(
tr::now, tr::now,
lt_bot, lt_bot,
_controller->bot()->name()), _controller->bot()->name()),
st::passportPasswordLabelBold)), st::passportPasswordLabelBold),
st::passportPasswordAbout1Padding)->entity(); st::passportPasswordAbout1Padding,
style::al_top);
_inner->add( _inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
_inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_inner, _inner,
tr::lng_passport_request2(tr::now), tr::lng_passport_request2(tr::now),
st::passportPasswordLabel)), st::passportPasswordLabel),
st::passportPasswordAbout2Padding)->entity(); st::passportPasswordAbout2Padding,
style::al_top);
const auto iconWrap = _inner->add( const auto iconWrap = _inner->add(
object_ptr<Ui::CenterWrap<Ui::FixedHeightWidget>>( object_ptr<Ui::CenterWrap<Ui::FixedHeightWidget>>(
@ -204,13 +202,12 @@ void PanelNoPassword::setupContent() {
QPoint(0, 0)); QPoint(0, 0));
_inner->add( _inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
_inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_inner, _inner,
tr::lng_passport_create_password(tr::now), tr::lng_passport_create_password(tr::now),
st::passportPasswordSetupLabel)), st::passportPasswordSetupLabel),
st::passportFormAbout2Padding)->entity(); st::passportFormAbout2Padding,
style::al_top);
refreshBottom(); refreshBottom();
} }
@ -218,15 +215,14 @@ void PanelNoPassword::setupContent() {
void PanelNoPassword::refreshBottom() { void PanelNoPassword::refreshBottom() {
const auto pattern = _controller->unconfirmedEmailPattern(); const auto pattern = _controller->unconfirmedEmailPattern();
_about.reset(_inner->add( _about.reset(_inner->add(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
_inner,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
_inner, _inner,
(pattern.isEmpty() (pattern.isEmpty()
? tr::lng_passport_about_password(tr::now) ? tr::lng_passport_about_password(tr::now)
: tr::lng_passport_code_sent(tr::now, lt_email, pattern)), : tr::lng_passport_code_sent(tr::now, lt_email, pattern)),
st::passportPasswordSetupLabel)), st::passportPasswordSetupLabel),
st::passportFormAbout2Padding)->entity()); st::passportFormAbout2Padding,
style::al_top));
if (pattern.isEmpty()) { if (pattern.isEmpty()) {
const auto button = _inner->add( const auto button = _inner->add(
object_ptr<Ui::CenterWrap<Ui::RoundButton>>( object_ptr<Ui::CenterWrap<Ui::RoundButton>>(

View File

@ -119,10 +119,13 @@ bool FormSummary::showCriticalError(const TextWithEntities &text) {
return false; return false;
} }
Ui::AddSkip(_layout.get(), st::paymentsPricesTopSkip); Ui::AddSkip(_layout.get(), st::paymentsPricesTopSkip);
_layout->add(object_ptr<FlatLabel>( _layout->add(
object_ptr<FlatLabel>(
_layout.get(), _layout.get(),
rpl::single(text), rpl::single(text),
st::paymentsCriticalError)); st::paymentsCriticalError),
{},
style::al_top);
return true; return true;
} }

View File

@ -481,7 +481,8 @@ void PaidReactionsBox(
box, box,
tr::lng_paid_react_title(), tr::lng_paid_react_title(),
st::boostCenteredTitle), st::boostCenteredTitle),
st::boxRowPadding + QMargins(0, st::paidReactTitleSkip, 0, 0)); st::boxRowPadding + QMargins(0, st::paidReactTitleSkip, 0, 0),
style::al_top);
const auto labelWrap = box->addRow( const auto labelWrap = box->addRow(
object_ptr<RpWidget>(box), object_ptr<RpWidget>(box),
(st::boxRowPadding (st::boxRowPadding

View File

@ -302,7 +302,7 @@ settingsAccentColorSkip: 4px;
settingsAccentColorLine: 3px; settingsAccentColorLine: 3px;
settingsFilterDividerLabel: FlatLabel(boxDividerLabel) { settingsFilterDividerLabel: FlatLabel(boxDividerLabel) {
minWidth: 258px; minWidth: 200px;
maxHeight: 0px; maxHeight: 0px;
align: align(top); align: align(top);
} }

View File

@ -186,22 +186,20 @@ void Blocked::setupContent() {
}, content->lifetime()); }, content->lifetime());
content->add( content->add(
object_ptr<Ui::CenterWrap<>>(
content,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
tr::lng_blocked_list_empty_title(), tr::lng_blocked_list_empty_title(),
st::changePhoneTitle)), st::changePhoneTitle),
st::changePhoneTitlePadding); st::changePhoneTitlePadding,
style::al_top);
content->add( content->add(
object_ptr<Ui::CenterWrap<>>(
content,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
content, content,
tr::lng_blocked_list_empty_description(), tr::lng_blocked_list_empty_description(),
st::changePhoneDescription)), st::changePhoneDescription),
st::changePhoneDescriptionPadding); st::changePhoneDescriptionPadding,
style::al_top);
Ui::AddSkip(content, st::settingsBlockedListIconPadding.top()); Ui::AddSkip(content, st::settingsBlockedListIconPadding.top());
} }

View File

@ -227,14 +227,13 @@ void AddDividerTextWithLottie(
if (descriptor.about) { if (descriptor.about) {
verticalLayout->add( verticalLayout->add(
object_ptr<Ui::CenterWrap<>>(
verticalLayout,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
verticalLayout, verticalLayout,
std::move(descriptor.about), std::move(descriptor.about),
st::settingsFilterDividerLabel)), st::settingsFilterDividerLabel),
descriptor.aboutMargins.value_or( descriptor.aboutMargins.value_or(
st::settingsFilterDividerLabelPadding)); st::settingsFilterDividerLabelPadding),
style::al_top)->setTryMakeSimilarLines(true);
} }
verticalLayout->geometryValue( verticalLayout->geometryValue(

View File

@ -853,8 +853,7 @@ void BoostCreditsBox(
AddCreditsBoostTable(controller->uiShow(), content, {}, b); AddCreditsBoostTable(controller->uiShow(), content, {}, b);
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_credits_box_out_about( tr::lng_credits_box_out_about(
@ -863,7 +862,9 @@ void BoostCreditsBox(
) | Ui::Text::ToLink( ) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)), tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::creditsBoxAboutDivider))); st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content); Ui::AddSkip(content);
const auto button = box->addButton(tr::lng_box_ok(), [=] { const auto button = box->addButton(tr::lng_box_ok(), [=] {
@ -1391,8 +1392,7 @@ void GenericCreditsEntryBox(
Ui::AddSkip(content); Ui::AddSkip(content);
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
rpl::single(!s.title.isEmpty() rpl::single(!s.title.isEmpty()
@ -1434,7 +1434,9 @@ void GenericCreditsEntryBox(
: (peer && !e.reaction) : (peer && !e.reaction)
? peer->name() ? peer->name()
: Ui::GenerateEntryName(e).text), : Ui::GenerateEntryName(e).text),
st::creditsBoxAboutTitle))); st::creditsBoxAboutTitle),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content); Ui::AddSkip(content);
} }
@ -1607,20 +1609,19 @@ void GenericCreditsEntryBox(
if (!isStarGift && !e.description.empty()) { if (!isStarGift && !e.description.empty()) {
Ui::AddSkip(content); Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
rpl::single(e.description), rpl::single(e.description),
st::creditsBoxAbout))); st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);
} }
const auto arrow = Ui::Text::IconEmoji(&st::textMoreIconEmoji); const auto arrow = Ui::Text::IconEmoji(&st::textMoreIconEmoji);
if (!uniqueGift && (starGiftCanManage || e.converted)) { if (!uniqueGift && (starGiftCanManage || e.converted)) {
Ui::AddSkip(content); Ui::AddSkip(content);
const auto about = box->addRow( const auto about = box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
(e.giftRefunded (e.giftRefunded
@ -1668,7 +1669,9 @@ void GenericCreditsEntryBox(
? tr::lng_action_gift_got_gift_channel ? tr::lng_action_gift_got_gift_channel
: tr::lng_action_gift_got_gift_text))( : tr::lng_action_gift_got_gift_text))(
Ui::Text::WithEntities))), Ui::Text::WithEntities))),
st::creditsBoxAbout)))->entity(); st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);
about->setClickHandlerFilter([=](const auto &...) { about->setClickHandlerFilter([=](const auto &...) {
Core::App().iv().openWithIvPreferred( Core::App().iv().openWithIvPreferred(
session, session,
@ -1690,8 +1693,7 @@ void GenericCreditsEntryBox(
std::move(text), std::move(text),
u"internal:stars_examples"_q); u"internal:stars_examples"_q);
}); });
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
Ui::CreateLabelWithCustomEmoji( Ui::CreateLabelWithCustomEmoji(
box, box,
(!e.in && peer) (!e.in && peer)
@ -1706,7 +1708,9 @@ void GenericCreditsEntryBox(
std::move(link), std::move(link),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
Core::TextContext({ .session = session }), Core::TextContext({ .session = session }),
st::creditsBoxAbout))); st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);
} else if (e.paidMessagesCommission && e.barePeerId) { } else if (e.paidMessagesCommission && e.barePeerId) {
Ui::AddSkip(content); Ui::AddSkip(content);
auto link = tr::lng_credits_paid_messages_fee_about_link( auto link = tr::lng_credits_paid_messages_fee_about_link(
@ -1719,8 +1723,7 @@ void GenericCreditsEntryBox(
u"internal:edit_paid_messages_fee/"_q + QString::number(id)); u"internal:edit_paid_messages_fee/"_q + QString::number(id));
}); });
const auto percent = 100. - (e.paidMessagesCommission / 10.); const auto percent = 100. - (e.paidMessagesCommission / 10.);
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
Ui::CreateLabelWithCustomEmoji( Ui::CreateLabelWithCustomEmoji(
box, box,
tr::lng_credits_paid_messages_fee_about( tr::lng_credits_paid_messages_fee_about(
@ -1731,7 +1734,9 @@ void GenericCreditsEntryBox(
std::move(link), std::move(link),
Ui::Text::RichLangValue), Ui::Text::RichLangValue),
Core::TextContext({ .session = session }), Core::TextContext({ .session = session }),
st::creditsBoxAbout))); st::creditsBoxAbout),
st::boxRowPadding,
style::al_top);
} }
Ui::AddSkip(content); Ui::AddSkip(content);
@ -1864,8 +1869,7 @@ void GenericCreditsEntryBox(
Ui::AddSkip(content); Ui::AddSkip(content);
if (!isStarGift && e.credits.stars()) { if (!isStarGift && e.credits.stars()) {
box->addRow(object_ptr<Ui::CenterWrap<>>( box->addRow(
box,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
tr::lng_credits_box_out_about( tr::lng_credits_box_out_about(
@ -1874,7 +1878,9 @@ void GenericCreditsEntryBox(
) | Ui::Text::ToLink( ) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)), tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::creditsBoxAboutDivider))); st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
} else if (starGiftCanManage) { } else if (starGiftCanManage) {
const auto hiddenPhrase = giftToChannelCanManage const auto hiddenPhrase = giftToChannelCanManage
? tr::lng_gift_hidden_hint_channel ? tr::lng_gift_hidden_hint_channel
@ -1925,7 +1931,9 @@ void GenericCreditsEntryBox(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
std::move(text), std::move(text),
st::creditsBoxAboutDivider)); st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
label->setClickHandlerFilter([=](const auto &...) { label->setClickHandlerFilter([=](const auto &...) {
toggleVisibility(!e.savedToProfile); toggleVisibility(!e.savedToProfile);
return false; return false;
@ -1942,7 +1950,9 @@ void GenericCreditsEntryBox(
Ui::Text::WithEntities Ui::Text::WithEntities
) | Ui::Text::ToLink(), ) | Ui::Text::ToLink(),
Ui::Text::WithEntities), Ui::Text::WithEntities),
st::creditsBoxAboutDivider)); st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
label->setClickHandlerFilter([=](const auto &...) { label->setClickHandlerFilter([=](const auto &...) {
UrlClickHandler::Open( UrlClickHandler::Open(
TonAddressUrl(session, uniqueGift->ownerAddress)); TonAddressUrl(session, uniqueGift->ownerAddress));
@ -1994,8 +2004,7 @@ void GenericCreditsEntryBox(
} else if (s.cancelled || s.cancelledByBot) { } else if (s.cancelled || s.cancelledByBot) {
label->setTextColorOverride(st::menuIconAttentionColor->c); label->setTextColorOverride(st::menuIconAttentionColor->c);
} }
box->addRow( box->addRow(std::move(label), st::boxRowPadding, style::al_top);
object_ptr<Ui::CenterWrap<>>(box, std::move(label)));
} }
Ui::AddSkip(content); Ui::AddSkip(content);

View File

@ -862,13 +862,12 @@ void SetupTopContent(
verticalLayout->add(std::move(icon.widget)); verticalLayout->add(std::move(icon.widget));
verticalLayout->add( verticalLayout->add(
object_ptr<Ui::CenterWrap<>>(
verticalLayout,
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
verticalLayout, verticalLayout,
tr::lng_filters_about(), tr::lng_filters_about(),
st::settingsFilterDividerLabel)), st::settingsFilterDividerLabel),
st::settingsFilterDividerLabelPadding); st::settingsFilterDividerLabelPadding,
style::al_top)->setTryMakeSimilarLines(true);
verticalLayout->geometryValue( verticalLayout->geometryValue(
) | rpl::start_with_next([=](const QRect &r) { ) | rpl::start_with_next([=](const QRect &r) {

View File

@ -752,14 +752,16 @@ void AskBoostBox(
box, box,
std::move(title), std::move(title),
st::boostCenteredTitle), st::boostCenteredTitle),
st::boxRowPadding + QMargins(0, st::boostTitleSkip, 0, 0)); st::boxRowPadding + QMargins(0, st::boostTitleSkip, 0, 0),
style::al_top);
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
std::move(text), std::move(text),
st::boostText), st::boostText),
(st::boxRowPadding (st::boxRowPadding
+ QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip))); + QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip)),
style::al_top);
auto stats = object_ptr<Ui::IconButton>(box, st::boostLinkStatsButton); auto stats = object_ptr<Ui::IconButton>(box, st::boostLinkStatsButton);
stats->setClickedCallback(openStatistics); stats->setClickedCallback(openStatistics);

View File

@ -201,7 +201,8 @@ void CollectibleInfoBox(
box, box,
rpl::single(header), rpl::single(header),
st::collectibleHeader), st::collectibleHeader),
st::collectibleHeaderPadding st::collectibleHeaderPadding,
style::al_top
)->setClickHandlerFilter([copyCallback](const auto &...) { )->setClickHandlerFilter([copyCallback](const auto &...) {
copyCallback(false); copyCallback(false);
return false; return false;
@ -220,7 +221,8 @@ void CollectibleInfoBox(
Ui::Text::RichLangValue); Ui::Text::RichLangValue);
const auto label = box->addRow( const auto label = box->addRow(
object_ptr<Ui::FlatLabel>(box, st::collectibleInfo), object_ptr<Ui::FlatLabel>(box, st::collectibleInfo),
st::collectibleInfoPadding); st::collectibleInfoPadding,
style::al_top);
label->setAttribute(Qt::WA_TransparentForMouseEvents); label->setAttribute(Qt::WA_TransparentForMouseEvents);
label->setMarkedText(text); label->setMarkedText(text);

View File

@ -57,10 +57,12 @@ constexpr auto kShowOrLineOpacity = 0.3;
object_ptr<RpWidget> MakeShowOrLabel( object_ptr<RpWidget> MakeShowOrLabel(
not_null<RpWidget*> parent, not_null<RpWidget*> parent,
rpl::producer<QString> text) { rpl::producer<QString> text) {
auto result = object_ptr<FlatLabel>( auto result = object_ptr<CenterWrap<>>(
parent,
object_ptr<FlatLabel>(
parent, parent,
std::move(text), std::move(text),
st::showOrLabel); st::showOrLabel));
const auto raw = result.data(); const auto raw = result.data();
raw->paintRequest( raw->paintRequest(
@ -69,7 +71,8 @@ object_ptr<RpWidget> MakeShowOrLabel(
const auto full = st::showOrLineWidth; const auto full = st::showOrLineWidth;
const auto left = (raw->width() - full) / 2; const auto left = (raw->width() - full) / 2;
const auto text = raw->textMaxWidth() + 2 * st::showOrLabelSkip; const auto text = raw->entity()->naturalWidth()
+ 2 * st::showOrLabelSkip;
const auto fill = (full - text) / 2; const auto fill = (full - text) / 2;
const auto stroke = st::lineWidth; const auto stroke = st::lineWidth;
const auto top = st::showOrLineTop; const auto top = st::showOrLineTop;
@ -152,13 +155,15 @@ void ShowOrPremiumBox(
box, box,
std::move(skin.showTitle), std::move(skin.showTitle),
st::boostCenteredTitle), st::boostCenteredTitle),
st::showOrTitlePadding + buttonPadding); st::showOrTitlePadding + buttonPadding,
style::al_top);
box->addRow( box->addRow(
object_ptr<FlatLabel>( object_ptr<FlatLabel>(
box, box,
std::move(skin.showAbout), std::move(skin.showAbout),
st::boostText), st::boostText),
st::showOrAboutPadding + buttonPadding); st::showOrAboutPadding + buttonPadding,
style::al_top);
const auto show = box->addRow( const auto show = box->addRow(
object_ptr<RoundButton>( object_ptr<RoundButton>(
box, box,
@ -168,19 +173,22 @@ void ShowOrPremiumBox(
show->setTextTransform(RoundButton::TextTransform::NoTransform); show->setTextTransform(RoundButton::TextTransform::NoTransform);
box->addRow( box->addRow(
MakeShowOrLabel(box, std::move(skin.orPremium)), MakeShowOrLabel(box, std::move(skin.orPremium)),
st::showOrLabelPadding + buttonPadding); st::showOrLabelPadding + buttonPadding,
style::al_top);
box->addRow( box->addRow(
object_ptr<FlatLabel>( object_ptr<FlatLabel>(
box, box,
std::move(skin.premiumTitle), std::move(skin.premiumTitle),
st::boostCenteredTitle), st::boostCenteredTitle),
st::showOrTitlePadding + buttonPadding); st::showOrTitlePadding + buttonPadding,
style::al_top);
box->addRow( box->addRow(
object_ptr<FlatLabel>( object_ptr<FlatLabel>(
box, box,
std::move(skin.premiumAbout), std::move(skin.premiumAbout),
st::boostText), st::boostText),
st::showOrPremiumAboutPadding + buttonPadding); st::showOrPremiumAboutPadding + buttonPadding,
style::al_top);
const auto premium = CreateChild<GradientButton>( const auto premium = CreateChild<GradientButton>(
box.get(), box.get(),

View File

@ -288,19 +288,21 @@ void AboutRatingBox(
lt_name, lt_name,
rpl::single(TextWithEntities{ name }), rpl::single(TextWithEntities{ name }),
Ui::Text::RichLangValue); Ui::Text::RichLangValue);
const auto aboutNegative = box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
std::move(text), std::move(text),
st::boostTextNegative), st::boostTextNegative),
(st::boxRowPadding (st::boxRowPadding
+ QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip))); + QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip)),
aboutNegative->setTryMakeSimilarLines(true); style::al_top
)->setTryMakeSimilarLines(true);
} }
box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>(box, std::move(title), st::infoStarsTitle), object_ptr<Ui::FlatLabel>(box, std::move(title), st::infoStarsTitle),
st::boxRowPadding + QMargins(0, st::boostTitleSkip / 2, 0, 0)); st::boxRowPadding + QMargins(0, st::boostTitleSkip / 2, 0, 0),
style::al_top);
if (pending) { if (pending) {
const auto now = base::unixtime::now(); const auto now = base::unixtime::now();
@ -331,7 +333,8 @@ void AboutRatingBox(
std::move(text), std::move(text),
st::boostTextPending), st::boostTextPending),
(st::boxRowPadding (st::boxRowPadding
+ QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip))); + QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip)),
style::al_top);
aboutPending->setTryMakeSimilarLines(true); aboutPending->setTryMakeSimilarLines(true);
aboutPending->setClickHandlerFilter([=](const auto &...) { aboutPending->setClickHandlerFilter([=](const auto &...) {
state->pending = !state->pending.current(); state->pending = !state->pending.current();
@ -343,14 +346,15 @@ void AboutRatingBox(
}); });
} }
const auto aboutLabel = box->addRow( box->addRow(
object_ptr<Ui::FlatLabel>( object_ptr<Ui::FlatLabel>(
box, box,
std::move(text), std::move(text),
st::boostText), st::boostText),
(st::boxRowPadding (st::boxRowPadding
+ QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip))); + QMargins(0, st::boostTextSkip, 0, st::boostBottomSkip)),
aboutLabel->setTryMakeSimilarLines(true); style::al_top
)->setTryMakeSimilarLines(true);
auto helper = Ui::Text::CustomEmojiHelper(); auto helper = Ui::Text::CustomEmojiHelper();
const auto makeBadge = [&]( const auto makeBadge = [&](

View File

@ -224,18 +224,6 @@ premiumGiftOption: PremiumOption {
badgeMargins: margins(5px, 1px, 5px, 0px); badgeMargins: margins(5px, 1px, 5px, 0px);
} }
premiumGiftUserpicPadding: margins(10px, 27px, 18px, 13px);
premiumGiftTitlePadding: margins(18px, 0px, 18px, 0px);
premiumGiftAboutPadding: margins(18px, 5px, 18px, 23px);
premiumGiftTermsPadding: margins(18px, 27px, 18px, 0px);
premiumGiftTerms: FlatLabel(defaultFlatLabel) {
minWidth: 256px;
align: align(top);
textFg: windowSubTextFg;
style: TextStyle(defaultTextStyle) {
font: font(11px);
}
}
premiumGiftBox: Box(premiumPreviewBox) { premiumGiftBox: Box(premiumPreviewBox) {
buttonPadding: margins(12px, 12px, 12px, 12px); buttonPadding: margins(12px, 12px, 12px, 12px);
} }
@ -245,10 +233,6 @@ premiumGiftsUserpicButton: UserpicButton(defaultUserpicButton) {
photoSize: 66px; photoSize: 66px;
photoPosition: point(-1px, -1px); photoPosition: point(-1px, -1px);
} }
premiumGiftsUserpicBadgeSize: size(26px, 26px);
premiumGiftsUserpicBadgeInner: 2px;
premiumGiftsUserpicBadgeFont: font(14px bold);
premiumGiftsBoostIcon: icon{{ "stories/boost_mini", windowBgActive }};
boostSkipTop: 37px; boostSkipTop: 37px;
boostLimits: PremiumLimits(defaultPremiumLimits) { boostLimits: PremiumLimits(defaultPremiumLimits) {

View File

@ -14,15 +14,7 @@ namespace Ui {
class CustomWidthSlider final : public SettingsSlider { class CustomWidthSlider final : public SettingsSlider {
public: public:
using Ui::SettingsSlider::SettingsSlider; using Ui::SettingsSlider::SettingsSlider;
void setNaturalWidth(int w) { using SettingsSlider::setNaturalWidth;
_naturalWidth = w;
}
int naturalWidth() const override {
return _naturalWidth;
}
private:
int _naturalWidth = 0;
}; };

@ -1 +1 @@
Subproject commit 7a21118ca0964dc66673df7a2241f846ec094860 Subproject commit 3201934f69e03d1461d8b5670ff6babbd6ca3789