Skip to content

Commit 313ae0f

Browse files
committed
Remove CenterWrap layout.
1 parent a39c018 commit 313ae0f

File tree

63 files changed

+456
-535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+456
-535
lines changed

Telegram/SourceFiles/api/api_chat_invite.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ void ConfirmSubscriptionBox(
142142
const auto content = box->verticalLayout();
143143

144144
Ui::AddSkip(content, st::confirmInvitePhotoTop);
145-
const auto userpicWrap = content->add(
146-
object_ptr<Ui::CenterWrap<>>(
147-
content,
148-
object_ptr<Ui::RpWidget>(content)));
149-
const auto userpic = userpicWrap->entity();
145+
const auto userpic = content->add(
146+
object_ptr<Ui::RpWidget>(content),
147+
style::al_top);
150148
const auto photoSize = st::confirmInvitePhotoSize;
151149
userpic->resize(Size(photoSize));
150+
userpic->setNaturalWidth(photoSize);
152151
const auto creditsIconSize = photoSize / 3;
153152
const auto creditsIconCallback =
154153
Ui::PaintOutlinedColoredCreditsIconCallback(
@@ -188,16 +187,16 @@ void ConfirmSubscriptionBox(
188187
}
189188
auto p = QPainter(userpic);
190189
p.drawImage(0, 0, state->frame);
191-
}, userpicWrap->lifetime());
192-
userpicWrap->setAttribute(Qt::WA_TransparentForMouseEvents);
190+
}, userpic->lifetime());
191+
userpic->setAttribute(Qt::WA_TransparentForMouseEvents);
193192
if (photo) {
194193
state->photoMedia = photo->createMediaView();
195194
state->photoMedia->wanted(Data::PhotoSize::Small, Data::FileOrigin());
196195
if (!state->photoMedia->image(Data::PhotoSize::Small)) {
197196
session->downloaderTaskFinished(
198197
) | rpl::start_with_next([=] {
199198
userpic->update();
200-
}, userpicWrap->entity()->lifetime());
199+
}, userpic->lifetime());
201200
}
202201
} else {
203202
state->photoEmpty = std::make_unique<Ui::EmptyUserpic>(
@@ -219,7 +218,6 @@ void ConfirmSubscriptionBox(
219218
box,
220219
tr::lng_channel_invite_subscription_title(),
221220
st::inviteLinkSubscribeBoxTitle),
222-
st::boxRowPadding,
223221
style::al_top);
224222
box->addRow(
225223
object_ptr<Ui::FlatLabel>(
@@ -234,7 +232,6 @@ void ConfirmSubscriptionBox(
234232
Ui::Text::Bold),
235233
Ui::Text::WithEntities),
236234
st::inviteLinkSubscribeBoxAbout),
237-
st::boxRowPadding,
238235
style::al_top);
239236
Ui::AddSkip(content);
240237
box->addRow(
@@ -250,7 +247,6 @@ void ConfirmSubscriptionBox(
250247
}),
251248
Ui::Text::RichLangValue),
252249
st::inviteLinkSubscribeBoxTerms),
253-
st::boxRowPadding,
254250
style::al_top);
255251

256252
{

Telegram/SourceFiles/boxes/about_box.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,8 @@ void ArchiveHintBox(
183183
const auto rect = Rect(icon.size() * 2);
184184
auto owned = object_ptr<Ui::RpWidget>(content);
185185
owned->resize(rect.size());
186-
const auto widget = box->addRow(
187-
object_ptr<Ui::CenterWrap<>>(
188-
content,
189-
std::move(owned)))->entity();
186+
owned->setNaturalWidth(rect.width());
187+
const auto widget = box->addRow(std::move(owned), style::al_top);
190188
widget->paintRequest(
191189
) | rpl::start_with_next([=] {
192190
auto p = Painter(widget);
@@ -199,12 +197,12 @@ void ArchiveHintBox(
199197
}
200198
Ui::AddSkip(content);
201199
Ui::AddSkip(content);
202-
box->addRow(object_ptr<Ui::CenterWrap<>>(
203-
content,
200+
box->addRow(
204201
object_ptr<Ui::FlatLabel>(
205202
content,
206203
tr::lng_archive_hint_title(),
207-
st::boxTitle)));
204+
st::boxTitle),
205+
style::al_top);
208206
Ui::AddSkip(content);
209207
Ui::AddSkip(content);
210208
{

Telegram/SourceFiles/boxes/edit_privacy_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ void EditDirectMessagesPriceBox(
12931293
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
12941294
box,
12951295
object_ptr<Ui::VerticalLayout>(box)),
1296-
{});
1296+
style::margins());
12971297
wrap->toggle(savedValue.has_value(), anim::type::instant);
12981298
wrap->toggleOn(toggle->toggledChanges());
12991299

Telegram/SourceFiles/boxes/gift_credits_box.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ void GiftCreditsBox(
5252
Ui::AddSkip(content);
5353
const auto &stUser = st::premiumGiftsUserpicButton;
5454
const auto userpicWrap = content->add(
55-
object_ptr<Ui::CenterWrap<>>(
56-
content,
57-
object_ptr<Ui::UserpicButton>(content, peer, stUser)));
55+
object_ptr<Ui::UserpicButton>(content, peer, stUser),
56+
style::al_top);
5857
userpicWrap->setAttribute(Qt::WA_TransparentForMouseEvents);
5958
Ui::AddSkip(content);
6059
Ui::AddSkip(content);

Telegram/SourceFiles/boxes/gift_premium_box.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,12 +990,11 @@ void GiveawayInfoBox(
990990
label->setTextColorOverride(st::windowActiveTextFg->c);
991991
}
992992
const auto result = box->addRow(
993-
object_ptr<Ui::PaddingWrap<Ui::CenterWrap<Ui::FlatLabel>>>(
993+
object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
994994
box.get(),
995-
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
996-
box.get(),
997-
std::move(label)),
998-
QMargins(0, skip, 0, skip)));
995+
std::move(label),
996+
QMargins(0, skip, 0, skip)),
997+
style::al_justify);
999998
result->paintRequest() | rpl::start_with_next([=] {
1000999
auto p = QPainter(result);
10011000
p.setPen(Qt::NoPen);

Telegram/SourceFiles/boxes/peers/add_participants_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void InviteForbiddenController::setComplexCover() {
513513
container->add(
514514
MakeShowOrLabel(container, tr::lng_invite_upgrade_or()),
515515
st::inviteForbiddenOrLabelPadding,
516-
style::al_top);
516+
style::al_justify);
517517
}
518518
container->add(
519519
object_ptr<Ui::FlatLabel>(

Telegram/SourceFiles/boxes/peers/edit_peer_color_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ void EditPeerColorBox(
12001200
peer,
12011201
state->index.value(),
12021202
state->emojiId.value()
1203-
), {});
1203+
), style::margins());
12041204

