Improve negative level display.

This commit is contained in:
John Preston
2025-08-01 15:20:36 +04:00
parent 61bdbdb5d6
commit d2c0ec12f3
3 changed files with 9 additions and 9 deletions
@@ -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();;
@@ -64,7 +64,7 @@ crl::time Bubble::SlideNoDeflectionDuration() {
return kSlideDuration * kStepBeforeDeflection;
}
int Bubble::counter() const {
std::optional<int> 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;
}
@@ -45,7 +45,7 @@ public:
[[nodiscard]] static crl::time SlideNoDeflectionDuration();
[[nodiscard]] int counter() const;
[[nodiscard]] std::optional<int> 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<int> _counter;
EdgeProgress _tailEdge = 0.;
bool _flipHorizontal = false;