2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-22 02:07:24 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Ilya Fedin
192a56ee15 Shorter notifications proxy check for Linux notifications 2025-08-13 11:19:38 +04:00
John Preston
cf16472dd0 Fix user profiles. 2025-08-13 11:18:34 +04:00
John Preston
b2fb2d5821 Attempt to fix the naturalWidth feature. 2025-08-13 11:18:34 +04:00
John Preston
c939eda7bb Hide "Use for calls" in Socks5 while not supported. 2025-08-13 11:18:34 +04:00
John Preston
428e059895 Write unknown cons to mtproto logs. 2025-08-13 11:18:34 +04:00
John Preston
1b4ea2e9c6 Use Api::ParseTextWithEntities more. 2025-08-13 11:18:34 +04:00
52 changed files with 445 additions and 454 deletions

View File

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

View File

@ -960,12 +960,9 @@ std::optional<Data::SavedStarGift> FromTL(
| ranges::to_vector)
: std::vector<int>()),
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
? Api::ParseTextWithEntities(
session,
data.vmessage()->data().ventities().v),
}
*data.vmessage())
: TextWithEntities()),
.starsConverted = int64(data.vconvert_stars().value_or_empty()),
.starsUpgradedBySender = int64(

View File

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

View File

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

View File

@ -741,7 +741,8 @@ void GiftCodeBox(
std::move(shareLink),
Ui::Text::WithEntities)),
st::giveawayGiftCodeFooter),
st::giveawayGiftCodeFooterMargin);
st::giveawayGiftCodeFooterMargin,
style::al_top);
footer->setClickHandlerFilter([=](const auto &...) {
ShareWithFriend(controller, slug);
return false;
@ -883,7 +884,8 @@ void GiftCodePendingBox(
box,
tr::lng_gift_link_pending_footer(),
st::giveawayGiftCodeFooter),
st::giveawayGiftCodeFooterMargin);
st::giveawayGiftCodeFooterMargin,
style::al_top);
const auto close = Ui::CreateChild<Ui::IconButton>(
box.get(),
@ -1186,7 +1188,8 @@ void GiveawayInfoBox(
: tr::lng_prizes_cancelled()),
st::giveawayRefundedLabel),
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>(
st::boxRadius,
st::attentionBoxButton.textBgOver);

View File

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

View File

