From a147c87cead5f0060489cd360e80cab92e763913 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 22 Jan 2022 21:25:35 +0100 Subject: [PATCH] Added a new getRatingValue function to RatingComponent. --- es-core/src/components/RatingComponent.cpp | 7 +++++++ es-core/src/components/RatingComponent.h | 1 + 2 files changed, 8 insertions(+) diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index 81bf7d73c..2b09497b2 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -75,6 +75,13 @@ std::string RatingComponent::getValue() const return ss.str(); } +std::string RatingComponent::getRatingValue() const +{ + std::stringstream ss; + ss << mValue * NUM_RATING_STARS; + return ss.str(); +} + void RatingComponent::setOpacity(unsigned char opacity) { mOpacity = opacity; diff --git a/es-core/src/components/RatingComponent.h b/es-core/src/components/RatingComponent.h index 3f514b591..54b66350b 100644 --- a/es-core/src/components/RatingComponent.h +++ b/es-core/src/components/RatingComponent.h @@ -23,6 +23,7 @@ public: RatingComponent(bool colorizeChanges = false); std::string getValue() const override; + std::string getRatingValue() const; // Should be a normalized float (in the range [0..1]) - if it's not, it will be clamped. void setValue(const std::string& value) override;