Improved text size in list of credits options.

This commit is contained in:
23rd 2024-08-05 20:26:47 +03:00 committed by John Preston
parent c4f45c4b7c
commit efc8417ab1
2 changed files with 8 additions and 8 deletions

View file

@ -39,6 +39,7 @@ void GiftCreditsBox(
not_null<Ui::GenericBox*> box, not_null<Ui::GenericBox*> box,
not_null<PeerData*> peer, not_null<PeerData*> peer,
Fn<void()> gifted) { Fn<void()> gifted) {
box->setWidth(st::boxWideWidth);
box->setStyle(st::creditsGiftBox); box->setStyle(st::creditsGiftBox);
box->setNoContentMargin(true); box->setNoContentMargin(true);
box->addButton(tr::lng_create_group_back(), [=] { box->closeBox(); }); box->addButton(tr::lng_create_group_back(), [=] { box->closeBox(); });

View file

@ -256,7 +256,7 @@ void FillCreditOptions(
const auto &st = st::creditsTopupButton; const auto &st = st::creditsTopupButton;
const auto diffBetweenTextAndStar = st.padding.left() const auto diffBetweenTextAndStar = st.padding.left()
- st.iconLeft - st.iconLeft
- singleStarWidth; - int(singleStarWidth * 1.5);
const auto buttonHeight = st.height + rect::m::sum::v(st.padding); const auto buttonHeight = st.height + rect::m::sum::v(st.padding);
const auto minCredits = (!options.empty() const auto minCredits = (!options.empty()
&& (minimumCredits > options.back().credits)) && (minimumCredits > options.back().credits))
@ -283,26 +283,25 @@ void FillCreditOptions(
st::creditsTopupPrice); st::creditsTopupPrice);
const auto inner = Ui::CreateChild<Ui::RpWidget>(button); const auto inner = Ui::CreateChild<Ui::RpWidget>(button);
const auto stars = Ui::GenerateStars(st.height, (i + 1)); const auto stars = Ui::GenerateStars(st.height, (i + 1));
const auto textLeft = diffBetweenTextAndStar
+ stars.width() / style::DevicePixelRatio();
inner->paintRequest( inner->paintRequest(
) | rpl::start_with_next([=](const QRect &rect) { ) | rpl::start_with_next([=](const QRect &rect) {
auto p = QPainter(inner); auto p = QPainter(inner);
p.drawImage(0, 0, stars); p.drawImage(0, 0, stars);
const auto textLeft = diffBetweenTextAndStar
+ stars.width() / style::DevicePixelRatio();
p.setPen(st.textFg); p.setPen(st.textFg);
text->draw(p, { text->draw(p, {
.position = QPoint(textLeft, 0), .position = QPoint(textLeft, 0),
.availableWidth = inner->width() - textLeft, .availableWidth = inner->width() - textLeft,
.elisionLines = 1,
}); });
}, inner->lifetime()); }, inner->lifetime());
button->sizeValue( button->widthValue(
) | rpl::start_with_next([=](const QSize &size) { ) | rpl::start_with_next([=](int width) {
price->moveToRight(st.padding.right(), st.padding.top()); price->moveToRight(st.padding.right(), st.padding.top());
inner->moveToLeft(st.iconLeft, st.padding.top()); inner->moveToLeft(st.iconLeft, st.padding.top());
inner->resize( inner->resize(
size.width() width - price->width() - st.padding.left(),
- rect::m::sum::h(st.padding)
- price->width(),
buttonHeight); buttonHeight);
}, button->lifetime()); }, button->lifetime());
button->setClickedCallback([=] { button->setClickedCallback([=] {