mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 22:25:38 +00:00
Merge branch '63-add-badges-decals-e-g-for-favorites-completed-games-non-working-games-collections-and-folders' into 575-theme-add-a-modern-clean-switch-like-theme-as-an-official-theme-in-es-de-to-choose-from
This commit is contained in:
commit
77ac53edb8
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
#include "resources/TextureResource.h"
|
||||
|
||||
// Available slot definitions.
|
||||
const std::vector<std::string> BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN};
|
||||
const std::vector<std::string> BadgesComponent::mSlots = {SLOT_FAVORITE, SLOT_COMPLETED, SLOT_KIDS, SLOT_BROKEN,
|
||||
SLOT_ALTERNATIVE_EMULATOR};
|
||||
std::map<std::string, std::string> BadgesComponent::mBadgeIcons = std::map<std::string, std::string>();
|
||||
std::map<std::string, ImageComponent> BadgesComponent::mImageComponents = std::map<std::string, ImageComponent>();
|
||||
|
||||
|
@ -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,19 +44,26 @@ 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});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BadgesComponent::setValue(const std::string& value)
|
||||
{
|
||||
BadgesComponent::~BadgesComponent() {
|
||||
mBadgeIcons.clear();
|
||||
mImageComponents.clear();
|
||||
}
|
||||
|
||||
|
||||
void BadgesComponent::setValue(const std::string &value) {
|
||||
mChildren.clear();
|
||||
if (!value.empty()) {
|
||||
std::string temp;
|
||||
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);
|
||||
|
|
|
@ -20,13 +20,16 @@
|
|||
#define SLOT_COMPLETED "completed"
|
||||
#define SLOT_KIDS "kidgame"
|
||||
#define SLOT_BROKEN "broken"
|
||||
#define SLOT_ALTERNATIVE_EMULATOR "altemu"
|
||||
|
||||
class TextureResource;
|
||||
|
||||
class BadgesComponent : public FlexboxComponent
|
||||
{
|
||||
public:
|
||||
BadgesComponent(Window* window);
|
||||
BadgesComponent(Window *window);
|
||||
|
||||
~BadgesComponent() noexcept;
|
||||
|
||||
std::string getValue() const override;
|
||||
// Should be a list of strings.
|
||||
|
|
|
@ -14,21 +14,23 @@
|
|||
|
||||
class TextureResource;
|
||||
|
||||
class ImageComponent : public GuiComponent
|
||||
{
|
||||
class ImageComponent : public GuiComponent {
|
||||
public:
|
||||
ImageComponent(Window* window, bool forceLoad = false, bool dynamic = true);
|
||||
virtual ~ImageComponent() {}
|
||||
ImageComponent(Window *window, bool forceLoad = false, bool dynamic = true);
|
||||
|
||||
virtual ~ImageComponent() noexcept {};
|
||||
|
||||
void setDefaultImage(std::string path) { mDefaultPath = path; }
|
||||
|
||||
// Loads the image at the given filepath. Will tile if tile is true (retrieves texture
|
||||
// as tiling, creates vertices accordingly).
|
||||
void setImage(std::string path, bool tile = false, bool linearMagnify = false);
|
||||
|
||||
// Loads an image from memory.
|
||||
void setImage(const char* data, size_t length, bool tile = false);
|
||||
void setImage(const char *data, size_t length, bool tile = false);
|
||||
|
||||
// Use an already existing texture.
|
||||
void setImage(const std::shared_ptr<TextureResource>& texture);
|
||||
void setImage(const std::shared_ptr<TextureResource> &texture);
|
||||
|
||||
void onSizeChanged() override { updateVertices(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue