mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45: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},
|
||||
{"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},
|
||||
{"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},
|
||||
{"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},
|
||||
{"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},
|
||||
{"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}
|
||||
};
|
||||
// clang-format on
|
||||
|
|
|
@ -53,11 +53,11 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
, mMediaFilesUpdated{false}
|
||||
, mInvalidEmulatorEntry{false}
|
||||
{
|
||||
mControllerTypes = BadgesComponent::getControllerTypes();
|
||||
mGameControllers = BadgesComponent::getGameControllers();
|
||||
|
||||
// Remove the last "unknown" controller entry.
|
||||
if (mControllerTypes.size() > 1)
|
||||
mControllerTypes.pop_back();
|
||||
if (mGameControllers.size() > 1)
|
||||
mGameControllers.pop_back();
|
||||
|
||||
addChild(&mBackground);
|
||||
addChild(&mGrid);
|
||||
|
@ -210,7 +210,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
originalValue] {
|
||||
GuiSettings* s = new GuiSettings(mWindow, title);
|
||||
|
||||
for (auto controllerType : mControllerTypes) {
|
||||
for (auto controller : mGameControllers) {
|
||||
std::string selectedLabel = ed->getValue();
|
||||
std::string label;
|
||||
ComponentListRow row;
|
||||
|
@ -218,14 +218,14 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
std::shared_ptr<TextComponent> labelText = std::make_shared<TextComponent>(
|
||||
mWindow, label, Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
||||
labelText->setSelectable(true);
|
||||
labelText->setValue(controllerType.displayName);
|
||||
labelText->setValue(controller.displayName);
|
||||
|
||||
label = controllerType.displayName;
|
||||
label = controller.displayName;
|
||||
|
||||
row.addElement(labelText, true);
|
||||
|
||||
row.makeAcceptInputHandler([s, updateVal, controllerType] {
|
||||
updateVal(controllerType.displayName);
|
||||
row.makeAcceptInputHandler([s, updateVal, controller] {
|
||||
updateVal(controller.displayName);
|
||||
delete s;
|
||||
});
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
ScraperSearchParams mScraperParams;
|
||||
|
||||
std::vector<ControllerTypes> mControllerTypes;
|
||||
std::vector<GameControllers> mGameControllers;
|
||||
std::vector<std::shared_ptr<GuiComponent>> mEditors;
|
||||
|
||||
std::vector<MetaDataDecl> mMetaDataDecl;
|
||||
|
|
|
@ -416,7 +416,7 @@ void DetailedGameListView::updateInfoPanel()
|
|||
badgeInfo.badgeType = badge;
|
||||
if (badge == "controller") {
|
||||
if (file->metadata.get("controller").compare("") != 0) {
|
||||
badgeInfo.controllerType = file->metadata.get("controller");
|
||||
badgeInfo.gameController = file->metadata.get("controller");
|
||||
badgeSlots.push_back(badgeInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -456,7 +456,7 @@ void VideoGameListView::updateInfoPanel()
|
|||
badgeInfo.badgeType = badge;
|
||||
if (badge == "controller") {
|
||||
if (file->metadata.get("controller").compare("") != 0) {
|
||||
badgeInfo.controllerType = file->metadata.get("controller");
|
||||
badgeInfo.gameController = file->metadata.get("controller");
|
||||
badgeSlots.push_back(badgeInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
#include "ThemeData.h"
|
||||
#include "utils/StringUtil.h"
|
||||
|
||||
std::vector<ControllerTypes> BadgesComponent::sControllerTypes;
|
||||
std::vector<GameControllers> BadgesComponent::sGameControllers;
|
||||
|
||||
// clang-format off
|
||||
|
||||
// The "unknown" controller entry has to be placed last.
|
||||
ControllerTypes sControllerDefinitions [] = {
|
||||
GameControllers sControllerDefinitions [] = {
|
||||
// shortName displayName fileName
|
||||
{"gamepad_generic", "Gamepad (Generic)", ":/graphics/controllers/gamepad_generic.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";
|
||||
}
|
||||
|
||||
void BadgesComponent::populateControllerTypes()
|
||||
void BadgesComponent::populateGameControllers()
|
||||
{
|
||||
sControllerTypes.clear();
|
||||
for (auto type : sControllerDefinitions)
|
||||
sControllerTypes.push_back(type);
|
||||
sGameControllers.clear();
|
||||
for (auto controller : sControllerDefinitions)
|
||||
sGameControllers.push_back(controller);
|
||||
}
|
||||
|
||||
void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||
|
@ -97,19 +97,19 @@ void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
|||
|
||||
if (it != mFlexboxItems.end()) {
|
||||
it->visible = true;
|
||||
if (badge.controllerType != "" &&
|
||||
badge.controllerType != it->overlayImage.getTexture()->getTextureFilePath()) {
|
||||
if (badge.gameController != "" &&
|
||||
badge.gameController != it->overlayImage.getTexture()->getTextureFilePath()) {
|
||||
|
||||
auto it2 = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
||||
[badge](ControllerTypes controllerType) {
|
||||
return controllerType.shortName == badge.controllerType;
|
||||
auto it2 = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||
[badge](GameControllers gameController) {
|
||||
return gameController.shortName == badge.gameController;
|
||||
});
|
||||
|
||||
if (it2 != sControllerTypes.cend()) {
|
||||
if (it2 != sGameControllers.cend()) {
|
||||
it->overlayImage.setImage((*it2).fileName);
|
||||
}
|
||||
else if (badge.controllerType != "")
|
||||
it->overlayImage.setImage(sControllerTypes.back().fileName);
|
||||
else if (badge.gameController != "")
|
||||
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)
|
||||
{
|
||||
auto it = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
||||
[displayName](ControllerTypes controllerType) {
|
||||
return controllerType.displayName == displayName;
|
||||
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||
[displayName](GameControllers gameController) {
|
||||
return gameController.displayName == displayName;
|
||||
});
|
||||
if (it != sControllerTypes.end())
|
||||
if (it != sGameControllers.end())
|
||||
return (*it).shortName;
|
||||
else
|
||||
return "unknown";
|
||||
|
@ -138,11 +138,11 @@ const std::string BadgesComponent::getShortName(const std::string& displayName)
|
|||
|
||||
const std::string BadgesComponent::getDisplayName(const std::string& shortName)
|
||||
{
|
||||
auto it = std::find_if(sControllerTypes.begin(), sControllerTypes.end(),
|
||||
[shortName](ControllerTypes controllerType) {
|
||||
return controllerType.shortName == shortName;
|
||||
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||
[shortName](GameControllers gameController) {
|
||||
return gameController.shortName == shortName;
|
||||
});
|
||||
if (it != sControllerTypes.end())
|
||||
if (it != sGameControllers.end())
|
||||
return (*it).displayName;
|
||||
else
|
||||
return "unknown";
|
||||
|
@ -168,7 +168,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
const std::string& element,
|
||||
unsigned int properties)
|
||||
{
|
||||
populateControllerTypes();
|
||||
populateGameControllers();
|
||||
|
||||
using namespace ThemeFlags;
|
||||
|
||||
|
@ -280,9 +280,9 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
}
|
||||
|
||||
for (auto& controllerType : sControllerTypes) {
|
||||
if (properties & PATH && elem->has(controllerType.shortName))
|
||||
controllerType.fileName = elem->get<std::string>(controllerType.shortName);
|
||||
for (auto& gameController : sGameControllers) {
|
||||
if (properties & PATH && elem->has(gameController.shortName))
|
||||
gameController.fileName = elem->get<std::string>(gameController.shortName);
|
||||
}
|
||||
|
||||
GuiComponent::applyTheme(theme, view, element, properties);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "FlexboxComponent.h"
|
||||
#include "GuiComponent.h"
|
||||
|
||||
struct ControllerTypes {
|
||||
struct GameControllers {
|
||||
std::string shortName;
|
||||
std::string displayName;
|
||||
std::string fileName;
|
||||
|
@ -26,17 +26,17 @@ public:
|
|||
|
||||
struct BadgeInfo {
|
||||
std::string badgeType;
|
||||
std::string controllerType;
|
||||
std::string gameController;
|
||||
};
|
||||
|
||||
static void populateControllerTypes();
|
||||
static void populateGameControllers();
|
||||
std::vector<std::string> getBadgeTypes() { return mBadgeTypes; }
|
||||
void setBadges(const std::vector<BadgeInfo>& badges);
|
||||
static const std::vector<ControllerTypes>& getControllerTypes()
|
||||
static const std::vector<GameControllers>& getGameControllers()
|
||||
{
|
||||
if (sControllerTypes.empty())
|
||||
populateControllerTypes();
|
||||
return sControllerTypes;
|
||||
if (sGameControllers.empty())
|
||||
populateGameControllers();
|
||||
return sGameControllers;
|
||||
}
|
||||
|
||||
static const std::string getShortName(const std::string& displayName);
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
unsigned int properties) override;
|
||||
|
||||
private:
|
||||
static std::vector<ControllerTypes> sControllerTypes;
|
||||
static std::vector<GameControllers> sGameControllers;
|
||||
|
||||
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
|
||||
FlexboxComponent mFlexboxComponent;
|
||||
|
|
Loading…
Reference in a new issue