mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Remove CenterWrap layout.
This commit is contained in:
@@ -142,13 +142,12 @@ void ConfirmSubscriptionBox(
|
||||
const auto content = box->verticalLayout();
|
||||
|
||||
Ui::AddSkip(content, st::confirmInvitePhotoTop);
|
||||
const auto userpicWrap = content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::RpWidget>(content)));
|
||||
const auto userpic = userpicWrap->entity();
|
||||
const auto userpic = content->add(
|
||||
object_ptr<Ui::RpWidget>(content),
|
||||
style::al_top);
|
||||
const auto photoSize = st::confirmInvitePhotoSize;
|
||||
userpic->resize(Size(photoSize));
|
||||
userpic->setNaturalWidth(photoSize);
|
||||
const auto creditsIconSize = photoSize / 3;
|
||||
const auto creditsIconCallback =
|
||||
Ui::PaintOutlinedColoredCreditsIconCallback(
|
||||
@@ -188,8 +187,8 @@ void ConfirmSubscriptionBox(
|
||||
}
|
||||
auto p = QPainter(userpic);
|
||||
p.drawImage(0, 0, state->frame);
|
||||
}, userpicWrap->lifetime());
|
||||
userpicWrap->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}, userpic->lifetime());
|
||||
userpic->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
if (photo) {
|
||||
state->photoMedia = photo->createMediaView();
|
||||
state->photoMedia->wanted(Data::PhotoSize::Small, Data::FileOrigin());
|
||||
@@ -197,7 +196,7 @@ void ConfirmSubscriptionBox(
|
||||
session->downloaderTaskFinished(
|
||||
) | rpl::start_with_next([=] {
|
||||
userpic->update();
|
||||
}, userpicWrap->entity()->lifetime());
|
||||
}, userpic->lifetime());
|
||||
}
|
||||
} else {
|
||||
state->photoEmpty = std::make_unique<Ui::EmptyUserpic>(
|
||||
@@ -219,7 +218,6 @@ void ConfirmSubscriptionBox(
|
||||
box,
|
||||
tr::lng_channel_invite_subscription_title(),
|
||||
st::inviteLinkSubscribeBoxTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
@@ -234,7 +232,6 @@ void ConfirmSubscriptionBox(
|
||||
Ui::Text::Bold),
|
||||
Ui::Text::WithEntities),
|
||||
st::inviteLinkSubscribeBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
box->addRow(
|
||||
@@ -250,7 +247,6 @@ void ConfirmSubscriptionBox(
|
||||
}),
|
||||
Ui::Text::RichLangValue),
|
||||
st::inviteLinkSubscribeBoxTerms),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
{
|
||||
|
||||
@@ -183,10 +183,8 @@ void ArchiveHintBox(
|
||||
const auto rect = Rect(icon.size() * 2);
|
||||
auto owned = object_ptr<Ui::RpWidget>(content);
|
||||
owned->resize(rect.size());
|
||||
const auto widget = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
std::move(owned)))->entity();
|
||||
owned->setNaturalWidth(rect.width());
|
||||
const auto widget = box->addRow(std::move(owned), style::al_top);
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = Painter(widget);
|
||||
@@ -199,12 +197,12 @@ void ArchiveHintBox(
|
||||
}
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_archive_hint_title(),
|
||||
st::boxTitle)));
|
||||
st::boxTitle),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
{
|
||||
|
||||
@@ -1293,7 +1293,7 @@ void EditDirectMessagesPriceBox(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
box,
|
||||
object_ptr<Ui::VerticalLayout>(box)),
|
||||
{});
|
||||
style::margins());
|
||||
wrap->toggle(savedValue.has_value(), anim::type::instant);
|
||||
wrap->toggleOn(toggle->toggledChanges());
|
||||
|
||||
|
||||
@@ -52,9 +52,8 @@ void GiftCreditsBox(
|
||||
Ui::AddSkip(content);
|
||||
const auto &stUser = st::premiumGiftsUserpicButton;
|
||||
const auto userpicWrap = content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::UserpicButton>(content, peer, stUser)));
|
||||
object_ptr<Ui::UserpicButton>(content, peer, stUser),
|
||||
style::al_top);
|
||||
userpicWrap->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
|
||||
@@ -990,12 +990,11 @@ void GiveawayInfoBox(
|
||||
label->setTextColorOverride(st::windowActiveTextFg->c);
|
||||
}
|
||||
const auto result = box->addRow(
|
||||
object_ptr<Ui::PaddingWrap<Ui::CenterWrap<Ui::FlatLabel>>>(
|
||||
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
box.get(),
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
box.get(),
|
||||
std::move(label)),
|
||||
QMargins(0, skip, 0, skip)));
|
||||
std::move(label),
|
||||
QMargins(0, skip, 0, skip)),
|
||||
style::al_justify);
|
||||
result->paintRequest() | rpl::start_with_next([=] {
|
||||
auto p = QPainter(result);
|
||||
p.setPen(Qt::NoPen);
|
||||
|
||||
@@ -513,7 +513,7 @@ void InviteForbiddenController::setComplexCover() {
|
||||
container->add(
|
||||
MakeShowOrLabel(container, tr::lng_invite_upgrade_or()),
|
||||
st::inviteForbiddenOrLabelPadding,
|
||||
style::al_top);
|
||||
style::al_justify);
|
||||
}
|
||||
container->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
|
||||
@@ -1200,7 +1200,7 @@ void EditPeerColorBox(
|
||||
peer,
|
||||
state->index.value(),
|
||||
state->emojiId.value()
|
||||
), {});
|
||||
), style::margins());
|
||||
|
||||
auto indices = peer->session().api().peerColors().suggestedValue();
|
||||
const auto margin = st::settingsColorRadioMargin;
|
||||
|
||||
@@ -969,9 +969,9 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||
|
||||
const auto photoSize = st::boostReplaceUserpic.photoSize;
|
||||
const auto session = &row->peer()->session();
|
||||
content->add(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
Settings::SubscriptionUserpic(content, channel, photoSize)));
|
||||
content->add(
|
||||
Settings::SubscriptionUserpic(content, channel, photoSize),
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
@@ -981,7 +981,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||
box,
|
||||
tr::lng_credits_box_subscription_title(),
|
||||
st::creditsBoxAboutTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(content);
|
||||
@@ -990,7 +989,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
st::creditsTopupPrice),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
subtitle1->setMarkedText(
|
||||
tr::lng_credits_subscription_subtitle(
|
||||
@@ -1002,11 +1000,10 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||
Ui::Text::WithEntities),
|
||||
_emojiHelper.context());
|
||||
const auto subtitle2 = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
st::creditsTopupPrice)))->entity();
|
||||
st::creditsTopupPrice),
|
||||
style::al_top);
|
||||
session->credits().rateValue(
|
||||
channel
|
||||
) | rpl::start_with_next([=, currency = u"USD"_q](float64 rate) {
|
||||
@@ -1038,7 +1035,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
|
||||
tr::lng_credits_box_out_about_link(tr::now)),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsBoxAboutDivider),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
const auto button = box->addButton(tr::lng_box_ok(), [=] {
|
||||
|
||||
@@ -585,14 +585,14 @@ void ChannelsLimitBox(
|
||||
|
||||
const auto content = box->addRow(
|
||||
object_ptr<PeerListContent>(box, controller),
|
||||
{});
|
||||
style::margins());
|
||||
delegate->setContent(content);
|
||||
controller->setDelegate(delegate);
|
||||
|
||||
const auto count = 100;
|
||||
const auto placeholder = box->addRow(
|
||||
object_ptr<PeerListDummy>(box, count, st::defaultPeerList),
|
||||
{});
|
||||
style::margins());
|
||||
|
||||
using namespace rpl::mappers;
|
||||
controller->countValue(
|
||||
@@ -676,14 +676,14 @@ void PublicLinksLimitBox(
|
||||
|
||||
const auto content = box->addRow(
|
||||
object_ptr<PeerListContent>(box, controller),
|
||||
{});
|
||||
style::margins());
|
||||
delegate->setContent(content);
|
||||
controller->setDelegate(delegate);
|
||||
|
||||
const auto count = defaultLimit;
|
||||
const auto placeholder = box->addRow(
|
||||
object_ptr<PeerListDummy>(box, count, st::defaultPeerList),
|
||||
{});
|
||||
style::margins());
|
||||
|
||||
using namespace rpl::mappers;
|
||||
controller->countValue(
|
||||
|
||||
@@ -902,7 +902,7 @@ void PreviewBox(
|
||||
|
||||
const auto outer = box->addRow(
|
||||
ChatBackPreview(box, size.height(), back),
|
||||
{});
|
||||
style::margins());
|
||||
|
||||
struct Hiding {
|
||||
not_null<Ui::RpWidget*> widget;
|
||||
|
||||
@@ -348,9 +348,9 @@ void SendCreditsBox(
|
||||
}, ministarsContainer->lifetime());
|
||||
}
|
||||
|
||||
const auto thumb = box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
SendCreditsThumbnail(content, session, form.get(), photoSize)));
|
||||
const auto thumb = box->addRow(
|
||||
SendCreditsThumbnail(content, session, form.get(), photoSize),
|
||||
style::al_top);
|
||||
thumb->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
if (form->invoice.subscriptionPeriod) {
|
||||
const auto badge = SendCreditsBadge(content, form->invoice.amount);
|
||||
@@ -371,16 +371,14 @@ void SendCreditsBox(
|
||||
? rpl::single(form->title)
|
||||
: tr::lng_credits_box_out_title(),
|
||||
st::settingsPremiumUserTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
if (form->invoice.subscriptionPeriod && form->botId && form->photo) {
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
const auto bot = session->data().user(form->botId);
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
Ui::CreatePeerBubble(box, bot)));
|
||||
Ui::CreatePeerBubble(box, bot),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
}
|
||||
Ui::AddSkip(content);
|
||||
@@ -389,7 +387,6 @@ void SendCreditsBox(
|
||||
box,
|
||||
SendCreditsConfirmText(session, form.get()),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
|
||||
@@ -3151,10 +3151,9 @@ void GiftBox(
|
||||
&& uniqueDisallowed;
|
||||
|
||||
content->add(
|
||||
object_ptr<CenterWrap<UserpicButton>>(
|
||||
content,
|
||||
object_ptr<UserpicButton>(content, peer, stUser))
|
||||
)->entity()->setClickedCallback([=] { window->showPeerInfo(peer); });
|
||||
object_ptr<UserpicButton>(content, peer, stUser),
|
||||
style::al_top
|
||||
)->setClickedCallback([=] { window->showPeerInfo(peer); });
|
||||
AddSkip(content);
|
||||
AddSkip(content);
|
||||
|
||||
@@ -4919,19 +4918,18 @@ void UpgradeBox(
|
||||
object_ptr<PlainShadow>(container),
|
||||
st::boxRowPadding + QMargins(0, skip, 0, skip));
|
||||
const auto checkbox = container->add(
|
||||
object_ptr<CenterWrap<Checkbox>>(
|
||||
object_ptr<Checkbox>(
|
||||
container,
|
||||
object_ptr<Checkbox>(
|
||||
container,
|
||||
(args.canAddComment
|
||||
? tr::lng_gift_upgrade_add_comment(tr::now)
|
||||
: args.canAddSender
|
||||
? tr::lng_gift_upgrade_add_sender(tr::now)
|
||||
: args.canAddMyComment
|
||||
? tr::lng_gift_upgrade_add_my_comment(tr::now)
|
||||
: tr::lng_gift_upgrade_add_my(tr::now)),
|
||||
args.addDetailsDefault)),
|
||||
st::defaultCheckbox.margin)->entity();
|
||||
(args.canAddComment
|
||||
? tr::lng_gift_upgrade_add_comment(tr::now)
|
||||
: args.canAddSender
|
||||
? tr::lng_gift_upgrade_add_sender(tr::now)
|
||||
: args.canAddMyComment
|
||||
? tr::lng_gift_upgrade_add_my_comment(tr::now)
|
||||
: tr::lng_gift_upgrade_add_my(tr::now)),
|
||||
args.addDetailsDefault),
|
||||
st::defaultCheckbox.margin,
|
||||
style::al_top);
|
||||
checkbox->checkedChanges() | rpl::start_with_next([=](bool checked) {
|
||||
state->preserveDetails = checked;
|
||||
}, checkbox->lifetime());
|
||||
|
||||
@@ -324,7 +324,7 @@ void UsernamesBox(
|
||||
|
||||
const auto editor = box->addRow(
|
||||
object_ptr<UsernameEditor>(box, peer),
|
||||
{});
|
||||
style::margins());
|
||||
editor->setEnabled(!isBot);
|
||||
box->setFocusCallback([=] { editor->setInnerFocus(); });
|
||||
|
||||
@@ -366,7 +366,7 @@ void UsernamesBox(
|
||||
!isBot
|
||||
? [=] { box->scrollToY(0); editor->setInnerFocus(); }
|
||||
: Fn<void()>(nullptr)),
|
||||
{});
|
||||
style::margins());
|
||||
|
||||
const auto finish = [=] {
|
||||
list->save(
|
||||
|
||||
@@ -825,7 +825,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
box,
|
||||
object_ptr<Ui::VerticalLayout>(box)),
|
||||
{});
|
||||
style::margins());
|
||||
groupCalls->hide(anim::type::instant);
|
||||
groupCalls->toggleOn(state->groupCallsController.shownValue());
|
||||
|
||||
@@ -833,8 +833,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
|
||||
groupCalls->entity(),
|
||||
tr::lng_call_box_groupcalls_subtitle());
|
||||
state->groupCallsDelegate.setContent(groupCalls->entity()->add(
|
||||
object_ptr<PeerListContent>(box, &state->groupCallsController),
|
||||
{}));
|
||||
object_ptr<PeerListContent>(box, &state->groupCallsController)));
|
||||
state->groupCallsController.setDelegate(&state->groupCallsDelegate);
|
||||
Ui::AddSkip(groupCalls->entity());
|
||||
Ui::AddDivider(groupCalls->entity());
|
||||
@@ -853,7 +852,7 @@ void ShowCallsBox(not_null<::Window::SessionController*> window) {
|
||||
|
||||
const auto content = box->addRow(
|
||||
object_ptr<PeerListContent>(box, &state->callsController),
|
||||
{});
|
||||
style::margins());
|
||||
state->callsDelegate.setContent(content);
|
||||
state->callsController.setDelegate(&state->callsDelegate);
|
||||
|
||||
|
||||
@@ -116,13 +116,12 @@ void ConferenceCallJoinConfirm(
|
||||
st::boxRowPadding + st::confcallLinkHeaderIconPadding);
|
||||
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_confcall_join_title(),
|
||||
st::boxTitle)),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding);
|
||||
tr::lng_confcall_join_title(),
|
||||
st::boxTitle),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding,
|
||||
style::al_top);
|
||||
const auto wrapName = [&](not_null<PeerData*> peer) {
|
||||
return rpl::single(Ui::Text::Bold(peer->shortName()));
|
||||
};
|
||||
@@ -323,13 +322,12 @@ void ShowConferenceCallLinkBox(
|
||||
Info::BotStarRef::CreateLinkHeaderIcon(box, &call->session()),
|
||||
st::boxRowPadding + st::confcallLinkHeaderIconPadding);
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_confcall_link_title(),
|
||||
st.box ? st.box->title : st::boxTitle)),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding);
|
||||
tr::lng_confcall_link_title(),
|
||||
st.box ? st.box->title : st::boxTitle),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding,
|
||||
style::al_top);
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
|
||||
@@ -1042,13 +1042,12 @@ not_null<Ui::RpWidget*> CreateReActivateHeader(not_null<QWidget*> parent) {
|
||||
st::boxRowPadding + st::confcallLinkHeaderIconPadding);
|
||||
|
||||
result->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
result,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
result,
|
||||
tr::lng_confcall_inactive_title(),
|
||||
st::boxTitle)),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding);
|
||||
tr::lng_confcall_inactive_title(),
|
||||
st::boxTitle),
|
||||
st::boxRowPadding + st::confcallLinkTitlePadding,
|
||||
style::al_top);
|
||||
result->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
result,
|
||||
|
||||
@@ -4151,14 +4151,13 @@ void InnerWidget::refreshEmpty() {
|
||||
.name = u"no_chats"_q,
|
||||
.sizeOverride = Size(st::changePhoneIconSize),
|
||||
});
|
||||
_emptyList->add(std::move(icon.widget), {}, style::al_top);
|
||||
_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),
|
||||
{},
|
||||
style::al_top);
|
||||
if (_state == WidgetState::Default) {
|
||||
icon.animate(anim::repeat::once);
|
||||
|
||||
@@ -186,7 +186,6 @@ void PostsSearchIntro::setup() {
|
||||
_content.get(),
|
||||
rpl::single(QString()),
|
||||
st::postsSearchIntroButton),
|
||||
{},
|
||||
style::al_top);
|
||||
_button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
_footer = _content->add(
|
||||
|
||||
@@ -1075,7 +1075,7 @@ void DraftOptionsBox(
|
||||
|
||||
state->wrap = box->addRow(
|
||||
object_ptr<PreviewWrap>(box, args.history),
|
||||
{});
|
||||
style::margins());
|
||||
state->wrap->draggingScrollDelta(
|
||||
) | rpl::start_with_next([=](int delta) {
|
||||
box->scrollByDraggingDelta(delta);
|
||||
|
||||
@@ -394,7 +394,6 @@ void ChooseSuggestPriceBox(
|
||||
box,
|
||||
std::move(title),
|
||||
st::settingsPremiumUserTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
}
|
||||
|
||||
|
||||
@@ -446,13 +446,12 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
|
||||
CreateLinkIcon(box, &bot->session(), row.state.users),
|
||||
st::boxRowPadding + st::starrefJoinUserpicsPadding);
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_star_ref_link_title(),
|
||||
st::boxTitle)),
|
||||
st::boxRowPadding + st::starrefJoinTitlePadding);
|
||||
tr::lng_star_ref_link_title(),
|
||||
st::boxTitle),
|
||||
st::boxRowPadding + st::starrefJoinTitlePadding,
|
||||
style::al_top);
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
@@ -470,7 +469,6 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
|
||||
FormatForProgramDuration(program.durationMonths),
|
||||
Ui::Text::WithEntities),
|
||||
st::starrefCenteredText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3);
|
||||
@@ -480,7 +478,6 @@ object_ptr<Ui::BoxContent> StarRefLinkBox(
|
||||
box,
|
||||
tr::lng_star_ref_link_recipient(),
|
||||
st::starrefCenteredText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
box->addRow(object_ptr<Ui::AbstractButton>::fromRaw(
|
||||
@@ -579,13 +576,12 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
|
||||
}, box->lifetime());
|
||||
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_star_ref_title(),
|
||||
st::boxTitle)),
|
||||
st::boxRowPadding + st::starrefJoinTitlePadding);
|
||||
tr::lng_star_ref_title(),
|
||||
st::boxTitle),
|
||||
st::boxRowPadding + st::starrefJoinTitlePadding,
|
||||
style::al_top);
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
@@ -599,7 +595,6 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
|
||||
FormatForProgramDuration(program.durationMonths),
|
||||
Ui::Text::WithEntities),
|
||||
st::starrefCenteredText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(box->verticalLayout(), st::defaultVerticalListSkip * 3);
|
||||
@@ -641,7 +636,6 @@ object_ptr<Ui::BoxContent> JoinStarRefBox(
|
||||
box,
|
||||
tr::lng_star_ref_link_recipient(),
|
||||
st::starrefCenteredText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
const auto recipientWrap = box->addRow(
|
||||
|
||||
@@ -215,7 +215,7 @@ void AddPremiumTopBarWithDefaultTitleBar(
|
||||
+ st::defaultVerticalListSkip,
|
||||
st::boxDividerBg,
|
||||
RectPart::Bottom),
|
||||
{});
|
||||
style::margins());
|
||||
bar->setPaused(true);
|
||||
bar->setRoundEdges(false);
|
||||
bar->setMaximumHeight(st::giveawayGiftCodeTopHeight);
|
||||
@@ -348,12 +348,11 @@ void CreateGiveawayBox(
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddSkip(container);
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_contacts_loading(),
|
||||
st::giveawayLoadingLabel)));
|
||||
tr::lng_contacts_loading(),
|
||||
st::giveawayLoadingLabel),
|
||||
style::al_top);
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddSkip(container);
|
||||
}
|
||||
|
||||
+4
-5
@@ -177,12 +177,11 @@ void SelectCountriesBox(
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddSkip(container);
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
tr::lng_search_messages_none(),
|
||||
st::membersAbout)));
|
||||
tr::lng_search_messages_none(),
|
||||
st::membersAbout),
|
||||
style::al_top);
|
||||
Ui::AddSkip(container);
|
||||
Ui::AddSkip(container);
|
||||
}
|
||||
|
||||
@@ -140,14 +140,12 @@ void AddHeader(
|
||||
}
|
||||
|
||||
void AddRecipient(not_null<Ui::GenericBox*> box, const TextWithEntities &t) {
|
||||
const auto wrap = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
const auto container = box->addRow(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
box,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
box,
|
||||
rpl::single(QString()),
|
||||
st::channelEarnHistoryRecipientButton)));
|
||||
const auto container = wrap->entity();
|
||||
rpl::single(QString()),
|
||||
st::channelEarnHistoryRecipientButton),
|
||||
style::al_top);
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
container,
|
||||
rpl::single(t),
|
||||
@@ -449,10 +447,10 @@ void InnerWidget::fill() {
|
||||
const auto rect = Rect(icon.size() * 1.4);
|
||||
auto owned = object_ptr<Ui::RpWidget>(content);
|
||||
owned->resize(rect.size());
|
||||
owned->setNaturalWidth(rect.width());
|
||||
const auto widget = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
std::move(owned)))->entity();
|
||||
std::move(owned),
|
||||
style::al_top);
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = Painter(widget);
|
||||
@@ -465,14 +463,13 @@ void InnerWidget::fill() {
|
||||
}
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
bot
|
||||
? tr::lng_channel_earn_bot_learn_title()
|
||||
: tr::lng_channel_earn_learn_title(),
|
||||
st::boxTitle)));
|
||||
bot
|
||||
? tr::lng_channel_earn_bot_learn_title()
|
||||
: tr::lng_channel_earn_learn_title(),
|
||||
st::boxTitle),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
@@ -540,17 +537,17 @@ void InnerWidget::fill() {
|
||||
Ui::AddSkip(content);
|
||||
{
|
||||
const auto l = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_channel_earn_learn_coin_title(
|
||||
lt_emoji,
|
||||
rpl::single(
|
||||
Ui::Text::Link(bigCurrencyIcon, 1)),
|
||||
Ui::Text::RichLangValue
|
||||
),
|
||||
st::boxTitle)))->entity();
|
||||
tr::lng_channel_earn_learn_coin_title(
|
||||
lt_emoji,
|
||||
rpl::single(
|
||||
Ui::Text::Link(bigCurrencyIcon, 1)),
|
||||
Ui::Text::RichLangValue),
|
||||
st::boxTitle,
|
||||
st::defaultPopupMenu,
|
||||
emojiHelper.context()),
|
||||
style::al_top);
|
||||
const auto diamonds = l->lifetime().make_state<int>(0);
|
||||
l->setLink(1, std::make_shared<LambdaClickHandler>([=] {
|
||||
const auto count = (*diamonds);
|
||||
@@ -837,9 +834,8 @@ void InnerWidget::fill() {
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto labels = container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RpWidget>>(
|
||||
container,
|
||||
object_ptr<Ui::RpWidget>(container)))->entity();
|
||||
object_ptr<Ui::RpWidget>(container),
|
||||
style::al_top);
|
||||
|
||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||
labels,
|
||||
@@ -864,6 +860,8 @@ void InnerWidget::fill() {
|
||||
labels->resize(
|
||||
majorSize.width() + minorSize.width(),
|
||||
majorSize.height());
|
||||
labels->setNaturalWidth(
|
||||
majorSize.width() + minorSize.width());
|
||||
majorLabel->moveToLeft(0, 0);
|
||||
minorLabel->moveToRight(
|
||||
0,
|
||||
@@ -873,12 +871,11 @@ void InnerWidget::fill() {
|
||||
|
||||
Ui::AddSkip(container);
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
ToUsd(value, multiplier, 0),
|
||||
st::channelEarnOverviewSubMinorLabel)));
|
||||
ToUsd(value, multiplier, 0),
|
||||
st::channelEarnOverviewSubMinorLabel),
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
@@ -888,7 +885,8 @@ void InnerWidget::fill() {
|
||||
container,
|
||||
rpl::never<QString>(),
|
||||
stButton),
|
||||
st::boxRowPadding);
|
||||
st::boxRowPadding,
|
||||
style::al_justify);
|
||||
|
||||
const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
button,
|
||||
@@ -1156,9 +1154,8 @@ void InnerWidget::fill() {
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
const auto labels = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::RpWidget>>(
|
||||
box,
|
||||
object_ptr<Ui::RpWidget>(box)))->entity();
|
||||
object_ptr<Ui::RpWidget>(box),
|
||||
style::al_top);
|
||||
|
||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||
labels,
|
||||
@@ -1187,6 +1184,8 @@ void InnerWidget::fill() {
|
||||
labels->resize(
|
||||
majorSize.width() + minorSize.width(),
|
||||
majorSize.height());
|
||||
labels->setNaturalWidth(
|
||||
majorSize.width() + minorSize.width());
|
||||
majorLabel->moveToLeft(0, 0);
|
||||
minorLabel->moveToRight(
|
||||
0,
|
||||
@@ -1194,12 +1193,12 @@ void InnerWidget::fill() {
|
||||
}, box->lifetime());
|
||||
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
dateText,
|
||||
st::channelEarnHistorySubLabel)));
|
||||
st::channelEarnHistorySubLabel),
|
||||
style::al_top);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
AddChannelEarnTable(
|
||||
@@ -1208,14 +1207,14 @@ void InnerWidget::fill() {
|
||||
entry);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
isIn
|
||||
? tr::lng_channel_earn_history_in_about()
|
||||
: tr::lng_channel_earn_history_out(),
|
||||
st::channelEarnHistoryDescriptionLabel)));
|
||||
st::channelEarnHistoryDescriptionLabel),
|
||||
style::al_top);
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
if (isIn) {
|
||||
Ui::AddSkip(box->verticalLayout());
|
||||
@@ -1226,9 +1225,8 @@ void InnerWidget::fill() {
|
||||
}
|
||||
if (isIn) {
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
box,
|
||||
Ui::CreatePeerBubble(box, peer)));
|
||||
Ui::CreatePeerBubble(box, peer),
|
||||
style::al_top);
|
||||
}
|
||||
const auto closeBox = [=] { box->closeBox(); };
|
||||
{
|
||||
|
||||
@@ -979,30 +979,27 @@ void InnerWidget::refreshAbout() {
|
||||
} else if (collectionCanAdd) {
|
||||
auto about = std::make_unique<Ui::VerticalLayout>(this);
|
||||
about->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
about.get(),
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
about.get(),
|
||||
tr::lng_gift_collection_empty_title(),
|
||||
st::collectionEmptyTitle)),
|
||||
st::collectionEmptyTitleMargin);
|
||||
tr::lng_gift_collection_empty_title(),
|
||||
st::collectionEmptyTitle),
|
||||
st::collectionEmptyTitleMargin,
|
||||
style::al_top);
|
||||
about->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
about.get(),
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
about.get(),
|
||||
tr::lng_gift_collection_empty_text(),
|
||||
st::collectionEmptyText)),
|
||||
st::collectionEmptyTextMargin);
|
||||
tr::lng_gift_collection_empty_text(),
|
||||
st::collectionEmptyText),
|
||||
st::collectionEmptyTextMargin,
|
||||
style::al_top);
|
||||
|
||||
const auto button = about->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
about.get(),
|
||||
object_ptr<Ui::RoundButton>(
|
||||
about.get(),
|
||||
rpl::single(QString()),
|
||||
st::collectionEmptyButton)),
|
||||
st::collectionEmptyAddMargin)->entity();
|
||||
rpl::single(QString()),
|
||||
st::collectionEmptyButton),
|
||||
st::collectionEmptyAddMargin,
|
||||
style::al_top);
|
||||
button->setText(tr::lng_gift_collection_add_button(
|
||||
) | rpl::map([](const QString &text) {
|
||||
return Ui::Text::IconEmoji(&st::collectionAddIcon).append(text);
|
||||
@@ -1081,7 +1078,7 @@ void InnerWidget::editCollectionGifts(int id) {
|
||||
state->descriptor.value(),
|
||||
id,
|
||||
(_all.filter == Filter()) ? _all : Entries()),
|
||||
{});
|
||||
style::margins());
|
||||
state->changes = content->changes();
|
||||
|
||||
content->descriptorChanges(
|
||||
@@ -1505,6 +1502,7 @@ Widget::Widget(QWidget *parent, not_null<Controller*> controller)
|
||||
controller->parentController(),
|
||||
controller->giftsPeer(),
|
||||
_descriptor.value()));
|
||||
_emptyCollectionShown = _inner->collectionEmptyValue();
|
||||
_inner->notifyEnabled(
|
||||
) | rpl::take(1) | rpl::start_with_next([=](bool enabled) {
|
||||
_notifyEnabled = enabled;
|
||||
@@ -1518,7 +1516,10 @@ Widget::Widget(QWidget *parent, not_null<Controller*> controller)
|
||||
scrollTo({ 0, 0 });
|
||||
}, _inner->lifetime());
|
||||
|
||||
_descriptor.value() | rpl::start_with_next([=] {
|
||||
rpl::combine(
|
||||
_descriptor.value(),
|
||||
_emptyCollectionShown.value()
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshBottom();
|
||||
}, _inner->lifetime());
|
||||
}
|
||||
@@ -1527,22 +1528,22 @@ void Widget::refreshBottom() {
|
||||
const auto notify = _notifyEnabled.has_value();
|
||||
const auto descriptor = _descriptor.current();
|
||||
const auto shownId = descriptor.collectionId;
|
||||
const auto withButton = shownId && peer()->canManageGifts();
|
||||
const auto withButton = shownId
|
||||
&& peer()->canManageGifts()
|
||||
&& !_emptyCollectionShown.current();
|
||||
const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0;
|
||||
delete _pinnedToBottom.data();
|
||||
if (!notify && !withButton) {
|
||||
setScrollBottomSkip(0);
|
||||
_hasPinnedToBottom = false;
|
||||
} else if (withButton) {
|
||||
setupBottomButton(wasBottom, _inner->collectionEmptyValue());
|
||||
setupBottomButton(wasBottom);
|
||||
} else {
|
||||
setupNotifyCheckbox(wasBottom, *_notifyEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setupBottomButton(
|
||||
int wasBottomHeight,
|
||||
rpl::producer<bool> hidden) {
|
||||
void Widget::setupBottomButton(int wasBottomHeight) {
|
||||
_pinnedToBottom = Ui::CreateChild<Ui::SlideWrap<Ui::RpWidget>>(
|
||||
this,
|
||||
object_ptr<Ui::RpWidget>(this));
|
||||
@@ -1561,10 +1562,8 @@ void Widget::setupBottomButton(
|
||||
) | rpl::map([](const QString &text) {
|
||||
return Ui::Text::IconEmoji(&st::collectionAddIcon).append(text);
|
||||
}));
|
||||
std::move(hidden) | rpl::start_with_next([=](bool hidden) {
|
||||
button->setVisible(!hidden);
|
||||
_hasPinnedToBottom = !hidden;
|
||||
}, button->lifetime());
|
||||
button->show();
|
||||
_hasPinnedToBottom = true;
|
||||
|
||||
button->setClickedCallback([=] {
|
||||
if (const auto id = _descriptor.current().collectionId) {
|
||||
|
||||
@@ -105,12 +105,13 @@ private:
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
|
||||
void setupNotifyCheckbox(int wasBottomHeight, bool enabled);
|
||||
void setupBottomButton(int wasBottomHeight, rpl::producer<bool> hidden);
|
||||
void setupBottomButton(int wasBottomHeight);
|
||||
void refreshBottom();
|
||||
|
||||
InnerWidget *_inner = nullptr;
|
||||
QPointer<Ui::SlideWrap<Ui::RpWidget>> _pinnedToBottom;
|
||||
rpl::variable<bool> _hasPinnedToBottom;
|
||||
rpl::variable<bool> _emptyCollectionShown;
|
||||
rpl::variable<Descriptor> _descriptor;
|
||||
std::optional<bool> _notifyEnabled;
|
||||
bool _shown = false;
|
||||
|
||||
@@ -1985,7 +1985,8 @@ void DetailsFiller::setupMainApp() {
|
||||
_wrap,
|
||||
tr::lng_profile_open_app(),
|
||||
st::infoOpenApp),
|
||||
st::infoOpenAppMargin);
|
||||
st::infoOpenAppMargin,
|
||||
style::al_justify);
|
||||
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
|
||||
const auto user = _peer->asUser();
|
||||
|
||||
@@ -590,30 +590,29 @@ void FillLoading(
|
||||
content->add(std::move(icon.widget));
|
||||
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
(type == LoadingType::Boosts)
|
||||
? tr::lng_stats_boosts_loading()
|
||||
: (type == LoadingType::Earn)
|
||||
? tr::lng_stats_earn_loading()
|
||||
: tr::lng_stats_loading(),
|
||||
st::changePhoneTitle)),
|
||||
st::changePhoneTitlePadding + st::boxRowPadding);
|
||||
(type == LoadingType::Boosts)
|
||||
? tr::lng_stats_boosts_loading()
|
||||
: (type == LoadingType::Earn)
|
||||
? tr::lng_stats_earn_loading()
|
||||
: tr::lng_stats_loading(),
|
||||
st::changePhoneTitle),
|
||||
st::changePhoneTitlePadding + st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
(type == LoadingType::Boosts)
|
||||
? tr::lng_stats_boosts_loading_subtext()
|
||||
: (type == LoadingType::Earn)
|
||||
? tr::lng_stats_earn_loading_subtext()
|
||||
: tr::lng_stats_loading_subtext(),
|
||||
st::statisticsLoadingSubtext)),
|
||||
st::changePhoneDescriptionPadding + st::boxRowPadding);
|
||||
(type == LoadingType::Boosts)
|
||||
? tr::lng_stats_boosts_loading_subtext()
|
||||
: (type == LoadingType::Earn)
|
||||
? tr::lng_stats_earn_loading_subtext()
|
||||
: tr::lng_stats_loading_subtext(),
|
||||
st::statisticsLoadingSubtext),
|
||||
st::changePhoneDescriptionPadding + st::boxRowPadding,
|
||||
style::al_top
|
||||
)->setTryMakeSimilarLines(true);
|
||||
|
||||
Ui::AddSkip(content, st::settingsBlockedListIconPadding.top());
|
||||
}
|
||||
|
||||
@@ -586,30 +586,27 @@ void InnerWidget::refreshEmpty() {
|
||||
if (albumCanAdd) {
|
||||
auto empty = object_ptr<Ui::VerticalLayout>(this);
|
||||
empty->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
empty.get(),
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
empty.get(),
|
||||
tr::lng_stories_album_empty_title(),
|
||||
st::collectionEmptyTitle)),
|
||||
st::collectionEmptyTitleMargin);
|
||||
tr::lng_stories_album_empty_title(),
|
||||
st::collectionEmptyTitle),
|
||||
st::collectionEmptyTitleMargin,
|
||||
style::al_top);
|
||||
empty->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
empty.get(),
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
empty.get(),
|
||||
tr::lng_stories_album_empty_text(),
|
||||
st::collectionEmptyText)),
|
||||
st::collectionEmptyTextMargin);
|
||||
tr::lng_stories_album_empty_text(),
|
||||
st::collectionEmptyText),
|
||||
st::collectionEmptyTextMargin,
|
||||
style::al_top);
|
||||
|
||||
const auto button = empty->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
empty.get(),
|
||||
object_ptr<Ui::RoundButton>(
|
||||
empty.get(),
|
||||
rpl::single(QString()),
|
||||
st::collectionEmptyButton)),
|
||||
st::collectionEmptyAddMargin)->entity();
|
||||
rpl::single(QString()),
|
||||
st::collectionEmptyButton),
|
||||
st::collectionEmptyAddMargin,
|
||||
style::al_top);
|
||||
button->setText(tr::lng_stories_album_add_button(
|
||||
) | rpl::map([](const QString &text) {
|
||||
return Ui::Text::IconEmoji(&st::collectionAddIcon).append(text);
|
||||
|
||||
@@ -65,6 +65,7 @@ Widget::Widget(
|
||||
controller,
|
||||
_albumId.value(),
|
||||
controller->key().storiesAddToAlbumId()));
|
||||
_emptyAlbumShown = _inner->albumEmptyValue();
|
||||
_inner->albumIdChanges() | rpl::start_with_next([=](int id) {
|
||||
controller->showSection(
|
||||
Make(controller->storiesPeer(), id),
|
||||
@@ -76,7 +77,10 @@ Widget::Widget(
|
||||
scrollTo(request);
|
||||
}, _inner->lifetime());
|
||||
|
||||
_albumId.value() | rpl::start_with_next([=] {
|
||||
rpl::combine(
|
||||
_albumId.value(),
|
||||
_emptyAlbumShown.value()
|
||||
) | rpl::start_with_next([=] {
|
||||
refreshBottom();
|
||||
}, _inner->lifetime());
|
||||
}
|
||||
@@ -133,20 +137,19 @@ void Widget::refreshBottom() {
|
||||
const auto albumId = _albumId.current();
|
||||
const auto withButton = (albumId != Data::kStoriesAlbumIdSaved)
|
||||
&& (albumId != Data::kStoriesAlbumIdArchive)
|
||||
&& controller()->storiesPeer()->canEditStories();
|
||||
&& controller()->storiesPeer()->canEditStories()
|
||||
&& !_emptyAlbumShown.current();
|
||||
const auto wasBottom = _pinnedToBottom ? _pinnedToBottom->height() : 0;
|
||||
delete _pinnedToBottom.data();
|
||||
if (!withButton) {
|
||||
setScrollBottomSkip(0);
|
||||
_hasPinnedToBottom = false;
|
||||
} else {
|
||||
setupBottomButton(wasBottom, _inner->albumEmptyValue());
|
||||
setupBottomButton(wasBottom);
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::setupBottomButton(
|
||||
int wasBottomHeight,
|
||||
rpl::producer<bool> hidden) {
|
||||
void Widget::setupBottomButton(int wasBottomHeight) {
|
||||
_pinnedToBottom = Ui::CreateChild<Ui::SlideWrap<Ui::RpWidget>>(
|
||||
this,
|
||||
object_ptr<Ui::RpWidget>(this));
|
||||
@@ -166,10 +169,7 @@ void Widget::setupBottomButton(
|
||||
return Ui::Text::IconEmoji(&st::collectionAddIcon).append(text);
|
||||
}));
|
||||
button->show();
|
||||
std::move(hidden) | rpl::start_with_next([=](bool hidden) {
|
||||
button->setVisible(!hidden);
|
||||
_hasPinnedToBottom = !hidden;
|
||||
}, button->lifetime());
|
||||
_hasPinnedToBottom = true;
|
||||
|
||||
button->setClickedCallback([=] {
|
||||
if (const auto id = _albumId.current()) {
|
||||
|
||||
@@ -72,7 +72,7 @@ private:
|
||||
void saveState(not_null<Memento*> memento);
|
||||
void restoreState(not_null<Memento*> memento);
|
||||
|
||||
void setupBottomButton(int wasBottomHeight, rpl::producer<bool> hidden);
|
||||
void setupBottomButton(int wasBottomHeight);
|
||||
void refreshBottom();
|
||||
|
||||
std::shared_ptr<ContentMemento> doCreateMemento() override;
|
||||
@@ -81,6 +81,7 @@ private:
|
||||
InnerWidget *_inner = nullptr;
|
||||
QPointer<Ui::SlideWrap<Ui::RpWidget>> _pinnedToBottom;
|
||||
rpl::variable<bool> _hasPinnedToBottom;
|
||||
rpl::variable<bool> _emptyAlbumShown;
|
||||
bool _shown = false;
|
||||
|
||||
};
|
||||
|
||||
@@ -52,10 +52,11 @@ QRect BubbleWrapInnerRect(const QRect &r) {
|
||||
not_null<Ui::RpWidget*> AddBubbleWrap(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
const QSize &size) {
|
||||
const auto bubble = container->add(object_ptr<Ui::CenterWrap<RpWidget>>(
|
||||
container,
|
||||
object_ptr<Ui::RpWidget>(container)))->entity();
|
||||
const auto bubble = container->add(
|
||||
object_ptr<Ui::RpWidget>(container),
|
||||
style::al_top);
|
||||
bubble->resize(size);
|
||||
bubble->setNaturalWidth(size.width());
|
||||
|
||||
auto cached = QImage(
|
||||
size * style::DevicePixelRatio(),
|
||||
|
||||
@@ -245,12 +245,11 @@ object_ptr<Ui::RpWidget> CreateGradientEditor(
|
||||
std::vector<QColor> colors;
|
||||
};
|
||||
const auto preview = container->add(
|
||||
object_ptr<Ui::CenterWrap<EmojiUserpic>>(
|
||||
object_ptr<EmojiUserpic>(
|
||||
container,
|
||||
object_ptr<EmojiUserpic>(
|
||||
container,
|
||||
Size(st::defaultUserpicButton.photoSize),
|
||||
false)))->entity();
|
||||
Size(st::defaultUserpicButton.photoSize),
|
||||
false),
|
||||
style::al_top);
|
||||
preview->setDuration(0);
|
||||
if (document) {
|
||||
preview->setDocument(document);
|
||||
|
||||
@@ -166,6 +166,7 @@ EmojiUserpic::EmojiUserpic(
|
||||
, _painter(size.width())
|
||||
, _duration(st::slideWrapDuration) {
|
||||
resize(size);
|
||||
setNaturalWidth(size.width());
|
||||
}
|
||||
|
||||
void EmojiUserpic::setDocument(not_null<DocumentData*> document) {
|
||||
|
||||
@@ -178,7 +178,7 @@ void ShowGradientEditor(
|
||||
},
|
||||
});
|
||||
box->setWidth(content->width());
|
||||
box->addRow(std::move(content), {});
|
||||
box->addRow(std::move(content), style::margins());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -408,13 +408,12 @@ not_null<Ui::VerticalLayout*> CreateUserpicBuilder(
|
||||
const auto state = container->lifetime().make_state<State>();
|
||||
|
||||
const auto preview = container->add(
|
||||
object_ptr<Ui::CenterWrap<EmojiUserpic>>(
|
||||
object_ptr<EmojiUserpic>(
|
||||
container,
|
||||
object_ptr<EmojiUserpic>(
|
||||
container,
|
||||
Size(st::settingsInfoPhotoSize),
|
||||
data.isForum)),
|
||||
st::userpicBuilderEmojiPreviewPadding)->entity();
|
||||
Size(st::settingsInfoPhotoSize),
|
||||
data.isForum),
|
||||
st::userpicBuilderEmojiPreviewPadding,
|
||||
style::al_top);
|
||||
if (const auto id = data.documentId) {
|
||||
const auto document = controller->session().data().document(id);
|
||||
if (document && document->sticker()) {
|
||||
@@ -423,13 +422,12 @@ not_null<Ui::VerticalLayout*> CreateUserpicBuilder(
|
||||
}
|
||||
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
tr::lng_userpic_builder_color_subtitle(),
|
||||
st::userpicBuilderEmojiSubtitle)),
|
||||
st::userpicBuilderEmojiSubtitlePadding);
|
||||
tr::lng_userpic_builder_color_subtitle(),
|
||||
st::userpicBuilderEmojiSubtitle),
|
||||
st::userpicBuilderEmojiSubtitlePadding,
|
||||
style::al_top);
|
||||
|
||||
const auto paletteBg = Ui::AddBubbleWrap(
|
||||
container,
|
||||
@@ -515,13 +513,12 @@ not_null<Ui::VerticalLayout*> CreateUserpicBuilder(
|
||||
}, palette->lifetime());
|
||||
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
tr::lng_userpic_builder_emoji_subtitle(),
|
||||
st::userpicBuilderEmojiSubtitle)),
|
||||
st::userpicBuilderEmojiSubtitlePadding);
|
||||
tr::lng_userpic_builder_emoji_subtitle(),
|
||||
st::userpicBuilderEmojiSubtitle),
|
||||
st::userpicBuilderEmojiSubtitlePadding,
|
||||
style::al_top);
|
||||
|
||||
const auto selectorBg = Ui::AddBubbleWrap(
|
||||
container,
|
||||
|
||||
@@ -519,7 +519,6 @@ void ConfirmEmojiStatusAccessBox(
|
||||
rpl::single(name),
|
||||
Ui::Text::RichLangValue),
|
||||
st::botEmojiStatusText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
box->addButton(tr::lng_bot_emoji_status_access_allow(), [=] {
|
||||
@@ -563,7 +562,6 @@ void ConfirmEmojiStatusBox(
|
||||
box,
|
||||
tr::lng_bot_emoji_status_title(),
|
||||
st::botEmojiStatusTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
AddSkip(box->verticalLayout());
|
||||
|
||||
@@ -575,7 +573,6 @@ void ConfirmEmojiStatusBox(
|
||||
rpl::single(Ui::Text::Bold(bot->name())),
|
||||
Ui::Text::RichLangValue),
|
||||
st::botEmojiStatusText),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
AddSkip(box->verticalLayout(), 2 * st::defaultVerticalListSkip);
|
||||
|
||||
@@ -177,6 +177,7 @@ void CodeInput::setDigitsCountMax(int digitsCount) {
|
||||
+ st::introCodeDigitSkip * (digitsCount - 1)
|
||||
+ padding.right(),
|
||||
st::introCodeDigitHeight);
|
||||
setNaturalWidth(width());
|
||||
|
||||
for (auto i = 0; i < digitsCount; i++) {
|
||||
const auto widget = Ui::CreateChild<CodeDigit>(this);
|
||||
|
||||
@@ -69,11 +69,10 @@ EmailWidget::EmailWidget(
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
const auto wrap = Settings::CloudPassword::AddWrappedField(
|
||||
const auto newInput = Settings::CloudPassword::AddWrappedField(
|
||||
content,
|
||||
tr::lng_settings_cloud_login_email_placeholder(),
|
||||
QString());
|
||||
const auto newInput = wrap->entity();
|
||||
Ui::AddSkip(content);
|
||||
const auto error = Settings::CloudPassword::AddError(content, nullptr);
|
||||
newInput->changes() | rpl::start_with_next([=] {
|
||||
|
||||
@@ -327,11 +327,8 @@ struct Feature {
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->setStyle(st::storiesStealthBox);
|
||||
box->addRow(MakeLogo(box));
|
||||
box->addRow(MakeTitle(box), st::boxRowPadding, style::al_top);
|
||||
box->addRow(
|
||||
MakeAbout(box, data->state.value()),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
box->addRow(MakeTitle(box), style::al_top);
|
||||
box->addRow(MakeAbout(box, data->state.value()), style::al_top);
|
||||
box->addRow(MakeFeature(box, FeaturePast()));
|
||||
box->addRow(
|
||||
MakeFeature(box, FeatureNext()),
|
||||
|
||||
@@ -56,6 +56,7 @@ void AboutBox(
|
||||
constexpr auto kUrl = "https://promote.telegram.org"_cs;
|
||||
|
||||
box->setWidth(st::boxWideWidth);
|
||||
box->setNoContentMargin(true);
|
||||
|
||||
const auto isChannel = (phrases == SponsoredPhrases::Channel);
|
||||
const auto isSearch = (phrases == SponsoredPhrases::Search);
|
||||
@@ -73,9 +74,8 @@ void AboutBox(
|
||||
const auto rect = Rect(icon.size() * 1.4);
|
||||
auto owned = object_ptr<Ui::RpWidget>(content);
|
||||
owned->resize(rect.size());
|
||||
const auto widget = box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
std::move(owned)))->entity();
|
||||
owned->setNaturalWidth(rect.width());
|
||||
const auto widget = box->addRow(std::move(owned), style::al_top);
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = Painter(widget);
|
||||
@@ -88,17 +88,19 @@ void AboutBox(
|
||||
}
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
box->addRow(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_sponsored_menu_revenued_about(),
|
||||
st::boxTitle)));
|
||||
st::boxTitle),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
box->addRow(object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_sponsored_revenued_subtitle(),
|
||||
st::channelEarnLearnDescription));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_sponsored_revenued_subtitle(),
|
||||
st::channelEarnLearnDescription),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
Ui::AddSkip(content);
|
||||
{
|
||||
@@ -208,12 +210,11 @@ void AboutBox(
|
||||
Ui::AddSkip(content);
|
||||
{
|
||||
box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_sponsored_revenued_footer_title(),
|
||||
st::boxTitle)));
|
||||
tr::lng_sponsored_revenued_footer_title(),
|
||||
st::boxTitle),
|
||||
style::al_top);
|
||||
}
|
||||
Ui::AddSkip(content);
|
||||
{
|
||||
|
||||
@@ -190,14 +190,13 @@ void PanelNoPassword::setupContent() {
|
||||
style::al_top);
|
||||
|
||||
const auto iconWrap = _inner->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FixedHeightWidget>>(
|
||||
object_ptr<Ui::FixedHeightWidget>(
|
||||
_inner,
|
||||
object_ptr<Ui::FixedHeightWidget>(
|
||||
_inner,
|
||||
st::passportPasswordIconHeight)));
|
||||
iconWrap->entity()->resizeToWidth(st::passportPasswordIcon.width());
|
||||
st::passportPasswordIconHeight),
|
||||
style::al_top);
|
||||
iconWrap->setNaturalWidth(st::passportPasswordIcon.width());
|
||||
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||
iconWrap->entity(),
|
||||
iconWrap,
|
||||
st::passportPasswordIcon,
|
||||
QPoint(0, 0));
|
||||
|
||||
@@ -225,13 +224,12 @@ void PanelNoPassword::refreshBottom() {
|
||||
style::al_top));
|
||||
if (pattern.isEmpty()) {
|
||||
const auto button = _inner->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
_inner,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
_inner,
|
||||
tr::lng_passport_password_create(),
|
||||
st::defaultBoxButton)));
|
||||
button->entity()->addClickHandler([=] {
|
||||
tr::lng_passport_password_create(),
|
||||
st::defaultBoxButton),
|
||||
style::al_top);
|
||||
button->addClickHandler([=] {
|
||||
_controller->setupPassword();
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -124,7 +124,6 @@ bool FormSummary::showCriticalError(const TextWithEntities &text) {
|
||||
_layout.get(),
|
||||
rpl::single(text),
|
||||
st::paymentsCriticalError),
|
||||
{},
|
||||
style::al_top);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -518,13 +518,13 @@ void PaidReactionsBox(
|
||||
state->shownPeer = state->savedShownPeer = barePeerId;
|
||||
});
|
||||
|
||||
const auto named = box->addRow(object_ptr<CenterWrap<Checkbox>>(
|
||||
box,
|
||||
const auto named = box->addRow(
|
||||
object_ptr<Checkbox>(
|
||||
box,
|
||||
tr::lng_paid_react_show_in_top(tr::now),
|
||||
state->shownPeer.current() != 0)));
|
||||
named->entity()->checkedValue(
|
||||
state->shownPeer.current() != 0),
|
||||
style::al_top);
|
||||
named->checkedValue(
|
||||
) | rpl::start_with_next([=](bool show) {
|
||||
state->shownPeer = show ? state->savedShownPeer : 0;
|
||||
}, named->lifetime());
|
||||
|
||||
@@ -560,7 +560,7 @@ void ChatIntro::setupContent(
|
||||
content,
|
||||
session,
|
||||
IntroWithRandomSticker(session, _intro.value())),
|
||||
{});
|
||||
style::margins());
|
||||
|
||||
const auto title = AddPartInput(
|
||||
content,
|
||||
|
||||
@@ -126,29 +126,25 @@ void SetupHeader(
|
||||
Ui::AddSkip(content);
|
||||
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
std::move(subtitle),
|
||||
st::changePhoneTitle)),
|
||||
st::changePhoneTitlePadding);
|
||||
std::move(subtitle),
|
||||
st::changePhoneTitle),
|
||||
st::changePhoneTitlePadding,
|
||||
style::al_top);
|
||||
|
||||
{
|
||||
const auto &st = st::settingLocalPasscodeDescription;
|
||||
const auto wrap = content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
const auto description = content->add(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
v::text::take_marked(std::move(about)),
|
||||
st,
|
||||
st::defaultPopupMenu)),
|
||||
st::changePhoneDescriptionPadding);
|
||||
wrap->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
wrap->resize(
|
||||
wrap->width(),
|
||||
st::settingLocalPasscodeDescriptionHeight);
|
||||
v::text::take_marked(std::move(about)),
|
||||
st,
|
||||
st::defaultPopupMenu),
|
||||
st::changePhoneDescriptionPadding,
|
||||
style::al_top);
|
||||
description->setTryMakeSimilarLines(true);
|
||||
description->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,24 +170,24 @@ not_null<Ui::PasswordInput*> AddPasswordField(
|
||||
return field;
|
||||
}
|
||||
|
||||
not_null<Ui::CenterWrap<Ui::InputField>*> AddWrappedField(
|
||||
not_null<Ui::InputField*> AddWrappedField(
|
||||
not_null<Ui::VerticalLayout*> content,
|
||||
rpl::producer<QString> &&placeholder,
|
||||
const QString &text) {
|
||||
return content->add(object_ptr<Ui::CenterWrap<Ui::InputField>>(
|
||||
content,
|
||||
return content->add(
|
||||
object_ptr<Ui::InputField>(
|
||||
content,
|
||||
st::settingLocalPasscodeInputField,
|
||||
std::move(placeholder),
|
||||
text)));
|
||||
text),
|
||||
style::al_top);
|
||||
}
|
||||
|
||||
not_null<Ui::LinkButton*> AddLinkButton(
|
||||
not_null<Ui::CenterWrap<Ui::InputField>*> wrap,
|
||||
not_null<Ui::InputField*> input,
|
||||
rpl::producer<QString> &&text) {
|
||||
const auto button = Ui::CreateChild<Ui::LinkButton>(
|
||||
wrap->parentWidget(),
|
||||
input->parentWidget(),
|
||||
QString());
|
||||
std::move(
|
||||
text
|
||||
@@ -199,9 +195,8 @@ not_null<Ui::LinkButton*> AddLinkButton(
|
||||
button->setText(text);
|
||||
}, button->lifetime());
|
||||
|
||||
wrap->geometryValue(
|
||||
input->geometryValue(
|
||||
) | rpl::start_with_next([=](QRect r) {
|
||||
r.translate(wrap->entity()->pos().x(), 0);
|
||||
button->moveToLeft(r.x(), r.y() + r.height() + st::passcodeTextLine);
|
||||
}, button->lifetime());
|
||||
return button;
|
||||
@@ -230,13 +225,12 @@ not_null<Ui::RoundButton*> AddDoneButton(
|
||||
not_null<Ui::VerticalLayout*> content,
|
||||
rpl::producer<QString> &&text) {
|
||||
const auto button = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
std::move(text),
|
||||
st::changePhoneButton)),
|
||||
st::settingLocalPasscodeButtonPadding)->entity();
|
||||
std::move(text),
|
||||
st::changePhoneButton),
|
||||
st::settingLocalPasscodeButtonPadding,
|
||||
style::al_top);
|
||||
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
return button;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
|
||||
namespace Ui {
|
||||
template <typename Widget>
|
||||
class CenterWrap;
|
||||
class FlatLabel;
|
||||
class InputField;
|
||||
class LinkButton;
|
||||
@@ -61,7 +59,7 @@ void SetupHeader(
|
||||
rpl::producer<QString> &&placeholder,
|
||||
const QString &text);
|
||||
|
||||
[[nodiscard]] not_null<Ui::CenterWrap<Ui::InputField>*> AddWrappedField(
|
||||
[[nodiscard]] not_null<Ui::InputField*> AddWrappedField(
|
||||
not_null<Ui::VerticalLayout*> content,
|
||||
rpl::producer<QString> &&placeholder,
|
||||
const QString &text);
|
||||
@@ -75,7 +73,7 @@ void SetupHeader(
|
||||
rpl::producer<QString> &&text);
|
||||
|
||||
[[nodiscard]] not_null<Ui::LinkButton*> AddLinkButton(
|
||||
not_null<Ui::CenterWrap<Ui::InputField>*> wrap,
|
||||
not_null<Ui::InputField*> input,
|
||||
rpl::producer<QString> &&text);
|
||||
|
||||
void AddSkipInsteadOfField(not_null<Ui::VerticalLayout*> content);
|
||||
|
||||
@@ -84,11 +84,10 @@ void Email::setupContent() {
|
||||
|
||||
Ui::AddSkip(content, st::settingLocalPasscodeDescriptionBottomSkip);
|
||||
|
||||
const auto wrap = AddWrappedField(
|
||||
const auto newInput = AddWrappedField(
|
||||
content,
|
||||
tr::lng_cloud_password_email(),
|
||||
currentStepDataEmail);
|
||||
const auto newInput = wrap->entity();
|
||||
const auto error = AddError(content, nullptr);
|
||||
newInput->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
@@ -169,7 +168,7 @@ void Email::setupContent() {
|
||||
};
|
||||
|
||||
const auto skip = AddLinkButton(
|
||||
wrap,
|
||||
newInput,
|
||||
tr::lng_cloud_password_skip_email());
|
||||
skip->setClickedCallback([=] {
|
||||
confirm(QString());
|
||||
|
||||
+6
-6
@@ -155,11 +155,9 @@ void EmailConfirm::setupContent() {
|
||||
content,
|
||||
st::settingLocalPasscodeInputField,
|
||||
tr::lng_change_phone_code_title());
|
||||
const auto newInput = objectInput.data();
|
||||
const auto wrap = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::InputField>>(
|
||||
content,
|
||||
std::move(objectInput)));
|
||||
const auto newInput = content->add(
|
||||
std::move(objectInput),
|
||||
style::al_top);
|
||||
|
||||
const auto error = AddError(content, nullptr);
|
||||
newInput->changes(
|
||||
@@ -184,7 +182,9 @@ void EmailConfirm::setupContent() {
|
||||
}
|
||||
}, resendInfo->lifetime());
|
||||
|
||||
const auto resend = AddLinkButton(wrap, tr::lng_cloud_password_resend());
|
||||
const auto resend = AddLinkButton(
|
||||
newInput,
|
||||
tr::lng_cloud_password_resend());
|
||||
resend->setClickedCallback([=] {
|
||||
if (_requestLifetime) {
|
||||
return;
|
||||
|
||||
@@ -75,11 +75,10 @@ void Hint::setupContent() {
|
||||
|
||||
Ui::AddSkip(content, st::settingLocalPasscodeDescriptionBottomSkip);
|
||||
|
||||
const auto wrap = AddWrappedField(
|
||||
const auto newInput = AddWrappedField(
|
||||
content,
|
||||
tr::lng_cloud_password_hint(),
|
||||
currentStepDataHint);
|
||||
const auto newInput = wrap->entity();
|
||||
const auto error = AddError(content, nullptr);
|
||||
newInput->changes(
|
||||
) | rpl::start_with_next([=] {
|
||||
@@ -122,7 +121,7 @@ void Hint::setupContent() {
|
||||
};
|
||||
|
||||
AddLinkButton(
|
||||
wrap,
|
||||
newInput,
|
||||
tr::lng_settings_cloud_password_skip_hint()
|
||||
)->setClickedCallback([=] {
|
||||
save(QString());
|
||||
|
||||
@@ -170,11 +170,8 @@ void Input::setupValidateGood() {
|
||||
}
|
||||
|
||||
if (auto owned = CreateValidateGoodIcon(&controller()->session())) {
|
||||
owned->setParent(content);
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
std::move(owned)),
|
||||
std::move(owned),
|
||||
QMargins(0, st::lineWidth * 75, 0, 0));
|
||||
}
|
||||
|
||||
@@ -254,10 +251,10 @@ void Input::setupContent() {
|
||||
|
||||
const auto newInput = AddPasswordField(
|
||||
content,
|
||||
isCheck
|
||||
(isCheck
|
||||
? tr::lng_cloud_password_enter_old()
|
||||
: tr::lng_cloud_password_enter_new(),
|
||||
currentStepDataPassword);
|
||||
: tr::lng_cloud_password_enter_new()),
|
||||
currentStepDataPassword);
|
||||
const auto reenterInput = isCheck
|
||||
? (Ui::PasswordInput*)(nullptr)
|
||||
: AddPasswordField(
|
||||
@@ -280,9 +277,12 @@ void Input::setupContent() {
|
||||
tr::lng_signin_hint(tr::now, lt_password_hint, hint),
|
||||
st::defaultFlatLabel);
|
||||
hintInfo->setVisible(!hint.isEmpty());
|
||||
error->geometryValue(
|
||||
) | rpl::start_with_next([=](const QRect &r) {
|
||||
hintInfo->setGeometry(r);
|
||||
rpl::combine(
|
||||
error->geometryValue(),
|
||||
newInput->geometryValue()
|
||||
) | rpl::start_with_next([=](QRect r, QRect input) {
|
||||
hintInfo->setGeometry(
|
||||
{ input.x(), r.y(), input.width(), r.height() });
|
||||
}, hintInfo->lifetime());
|
||||
error->shownValue(
|
||||
) | rpl::start_with_next([=](bool shown) {
|
||||
|
||||
+1
-2
@@ -63,11 +63,10 @@ void LoginEmail::setupContent() {
|
||||
|
||||
Ui::AddSkip(content, st::settingLocalPasscodeDescriptionBottomSkip);
|
||||
|
||||
const auto wrap = AddWrappedField(
|
||||
const auto newInput = AddWrappedField(
|
||||
content,
|
||||
tr::lng_settings_cloud_login_email_placeholder(),
|
||||
QString());
|
||||
const auto newInput = wrap->entity();
|
||||
const auto error = AddError(content, nullptr);
|
||||
newInput->changes() | rpl::start_with_next([=] {
|
||||
error->hide();
|
||||
|
||||
+3
-5
@@ -106,11 +106,9 @@ void LoginEmailConfirm::setupContent() {
|
||||
|
||||
Ui::AddSkip(content, st::settingLocalPasscodeDescriptionBottomSkip);
|
||||
|
||||
const auto wrap = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::CodeInput>>(
|
||||
content,
|
||||
object_ptr<Ui::CodeInput>(content)));
|
||||
const auto newInput = wrap->entity();
|
||||
const auto newInput = content->add(
|
||||
object_ptr<Ui::CodeInput>(content),
|
||||
style::al_top);
|
||||
newInput->setDigitsCountMax(currentStepDataCodeLength);
|
||||
|
||||
Ui::AddSkip(content);
|
||||
|
||||
@@ -67,6 +67,7 @@ object_ptr<Ui::RpWidget> CreateValidateGoodIcon(
|
||||
}, widget->lifetime());
|
||||
const auto padding = st::settingLocalPasscodeIconPadding;
|
||||
widget->resize((Rect(Size(size)) + padding).size());
|
||||
widget->setNaturalWidth(padding.left() + size + padding.right());
|
||||
|
||||
return owned;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,13 @@ Blocked::Blocked(
|
||||
{
|
||||
auto padding = st::changePhoneIconPadding;
|
||||
padding.setBottom(padding.top());
|
||||
_loading = base::make_unique_q<Ui::CenterWrap<>>(
|
||||
_loading = base::make_unique_q<Ui::PaddingWrap<>>(
|
||||
this,
|
||||
object_ptr<Ui::PaddingWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
tr::lng_contacts_loading(),
|
||||
st::changePhoneDescription),
|
||||
std::move(padding)));
|
||||
tr::lng_contacts_loading(),
|
||||
st::changePhoneDescription),
|
||||
std::move(padding));
|
||||
Ui::ResizeFitChild(
|
||||
this,
|
||||
_loading.get(),
|
||||
|
||||
@@ -424,13 +424,12 @@ void Credits::setupContent() {
|
||||
|
||||
{
|
||||
const auto button = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
nullptr,
|
||||
st::creditsSettingsBigBalanceButton)),
|
||||
st::boxRowPadding)->entity();
|
||||
nullptr,
|
||||
st::creditsSettingsBigBalanceButton),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
button->setContext([&]() -> Ui::Text::MarkedContext {
|
||||
auto customEmojiFactory = [=](const auto &...) {
|
||||
const auto &icon = st::settingsIconAdd;
|
||||
@@ -507,39 +506,37 @@ void Credits::setupContent() {
|
||||
return { .customEmojiFactory = std::move(customEmojiFactory) };
|
||||
}();
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_credits_balance_me_count(
|
||||
lt_emoji,
|
||||
rpl::single(Ui::MakeCreditsIconEntity()),
|
||||
lt_amount,
|
||||
(isCurrency
|
||||
? _controller->session().credits().tonBalanceValue()
|
||||
: _controller->session().credits().balanceValue()
|
||||
) | rpl::map(
|
||||
Lang::FormatCreditsAmountDecimal
|
||||
) | rpl::map(Ui::Text::Bold),
|
||||
Ui::Text::WithEntities),
|
||||
textSt,
|
||||
st::defaultPopupMenu,
|
||||
std::move(context))));
|
||||
tr::lng_credits_balance_me_count(
|
||||
lt_emoji,
|
||||
rpl::single(Ui::MakeCreditsIconEntity()),
|
||||
lt_amount,
|
||||
(isCurrency
|
||||
? _controller->session().credits().tonBalanceValue()
|
||||
: _controller->session().credits().balanceValue()
|
||||
) | rpl::map(
|
||||
Lang::FormatCreditsAmountDecimal
|
||||
) | rpl::map(Ui::Text::Bold),
|
||||
Ui::Text::WithEntities),
|
||||
textSt,
|
||||
st::defaultPopupMenu,
|
||||
std::move(context)),
|
||||
style::al_top);
|
||||
if (isCurrency) {
|
||||
const auto rate = _controller->session().credits().usdRate();
|
||||
const auto wrap = content->add(
|
||||
object_ptr<Ui::SlideWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
_controller->session().credits().tonBalanceValue(
|
||||
) | rpl::map([=](CreditsAmount value) {
|
||||
using namespace Info::ChannelEarn;
|
||||
return value ? ToUsd(value, rate, 3) : QString();
|
||||
}),
|
||||
st::channelEarnOverviewSubMinorLabel))));
|
||||
_controller->session().credits().tonBalanceValue(
|
||||
) | rpl::map([=](CreditsAmount value) {
|
||||
using namespace Info::ChannelEarn;
|
||||
return value ? ToUsd(value, rate, 3) : QString();
|
||||
}),
|
||||
st::channelEarnOverviewSubMinorLabel)),
|
||||
style::al_top);
|
||||
wrap->toggleOn(_controller->session().credits().tonBalanceValue(
|
||||
) | rpl::map(rpl::mappers::_1 > CreditsAmount(0)));
|
||||
wrap->finishAnimating();
|
||||
@@ -615,9 +612,8 @@ void Credits::setupContent() {
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto labels = container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RpWidget>>(
|
||||
container,
|
||||
object_ptr<Ui::RpWidget>(container)))->entity();
|
||||
object_ptr<Ui::RpWidget>(container),
|
||||
style::al_top);
|
||||
|
||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||
labels,
|
||||
@@ -642,6 +638,8 @@ void Credits::setupContent() {
|
||||
labels->resize(
|
||||
majorSize.width() + minorSize.width(),
|
||||
majorSize.height());
|
||||
labels->setNaturalWidth(
|
||||
majorSize.width() + minorSize.width());
|
||||
majorLabel->moveToLeft(0, 0);
|
||||
minorLabel->moveToRight(
|
||||
0,
|
||||
@@ -651,12 +649,11 @@ void Credits::setupContent() {
|
||||
|
||||
Ui::AddSkip(container);
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
ToUsd(value, multiplier, 0),
|
||||
st::channelEarnOverviewSubMinorLabel)));
|
||||
ToUsd(value, multiplier, 0),
|
||||
st::channelEarnOverviewSubMinorLabel),
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
|
||||
@@ -791,14 +791,13 @@ void BoostCreditsBox(
|
||||
}, widget->lifetime());
|
||||
}
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_gift_stars_title(
|
||||
lt_count,
|
||||
rpl::single(float64(b.credits))),
|
||||
st::boxTitle)));
|
||||
tr::lng_gift_stars_title(
|
||||
lt_count,
|
||||
rpl::single(float64(b.credits))),
|
||||
st::boxTitle),
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
if (b.multiplier) {
|
||||
const auto &st = st::statisticsDetailsBottomCaptionStyle;
|
||||
@@ -862,7 +861,6 @@ void BoostCreditsBox(
|
||||
tr::lng_credits_box_out_about_link(tr::now)),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsBoxAboutDivider),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
Ui::AddSkip(content);
|
||||
|
||||
@@ -1263,10 +1261,10 @@ void GenericCreditsEntryBox(
|
||||
Ui::PreloadUniqueGiftResellPrices(session);
|
||||
}
|
||||
} else if (const auto callback = Ui::PaintPreviewCallback(session, e)) {
|
||||
const auto thumb = content->add(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
GenericEntryPhoto(content, callback, stUser.photoSize)));
|
||||
AddViewMediaHandler(thumb->entity(), show, e);
|
||||
const auto thumb = content->add(
|
||||
GenericEntryPhoto(content, callback, stUser.photoSize),
|
||||
style::al_top);
|
||||
AddViewMediaHandler(thumb, show, e);
|
||||
} else if (s.photoId || (e.photoId && !e.subscriptionUntil.isNull())) {
|
||||
if (!(s.cancelled || s.expired || s.cancelledByBot)) {
|
||||
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
||||
@@ -1279,21 +1277,21 @@ void GenericCreditsEntryBox(
|
||||
owner->photo(photoId),
|
||||
std::move(update));
|
||||
};
|
||||
content->add(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
GenericEntryPhoto(content, callback, stUser.photoSize)));
|
||||
content->add(
|
||||
GenericEntryPhoto(content, callback, stUser.photoSize),
|
||||
style::al_top);
|
||||
} else if (peer
|
||||
&& !e.gift
|
||||
&& !e.premiumMonthsForStars
|
||||
&& !e.postsSearch) {
|
||||
if (e.subscriptionUntil.isNull() && s.until.isNull()) {
|
||||
content->add(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::UserpicButton>(content, peer, stUser)));
|
||||
content->add(
|
||||
object_ptr<Ui::UserpicButton>(content, peer, stUser),
|
||||
style::al_top);
|
||||
} else {
|
||||
content->add(object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
SubscriptionUserpic(content, peer, stUser.photoSize)));
|
||||
content->add(
|
||||
SubscriptionUserpic(content, peer, stUser.photoSize),
|
||||
style::al_top);
|
||||
}
|
||||
} else if (e.gift || isPrize || e.premiumMonthsForStars) {
|
||||
struct State final {
|
||||
@@ -1373,13 +1371,13 @@ void GenericCreditsEntryBox(
|
||||
}, icon->lifetime());
|
||||
} else if (!e.postsSearch) {
|
||||
const auto widget = content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::RpWidget>(content)))->entity();
|
||||
object_ptr<Ui::RpWidget>(content),
|
||||
style::al_top);
|
||||
using Draw = Fn<void(Painter &, int, int, int, int)>;
|
||||
const auto draw = widget->lifetime().make_state<Draw>(
|
||||
Ui::GenerateCreditsPaintUserpicCallback(e));
|
||||
widget->resize(Size(stUser.photoSize));
|
||||
widget->setNaturalWidth(stUser.photoSize);
|
||||
widget->paintRequest(
|
||||
) | rpl::start_with_next([=] {
|
||||
auto p = Painter(widget);
|
||||
@@ -1434,7 +1432,6 @@ void GenericCreditsEntryBox(
|
||||
? peer->name()
|
||||
: Ui::GenerateEntryName(e).text),
|
||||
st::creditsBoxAboutTitle),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(content);
|
||||
@@ -1442,16 +1439,15 @@ void GenericCreditsEntryBox(
|
||||
if (e.bareGiftReleasedById && !e.uniqueGift) {
|
||||
const auto peer = owner->peer(PeerId(e.bareGiftReleasedById));
|
||||
const auto released = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
box,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_credits_box_history_entry_gift_released(
|
||||
lt_name,
|
||||
rpl::single(Ui::Text::Link('@' + peer->username())),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsReleasedByLabel)));
|
||||
released->entity()->setClickHandlerFilter([=](const auto &...) {
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
tr::lng_credits_box_history_entry_gift_released(
|
||||
lt_name,
|
||||
rpl::single(Ui::Text::Link('@' + peer->username())),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsReleasedByLabel),
|
||||
style::al_top);
|
||||
released->setClickHandlerFilter([=](const auto &...) {
|
||||
Ui::GiftReleasedByHandler(peer);
|
||||
return false;
|
||||
});
|
||||
@@ -1613,7 +1609,6 @@ void GenericCreditsEntryBox(
|
||||
box,
|
||||
rpl::single(e.description),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
}
|
||||
|
||||
@@ -1669,7 +1664,6 @@ void GenericCreditsEntryBox(
|
||||
: tr::lng_action_gift_got_gift_text))(
|
||||
Ui::Text::WithEntities))),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
about->setClickHandlerFilter([=](const auto &...) {
|
||||
Core::App().iv().openWithIvPreferred(
|
||||
@@ -1707,7 +1701,6 @@ void GenericCreditsEntryBox(
|
||||
std::move(link),
|
||||
Ui::Text::RichLangValue),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
} else if (e.paidMessagesCommission && e.barePeerId) {
|
||||
Ui::AddSkip(content);
|
||||
@@ -1732,7 +1725,6 @@ void GenericCreditsEntryBox(
|
||||
std::move(link),
|
||||
Ui::Text::RichLangValue),
|
||||
st::creditsBoxAbout),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
}
|
||||
|
||||
@@ -1876,7 +1868,6 @@ void GenericCreditsEntryBox(
|
||||
tr::lng_credits_box_out_about_link(tr::now)),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsBoxAboutDivider),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
} else if (starGiftCanManage) {
|
||||
const auto hiddenPhrase = giftToChannelCanManage
|
||||
@@ -1929,7 +1920,6 @@ void GenericCreditsEntryBox(
|
||||
box,
|
||||
std::move(text),
|
||||
st::creditsBoxAboutDivider),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
label->setClickHandlerFilter([=](const auto &...) {
|
||||
toggleVisibility(!e.savedToProfile);
|
||||
@@ -1948,7 +1938,6 @@ void GenericCreditsEntryBox(
|
||||
) | Ui::Text::ToLink(),
|
||||
Ui::Text::WithEntities),
|
||||
st::creditsBoxAboutDivider),
|
||||
st::boxRowPadding,
|
||||
style::al_top);
|
||||
label->setClickHandlerFilter([=](const auto &...) {
|
||||
UrlClickHandler::Open(
|
||||
@@ -2001,7 +1990,7 @@ void GenericCreditsEntryBox(
|
||||
} else if (s.cancelled || s.cancelledByBot) {
|
||||
label->setTextColorOverride(st::menuIconAttentionColor->c);
|
||||
}
|
||||
box->addRow(std::move(label), st::boxRowPadding, style::al_top);
|
||||
box->addRow(std::move(label), style::al_top);
|
||||
}
|
||||
|
||||
Ui::AddSkip(content);
|
||||
@@ -2404,6 +2393,7 @@ object_ptr<Ui::RpWidget> GenericEntryPhoto(
|
||||
auto owned = object_ptr<Ui::RpWidget>(parent);
|
||||
const auto widget = owned.data();
|
||||
widget->resize(Size(photoSize));
|
||||
widget->setNaturalWidth(photoSize);
|
||||
|
||||
const auto draw = callback(
|
||||
crl::guard(widget, [=] { widget->update(); }));
|
||||
@@ -2453,6 +2443,7 @@ object_ptr<Ui::RpWidget> SubscriptionUserpic(
|
||||
auto widget = object_ptr<Ui::RpWidget>(parent);
|
||||
const auto raw = widget.data();
|
||||
widget->resize(photoSize, photoSize);
|
||||
widget->setNaturalWidth(photoSize);
|
||||
const auto userpicMedia = Ui::MakeUserpicThumbnail(peer, false);
|
||||
userpicMedia->subscribeToUpdates([=] { raw->update(); });
|
||||
const auto creditsIconSize = photoSize / 3;
|
||||
@@ -2642,9 +2633,8 @@ void AddWithdrawalWidget(
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto labels = container->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RpWidget>>(
|
||||
container,
|
||||
object_ptr<Ui::RpWidget>(container)))->entity();
|
||||
object_ptr<Ui::RpWidget>(container),
|
||||
style::al_top);
|
||||
|
||||
const auto majorLabel = Ui::CreateChild<Ui::FlatLabel>(
|
||||
labels,
|
||||
@@ -2664,18 +2654,18 @@ void AddWithdrawalWidget(
|
||||
labels->resize(
|
||||
majorSize.width() + icon->width() + skip,
|
||||
majorSize.height());
|
||||
labels->setNaturalWidth(majorSize.width() + icon->width() + skip);
|
||||
majorLabel->moveToLeft(icon->width() + skip, 0);
|
||||
}, labels->lifetime());
|
||||
Ui::ToggleChildrenVisibility(labels, true);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
container->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(usdValue),
|
||||
st::channelEarnOverviewSubMinorLabel)));
|
||||
std::move(usdValue),
|
||||
st::channelEarnOverviewSubMinorLabel),
|
||||
style::al_top);
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
|
||||
@@ -136,25 +136,24 @@ void LocalPasscodeEnter::setupContent() {
|
||||
Ui::AddSkip(content);
|
||||
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
isCreate
|
||||
? tr::lng_passcode_create_title()
|
||||
: isCheck
|
||||
? tr::lng_passcode_check_title()
|
||||
: tr::lng_passcode_change_title(),
|
||||
st::changePhoneTitle)),
|
||||
st::changePhoneTitlePadding);
|
||||
isCreate
|
||||
? tr::lng_passcode_create_title()
|
||||
: isCheck
|
||||
? tr::lng_passcode_check_title()
|
||||
: tr::lng_passcode_change_title(),
|
||||
st::changePhoneTitle),
|
||||
st::changePhoneTitlePadding,
|
||||
style::al_top);
|
||||
|
||||
const auto addDescription = [&](rpl::producer<QString> &&text) {
|
||||
const auto &st = st::settingLocalPasscodeDescription;
|
||||
content->add(
|
||||
object_ptr<Ui::CenterWrap<>>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(content, std::move(text), st)),
|
||||
st::changePhoneDescriptionPadding);
|
||||
object_ptr<Ui::FlatLabel>(content, std::move(text), st),
|
||||
st::changePhoneDescriptionPadding,
|
||||
style::al_top
|
||||
)->setTryMakeSimilarLines(true);
|
||||
};
|
||||
|
||||
addDescription(tr::lng_passcode_about1());
|
||||
@@ -183,14 +182,13 @@ void LocalPasscodeEnter::setupContent() {
|
||||
|
||||
const auto addError = [&](not_null<Ui::PasswordInput*> input) {
|
||||
const auto error = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
content,
|
||||
// Set any text to resize.
|
||||
tr::lng_language_name(tr::now),
|
||||
st::settingLocalPasscodeError)),
|
||||
st::changePhoneDescriptionPadding)->entity();
|
||||
// Set any text to resize.
|
||||
tr::lng_language_name(tr::now),
|
||||
st::settingLocalPasscodeError),
|
||||
st::changePhoneDescriptionPadding,
|
||||
style::al_top);
|
||||
error->hide();
|
||||
QObject::connect(input.get(), &Ui::MaskedInputField::changed, [=] {
|
||||
error->hide();
|
||||
@@ -208,17 +206,16 @@ void LocalPasscodeEnter::setupContent() {
|
||||
const auto error = addError(isCheck ? newPasscode : reenterPasscode);
|
||||
|
||||
const auto button = content->add(
|
||||
object_ptr<Ui::CenterWrap<Ui::RoundButton>>(
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
object_ptr<Ui::RoundButton>(
|
||||
content,
|
||||
(isCreate
|
||||
? tr::lng_passcode_create_button()
|
||||
: isCheck
|
||||
? tr::lng_passcode_check_button()
|
||||
: tr::lng_passcode_change_button()),
|
||||
st::changePhoneButton)),
|
||||
st::settingLocalPasscodeButtonPadding)->entity();
|
||||
(isCreate
|
||||
? tr::lng_passcode_create_button()
|
||||
: isCheck
|
||||
? tr::lng_passcode_check_button()
|
||||
: tr::lng_passcode_change_button()),
|
||||
st::changePhoneButton),
|
||||
st::settingLocalPasscodeButtonPadding,
|
||||
style::al_top);
|
||||
button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform);
|
||||
button->setClickedCallback([=] {
|
||||
const auto newText = newPasscode->text();
|
||||
|
||||
@@ -59,7 +59,7 @@ void PowerSavingBox(not_null<Ui::GenericBox*> box) {
|
||||
state->forceDisabledMessage.value());
|
||||
|
||||
const auto controlsRaw = checkboxes.data();
|
||||
box->addRow(std::move(checkboxes), {});
|
||||
box->addRow(std::move(checkboxes), style::margins());
|
||||
|
||||
auto automatic = (Ui::SettingsButton*)nullptr;
|
||||
if (batterySaving.has_value()) {
|
||||
|
||||
@@ -112,13 +112,12 @@ void InfoBox(
|
||||
});
|
||||
|
||||
const auto userpic = box->addRow(
|
||||
object_ptr<Ui::CenterWrap<Ui::UserpicButton>>(
|
||||
object_ptr<Ui::UserpicButton>(
|
||||
box,
|
||||
object_ptr<Ui::UserpicButton>(
|
||||
box,
|
||||
data.bot,
|
||||
st::websiteBigUserpic)),
|
||||
st::sessionBigCoverPadding)->entity();
|
||||
data.bot,
|
||||
st::websiteBigUserpic),
|
||||
st::sessionBigCoverPadding,
|
||||
style::al_top);
|
||||
userpic->overrideShape(Ui::PeerUserpicShape::Forum);
|
||||
userpic->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
|
||||
|
||||
@@ -57,12 +57,10 @@ constexpr auto kShowOrLineOpacity = 0.3;
|
||||
object_ptr<RpWidget> MakeShowOrLabel(
|
||||
not_null<RpWidget*> parent,
|
||||
rpl::producer<QString> text) {
|
||||
auto result = object_ptr<CenterWrap<>>(
|
||||
auto result = object_ptr<FlatLabel>(
|
||||
parent,
|
||||
object_ptr<FlatLabel>(
|
||||
parent,
|
||||
std::move(text),
|
||||
st::showOrLabel));
|
||||
std::move(text),
|
||||
st::showOrLabel);
|
||||
const auto raw = result.data();
|
||||
|
||||
raw->paintRequest(
|
||||
@@ -71,8 +69,7 @@ object_ptr<RpWidget> MakeShowOrLabel(
|
||||
|
||||
const auto full = st::showOrLineWidth;
|
||||
const auto left = (raw->width() - full) / 2;
|
||||
const auto text = raw->entity()->naturalWidth()
|
||||
+ 2 * st::showOrLabelSkip;
|
||||
const auto text = raw->naturalWidth() + 2 * st::showOrLabelSkip;
|
||||
const auto fill = (full - text) / 2;
|
||||
const auto stroke = st::lineWidth;
|
||||
const auto top = st::showOrLineTop;
|
||||
@@ -174,7 +171,7 @@ void ShowOrPremiumBox(
|
||||
box->addRow(
|
||||
MakeShowOrLabel(box, std::move(skin.orPremium)),
|
||||
st::showOrLabelPadding + buttonPadding,
|
||||
style::al_top);
|
||||
style::al_justify);
|
||||
box->addRow(
|
||||
object_ptr<FlatLabel>(
|
||||
box,
|
||||
|
||||
@@ -221,6 +221,7 @@ UserpicButton::~UserpicButton() = default;
|
||||
|
||||
void UserpicButton::prepare() {
|
||||
resize(_st.size);
|
||||
setNaturalWidth(_st.size.width());
|
||||
_notShownYet = _waiting;
|
||||
if (!_waiting) {
|
||||
prepareUserpicPixmap();
|
||||
|
||||
@@ -42,9 +42,9 @@ object_ptr<Ui::RpWidget> CreatePeerBubble(
|
||||
) | rpl::start_with_next([=](
|
||||
const QSize &leftSize,
|
||||
const QSize &rightSize) {
|
||||
peerBubble->resize(
|
||||
leftSize.width() + rightSize.width() + rect::m::sum::h(padding),
|
||||
leftSize.height());
|
||||
peerBubble->setNaturalWidth(
|
||||
leftSize.width() + rightSize.width() + rect::m::sum::h(padding));
|
||||
peerBubble->resize(peerBubble->naturalWidth(), leftSize.height());
|
||||
left->moveToLeft(0, 0);
|
||||
right->moveToRight(padding.right() + st::lineWidth, padding.top());
|
||||
const auto maxRightSize = parent->width()
|
||||
|
||||
+1
-1
Submodule Telegram/lib_ui updated: f7bca08f41...96481551eb
Reference in New Issue
Block a user