12051205
auto indices = peer->session().api().peerColors().suggestedValue();
12061206
const auto margin = st::settingsColorRadioMargin;

Telegram/SourceFiles/boxes/peers/edit_peer_invite_link.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,9 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
969969

970970
const auto photoSize = st::boostReplaceUserpic.photoSize;
971971
const auto session = &row->peer()->session();
972-
content->add(object_ptr<Ui::CenterWrap<>>(
973-
content,
974-
Settings::SubscriptionUserpic(content, channel, photoSize)));
972+
content->add(
973+
Settings::SubscriptionUserpic(content, channel, photoSize),
974+
style::al_top);
975975

976976
Ui::AddSkip(content);
977977
Ui::AddSkip(content);
@@ -981,7 +981,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
981981
box,
982982
tr::lng_credits_box_subscription_title(),
983983
st::creditsBoxAboutTitle),
984-
st::boxRowPadding,
985984
style::al_top);
986985

987986
Ui::AddSkip(content);
@@ -990,7 +989,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
990989
object_ptr<Ui::FlatLabel>(
991990
box,
992991
st::creditsTopupPrice),
993-
st::boxRowPadding,
994992
style::al_top);
995993
subtitle1->setMarkedText(
996994
tr::lng_credits_subscription_subtitle(
@@ -1002,11 +1000,10 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
10021000
Ui::Text::WithEntities),
10031001
_emojiHelper.context());
10041002
const auto subtitle2 = box->addRow(
1005-
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
1003+
object_ptr<Ui::FlatLabel>(
10061004
box,
1007-
object_ptr<Ui::FlatLabel>(
1008-
box,
1009-
st::creditsTopupPrice)))->entity();
1005+
st::creditsTopupPrice),
1006+
style::al_top);
10101007
session->credits().rateValue(
10111008
channel
10121009
) | rpl::start_with_next([=, currency = u"USD"_q](float64 rate) {
@@ -1038,7 +1035,6 @@ void Controller::rowClicked(not_null<PeerListRow*> row) {
10381035
tr::lng_credits_box_out_about_link(tr::now)),
10391036
Ui::Text::WithEntities),
10401037
st::creditsBoxAboutDivider),
1041-
st::boxRowPadding,
10421038
style::al_top);
10431039

10441040
const auto button = box->addButton(tr::lng_box_ok(), [=] {

Telegram/SourceFiles/boxes/premium_limits_box.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,14 +585,14 @@ void ChannelsLimitBox(
585585

586586
const auto content = box->addRow(
587587
object_ptr<PeerListContent>(box, controller),
588-
{});
588+
style::margins());
589589
delegate->setContent(content);
590590
controller->setDelegate(delegate);
591591

592592
const auto count = 100;
593593
const auto placeholder = box->addRow(
594594
object_ptr<PeerListDummy>(box, count, st::defaultPeerList),
595-
{});
595+
style::margins());
596596

597597
using namespace rpl::mappers;
598598
controller->countValue(
@@ -676,14 +676,14 @@ void PublicLinksLimitBox(
676676

677677
const auto content = box->addRow(
678678
object_ptr<PeerListContent>(box, controller),
679-
{});
679+
style::margins());
680680
delegate->setContent(content);
681681
controller->setDelegate(delegate);
682682

683683
const auto count = defaultLimit;
684684
const auto placeholder = box->addRow(
685685
object_ptr<PeerListDummy>(box, count, st::defaultPeerList),
686-
{});
686+
style::margins());
687687

688688
using namespace rpl::mappers;
689689
controller->countValue(

Telegram/SourceFiles/boxes/premium_preview_box.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ void PreviewBox(
902902

903903
const auto outer = box->addRow(
904904
ChatBackPreview(box, size.height(), back),
905-
{});
905+
style::margins());
906906

907907
struct Hiding {
908908
not_null<Ui::RpWidget*> widget;

0 commit comments

Comments
 (0)