mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-30 03:55:40 +00:00
Added theme support for controlling the TextListComponent collection indicators.
This commit is contained in:
parent
03e457516a
commit
7daf69092f
|
@ -572,29 +572,30 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
|
|||
if (mTextList != nullptr) {
|
||||
TextListComponent<FileData*>::Entry textListEntry;
|
||||
std::string indicators {mTextList->getIndicators()};
|
||||
std::string collectionIndicators {mTextList->getCollectionIndicators()};
|
||||
|
||||
if (!mFirstGameEntry && (*it)->getType() == GAME)
|
||||
mFirstGameEntry = (*it);
|
||||
|
||||
// Add a leading tick mark icon to the game name if it's part of the custom
|
||||
// collection currently being edited.
|
||||
if (isEditing && (*it)->getType() == GAME) {
|
||||
if (CollectionSystemsManager::getInstance()->inCustomCollection(
|
||||
editingCollection, (*it))) {
|
||||
if (collectionIndicators == "ascii")
|
||||
inCollectionPrefix = "! ";
|
||||
else
|
||||
inCollectionPrefix = ViewController::TICKMARK_CHAR + " ";
|
||||
}
|
||||
else {
|
||||
inCollectionPrefix = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (indicators == "none") {
|
||||
name = (*it)->getName();
|
||||
name = inCollectionPrefix + (*it)->getName();
|
||||
}
|
||||
else {
|
||||
// Add a leading tick mark icon to the game name if it's part of the custom
|
||||
// collection currently being edited.
|
||||
if (isEditing && (*it)->getType() == GAME) {
|
||||
if (CollectionSystemsManager::getInstance()->inCustomCollection(
|
||||
editingCollection, (*it))) {
|
||||
if (indicators == "ascii")
|
||||
inCollectionPrefix = "! ";
|
||||
else
|
||||
inCollectionPrefix = ViewController::TICKMARK_CHAR + " ";
|
||||
}
|
||||
else {
|
||||
inCollectionPrefix = "";
|
||||
}
|
||||
}
|
||||
|
||||
if ((*it)->getFavorite() && favoriteStar &&
|
||||
mRoot->getSystem()->getName() != "favorites") {
|
||||
if (indicators == "ascii")
|
||||
|
|
|
@ -290,6 +290,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
|||
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
||||
{"lineSpacing", FLOAT},
|
||||
{"indicators", STRING},
|
||||
{"collectionIndicators", STRING},
|
||||
{"zIndex", FLOAT}}},
|
||||
{"gameselector",
|
||||
{{"selection", STRING},
|
||||
|
|
|
@ -119,6 +119,7 @@ public:
|
|||
void setColor(unsigned int id, unsigned int color) { mColors[id] = color; }
|
||||
void setLineSpacing(float lineSpacing) { mLineSpacing = lineSpacing; }
|
||||
const std::string& getIndicators() const { return mIndicators; }
|
||||
const std::string& getCollectionIndicators() const { return mCollectionIndicators; }
|
||||
|
||||
protected:
|
||||
void onScroll() override
|
||||
|
@ -163,6 +164,7 @@ private:
|
|||
|
||||
std::shared_ptr<Font> mFont;
|
||||
std::string mIndicators;
|
||||
std::string mCollectionIndicators;
|
||||
bool mUppercase;
|
||||
bool mLowercase;
|
||||
bool mCapitalize;
|
||||
|
@ -193,6 +195,7 @@ TextListComponent<T>::TextListComponent()
|
|||
, mHorizontalMargin {0.0f}
|
||||
, mFont {Font::get(FONT_SIZE_MEDIUM)}
|
||||
, mIndicators {"symbols"}
|
||||
, mCollectionIndicators {"symbols"}
|
||||
, mUppercase {false}
|
||||
, mLowercase {false}
|
||||
, mCapitalize {false}
|
||||
|
@ -612,6 +615,19 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
}
|
||||
|
||||
if (elem->has("collectionIndicators")) {
|
||||
std::string collectionIndicators {elem->get<std::string>("collectionIndicators")};
|
||||
if (collectionIndicators == "symbols" || collectionIndicators == "ascii") {
|
||||
mCollectionIndicators = collectionIndicators;
|
||||
}
|
||||
else {
|
||||
mCollectionIndicators = "symbols";
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<collectionIndicators> defined as \""
|
||||
<< collectionIndicators << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("selectorImagePath")) {
|
||||
std::string path {elem->get<std::string>("selectorImagePath")};
|
||||
bool tile = elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile");
|
||||
|
|
Loading…
Reference in a new issue