mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +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()->setDefaultZIndex(40.0f);
|
||||||
mTextComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
mTextComponents.back()->applyTheme(theme, "gamelist", element.first, ALL);
|
||||||
if (mTextComponents.back()->getThemeOpacity() != 0.0f) {
|
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);
|
mTextComponents.back()->setScrollHide(true);
|
||||||
else if (mTextComponents.back()->getMetadataElement())
|
else if (mTextComponents.back()->getMetadataElement())
|
||||||
mTextComponents.back()->setScrollHide(true);
|
mTextComponents.back()->setScrollHide(true);
|
||||||
|
@ -581,7 +584,11 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
|
|
||||||
if (hideMetaDataFields) {
|
if (hideMetaDataFields) {
|
||||||
for (auto& text : mTextComponents) {
|
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);
|
text->setVisible(false);
|
||||||
}
|
}
|
||||||
for (auto& date : mDateTimeComponents)
|
for (auto& date : mDateTimeComponents)
|
||||||
|
@ -884,6 +891,14 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
return file->metadata.get("playcount");
|
return file->metadata.get("playcount");
|
||||||
else if (metadata == "altemulator")
|
else if (metadata == "altemulator")
|
||||||
return file->metadata.get("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
|
else
|
||||||
return metadata;
|
return metadata;
|
||||||
};
|
};
|
||||||
|
@ -911,6 +926,13 @@ void GamelistView::updateView(const CursorState& state)
|
||||||
metadata = text->getThemeMetadata();
|
metadata = text->getThemeMetadata();
|
||||||
if (metadata == "")
|
if (metadata == "")
|
||||||
continue;
|
continue;
|
||||||
|
if ((file->getSystem()->isCustomCollection() &&
|
||||||
|
file->getPath() == file->getSystem()->getName()) &&
|
||||||
|
(metadata == "systemName" || metadata == "systemFullname" ||
|
||||||
|
metadata == "sourceSystemName" || metadata == "sourceSystemFullname")) {
|
||||||
|
text->setValue("");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (metadata == "rating") {
|
if (metadata == "rating") {
|
||||||
text->setValue(RatingComponent::getRatingValue(file->metadata.get("rating")));
|
text->setValue(RatingComponent::getRatingValue(file->metadata.get("rating")));
|
||||||
|
|
|
@ -895,13 +895,13 @@ void SystemView::updateGameCount()
|
||||||
if (gameCount->getThemeSystemdata() == "gamecount") {
|
if (gameCount->getThemeSystemdata() == "gamecount") {
|
||||||
gameCount->setValue(ss.str());
|
gameCount->setValue(ss.str());
|
||||||
}
|
}
|
||||||
else if (gameCount->getThemeSystemdata() == "gamecount_games") {
|
else if (gameCount->getThemeSystemdata() == "gamecountGames") {
|
||||||
if (games)
|
if (games)
|
||||||
gameCount->setValue(ssGames.str());
|
gameCount->setValue(ssGames.str());
|
||||||
else
|
else
|
||||||
gameCount->setValue(ss.str());
|
gameCount->setValue(ss.str());
|
||||||
}
|
}
|
||||||
else if (gameCount->getThemeSystemdata() == "gamecount_favorites") {
|
else if (gameCount->getThemeSystemdata() == "gamecountFavorites") {
|
||||||
gameCount->setValue(ssFavorites.str());
|
gameCount->setValue(ssFavorites.str());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1269,36 +1269,46 @@ void SystemView::updateGameSelectors()
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("name"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("name"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (metadata == "description")
|
else if (metadata == "description")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("desc"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("desc"));
|
||||||
if (metadata == "rating")
|
else if (metadata == "rating")
|
||||||
text->setValue(RatingComponent::getRatingValue(
|
text->setValue(RatingComponent::getRatingValue(
|
||||||
games.at(gameSelectorEntry)->metadata.get("rating")));
|
games.at(gameSelectorEntry)->metadata.get("rating")));
|
||||||
if (metadata == "developer")
|
else if (metadata == "developer")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("developer"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("developer"));
|
||||||
if (metadata == "publisher")
|
else if (metadata == "publisher")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("publisher"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("publisher"));
|
||||||
if (metadata == "genre")
|
else if (metadata == "genre")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("genre"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("genre"));
|
||||||
if (metadata == "players")
|
else if (metadata == "players")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("players"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("players"));
|
||||||
if (metadata == "favorite")
|
else if (metadata == "favorite")
|
||||||
text->setValue(
|
text->setValue(
|
||||||
games.at(gameSelectorEntry)->metadata.get("favorite") == "true" ? "yes" : "no");
|
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" ?
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("completed") == "true" ?
|
||||||
"yes" :
|
"yes" :
|
||||||
"no");
|
"no");
|
||||||
if (metadata == "kidgame")
|
else if (metadata == "kidgame")
|
||||||
text->setValue(
|
text->setValue(
|
||||||
games.at(gameSelectorEntry)->metadata.get("kidgame") == "true" ? "yes" : "no");
|
games.at(gameSelectorEntry)->metadata.get("kidgame") == "true" ? "yes" : "no");
|
||||||
if (metadata == "broken")
|
else if (metadata == "broken")
|
||||||
text->setValue(
|
text->setValue(
|
||||||
games.at(gameSelectorEntry)->metadata.get("broken") == "true" ? "yes" : "no");
|
games.at(gameSelectorEntry)->metadata.get("broken") == "true" ? "yes" : "no");
|
||||||
if (metadata == "playcount")
|
else if (metadata == "playcount")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("playcount"));
|
text->setValue(games.at(gameSelectorEntry)->metadata.get("playcount"));
|
||||||
if (metadata == "altemulator")
|
else if (metadata == "altemulator")
|
||||||
text->setValue(games.at(gameSelectorEntry)->metadata.get("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 {
|
else {
|
||||||
text->setValue("");
|
text->setValue("");
|
||||||
|
|
|
@ -439,7 +439,20 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
|
||||||
if (properties & METADATA && elem->has("systemdata")) {
|
if (properties & METADATA && elem->has("systemdata")) {
|
||||||
mThemeSystemdata = "";
|
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) {
|
for (auto& type : supportedSystemdataTypes) {
|
||||||
if (type == systemdata) {
|
if (type == systemdata) {
|
||||||
mThemeSystemdata = type;
|
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 = "";
|
mThemeMetadata = "";
|
||||||
const std::string& metadata {elem->get<std::string>("metadata")};
|
const std::string& metadata {elem->get<std::string>("metadata")};
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,15 @@ private:
|
||||||
void onColorChanged();
|
void onColorChanged();
|
||||||
|
|
||||||
static inline std::vector<std::string> supportedSystemdataTypes {
|
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 {
|
static inline std::vector<std::string> supportedMetadataTypes {
|
||||||
"name", "description", "rating", "developer", "publisher",
|
"name", "description", "rating",
|
||||||
"genre", "players", "favorite", "completed", "kidgame",
|
"developer", "publisher", "genre",
|
||||||
"broken", "playcount", "controller", "altemulator"};
|
"players", "favorite", "completed",
|
||||||
|
"kidgame", "broken", "playcount",
|
||||||
|
"controller", "altemulator", "systemName",
|
||||||
|
"systemFullname", "sourceSystemName", "sourceSystemFullname"};
|
||||||
|
|
||||||
Renderer* mRenderer;
|
Renderer* mRenderer;
|
||||||
std::string mDefaultValue;
|
std::string mDefaultValue;
|
||||||
|
|
Loading…
Reference in a new issue