mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Improved colors of ministars in buttons from section of peer gifts.
This commit is contained in:
parent
0a92b1dc68
commit
a8f492a027
1 changed files with 19 additions and 1 deletions
|
@ -42,7 +42,6 @@ GiftButton::GiftButton(
|
||||||
: AbstractButton(parent)
|
: AbstractButton(parent)
|
||||||
, _delegate(delegate)
|
, _delegate(delegate)
|
||||||
, _stars(this, true, Ui::Premium::MiniStars::Type::SlowStars) {
|
, _stars(this, true, Ui::Premium::MiniStars::Type::SlowStars) {
|
||||||
_stars.setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GiftButton::~GiftButton() {
|
GiftButton::~GiftButton() {
|
||||||
|
@ -82,7 +81,14 @@ void GiftButton::setDescriptor(const GiftDescriptor &descriptor) {
|
||||||
data.currency,
|
data.currency,
|
||||||
true));
|
true));
|
||||||
_userpic = nullptr;
|
_userpic = nullptr;
|
||||||
|
_stars.setColorOverride(QGradientStops{
|
||||||
|
{ 0., anim::with_alpha(st::windowActiveTextFg->c, .3) },
|
||||||
|
{ 1., st::windowActiveTextFg->c },
|
||||||
|
});
|
||||||
}, [&](const GiftTypeStars &data) {
|
}, [&](const GiftTypeStars &data) {
|
||||||
|
const auto soldOut = data.limitedCount
|
||||||
|
&& !data.userpic
|
||||||
|
&& !data.limitedLeft;
|
||||||
_price.setMarkedText(
|
_price.setMarkedText(
|
||||||
st::semiboldTextStyle,
|
st::semiboldTextStyle,
|
||||||
_delegate->star().append(' ' + QString::number(data.stars)),
|
_delegate->star().append(' ' + QString::number(data.stars)),
|
||||||
|
@ -93,6 +99,14 @@ void GiftButton::setDescriptor(const GiftDescriptor &descriptor) {
|
||||||
: data.from
|
: data.from
|
||||||
? Ui::MakeUserpicThumbnail(data.from)
|
? Ui::MakeUserpicThumbnail(data.from)
|
||||||
: Ui::MakeHiddenAuthorThumbnail();
|
: Ui::MakeHiddenAuthorThumbnail();
|
||||||
|
if (soldOut) {
|
||||||
|
_stars.setColorOverride(QGradientStops{
|
||||||
|
{ 0., Qt::transparent },
|
||||||
|
{ 1., Qt::transparent },
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
_stars.setColorOverride(Ui::Premium::CreditsIconGradientStops());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (const auto document = _delegate->lookupSticker(descriptor)) {
|
if (const auto document = _delegate->lookupSticker(descriptor)) {
|
||||||
setDocument(document);
|
setDocument(document);
|
||||||
|
@ -110,6 +124,10 @@ void GiftButton::setDescriptor(const GiftDescriptor &descriptor) {
|
||||||
const auto skipx = (width() - inner.width()) / 2;
|
const auto skipx = (width() - inner.width()) / 2;
|
||||||
const auto outer = (width() - 2 * skipx);
|
const auto outer = (width() - 2 * skipx);
|
||||||
_button = QRect(skipx, skipy, outer, inner.height());
|
_button = QRect(skipx, skipy, outer, inner.height());
|
||||||
|
{
|
||||||
|
const auto padding = _button.height() / 2;
|
||||||
|
_stars.setCenter(_button - QMargins(padding, 0, padding, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GiftButton::documentResolved() const {
|
bool GiftButton::documentResolved() const {
|
||||||
|
|
Loading…
Add table
Reference in a new issue