From 949f059b7e9fc9992c9e9f3efba27f6e1146955a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 7 Dec 2022 19:43:03 +0100 Subject: [PATCH] Fixed an issue where the CarouselComponent text property value was ignored. --- es-app/src/views/SystemView.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index 2e30a8fb0..823c72b3d 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -449,7 +449,7 @@ void SystemView::populate() if (SystemData::sSystemVector.size() == 0) return; - LOG(LogDebug) << "SystemView::populate(): Populating carousel"; + LOG(LogDebug) << "SystemView::populate(): Populating primary element..."; auto themeSets = ThemeData::getThemeSets(); std::map::const_iterator @@ -467,6 +467,7 @@ void SystemView::populate() const std::shared_ptr& theme {it->getTheme()}; std::string itemPath; std::string defaultItemPath; + std::string itemText; if (mLegacyMode && mViewNeedsReload) { if (mCarousel == nullptr) { @@ -577,6 +578,8 @@ void SystemView::populate() itemPath = element.second.get("staticItem"); if (element.second.has("defaultItem")) defaultItemPath = element.second.get("defaultItem"); + if (element.second.has("text")) + itemText = element.second.get("text"); } } else if (element.second.type == "image") { @@ -738,12 +741,17 @@ void SystemView::populate() if (mCarousel != nullptr) { CarouselComponent::Entry entry; - // Keep showing only the short name for legacy themes to maintain maximum - // backward compatibility. This also applies to unreadable theme sets. - if (mLegacyMode) + if (mLegacyMode) { + // Keep showing only the short name for legacy themes to maintain maximum + // backward compatibility. This also applies to unreadable theme sets. entry.name = it->getName(); - else - entry.name = it->getFullName(); + } + else { + if (itemText == "") + entry.name = it->getFullName(); + else + entry.name = itemText; + } letterCaseFunc(entry.name); entry.object = it; entry.data.itemPath = itemPath; @@ -752,7 +760,10 @@ void SystemView::populate() } else if (mGrid != nullptr) { GridComponent::Entry entry; - entry.name = it->getFullName(); + if (itemText == "") + entry.name = it->getFullName(); + else + entry.name = itemText; letterCaseFunc(entry.name); entry.object = it; entry.data.itemPath = itemPath;