mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Moved out to single place ministars creation in top of box.
This commit is contained in:
parent
c3f354826d
commit
2532a0ff59
5 changed files with 35 additions and 89 deletions
|
@ -207,32 +207,12 @@ void ConfirmSubscriptionBox(
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
|
|
||||||
{
|
Settings::AddMiniStars(
|
||||||
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
content,
|
||||||
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
|
Ui::CreateChild<Ui::RpWidget>(content),
|
||||||
const auto stars = widget->lifetime().make_state<ColoredMiniStars>(
|
photoSize,
|
||||||
widget,
|
box->width(),
|
||||||
false,
|
2.);
|
||||||
Ui::Premium::MiniStars::Type::BiStars);
|
|
||||||
stars->setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
|
||||||
widget->resize(
|
|
||||||
st::boxWideWidth - photoSize,
|
|
||||||
photoSize * 2);
|
|
||||||
content->sizeValue(
|
|
||||||
) | rpl::start_with_next([=](const QSize &size) {
|
|
||||||
widget->moveToLeft(photoSize / 2, 0);
|
|
||||||
const auto starsRect = Rect(widget->size());
|
|
||||||
stars->setPosition(starsRect.topLeft());
|
|
||||||
stars->setSize(starsRect.size());
|
|
||||||
widget->lower();
|
|
||||||
}, widget->lifetime());
|
|
||||||
widget->paintRequest(
|
|
||||||
) | rpl::start_with_next([=](const QRect &r) {
|
|
||||||
auto p = QPainter(widget);
|
|
||||||
p.fillRect(r, Qt::transparent);
|
|
||||||
stars->paint(p);
|
|
||||||
}, widget->lifetime());
|
|
||||||
}
|
|
||||||
|
|
||||||
box->addRow(
|
box->addRow(
|
||||||
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
object_ptr<Ui::CenterWrap<Ui::FlatLabel>>(
|
||||||
|
|
|
@ -47,6 +47,7 @@ void GiftCreditsBox(
|
||||||
const auto content = box->setPinnedToTopContent(
|
const auto content = box->setPinnedToTopContent(
|
||||||
object_ptr<Ui::VerticalLayout>(box));
|
object_ptr<Ui::VerticalLayout>(box));
|
||||||
|
|
||||||
|
Ui::AddSkip(content);
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
const auto &stUser = st::premiumGiftsUserpicButton;
|
const auto &stUser = st::premiumGiftsUserpicButton;
|
||||||
|
@ -58,32 +59,12 @@ void GiftCreditsBox(
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
|
|
||||||
{
|
Settings::AddMiniStars(
|
||||||
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
content,
|
||||||
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
|
Ui::CreateChild<Ui::RpWidget>(content),
|
||||||
const auto stars = widget->lifetime().make_state<ColoredMiniStars>(
|
stUser.photoSize,
|
||||||
widget,
|
box->width(),
|
||||||
false,
|
2.);
|
||||||
Ui::Premium::MiniStars::Type::BiStars);
|
|
||||||
stars->setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
|
||||||
widget->resize(
|
|
||||||
st::boxWidth - stUser.photoSize,
|
|
||||||
stUser.photoSize * 2);
|
|
||||||
content->sizeValue(
|
|
||||||
) | rpl::start_with_next([=](const QSize &size) {
|
|
||||||
widget->moveToLeft(stUser.photoSize / 2, 0);
|
|
||||||
const auto starsRect = Rect(widget->size());
|
|
||||||
stars->setPosition(starsRect.topLeft());
|
|
||||||
stars->setSize(starsRect.size());
|
|
||||||
widget->lower();
|
|
||||||
}, widget->lifetime());
|
|
||||||
widget->paintRequest(
|
|
||||||
) | rpl::start_with_next([=](const QRect &r) {
|
|
||||||
auto p = QPainter(widget);
|
|
||||||
p.fillRect(r, Qt::transparent);
|
|
||||||
stars->paint(p);
|
|
||||||
}, widget->lifetime());
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
Ui::AddSkip(content);
|
Ui::AddSkip(content);
|
||||||
const auto arrow = Ui::Text::SingleCustomEmoji(
|
const auto arrow = Ui::Text::SingleCustomEmoji(
|
||||||
|
|
|
@ -1325,32 +1325,12 @@ void GiftBox(
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
|
|
||||||
{
|
Settings::AddMiniStars(
|
||||||
const auto widget = CreateChild<RpWidget>(content);
|
content,
|
||||||
using ColoredMiniStars = Premium::ColoredMiniStars;
|
Ui::CreateChild<Ui::RpWidget>(content),
|
||||||
const auto stars = widget->lifetime().make_state<ColoredMiniStars>(
|
stUser.photoSize,
|
||||||
widget,
|
box->width(),
|
||||||
false,
|
2.);
|
||||||
Premium::MiniStars::Type::BiStars);
|
|
||||||
stars->setColorOverride(Premium::CreditsIconGradientStops());
|
|
||||||
widget->resize(
|
|
||||||
st::boxWidth - stUser.photoSize,
|
|
||||||
stUser.photoSize * 2);
|
|
||||||
content->sizeValue(
|
|
||||||
) | rpl::start_with_next([=](const QSize &size) {
|
|
||||||
widget->moveToLeft((size.width() - widget->width()) / 2, 0);
|
|
||||||
const auto starsRect = Rect(widget->size());
|
|
||||||
stars->setPosition(starsRect.topLeft());
|
|
||||||
stars->setSize(starsRect.size());
|
|
||||||
widget->lower();
|
|
||||||
}, widget->lifetime());
|
|
||||||
widget->paintRequest(
|
|
||||||
) | rpl::start_with_next([=](const QRect &r) {
|
|
||||||
auto p = QPainter(widget);
|
|
||||||
p.fillRect(r, Qt::transparent);
|
|
||||||
stars->paint(p);
|
|
||||||
}, widget->lifetime());
|
|
||||||
}
|
|
||||||
AddSkip(content);
|
AddSkip(content);
|
||||||
AddSkip(box->verticalLayout());
|
AddSkip(box->verticalLayout());
|
||||||
|
|
||||||
|
|
|
@ -348,10 +348,12 @@ void AddViewMediaHandler(
|
||||||
}, thumb->lifetime());
|
}, thumb->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void AddMiniStars(
|
void AddMiniStars(
|
||||||
not_null<Ui::VerticalLayout*> content,
|
not_null<Ui::VerticalLayout*> content,
|
||||||
not_null<Ui::RpWidget*> widget,
|
not_null<Ui::RpWidget*> widget,
|
||||||
const style::UserpicButton &stUser,
|
int photoSize,
|
||||||
int boxWidth,
|
int boxWidth,
|
||||||
float64 heightRatio) {
|
float64 heightRatio) {
|
||||||
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
|
using ColoredMiniStars = Ui::Premium::ColoredMiniStars;
|
||||||
|
@ -360,12 +362,10 @@ void AddMiniStars(
|
||||||
false,
|
false,
|
||||||
Ui::Premium::MiniStars::Type::BiStars);
|
Ui::Premium::MiniStars::Type::BiStars);
|
||||||
stars->setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
stars->setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
||||||
widget->resize(
|
widget->resize(boxWidth - photoSize, photoSize * heightRatio);
|
||||||
boxWidth - stUser.photoSize,
|
|
||||||
stUser.photoSize * heightRatio);
|
|
||||||
content->sizeValue(
|
content->sizeValue(
|
||||||
) | rpl::start_with_next([=](const QSize &size) {
|
) | rpl::start_with_next([=](const QSize &size) {
|
||||||
widget->moveToLeft(stUser.photoSize / 2, 0);
|
widget->moveToLeft(photoSize / 2, 0);
|
||||||
const auto starsRect = Rect(widget->size());
|
const auto starsRect = Rect(widget->size());
|
||||||
stars->setPosition(starsRect.topLeft());
|
stars->setPosition(starsRect.topLeft());
|
||||||
stars->setSize(starsRect.size());
|
stars->setSize(starsRect.size());
|
||||||
|
@ -379,8 +379,6 @@ void AddMiniStars(
|
||||||
}, widget->lifetime());
|
}, widget->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
SubscriptionRightLabel PaintSubscriptionRightLabelCallback(
|
SubscriptionRightLabel PaintSubscriptionRightLabelCallback(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
const style::PeerListItem &st,
|
const style::PeerListItem &st,
|
||||||
|
@ -699,7 +697,7 @@ void BoostCreditsBox(
|
||||||
{
|
{
|
||||||
const auto &stUser = st::premiumGiftsUserpicButton;
|
const auto &stUser = st::premiumGiftsUserpicButton;
|
||||||
const auto widget = content->add(object_ptr<Ui::RpWidget>(content));
|
const auto widget = content->add(object_ptr<Ui::RpWidget>(content));
|
||||||
AddMiniStars(content, widget, stUser, st::boxWidth, 1.3);
|
AddMiniStars(content, widget, stUser.photoSize, st::boxWidth, 1.3);
|
||||||
const auto svg = std::make_shared<QSvgRenderer>(
|
const auto svg = std::make_shared<QSvgRenderer>(
|
||||||
Ui::Premium::ColorizedSvg(
|
Ui::Premium::ColorizedSvg(
|
||||||
Ui::Premium::CreditsIconGradientStops()));
|
Ui::Premium::CreditsIconGradientStops()));
|
||||||
|
@ -893,7 +891,8 @@ void ReceiptCreditsBox(
|
||||||
} else if (s.photoId || (e.photoId && !e.subscriptionUntil.isNull())) {
|
} else if (s.photoId || (e.photoId && !e.subscriptionUntil.isNull())) {
|
||||||
if (!(s.cancelled || s.expired || s.cancelledByBot)) {
|
if (!(s.cancelled || s.expired || s.cancelledByBot)) {
|
||||||
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
||||||
AddMiniStars(content, widget, stUser, st::boxWideWidth, 1.5);
|
const auto photoSize = stUser.photoSize;
|
||||||
|
AddMiniStars(content, widget, photoSize, st::boxWideWidth, 1.5);
|
||||||
}
|
}
|
||||||
const auto photoId = s.photoId ? s.photoId : e.photoId;
|
const auto photoId = s.photoId ? s.photoId : e.photoId;
|
||||||
const auto callback = [=](Fn<void()> update) {
|
const auto callback = [=](Fn<void()> update) {
|
||||||
|
@ -1427,7 +1426,7 @@ void ReceiptCreditsBox(
|
||||||
|
|
||||||
if (e.peerType == Data::CreditsHistoryEntry::PeerType::PremiumBot) {
|
if (e.peerType == Data::CreditsHistoryEntry::PeerType::PremiumBot) {
|
||||||
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
const auto widget = Ui::CreateChild<Ui::RpWidget>(content);
|
||||||
AddMiniStars(content, widget, stUser, st::boxWideWidth, 2);
|
AddMiniStars(content, widget, stUser.photoSize, st::boxWideWidth, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto rejoinByApi = base::unixtime::serialize(s.until)
|
const auto rejoinByApi = base::unixtime::serialize(s.until)
|
||||||
|
|
|
@ -179,5 +179,11 @@ void MaybeRequestBalanceIncrease(
|
||||||
SmallBalanceSource source,
|
SmallBalanceSource source,
|
||||||
Fn<void(SmallBalanceResult)> done);
|
Fn<void(SmallBalanceResult)> done);
|
||||||
|
|
||||||
} // namespace Settings
|
void AddMiniStars(
|
||||||
|
not_null<Ui::VerticalLayout*> content,
|
||||||
|
not_null<Ui::RpWidget*> widget,
|
||||||
|
int photoSize,
|
||||||
|
int boxWidth,
|
||||||
|
float64 heightRatio);
|
||||||
|
|
||||||
|
} // namespace Settings
|
||||||
|
|
Loading…
Add table
Reference in a new issue