mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Renamed BadgesComponent to BadgeComponent.
This commit is contained in:
parent
0351a2ccdb
commit
1aa360598d
|
@ -53,7 +53,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
, mMediaFilesUpdated{false}
|
||||
, mInvalidEmulatorEntry{false}
|
||||
{
|
||||
mGameControllers = BadgesComponent::getGameControllers();
|
||||
mGameControllers = BadgeComponent::getGameControllers();
|
||||
|
||||
// Remove the last "unknown" controller entry.
|
||||
if (mGameControllers.size() > 1)
|
||||
|
@ -200,7 +200,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
// OK callback (apply new value to ed).
|
||||
auto updateVal = [ed, originalValue](const std::string& newVal) {
|
||||
ed->setValue(newVal);
|
||||
if (newVal == BadgesComponent::getDisplayName(originalValue))
|
||||
if (newVal == BadgeComponent::getDisplayName(originalValue))
|
||||
ed->setColor(DEFAULT_TEXTCOLOR);
|
||||
else
|
||||
ed->setColor(TEXTCOLOR_USERMARKED);
|
||||
|
@ -478,7 +478,7 @@ GuiMetaDataEd::GuiMetaDataEd(Window* window,
|
|||
ed->setValue(ViewController::EXCLAMATION_CHAR + " " + originalValue);
|
||||
}
|
||||
else if (iter->type == MD_CONTROLLER && mMetaData->get(iter->key) != "") {
|
||||
std::string displayName = BadgesComponent::getDisplayName(mMetaData->get(iter->key));
|
||||
std::string displayName = BadgeComponent::getDisplayName(mMetaData->get(iter->key));
|
||||
if (displayName != "unknown")
|
||||
ed->setValue(displayName);
|
||||
else
|
||||
|
@ -618,7 +618,7 @@ void GuiMetaDataEd::save()
|
|||
continue;
|
||||
|
||||
if (mMetaDataDecl.at(i).key == "controller" && mEditors.at(i)->getValue() != "") {
|
||||
std::string shortName = BadgesComponent::getShortName(mEditors.at(i)->getValue());
|
||||
std::string shortName = BadgeComponent::getShortName(mEditors.at(i)->getValue());
|
||||
if (shortName != "unknown")
|
||||
mMetaData->set(mMetaDataDecl.at(i).key, shortName);
|
||||
continue;
|
||||
|
@ -769,7 +769,7 @@ void GuiMetaDataEd::close()
|
|||
continue;
|
||||
|
||||
if (mMetaDataDecl.at(i).key == "controller" && mEditors.at(i)->getValue() != "") {
|
||||
std::string shortName = BadgesComponent::getShortName(mEditors.at(i)->getValue());
|
||||
std::string shortName = BadgeComponent::getShortName(mEditors.at(i)->getValue());
|
||||
if (shortName == "unknown" || mMetaDataValue == shortName)
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "GuiComponent.h"
|
||||
#include "MetaData.h"
|
||||
#include "components/BadgesComponent.h"
|
||||
#include "components/BadgeComponent.h"
|
||||
#include "components/ComponentGrid.h"
|
||||
#include "components/NinePatchComponent.h"
|
||||
#include "components/ScrollIndicatorComponent.h"
|
||||
|
|
|
@ -410,9 +410,9 @@ void DetailedGameListView::updateInfoPanel()
|
|||
mPlayers.setValue(file->metadata.get("players"));
|
||||
|
||||
// Populate the badge slots based on game metadata.
|
||||
std::vector<BadgesComponent::BadgeInfo> badgeSlots;
|
||||
std::vector<BadgeComponent::BadgeInfo> badgeSlots;
|
||||
for (auto badge : mBadges.getBadgeTypes()) {
|
||||
BadgesComponent::BadgeInfo badgeInfo;
|
||||
BadgeComponent::BadgeInfo badgeInfo;
|
||||
badgeInfo.badgeType = badge;
|
||||
if (badge == "controller") {
|
||||
if (file->metadata.get("controller").compare("") != 0) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H
|
||||
#define ES_APP_VIEWS_GAME_LIST_DETAILED_GAME_LIST_VIEW_H
|
||||
|
||||
#include "components/BadgesComponent.h"
|
||||
#include "components/BadgeComponent.h"
|
||||
#include "components/DateTimeComponent.h"
|
||||
#include "components/RatingComponent.h"
|
||||
#include "components/ScrollableContainer.h"
|
||||
|
@ -56,7 +56,7 @@ private:
|
|||
DateTimeComponent mLastPlayed;
|
||||
TextComponent mPlayCount;
|
||||
TextComponent mName;
|
||||
BadgesComponent mBadges;
|
||||
BadgeComponent mBadges;
|
||||
|
||||
std::vector<TextComponent*> getMDLabels();
|
||||
std::vector<GuiComponent*> getMDValues();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef ES_APP_VIEWS_GAME_LIST_GRID_GAME_LIST_VIEW_H
|
||||
#define ES_APP_VIEWS_GAME_LIST_GRID_GAME_LIST_VIEW_H
|
||||
|
||||
#include "components/BadgesComponent.h"
|
||||
#include "components/BadgeComponent.h"
|
||||
#include "components/DateTimeComponent.h"
|
||||
#include "components/ImageGridComponent.h"
|
||||
#include "components/RatingComponent.h"
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
TextComponent mLblLastPlayed;
|
||||
TextComponent mLblPlayCount;
|
||||
|
||||
BadgesComponent mBadges;
|
||||
BadgeComponent mBadges;
|
||||
RatingComponent mRating;
|
||||
DateTimeComponent mReleaseDate;
|
||||
TextComponent mDeveloper;
|
||||
|
|
|
@ -450,9 +450,9 @@ void VideoGameListView::updateInfoPanel()
|
|||
mPlayers.setValue(file->metadata.get("players"));
|
||||
|
||||
// Populate the badge slots based on game metadata.
|
||||
std::vector<BadgesComponent::BadgeInfo> badgeSlots;
|
||||
std::vector<BadgeComponent::BadgeInfo> badgeSlots;
|
||||
for (auto badge : mBadges.getBadgeTypes()) {
|
||||
BadgesComponent::BadgeInfo badgeInfo;
|
||||
BadgeComponent::BadgeInfo badgeInfo;
|
||||
badgeInfo.badgeType = badge;
|
||||
if (badge == "controller") {
|
||||
if (file->metadata.get("controller").compare("") != 0) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H
|
||||
#define ES_APP_VIEWS_GAME_LIST_VIDEO_GAME_LIST_VIEW_H
|
||||
|
||||
#include "components/BadgesComponent.h"
|
||||
#include "components/BadgeComponent.h"
|
||||
#include "components/DateTimeComponent.h"
|
||||
#include "components/RatingComponent.h"
|
||||
#include "components/ScrollableContainer.h"
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
DateTimeComponent mLastPlayed;
|
||||
TextComponent mPlayCount;
|
||||
TextComponent mName;
|
||||
BadgesComponent mBadges;
|
||||
BadgeComponent mBadges;
|
||||
|
||||
std::vector<TextComponent*> getMDLabels();
|
||||
std::vector<GuiComponent*> getMDValues();
|
||||
|
|
|
@ -34,7 +34,7 @@ set(CORE_HEADERS
|
|||
|
||||
# GUI components
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgesComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgeComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.h
|
||||
|
@ -112,7 +112,7 @@ set(CORE_SOURCES
|
|||
|
||||
# GUI components
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/AnimatedImageComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgesComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BadgeComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/BusyComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ButtonComponent.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/components/ComponentGrid.cpp
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// EmulationStation Desktop Edition
|
||||
// BadgesComponent.cpp
|
||||
// BadgeComponent.cpp
|
||||
//
|
||||
// Game badges icons.
|
||||
// Used by the gamelist views.
|
||||
|
@ -14,13 +14,13 @@
|
|||
#define SLOT_CONTROLLER "controller"
|
||||
#define SLOT_ALTEMULATOR "altemulator"
|
||||
|
||||
#include "components/BadgesComponent.h"
|
||||
#include "components/BadgeComponent.h"
|
||||
|
||||
#include "Log.h"
|
||||
#include "ThemeData.h"
|
||||
#include "utils/StringUtil.h"
|
||||
|
||||
std::vector<GameControllers> BadgesComponent::sGameControllers;
|
||||
std::vector<GameControllers> BadgeComponent::sGameControllers;
|
||||
|
||||
// clang-format off
|
||||
|
||||
|
@ -55,7 +55,7 @@ GameControllers sControllerDefinitions [] = {
|
|||
|
||||
// clang-format on
|
||||
|
||||
BadgesComponent::BadgesComponent(Window* window)
|
||||
BadgeComponent::BadgeComponent(Window* window)
|
||||
: GuiComponent{window}
|
||||
, mFlexboxItems{}
|
||||
, mFlexboxComponent{window, mFlexboxItems}
|
||||
|
@ -70,14 +70,14 @@ BadgesComponent::BadgesComponent(Window* window)
|
|||
mBadgeIcons[SLOT_ALTEMULATOR] = ":/graphics/badge_altemulator.svg";
|
||||
}
|
||||
|
||||
void BadgesComponent::populateGameControllers()
|
||||
void BadgeComponent::populateGameControllers()
|
||||
{
|
||||
sGameControllers.clear();
|
||||
for (auto controller : sControllerDefinitions)
|
||||
sGameControllers.push_back(controller);
|
||||
}
|
||||
|
||||
void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||
void BadgeComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
||||
{
|
||||
std::map<std::string, bool> prevVisibility;
|
||||
std::map<std::string, std::string> prevPlayers;
|
||||
|
@ -124,7 +124,7 @@ void BadgesComponent::setBadges(const std::vector<BadgeInfo>& badges)
|
|||
}
|
||||
}
|
||||
|
||||
const std::string BadgesComponent::getShortName(const std::string& displayName)
|
||||
const std::string BadgeComponent::getShortName(const std::string& displayName)
|
||||
{
|
||||
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||
[displayName](GameControllers gameController) {
|
||||
|
@ -136,7 +136,7 @@ const std::string BadgesComponent::getShortName(const std::string& displayName)
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
const std::string BadgesComponent::getDisplayName(const std::string& shortName)
|
||||
const std::string BadgeComponent::getDisplayName(const std::string& shortName)
|
||||
{
|
||||
auto it = std::find_if(sGameControllers.begin(), sGameControllers.end(),
|
||||
[shortName](GameControllers gameController) {
|
||||
|
@ -148,7 +148,7 @@ const std::string BadgesComponent::getDisplayName(const std::string& shortName)
|
|||
return "unknown";
|
||||
}
|
||||
|
||||
void BadgesComponent::render(const glm::mat4& parentTrans)
|
||||
void BadgeComponent::render(const glm::mat4& parentTrans)
|
||||
{
|
||||
if (!isVisible())
|
||||
return;
|
||||
|
@ -163,10 +163,10 @@ void BadgesComponent::render(const glm::mat4& parentTrans)
|
|||
}
|
||||
}
|
||||
|
||||
void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||
const std::string& view,
|
||||
const std::string& element,
|
||||
unsigned int properties)
|
||||
void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||
const std::string& view,
|
||||
const std::string& element,
|
||||
unsigned int properties)
|
||||
{
|
||||
populateGameControllers();
|
||||
|
||||
|
@ -179,7 +179,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if (elem->has("alignment")) {
|
||||
const std::string alignment{elem->get<std::string>("alignment")};
|
||||
if (alignment != "left" && alignment != "right") {
|
||||
LOG(LogWarning) << "BadgesComponent: Invalid theme configuration, <alignment> set to \""
|
||||
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <alignment> set to \""
|
||||
<< alignment << "\"";
|
||||
}
|
||||
else {
|
||||
|
@ -191,7 +191,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
const float itemsPerRow{elem->get<float>("itemsPerRow")};
|
||||
if (itemsPerRow < 1.0f || itemsPerRow > 10.0f) {
|
||||
LOG(LogWarning)
|
||||
<< "BadgesComponent: Invalid theme configuration, <itemsPerRow> set to \""
|
||||
<< "BadgeComponent: Invalid theme configuration, <itemsPerRow> set to \""
|
||||
<< itemsPerRow << "\"";
|
||||
}
|
||||
else {
|
||||
|
@ -202,7 +202,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if (elem->has("rows")) {
|
||||
const float rows{elem->get<float>("rows")};
|
||||
if (rows < 1.0f || rows > 10.0f) {
|
||||
LOG(LogWarning) << "BadgesComponent: Invalid theme configuration, <rows> set to \""
|
||||
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <rows> set to \""
|
||||
<< rows << "\"";
|
||||
}
|
||||
else {
|
||||
|
@ -215,9 +215,8 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if ((itemMargin.x != -1.0 && itemMargin.y != -1.0) &&
|
||||
(itemMargin.x < 0.0f || itemMargin.x > 0.2f || itemMargin.y < 0.0f ||
|
||||
itemMargin.y > 0.2f)) {
|
||||
LOG(LogWarning)
|
||||
<< "BadgesComponent: Invalid theme configuration, <itemMargin> set to \""
|
||||
<< itemMargin.x << " " << itemMargin.y << "\"";
|
||||
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <itemMargin> set to \""
|
||||
<< itemMargin.x << " " << itemMargin.y << "\"";
|
||||
}
|
||||
else {
|
||||
mFlexboxComponent.setItemMargin(itemMargin);
|
||||
|
@ -229,7 +228,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if (controllerPos.x < -1.0f || controllerPos.x > 2.0f || controllerPos.y < -1.0f ||
|
||||
controllerPos.y > 2.0f) {
|
||||
LOG(LogWarning)
|
||||
<< "BadgesComponent: Invalid theme configuration, <controllerPos> set to \""
|
||||
<< "BadgeComponent: Invalid theme configuration, <controllerPos> set to \""
|
||||
<< controllerPos.x << " " << controllerPos.y << "\"";
|
||||
}
|
||||
else {
|
||||
|
@ -241,7 +240,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
const float controllerSize = elem->get<float>("controllerSize");
|
||||
if (controllerSize < 0.1f || controllerSize > 2.0f) {
|
||||
LOG(LogWarning)
|
||||
<< "BadgesComponent: Invalid theme configuration, <controllerSize> set to \""
|
||||
<< "BadgeComponent: Invalid theme configuration, <controllerSize> set to \""
|
||||
<< controllerSize << "\"";
|
||||
}
|
||||
else {
|
|
@ -1,14 +1,14 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
// EmulationStation Desktop Edition
|
||||
// BadgesComponent.h
|
||||
// BadgeComponent.h
|
||||
//
|
||||
// Game badges icons.
|
||||
// Used by the gamelist views.
|
||||
//
|
||||
|
||||
#ifndef ES_CORE_COMPONENTS_BADGES_COMPONENT_H
|
||||
#define ES_CORE_COMPONENTS_BADGES_COMPONENT_H
|
||||
#ifndef ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|
||||
#define ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|
||||
|
||||
#include "FlexboxComponent.h"
|
||||
#include "GuiComponent.h"
|
||||
|
@ -19,10 +19,10 @@ struct GameControllers {
|
|||
std::string fileName;
|
||||
};
|
||||
|
||||
class BadgesComponent : public GuiComponent
|
||||
class BadgeComponent : public GuiComponent
|
||||
{
|
||||
public:
|
||||
BadgesComponent(Window* window);
|
||||
BadgeComponent(Window* window);
|
||||
|
||||
struct BadgeInfo {
|
||||
std::string badgeType;
|
||||
|
@ -60,4 +60,4 @@ private:
|
|||
std::map<std::string, std::string> mBadgeIcons;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_COMPONENTS_BADGES_COMPONENT_H
|
||||
#endif // ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|
Loading…
Reference in a new issue