@ -81,7 +81,6 @@ public:
bool selected);
[[nodiscard]] uint8 index() const;
int naturalWidth() const override;
void setSelected(bool selected);
@ -181,6 +180,15 @@ ColorSample::ColorSample(
colorIndex
) | rpl::start_with_next([=](uint8 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();
}, lifetime());
}
@ -195,6 +203,7 @@ ColorSample::ColorSample(
, _index(colorIndex)
, _selected(selected)
, _simple(true) {
setNaturalWidth(st::settingsColorSampleSize);
}
void ColorSample::setSelected(bool selected) {
@ -276,16 +285,6 @@ uint8 ColorSample::index() const {
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(
not_null<Ui::GenericBox*> box,
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);
box->addRow(object_ptr<Ui::CenterWrap<>>(
box,
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_credits_box_subscription_title(),
st::creditsBoxAboutTitle)));
st::creditsBoxAboutTitle),
st::boxRowPadding,
style::al_top);
Ui::AddSkip(content);
const auto subtitle1 = box->addRow(
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
box,
object_ptr<Ui::FlatLabel>(
box,
st::creditsTopupPrice)))->entity();
st::creditsTopupPrice),
st::boxRowPadding,
style::al_top);
subtitle1->setMarkedText(
tr::lng_credits_subscription_subtitle(
tr::now,
@ -1027,8 +1028,7 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
Ui::AddSkip(content);
Ui::AddSkip(content);
box->addRow(object_ptr<Ui::CenterWrap<>>(
box,
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
tr::lng_credits_box_out_about(
@ -1037,7 +1037,9 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
) | Ui::Text::ToLink(
tr::lng_credits_box_out_about_link(tr::now)),
Ui::Text::WithEntities),
st::creditsBoxAboutDivider)));
st::creditsBoxAboutDivider),
st::boxRowPadding,
style::al_top);
const auto button = box->addButton(tr::lng_box_ok(), [=] {
box->closeBox();

View File

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

View File

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

View File

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

View File

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

View File

@ -248,12 +248,9 @@ void TranslateBox(
showText(
Ui::Text::Italic(tr::lng_translate_box_error(tr::now)));
} else {
showText(TextWithEntities{
.text = qs(list.front().data().vtext()),
.entities = Api::EntitiesFromMTP(
showText(Api::ParseTextWithEntities(
&peer->session(),
list.front().data().ventities().v),
});
list.front()));
}
}).fail([=](const MTP::Error &error) {
showText(

View File

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

View File

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

View File

@ -196,22 +196,13 @@ void RecordingInfo::prepareVideo() {
}
void RecordingInfo::setLabel(const QString &text) {
const auto label = _container->add(
_container->add(
object_ptr<Ui::FlatLabel>(
_container,
text,
st::groupCallRecordingSubLabel),
st::groupCallRecordingSubLabelMargins);
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());
st::groupCallRecordingSubLabelMargins,
style::al_top);
}
RecordingType RecordingInfo::type() const {

View File

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

View File

@ -70,12 +70,9 @@ bool PollData::closeByTimer() {
bool PollData::applyChanges(const MTPDpoll &poll) {
Expects(poll.vid().v == id);
const auto newQuestion = TextWithEntities{
.text = qs(poll.vquestion().data().vtext()),
.entities = Api::EntitiesFromMTP(
const auto newQuestion = Api::ParseTextWithEntities(
&session(),
poll.vquestion().data().ventities().v),
};
poll.vquestion());
const auto newFlags = (poll.is_closed() ? Flag::Closed : Flag(0))
| (poll.is_public_voters() ? Flag::PublicVotes : Flag(0))
| (poll.is_multiple_choice() ? Flag::MultiChoice : Flag(0))
@ -88,12 +85,9 @@ bool PollData::applyChanges(const MTPDpoll &poll) {
return data.match([&](const MTPDpollAnswer &answer) {
auto result = PollAnswer();
result.option = answer.voption().v;
result.text = TextWithEntities{
.text = qs(answer.vtext().data().vtext()),
.entities = Api::EntitiesFromMTP(
result.text = Api::ParseTextWithEntities(
&session(),
answer.vtext().data().ventities().v),
};
answer.vtext());
return result;
});
}) | ranges::views::take(

View File

@ -45,12 +45,9 @@ Main::Session &TodoListData::session() const {
}
bool TodoListData::applyChanges(const MTPDtodoList &todolist) {
const auto newTitle = TextWithEntities{
.text = qs(todolist.vtitle().data().vtext()),
.entities = Api::EntitiesFromMTP(
const auto newTitle = Api::ParseTextWithEntities(
&session(),
todolist.vtitle().data().ventities().v),
};
todolist.vtitle());
const auto newFlags = (todolist.is_others_can_append()
? Flag::OthersCanAppend
: Flag())
@ -222,12 +219,7 @@ TodoListItem TodoListItemFromMTP(
const MTPTodoItem &item) {
const auto &data = item.data();
return {
.text = TextWithEntities{
.text = qs(data.vtitle().data().vtext()),
.entities = Api::EntitiesFromMTP(
session,
data.vtitle().data().ventities().v),
},
.text = Api::ParseTextWithEntities(session, data.vtitle()),
.id = data.vid().v,
};
}

View File

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

View File

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

View File

@ -6295,12 +6295,9 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
Data::GiftCode{
.slug = qs(data.vslug()),
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
? Api::ParseTextWithEntities(
&history()->session(),
data.vmessage()->data().ventities().v),
}
*data.vmessage())
: TextWithEntities()),
.channel = (boostedId
? history()->owner().channel(boostedId).get()
@ -6347,12 +6344,9 @@ void HistoryItem::applyAction(const MTPMessageAction &action) {
using Fields = Data::GiftCode;
auto fields = Fields{
.message = (data.vmessage()
? TextWithEntities{
.text = qs(data.vmessage()->data().vtext()),
.entities = Api::EntitiesFromMTP(
? Api::ParseTextWithEntities(
&history()->session(),
data.vmessage()->data().ventities().v),
}
*data.vmessage())
: TextWithEntities()),
.channel = ((service && peerIsChannel(to))
? history()->owner().channel(peerToChannel(to)).get()

View File

@ -1336,11 +1336,7 @@ MessageFactcheck FromMTP(
}
const auto &data = factcheck->data();
if (const auto text = data.vtext()) {
const auto &data = text->data();
result.text = {
qs(data.vtext()),
Api::EntitiesFromMTP(session, data.ventities().v),
};
result.text = Api::ParseTextWithEntities(session, *text);
}
if (const auto country = data.vcountry()) {
result.country = qs(country->v);

View File

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

View File

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

View File

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

View File

@ -829,7 +829,7 @@ rpl::producer<int> WrapWidget::desiredHeightValue() const {
QRect WrapWidget::contentGeometry() const {
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(

View File

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

View File

@ -1493,8 +1493,11 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupInfo() {
if (!user->isBot()) {
tracker.track(result->add(
CreateBirthday(result, controller, user)));
tracker.track(result->add(CreateWorkingHours(result, user)));
CreateBirthday(result, controller, user),
{},
style::al_justify));
tracker.track(result->add(
CreateWorkingHours(result, user), {}, style::al_justify));
auto locationText = user->session().changes().peerFlagsValue(
user,

View File

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

View File

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

View File

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

View File

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

View File

@ -153,7 +153,7 @@ ProxyData::Status ProxyData::status() const {
}
bool ProxyData::supportsCalls() const {
return (type == Type::Socks5);
return false;// (type == Type::Socks5);
}
bool ProxyData::tryCustomResolve() const {

View File

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

View File

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

View File

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

View File

@ -481,7 +481,8 @@ void PaidReactionsBox(
box,
tr::lng_paid_react_title(),
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(
object_ptr<RpWidget>(box),
(st::boxRowPadding

View File

@ -263,15 +263,7 @@ void Create(Window::Notifications::System *system) {
res,
nullptr);
if (!proxy) {
ServiceRegistered = false;
CurrentServerInformation = {};
CurrentCapabilities = {};
managerSetter(nullptr);
return;
}
ServiceRegistered = bool(proxy.get_name_owner());
ServiceRegistered = proxy ? bool(proxy.get_name_owner()) : false;
if (!ServiceRegistered) {
CurrentServerInformation = {};
CurrentCapabilities = {};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -752,14 +752,16 @@ void AskBoostBox(
box,
std::move(title),
st::boostCenteredTitle),
st::boxRowPadding + QMargins(0, st::boostTitleSkip, 0, 0));
st::boxRowPadding + QMargins(0, st::boostTitleSkip, 0, 0),
style::al_top);
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
std::move(text),
st::boostText),
(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);
stats->setClickedCallback(openStatistics);

View File

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

View File

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

View File

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

View File

@ -224,18 +224,6 @@ premiumGiftOption: PremiumOption {
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) {
buttonPadding: margins(12px, 12px, 12px, 12px);
}
@ -245,10 +233,6 @@ premiumGiftsUserpicButton: UserpicButton(defaultUserpicButton) {
photoSize: 66px;
photoPosition: point(-1px, -1px);
}
premiumGiftsUserpicBadgeSize: size(26px, 26px);
premiumGiftsUserpicBadgeInner: 2px;
premiumGiftsUserpicBadgeFont: font(14px bold);
premiumGiftsBoostIcon: icon{{ "stories/boost_mini", windowBgActive }};
boostSkipTop: 37px;
boostLimits: PremiumLimits(defaultPremiumLimits) {

View File

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

@ -1 +1 @@
Subproject commit 237cbeb9d1c637759f89a508c1d854caf16e1984
Subproject commit 783052514ea6bd9ed0b7ddb4e5adb8c0077e5b9a

@ -1 +1 @@
Subproject commit 7a21118ca0964dc66673df7a2241f846ec094860
Subproject commit a0fb3ce977ab5ff5952dcb96ef25caa17d6c1da1