diff --git a/Telegram/SourceFiles/ui/controls/stars_rating.cpp b/Telegram/SourceFiles/ui/controls/stars_rating.cpp index b66584697e..32dcf87b5a 100644 --- a/Telegram/SourceFiles/ui/controls/stars_rating.cpp +++ b/Telegram/SourceFiles/ui/controls/stars_rating.cpp @@ -121,6 +121,9 @@ struct Feature { } [[nodiscard]] Counters AdjustByReached(Counters data) { + if (data.stars < 0) { + return data; + } const auto reached = !data.nextLevelStars; if (reached) { --data.level; @@ -274,9 +277,6 @@ void AboutRatingBox( data.stars); box->setMaxHeight(st::boostBoxMaxHeight); - const auto close = box->addTopButton( - st::boxTitleClose, - [=] { box->closeBox(); }); auto title = tr::lng_stars_rating_title();; diff --git a/Telegram/SourceFiles/ui/effects/premium_bubble.cpp b/Telegram/SourceFiles/ui/effects/premium_bubble.cpp index a507f78816..75a6965a1d 100644 --- a/Telegram/SourceFiles/ui/effects/premium_bubble.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_bubble.cpp @@ -64,7 +64,7 @@ crl::time Bubble::SlideNoDeflectionDuration() { return kSlideDuration * kStepBeforeDeflection; } -int Bubble::counter() const { +std::optional Bubble::counter() const { return _counter; } @@ -100,7 +100,7 @@ int Bubble::countMaxWidth(int maxPossibleCounter) const { void Bubble::setCounter(int value) { if (_counter != value) { _counter = value; - _numberAnimation.setText(_textFactory(_counter), _counter); + _numberAnimation.setText(_textFactory(value), value); } } @@ -113,7 +113,7 @@ void Bubble::setFlipHorizontal(bool value) { } void Bubble::paintBubble(QPainter &p, const QRect &r, const QBrush &brush) { - if (_counter < 0) { + if (!_counter.has_value()) { return; } @@ -364,7 +364,7 @@ void BubbleWidget::animateTo(BubbleRowState state) { } void BubbleWidget::paintEvent(QPaintEvent *e) { - if (_bubble.counter() < 0) { + if (!_bubble.counter().has_value()) { return; } diff --git a/Telegram/SourceFiles/ui/effects/premium_bubble.h b/Telegram/SourceFiles/ui/effects/premium_bubble.h index 404a75abef..b867250400 100644 --- a/Telegram/SourceFiles/ui/effects/premium_bubble.h +++ b/Telegram/SourceFiles/ui/effects/premium_bubble.h @@ -45,7 +45,7 @@ public: [[nodiscard]] static crl::time SlideNoDeflectionDuration(); - [[nodiscard]] int counter() const; + [[nodiscard]] std::optional counter() const; [[nodiscard]] int height() const; [[nodiscard]] int width() const; [[nodiscard]] int bubbleRadius() const; @@ -72,7 +72,7 @@ private: const int _textTop; const bool _hasTail; - int _counter = -1; + std::optional _counter; EdgeProgress _tailEdge = 0.; bool _flipHorizontal = false;