mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 07:33:52 +02:00
Added strike out cost without discount in premium options in settings.
This commit is contained in:
parent
9ad1d1c25d
commit
3ed6d1dec1
4 changed files with 38 additions and 9 deletions
|
@ -33,6 +33,9 @@ Data::PremiumSubscriptionOption CreateSubscriptionOption(
|
||||||
.costPerMonth = Ui::FillAmountAndCurrency(
|
.costPerMonth = Ui::FillAmountAndCurrency(
|
||||||
amount / float64(months),
|
amount / float64(months),
|
||||||
currency),
|
currency),
|
||||||
|
.costNoDiscount = Ui::FillAmountAndCurrency(
|
||||||
|
monthlyAmount * months,
|
||||||
|
currency),
|
||||||
.costTotal = Ui::FillAmountAndCurrency(amount, currency),
|
.costTotal = Ui::FillAmountAndCurrency(amount, currency),
|
||||||
.botUrl = botUrl,
|
.botUrl = botUrl,
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct PremiumSubscriptionOption {
|
||||||
QString duration;
|
QString duration;
|
||||||
QString discount;
|
QString discount;
|
||||||
QString costPerMonth;
|
QString costPerMonth;
|
||||||
|
QString costNoDiscount;
|
||||||
QString costTotal;
|
QString costTotal;
|
||||||
QString total;
|
QString total;
|
||||||
QString botUrl;
|
QString botUrl;
|
||||||
|
|
|
@ -85,6 +85,7 @@ using SectionCustomTopBarData = Info::Settings::SectionCustomTopBarData;
|
||||||
|
|
||||||
if (option.duration == tr::lng_months(tr::now, lt_count, 1)) {
|
if (option.duration == tr::lng_months(tr::now, lt_count, 1)) {
|
||||||
option.costPerMonth = QString();
|
option.costPerMonth = QString();
|
||||||
|
option.costNoDiscount = QString();
|
||||||
option.duration = tr::lng_premium_subscribe_months_1(tr::now);
|
option.duration = tr::lng_premium_subscribe_months_1(tr::now);
|
||||||
} else if (option.duration == tr::lng_months(tr::now, lt_count, 6)) {
|
} else if (option.duration == tr::lng_months(tr::now, lt_count, 6)) {
|
||||||
option.duration = tr::lng_premium_subscribe_months_6(tr::now);
|
option.duration = tr::lng_premium_subscribe_months_6(tr::now);
|
||||||
|
|
|
@ -927,9 +927,19 @@ void AddGiftOptions(
|
||||||
const auto costPerMonthIcon = info.costPerMonth.startsWith(kStar)
|
const auto costPerMonthIcon = info.costPerMonth.startsWith(kStar)
|
||||||
? GenerateStars(costPerMonthFont->height, 1)
|
? GenerateStars(costPerMonthFont->height, 1)
|
||||||
: QImage();
|
: QImage();
|
||||||
const auto costPerMonthText = costPerMonthIcon.isNull()
|
const auto costPerMonthLabel
|
||||||
? info.costPerMonth
|
= row->lifetime().make_state<Ui::Text::String>();
|
||||||
: removedStar(info.costPerMonth);
|
costPerMonthLabel->setMarkedText(
|
||||||
|
st::shareBoxListItem.nameStyle,
|
||||||
|
TextWithEntities()
|
||||||
|
.append(Ui::Text::Wrapped(
|
||||||
|
TextWithEntities{ info.costNoDiscount },
|
||||||
|
EntityType::StrikeOut))
|
||||||
|
.append(' ')
|
||||||
|
.append(costPerMonthIcon.isNull()
|
||||||
|
? info.costPerMonth
|
||||||
|
: removedStar(info.costPerMonth)));
|
||||||
|
|
||||||
const auto costTotalEntry = [&] {
|
const auto costTotalEntry = [&] {
|
||||||
if (!info.costTotal.startsWith(kStar)) {
|
if (!info.costTotal.startsWith(kStar)) {
|
||||||
return QImage();
|
return QImage();
|
||||||
|
@ -1049,12 +1059,26 @@ void AddGiftOptions(
|
||||||
0);
|
0);
|
||||||
p.setPen(st::windowSubTextFg);
|
p.setPen(st::windowSubTextFg);
|
||||||
p.setFont(costPerMonthFont);
|
p.setFont(costPerMonthFont);
|
||||||
const auto perMonthLeft = costPerMonthFont->spacew
|
|
||||||
+ costPerMonthIcon.width() / style::DevicePixelRatio();
|
{
|
||||||
p.drawText(
|
const auto left = costPerMonthIcon.isNull()
|
||||||
perRect.translated(perMonthLeft, 0),
|
? 0
|
||||||
costPerMonthText,
|
: (costPerMonthFont->spacew
|
||||||
style::al_left);
|
+ costPerMonthIcon.width()
|
||||||
|
/ style::DevicePixelRatio());
|
||||||
|
const auto costTotalWidth = costTotalFont->width(
|
||||||
|
info.costTotal);
|
||||||
|
const auto pos = perRect.translated(left, 0).topLeft();
|
||||||
|
const auto availableWidth = row->width()
|
||||||
|
- pos.x()
|
||||||
|
- costTotalWidth;
|
||||||
|
costPerMonthLabel->draw(p, {
|
||||||
|
.position = pos,
|
||||||
|
.outerWidth = availableWidth,
|
||||||
|
.availableWidth = availableWidth,
|
||||||
|
.elisionLines = 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
p.drawImage(perRect.topLeft(), costPerMonthIcon);
|
p.drawImage(perRect.topLeft(), costPerMonthIcon);
|
||||||
|
|
||||||
const auto totalRect = row->rect()
|
const auto totalRect = row->rect()
|
||||||
|
|
Loading…
Add table
Reference in a new issue