From 0587b220cc43de572cc22b1651912be28ee02ad1 Mon Sep 17 00:00:00 2001 From: Sophia Hadash Date: Sun, 26 Sep 2021 22:26:47 +0200 Subject: [PATCH] add alternative emulator badge --- es-app/src/views/gamelist/DetailedGameListView.cpp | 1 + es-app/src/views/gamelist/VideoGameListView.cpp | 1 + es-core/src/components/BadgesComponent.cpp | 9 +++++++-- es-core/src/components/BadgesComponent.h | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/es-app/src/views/gamelist/DetailedGameListView.cpp b/es-app/src/views/gamelist/DetailedGameListView.cpp index c6bb5b5aa..c62eef1b1 100644 --- a/es-app/src/views/gamelist/DetailedGameListView.cpp +++ b/es-app/src/views/gamelist/DetailedGameListView.cpp @@ -389,6 +389,7 @@ void DetailedGameListView::updateInfoPanel() ss << (file->metadata.get("completed").compare("true") ? "" : "completed "); ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame "); ss << (file->metadata.get("broken").compare("true") ? "" : "broken "); + ss << (file->metadata.get("altemulator").compare("") ? "altemu " : ""); std::string slots = ss.str(); if (!slots.empty()) slots.pop_back(); diff --git a/es-app/src/views/gamelist/VideoGameListView.cpp b/es-app/src/views/gamelist/VideoGameListView.cpp index a6a187e0a..49b25ddd1 100644 --- a/es-app/src/views/gamelist/VideoGameListView.cpp +++ b/es-app/src/views/gamelist/VideoGameListView.cpp @@ -451,6 +451,7 @@ void VideoGameListView::updateInfoPanel() ss << (file->metadata.get("completed").compare("true") ? "" : "completed "); ss << (file->metadata.get("kidgame").compare("true") ? "" : "kidgame "); ss << (file->metadata.get("broken").compare("true") ? "" : "broken "); + ss << (file->metadata.get("altemulator").compare("") ? "altemu " : ""); std::string slots = ss.str(); if (!slots.empty()) slots.pop_back(); diff --git a/es-core/src/components/BadgesComponent.cpp b/es-core/src/components/BadgesComponent.cpp index 5b0a569be..48bcc1f78 100644 --- a/es-core/src/components/BadgesComponent.cpp +++ b/es-core/src/components/BadgesComponent.cpp @@ -14,7 +14,8 @@ #include "resources/TextureResource.h" // Available slot definitions. -const std::vector BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN}; +const std::vector BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN, + SLOT_ALTERNATIVE_EMULATOR}; std::map BadgesComponent::mBadgeIcons = std::map(); std::map BadgesComponent::mImageComponents = std::map(); @@ -25,6 +26,7 @@ BadgesComponent::BadgesComponent(Window *window) mBadgeIcons[SLOT_COMPLETED] = ":/graphics/badge_completed.svg"; mBadgeIcons[SLOT_KIDS] = ":/graphics/badge_kidgame.svg"; mBadgeIcons[SLOT_BROKEN] = ":/graphics/badge_broken.svg"; + mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR] = ":/graphics/badge_altemu.svg"; } @@ -42,6 +44,9 @@ BadgesComponent::BadgesComponent(Window *window) ImageComponent mImageBroken = ImageComponent(window); mImageBroken.setImage(mBadgeIcons[SLOT_BROKEN], false, true); mImageComponents.insert({SLOT_BROKEN, mImageBroken}); + ImageComponent mImageAltEmu = ImageComponent(window); + mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true); + mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu}); } } @@ -54,7 +59,7 @@ void BadgesComponent::setValue(const std::string& value) std::istringstream ss(value); while (std::getline(ss, temp, ' ')) { if (!(temp == SLOT_FAVORITE || temp == SLOT_COMPLETED || temp == SLOT_KIDS || - temp == SLOT_BROKEN)) + temp == SLOT_BROKEN || temp == SLOT_ALTERNATIVE_EMULATOR)) LOG(LogError) << "Badge slot '" << temp << "' is invalid."; else mChildren.push_back(&mImageComponents.find(temp)->second); diff --git a/es-core/src/components/BadgesComponent.h b/es-core/src/components/BadgesComponent.h index 79b49fc8a..6c3c1509e 100644 --- a/es-core/src/components/BadgesComponent.h +++ b/es-core/src/components/BadgesComponent.h @@ -20,6 +20,7 @@ #define SLOT_COMPLETED "completed" #define SLOT_KIDS "kidgame" #define SLOT_BROKEN "broken" +#define SLOT_ALTERNATIVE_EMULATOR "altemu" class TextureResource;