Set linear interpolation for the rating component in GuiMetaDataEd and GuiScraperSearch.

This commit is contained in:
Leon Styhre 2022-09-03 21:43:36 +02:00
parent 455b970a59
commit d242c84ea8
4 changed files with 6 additions and 4 deletions

View file

@ -161,7 +161,7 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
spacer->setSize(Renderer::getScreenWidth() * 0.0025f, 0.0f);
row.addElement(spacer, false);
ed = std::make_shared<RatingComponent>(true);
ed = std::make_shared<RatingComponent>(true, true);
ed->setChangedColor(ICONCOLOR_USERMARKED);
const float height {lbl->getSize().y * 0.71f};
ed->setSize(0.0f, height);

View file

@ -82,7 +82,7 @@ GuiScraperSearch::GuiScraperSearch(SearchType type, unsigned int scrapeCount)
auto font = Font::get(FONT_SIZE_SMALL); // Placeholder, gets replaced in onSizeChanged().
const unsigned int mdColor {0x777777FF};
const unsigned int mdLblColor {0x666666FF};
mMD_Rating = std::make_shared<RatingComponent>();
mMD_Rating = std::make_shared<RatingComponent>(false, true);
mMD_ReleaseDate = std::make_shared<DateTimeEditComponent>();
mMD_ReleaseDate->setColor(mdColor);
mMD_ReleaseDate->setUppercase(true);

View file

@ -13,7 +13,7 @@
#include "ThemeData.h"
#include "resources/TextureResource.h"
RatingComponent::RatingComponent(bool colorizeChanges)
RatingComponent::RatingComponent(bool colorizeChanges, bool linearInterpolation)
: mRenderer {Renderer::getInstance()}
, mValue {0.5f}
, mImageRatio {1.0f}
@ -27,9 +27,11 @@ RatingComponent::RatingComponent(bool colorizeChanges)
mIconFilled.setResize(mSize, false);
mIconFilled.setTileSize(mSize.y, mSize.y);
mIconFilled.setLinearInterpolation(linearInterpolation);
mIconUnfilled.setResize(mSize, false);
mIconUnfilled.setTileSize(mSize.y, mSize.y);
mIconUnfilled.setLinearInterpolation(linearInterpolation);
mIconFilled.setImage(std::string(":/graphics/star_filled.svg"), true);
mIconUnfilled.setImage(std::string(":/graphics/star_unfilled.svg"), true);

View file

@ -21,7 +21,7 @@ class TextureResource;
class RatingComponent : public GuiComponent
{
public:
RatingComponent(bool colorizeChanges = false);
RatingComponent(bool colorizeChanges = false, bool linearInterpolation = false);
std::string getValue() const override;
// Returns a rating value between 0 and 5 as a string.