From 61d2b92814529d4f57900fe928217d574ed1d348 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 23 Sep 2023 12:52:00 +0200 Subject: [PATCH] Added theme support for the 'physicalName' and 'physicalNameExtension' metadata types for the text element --- es-app/src/views/GamelistView.cpp | 6 ++++++ es-app/src/views/SystemView.cpp | 5 +++++ es-core/src/components/TextComponent.h | 27 +++++++++++++++++++++----- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/es-app/src/views/GamelistView.cpp b/es-app/src/views/GamelistView.cpp index cc4919ab1..fe7d22ae7 100644 --- a/es-app/src/views/GamelistView.cpp +++ b/es-app/src/views/GamelistView.cpp @@ -914,6 +914,12 @@ void GamelistView::updateView(const CursorState& state) ->getSystemEnvData() ->mLaunchCommands.front() .second)); + else if (metadata == "physicalName") + return file->getType() == PLACEHOLDER ? + "" : + Utils::FileSystem::getStem(file->getFileName()); + else if (metadata == "physicalNameExtension") + return file->getType() == PLACEHOLDER ? "" : file->getFileName(); else if (metadata == "systemName") return file->getSystem()->getName(); else if (metadata == "systemFullname") diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index b7066687f..dee557371 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -1277,6 +1277,11 @@ void SystemView::updateGameSelectors() ->getSystemEnvData() ->mLaunchCommands.front() .second)); + else if (metadata == "physicalName") + text->setValue( + Utils::FileSystem::getStem(games.at(gameSelectorEntry)->getFileName())); + else if (metadata == "physicalNameExtension") + text->setValue(games.at(gameSelectorEntry)->getFileName()); else if (metadata == "systemName") text->setValue(games.at(gameSelectorEntry)->getSystem()->getName()); else if (metadata == "systemFullname") diff --git a/es-core/src/components/TextComponent.h b/es-core/src/components/TextComponent.h index 78a81dfb3..7e180746b 100644 --- a/es-core/src/components/TextComponent.h +++ b/es-core/src/components/TextComponent.h @@ -126,11 +126,28 @@ private: "gamecountFavorites", "gamecountFavoritesNoText"}; - static inline std::vector supportedMetadataTypes { - "name", "description", "rating", "developer", "publisher", - "genre", "players", "favorite", "completed", "kidgame", - "broken", "playcount", "controller", "altemulator", "emulator", - "manual", "systemName", "systemFullname", "sourceSystemName", "sourceSystemFullname"}; + static inline std::vector supportedMetadataTypes {"name", + "description", + "rating", + "developer", + "publisher", + "genre", + "players", + "favorite", + "completed", + "kidgame", + "broken", + "playcount", + "controller", + "altemulator", + "emulator", + "manual", + "physicalName", + "physicalNameExtension", + "systemName", + "systemFullname", + "sourceSystemName", + "sourceSystemFullname"}; Renderer* mRenderer; std::string mDefaultValue;