Made the text element 'defaultValue' property usable with metadata types systemName, systemFullname, sourceSystemName and sourceSystemFullname

This commit is contained in:
Leon Styhre 2024-01-28 12:34:41 +01:00
parent 0b33884baa
commit 24c3817aaa
3 changed files with 7 additions and 2 deletions

View file

@ -999,7 +999,7 @@ void GamelistView::updateView(const CursorState& state)
file->getPath() == file->getSystem()->getName()) &&
(metadata == "systemName" || metadata == "systemFullname" ||
metadata == "sourceSystemName" || metadata == "sourceSystemFullname")) {
text->setValue("");
text->setValue(text->getDefaultValue());
continue;
}

View file

@ -691,7 +691,10 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
mThemeMetadata = type;
if (elem->has("defaultValue")) {
if (mThemeMetadata == "developer" || mThemeMetadata == "publisher" ||
mThemeMetadata == "genre" || mThemeMetadata == "players") {
mThemeMetadata == "genre" || mThemeMetadata == "players" ||
mThemeMetadata == "systemName" || mThemeMetadata == "systemFullname" ||
mThemeMetadata == "sourceSystemName" ||
mThemeMetadata == "sourceSystemFullname") {
const std::string& defaultValue {elem->get<std::string>("defaultValue")};
if (defaultValue == ":space:")
mDefaultValue = " ";

View file

@ -62,6 +62,8 @@ public:
std::string getHiddenValue() const override { return mHiddenText; }
void setHiddenValue(const std::string& value) override { setHiddenText(value); }
const std::string getDefaultValue() const { return mDefaultValue; }
float const getOpacity() const override
{
return static_cast<float>((mColor & 0x000000FF) / 255.0f);