mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Renamed 'controller types' to 'game controllers' (code) and simply 'controllers' (metadata editor).
This commit is contained in:
parent
9c8a5ca5d3
commit
b5a61a0617
|
@ -37,7 +37,7 @@ MetaDataDecl gameDecls[] = {
|
||||||
{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false},
|
{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false},
|
||||||
{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false},
|
{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false},
|
||||||
{"playcount", MD_INT, "0", false, "times played", "enter number of times played", false},
|
{"playcount", MD_INT, "0", false, "times played", "enter number of times played", false},
|
||||||
{"controller", MD_CONTROLLER, "", false, "controller type", "select controller type", false},
|
{"controller", MD_CONTROLLER, "", false, "controller", "select controller", false},
|
||||||
{"altemulator", MD_ALT_EMULATOR, "", false, "alternative emulator", "select alternative emulator", false},
|
{"altemulator", MD_ALT_EMULATOR, "", false, "alternative emulator", "select alternative emulator", false},
|
||||||
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
||||||
};
|
};
|
||||||
|
@ -58,7 +58,7 @@ MetaDataDecl folderDecls[] = {
|
||||||
{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false},
|
{"broken", MD_BOOL, "false", false, "broken/not working", "enter broken off/on", false},
|
||||||
{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false},
|
{"nomultiscrape", MD_BOOL, "false", false, "exclude from multi-scraper", "enter no multi-scrape off/on", false},
|
||||||
{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false},
|
{"hidemetadata", MD_BOOL, "false", false, "hide metadata fields", "enter hide metadata off/on", false},
|
||||||
{"controller", MD_CONTROLLER, "", false, "controller type", "select controller type", false},
|
{"controller", MD_CONTROLLER, "", false, "controller", "select controller", false},
|
||||||
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
|
@ -53,11 +53,11 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
||||||
, mMediaFilesUpdated{false}
|
, mMediaFilesUpdated{false}
|
||||||
, mInvalidEmulatorEntry{false}
|
, mInvalidEmulatorEntry{false}
|
||||||
{
|
{
|
||||||
mControllerTypes = BadgesComponent::getControllerTypes();
|
mGameControllers = BadgesComponent::getGameControllers();
|
||||||
|
|
||||||
// Remove the last "unknown" controller entry.
|
// Remove the last "unknown" controller entry.
|
||||||
if (mControllerTypes.size() > 1)
|
if (mGameControllers.size() > 1)
|
||||||
mControllerTypes.pop_back();
|
mGameControllers.pop_back();
|
||||||
|
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
@ -210,7 +210,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
||||||
originalValue] {
|
originalValue] {
|
||||||
GuiSettings* s = new GuiSettings(mWindow, title);
|
GuiSettings* s = new GuiSettings(mWindow, title);
|
||||||
|
|
||||||
for (auto controllerType : mControllerTypes) {
|
for (auto controller : mGameControllers) {
|
||||||
std::string selectedLabel = ed->getValue();
|
std::string selectedLabel = ed->getValue();
|
||||||
std::string label;
|
std::string label;
|
||||||
ComponentListRow row;
|
ComponentListRow row;
|
||||||
|
@ -218,14 +218,14 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
||||||
std::shared_ptr<TextComponent> labelText = std::make_shared<TextComponent>(
|
std::shared_ptr<TextComponent> labelText = std::make_shared<TextComponent>(
|
||||||
mWindow, label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
mWindow, label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||||
labelText->setSelectable(true);
|
labelText->setSelectable(true);
|
||||||
labelText->setValue(controllerType.displayName);
|
labelText->setValue(controller.displayName);
|
||||||
|
|
||||||
label = controllerType.displayName;
|
label = controller.displayName;
|
||||||
|
|
||||||
row.addElement(labelText, true);
|
row.addElement(labelText, true);
|
||||||
|
|
||||||
row.makeAcceptInputHandler([s, updateVal, controllerType] {
|
row.makeAcceptInputHandler([s, updateVal, controller] {
|
||||||
updateVal(controllerType.displayName);
|
updateVal(controller.displayName);
|
||||||
delete s;
|
delete s;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ private:
|
||||||
|
|
||||||
ScraperSearchParams mScraperParams;
|
ScraperSearchParams mScraperParams;
|
||||||
|
|
||||||
std::vector<ControllerTypes> mControllerTypes;
|
std::vector<GameControllers> mGameControllers;
|
||||||
std::vector<std::shared_ptr<GuiComponent>> mEditors;
|
std::vector<std::shared_ptr<GuiComponent>> mEditors;
|
||||||
|
|
||||||
std::vector<MetaDataDecl> mMetaDataDecl;
|
std::vector<MetaDataDecl> mMetaDataDecl;
|
||||||
|
|
|
@ -416,7 +416,7 @@ void DetailedGameListView::updateInfoPanel()
|
||||||
badgeInfo.badgeType = badge;
|
badgeInfo.badgeType = badge;
|
||||||
if (badge == "controller") {
|
if (badge == "controller") {
|
||||||
if (file->metadata.get("controller").compare("") != 0) {
|
if (file->metadata.get("controller").compare("") != 0) {
|
||||||
badgeInfo.controllerType = file->metadata.get("controller");
|
badgeInfo.gameController = file->metadata.get("controller");
|
||||||
badgeSlots.push_back(badgeInfo);
|
badgeSlots.push_back(badgeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ void VideoGameListView::updateInfoPanel()
|
||||||
badgeInfo.badgeType = badge;
|
badgeInfo.badgeType = badge;
|
||||||
if (badge == "controller") {
|
if (badge == "controller") {
|
||||||
if (file->metadata.get("controller").compare("") != 0) {
|
if (file->metadata.get("controller").compare("") != 0) {
|
||||||
badgeInfo.controllerType = file->metadata.get("controller");
|
badgeInfo.gameController = file->metadata.get("controller");
|
||||||
badgeSlots.push_back(badgeInfo);
|
badgeSlots.push_back(badgeInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
#include "ThemeData.h"
|
#include "ThemeData.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
std::vector<ControllerTypes> BadgesComponent::sControllerTypes;
|
std::vector<GameControllers> BadgesComponent::sGameControllers;
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
|
||||||
// The "unknown" controller entry has to be placed last.
|
// The "unknown" controller entry has to be placed last.
|
||||||
ControllerTypes sControllerDefinitions [] = {
|
GameControllers sControllerDefinitions [] = {
|
||||||
// shortName displayName fileName
|
// shortName displayName fileName
|
||||||
{"gamepad_generic", "Gamepad (Generic)", ":/graphics/controllers/gamepad_generic.svg"},
|
{"gamepad_generic", "Gamepad (Generic)", ":/graphics/controllers/gamepad_generic.svg"},
|
||||||
{"gamepad_xbox", "Gamepad (Xbox)", ":/graphics/controllers/gamepad_xbox.svg"},
|
{"gamepad_xbox", "Gamepad (Xbox)", ":/graphics/controllers/gamepad_xbox.svg"},
|
||||||
|
@ -70,11 +70,11 @@ BadgesComponent::BadgesComponent(Window* window)
|
||||||
mBadgeIcons[SLOT_ALTEMULATOR] = ":/graphics/badge_altemulator.svg";
|
mBadgeIcons[SLOT_ALTEMULATOR] = ":/graphics/badge_altemulator.svg";
|
||||||
}
|
}
|
||||||
|
|
||||||
void BadgesComponent::populateControllerTypes()
|
void BadgesComponent::populateGameControllers()
|
||||||
{
|
{
|
||||||
sControllerTypes.clear();
|
sGameControllers.clear();
|
||||||
for (auto type : sControllerDefinitions)
|
for (auto controller : sControllerDefinitions)
|
||||||
sControllerTypes.push_back(type);
|
sGameControllers.push_back(controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||||
|
@ -97,19 +97,19 @@ void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||||
|
|
||||||
if (it != mFlexboxItems.end()) {
|
if (it != mFlexboxItems.end()) {
|
||||||
it->visible = true;
|
it->visible = true;
|
||||||
if (badge.controllerType != "" &&
|
if (badge.gameController != "" &&
|
||||||
badge.controllerType != it->overlayImage.getTexture()->getTextureFilePath()) {
|
badge.gameController != it->overlayImage.getTexture()->getTextureFilePath()) {
|
||||||
|
|
||||||
auto it2 = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
auto it2 = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||||
[badge](ControllerTypes controllerType) {
|
[badge](GameControllers gameController) {
|
||||||
return controllerType.shortName == badge.controllerType;
|
return gameController.shortName == badge.gameController;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it2 != sControllerTypes.cend()) {
|
if (it2 != sGameControllers.cend()) {
|
||||||
it->overlayImage.setImage((*it2).fileName);
|
it->overlayImage.setImage((*it2).fileName);
|
||||||
}
|
}
|
||||||
else if (badge.controllerType != "")
|
else if (badge.gameController != "")
|
||||||
it->overlayImage.setImage(sControllerTypes.back().fileName);
|
it->overlayImage.setImage(sGameControllers.back().fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -126,11 +126,11 @@ void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||||
|
|
||||||
const std::string BadgesComponent::getShortName(const std::string& displayName)
|
const std::string BadgesComponent::getShortName(const std::string& displayName)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||||
[displayName](ControllerTypes controllerType) {
|
[displayName](GameControllers gameController) {
|
||||||
return controllerType.displayName == displayName;
|
return gameController.displayName == displayName;
|
||||||
});
|
});
|
||||||
if (it != sControllerTypes.end())
|
if (it != sGameControllers.end())
|
||||||
return (*it).shortName;
|
return (*it).shortName;
|
||||||
else
|
else
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
@ -138,11 +138,11 @@ const std::string BadgesComponent::getShortName(const std::string& displayName)
|
||||||
|
|
||||||
const std::string BadgesComponent::getDisplayName(const std::string& shortName)
|
const std::string BadgesComponent::getDisplayName(const std::string& shortName)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||||
[shortName](ControllerTypes controllerType) {
|
[shortName](GameControllers gameController) {
|
||||||
return controllerType.shortName == shortName;
|
return gameController.shortName == shortName;
|
||||||
});
|
});
|
||||||
if (it != sControllerTypes.end())
|
if (it != sGameControllers.end())
|
||||||
return (*it).displayName;
|
return (*it).displayName;
|
||||||
else
|
else
|
||||||
return "unknown";
|
return "unknown";
|
||||||
|
@ -168,7 +168,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
const std::string& element,
|
const std::string& element,
|
||||||
unsigned int properties)
|
unsigned int properties)
|
||||||
{
|
{
|
||||||
populateControllerTypes();
|
populateGameControllers();
|
||||||
|
|
||||||
using namespace ThemeFlags;
|
using namespace ThemeFlags;
|
||||||
|
|
||||||
|
@ -280,9 +280,9 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& controllerType : sControllerTypes) {
|
for (auto& gameController : sGameControllers) {
|
||||||
if (properties & PATH && elem->has(controllerType.shortName))
|
if (properties & PATH && elem->has(gameController.shortName))
|
||||||
controllerType.fileName = elem->get<std::string>(controllerType.shortName);
|
gameController.fileName = elem->get<std::string>(gameController.shortName);
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiComponent::applyTheme(theme, view, element, properties);
|
GuiComponent::applyTheme(theme, view, element, properties);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "FlexboxComponent.h"
|
#include "FlexboxComponent.h"
|
||||||
#include "GuiComponent.h"
|
#include "GuiComponent.h"
|
||||||
|
|
||||||
struct ControllerTypes {
|
struct GameControllers {
|
||||||
std::string shortName;
|
std::string shortName;
|
||||||
std::string displayName;
|
std::string displayName;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
|
@ -26,17 +26,17 @@ public:
|
||||||
|
|
||||||
struct BadgeInfo {
|
struct BadgeInfo {
|
||||||
std::string badgeType;
|
std::string badgeType;
|
||||||
std::string controllerType;
|
std::string gameController;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void populateControllerTypes();
|
static void populateGameControllers();
|
||||||
std::vector<std::string> getBadgeTypes() { return mBadgeTypes; }
|
std::vector<std::string> getBadgeTypes() { return mBadgeTypes; }
|
||||||
void setBadges(const std::vector<BadgeInfo>& badges);
|
void setBadges(const std::vector<BadgeInfo>& badges);
|
||||||
static const std::vector<ControllerTypes>& getControllerTypes()
|
static const std::vector<GameControllers>& getGameControllers()
|
||||||
{
|
{
|
||||||
if (sControllerTypes.empty())
|
if (sGameControllers.empty())
|
||||||
populateControllerTypes();
|
populateGameControllers();
|
||||||
return sControllerTypes;
|
return sGameControllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const std::string getShortName(const std::string& displayName);
|
static const std::string getShortName(const std::string& displayName);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
||||||
unsigned int properties) override;
|
unsigned int properties) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<ControllerTypes> sControllerTypes;
|
static std::vector<GameControllers> sGameControllers;
|
||||||
|
|
||||||
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
|
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
|
||||||
FlexboxComponent mFlexboxComponent;
|
FlexboxComponent mFlexboxComponent;
|
||||||
|
|
Loading…
Reference in a new issue