mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +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) {
|
if (mTextList != nullptr) {
|
||||||
TextListComponent<FileData*>::Entry textListEntry;
|
TextListComponent<FileData*>::Entry textListEntry;
|
||||||
std::string indicators {mTextList->getIndicators()};
|
std::string indicators {mTextList->getIndicators()};
|
||||||
|
std::string collectionIndicators {mTextList->getCollectionIndicators()};
|
||||||
|
|
||||||
if (!mFirstGameEntry && (*it)->getType() == GAME)
|
if (!mFirstGameEntry && (*it)->getType() == GAME)
|
||||||
mFirstGameEntry = (*it);
|
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") {
|
if (indicators == "none") {
|
||||||
name = (*it)->getName();
|
name = inCollectionPrefix + (*it)->getName();
|
||||||
}
|
}
|
||||||
else {
|
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 &&
|
if ((*it)->getFavorite() && favoriteStar &&
|
||||||
mRoot->getSystem()->getName() != "favorites") {
|
mRoot->getSystem()->getName() != "favorites") {
|
||||||
if (indicators == "ascii")
|
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.
|
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
{"indicators", STRING},
|
{"indicators", STRING},
|
||||||
|
{"collectionIndicators", STRING},
|
||||||
{"zIndex", FLOAT}}},
|
{"zIndex", FLOAT}}},
|
||||||
{"gameselector",
|
{"gameselector",
|
||||||
{{"selection", STRING},
|
{{"selection", STRING},
|
||||||
|
|
|
@ -119,6 +119,7 @@ public:
|
||||||
void setColor(unsigned int id, unsigned int color) { mColors[id] = color; }
|
void setColor(unsigned int id, unsigned int color) { mColors[id] = color; }
|
||||||
void setLineSpacing(float lineSpacing) { mLineSpacing = lineSpacing; }
|
void setLineSpacing(float lineSpacing) { mLineSpacing = lineSpacing; }
|
||||||
const std::string& getIndicators() const { return mIndicators; }
|
const std::string& getIndicators() const { return mIndicators; }
|
||||||
|
const std::string& getCollectionIndicators() const { return mCollectionIndicators; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onScroll() override
|
void onScroll() override
|
||||||
|
@ -163,6 +164,7 @@ private:
|
||||||
|
|
||||||
std::shared_ptr<Font> mFont;
|
std::shared_ptr<Font> mFont;
|
||||||
std::string mIndicators;
|
std::string mIndicators;
|
||||||
|
std::string mCollectionIndicators;
|
||||||
bool mUppercase;
|
bool mUppercase;
|
||||||
bool mLowercase;
|
bool mLowercase;
|
||||||
bool mCapitalize;
|
bool mCapitalize;
|
||||||
|
@ -193,6 +195,7 @@ TextListComponent<T>::TextListComponent()
|
||||||
, mHorizontalMargin {0.0f}
|
, mHorizontalMargin {0.0f}
|
||||||
, mFont {Font::get(FONT_SIZE_MEDIUM)}
|
, mFont {Font::get(FONT_SIZE_MEDIUM)}
|
||||||
, mIndicators {"symbols"}
|
, mIndicators {"symbols"}
|
||||||
|
, mCollectionIndicators {"symbols"}
|
||||||
, mUppercase {false}
|
, mUppercase {false}
|
||||||
, mLowercase {false}
|
, mLowercase {false}
|
||||||
, mCapitalize {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")) {
|
if (elem->has("selectorImagePath")) {
|
||||||
std::string path {elem->get<std::string>("selectorImagePath")};
|
std::string path {elem->get<std::string>("selectorImagePath")};
|
||||||
bool tile = elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile");
|
bool tile = elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile");
|
||||||
|
|
Loading…
Reference in a new issue