mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
Added support for displaying system name information per-game.
This commit is contained in:
parent
fb1caaf879
commit
558e13d0c9
|
@ -346,7 +346,10 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
|||
mTextComponents.back()->setDefaultZIndex(40.0f);
|
||||
mTextComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
||||
if (mTextComponents.back()->getThemeOpacity() != 0.0f) {
|
||||
if (mTextComponents.back()->getThemeMetadata() != "")
|
||||
const std::string& metadata {mTextComponents.back()->getThemeMetadata()};
|
||||
if (metadata != "" && metadata != "systemName" &&
|
||||
metadata != "systemFullname" && metadata != "sourceSystemName" &&
|
||||
metadata != "sourceSystemFullname")
|
||||
mTextComponents.back()->setScrollHide(true);
|
||||
else if (mTextComponents.back()->getMetadataElement())
|
||||
mTextComponents.back()->setScrollHide(true);
|
||||
|
@ -581,7 +584,11 @@ void GamelistView::updateView(const CursorState& state)
|
|||
|
||||
if (hideMetaDataFields) {
|
||||
for (auto& text : mTextComponents) {
|
||||
if (text->getMetadataElement() || text->getThemeMetadata() != "")
|
||||
if (text->getMetadataElement() ||
|
||||
(text->getThemeMetadata() != "" && text->getThemeMetadata() != "systemName" &&
|
||||
text->getThemeMetadata() != "systemFullname" &&
|
||||
text->getThemeMetadata() != "sourceSystemName" &&
|
||||
text->getThemeMetadata() != "sourceSystemFullname"))
|
||||
text->setVisible(false);
|
||||
}
|
||||
for (auto& date : mDateTimeComponents)
|
||||
|
@ -884,6 +891,14 @@ void GamelistView::updateView(const CursorState& state)
|
|||
return file->metadata.get("playcount");
|
||||
else if (metadata == "altemulator")
|
||||
return file->metadata.get("altemulator");
|
||||
else if (metadata == "systemName")
|
||||
return file->getSystem()->getName();
|
||||
else if (metadata == "systemFullname")
|
||||
return file->getSystem()->getFullName();
|
||||
else if (metadata == "sourceSystemName")
|
||||
return file->getSourceFileData()->getSystem()->getName();
|
||||
else if (metadata == "sourceSystemFullname")
|
||||
return file->getSourceFileData()->getSystem()->getFullName();
|
||||
else
|
||||
return metadata;
|
||||
};
|
||||
|
@ -911,6 +926,13 @@ void GamelistView::updateView(const CursorState& state)
|
|||
metadata = text->getThemeMetadata();
|
||||
if (metadata == "")
|
||||
continue;
|
||||
if ((file->getSystem()->isCustomCollection() &&
|
||||
file->getPath() == file->getSystem()->getName()) &&
|
||||
(metadata == "systemName" || metadata == "systemFullname" ||
|
||||
metadata == "sourceSystemName" || metadata == "sourceSystemFullname")) {
|
||||
text->setValue("");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (metadata == "rating") {
|
||||
text->setValue(RatingComponent::getRatingValue(file->metadata.get("rating")));
|
||||
|
|
|
@ -895,13 +895,13 @@ void SystemView::updateGameCount()
|
|||
if (gameCount->getThemeSystemdata() == "gamecount") {
|
||||
gameCount->setValue(ss.str());
|
||||
}
|
||||
else if (gameCount->getThemeSystemdata() == "gamecount_games") {
|
||||
else if (gameCount->getThemeSystemdata() == "gamecountGames") {
|
||||
if (games)
|
||||
gameCount->setValue(ssGames.str());
|
||||
else
|
||||
gameCount->setValue(ss.str());
|
||||
}
|
||||
else if (gameCount->getThemeSystemdata() == "gamecount_favorites") {
|
||||
else if (gameCount->getThemeSystemdata() == "gamecountFavorites") {
|
||||
gameCount->setValue(ssFavorites.str());
|
||||
}
|
||||
else {
|
||||
|
@ -1269,36 +1269,46 @@ void SystemView::updateGameSelectors()
|
|||
text->setValue(games.at(gameSelectorEntry)->metadata.get("name"));
|
||||
}
|
||||
}
|
||||
if (metadata == "description")
|
||||
else if (metadata == "description")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("desc"));
|
||||
if (metadata == "rating")
|
||||
else if (metadata == "rating")
|
||||
text->setValue(RatingComponent::getRatingValue(
|
||||
games.at(gameSelectorEntry)->metadata.get("rating")));
|
||||
if (metadata == "developer")
|
||||
else if (metadata == "developer")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("developer"));
|
||||
if (metadata == "publisher")
|
||||
else if (metadata == "publisher")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("publisher"));
|
||||
if (metadata == "genre")
|
||||
else if (metadata == "genre")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("genre"));
|
||||
if (metadata == "players")
|
||||
else if (metadata == "players")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("players"));
|
||||
if (metadata == "favorite")
|
||||
else if (metadata == "favorite")
|
||||
text->setValue(
|
||||
games.at(gameSelectorEntry)->metadata.get("favorite") == "true" ? "yes" : "no");
|
||||
if (metadata == "completed")
|
||||
else if (metadata == "completed")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("completed") == "true" ?
|
||||
"yes" :
|
||||
"no");
|
||||
if (metadata == "kidgame")
|
||||
else if (metadata == "kidgame")
|
||||
text->setValue(
|
||||
games.at(gameSelectorEntry)->metadata.get("kidgame") == "true" ? "yes" : "no");
|
||||
if (metadata == "broken")
|
||||
else if (metadata == "broken")
|
||||
text->setValue(
|
||||
games.at(gameSelectorEntry)->metadata.get("broken") == "true" ? "yes" : "no");
|
||||
if (metadata == "playcount")
|
||||
else if (metadata == "playcount")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("playcount"));
|
||||
if (metadata == "altemulator")
|
||||
else if (metadata == "altemulator")
|
||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("altemulator"));
|
||||
else if (metadata == "systemName")
|
||||
text->setValue(games.at(gameSelectorEntry)->getSystem()->getName());
|
||||
else if (metadata == "systemFullname")
|
||||
text->setValue(games.at(gameSelectorEntry)->getSystem()->getFullName());
|
||||
else if (metadata == "sourceSystemName")
|
||||
text->setValue(
|
||||
games.at(gameSelectorEntry)->getSourceFileData()->getSystem()->getName());
|
||||
else if (metadata == "sourceSystemFullname")
|
||||
text->setValue(
|
||||
games.at(gameSelectorEntry)->getSourceFileData()->getSystem()->getFullName());
|
||||
}
|
||||
else {
|
||||
text->setValue("");
|
||||
|
|
|
@ -439,7 +439,20 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
|
||||
if (properties & METADATA && elem->has("systemdata")) {
|
||||
mThemeSystemdata = "";
|
||||
const std::string& systemdata {elem->get<std::string>("systemdata")};
|
||||
std::string systemdata {elem->get<std::string>("systemdata")};
|
||||
if (systemdata == "gamecount_games") {
|
||||
systemdata = "gamecountGames";
|
||||
LOG(LogWarning) << "TextComponent: Property value \"gamecount_games\" has been "
|
||||
"deprecated and will be removed in a future release, use "
|
||||
"\"gamecountGames\" instead";
|
||||
}
|
||||
else if (systemdata == "gamecount_favorites") {
|
||||
systemdata = "gamecountFavorites";
|
||||
LOG(LogWarning) << "TextComponent: Property value \"gamecount_favorites\" has been "
|
||||
"deprecated and will be removed in a future release, use "
|
||||
"\"gamecountFavorites\" instead";
|
||||
}
|
||||
|
||||
for (auto& type : supportedSystemdataTypes) {
|
||||
if (type == systemdata) {
|
||||
mThemeSystemdata = type;
|
||||
|
@ -453,7 +466,16 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
}
|
||||
|
||||
if (properties & METADATA && elem->has("metadata")) {
|
||||
bool systemdataAndMetadata {false};
|
||||
|
||||
if (elem->has("systemdata") && elem->has("metadata")) {
|
||||
systemdataAndMetadata = true;
|
||||
LOG(LogWarning) << "TextComponent: Invalid theme configuration, element \""
|
||||
<< element.substr(5)
|
||||
<< "\" has both \"systemdata\" and \"metadata\" properties defined";
|
||||
}
|
||||
|
||||
if (!systemdataAndMetadata && properties & METADATA && elem->has("metadata")) {
|
||||
mThemeMetadata = "";
|
||||
const std::string& metadata {elem->get<std::string>("metadata")};
|
||||
|
||||
|
|
|
@ -96,12 +96,15 @@ private:
|
|||
void onColorChanged();
|
||||
|
||||
static inline std::vector<std::string> supportedSystemdataTypes {
|
||||
"name", "fullname", "gamecount", "gamecount_games", "gamecount_favorites"};
|
||||
"name", "fullname", "gamecount", "gamecountGames", "gamecountFavorites"};
|
||||
|
||||
static inline std::vector<std::string> supportedMetadataTypes {
|
||||
"name", "description", "rating", "developer", "publisher",
|
||||
"genre", "players", "favorite", "completed", "kidgame",
|
||||
"broken", "playcount", "controller", "altemulator"};
|
||||
"name", "description", "rating",
|
||||
"developer", "publisher", "genre",
|
||||
"players", "favorite", "completed",
|
||||
"kidgame", "broken", "playcount",
|
||||
"controller", "altemulator", "systemName",
|
||||
"systemFullname", "sourceSystemName", "sourceSystemFullname"};
|
||||
|
||||
Renderer* mRenderer;
|
||||
std::string mDefaultValue;
|
||||
|
|
Loading…
Reference in a new issue