Added two letterCaseCollections and letterCaseGroupedCollections properties to TextListComponent and CarouselComponent.

Also refactored the letterCase logic overall in these two components.
This commit is contained in:
Leon Styhre 2022-11-03 12:31:42 +01:00
parent b426473ec0
commit 412a19275d
7 changed files with 190 additions and 119 deletions

View file

@ -543,18 +543,21 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
mFirstGameEntry = nullptr; mFirstGameEntry = nullptr;
bool favoriteStar {true}; bool favoriteStar {true};
bool isEditing {false}; bool isEditing {false};
bool customCollection {false};
std::string editingCollection; std::string editingCollection;
std::string inCollectionPrefix; std::string inCollectionPrefix;
LetterCase letterCase {LetterCase::NONE};
if (CollectionSystemsManager::getInstance()->isEditing()) { if (CollectionSystemsManager::getInstance()->isEditing()) {
editingCollection = CollectionSystemsManager::getInstance()->getEditingCollection(); editingCollection = CollectionSystemsManager::getInstance()->getEditingCollection();
isEditing = true; isEditing = true;
} }
if (files.size() > 0) {
customCollection = files.front()->getSystem()->isCustomCollection();
// Read the settings that control whether a unicode star character should be added // Read the settings that control whether a unicode star character should be added
// as a prefix to the game name. // as a prefix to the game name.
if (files.size() > 0) { if (customCollection)
if (files.front()->getSystem()->isCustomCollection())
favoriteStar = Settings::getInstance()->getBool("FavStarCustom"); favoriteStar = Settings::getInstance()->getBool("FavStarCustom");
else else
favoriteStar = Settings::getInstance()->getBool("FavoritesStar"); favoriteStar = Settings::getInstance()->getBool("FavoritesStar");
@ -575,13 +578,21 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
if (!ResourceManager::getInstance().fileExists(carouselDefaultItem)) if (!ResourceManager::getInstance().fileExists(carouselDefaultItem))
carouselDefaultItem = ""; carouselDefaultItem = "";
} }
if (files.size() > 0) { if (files.size() > 0) {
for (auto it = files.cbegin(); it != files.cend(); ++it) { for (auto it = files.cbegin(); it != files.cend(); ++it) {
if (!mFirstGameEntry && (*it)->getType() == GAME) if (!mFirstGameEntry && (*it)->getType() == GAME)
mFirstGameEntry = (*it); mFirstGameEntry = (*it);
if (customCollection && (*it)->getType() == FOLDER) {
letterCase = mPrimary->getLetterCaseGroupedCollections();
if (letterCase == LetterCase::NONE)
letterCase = mPrimary->getLetterCase();
}
else {
letterCase = mPrimary->getLetterCase();
}
if (mCarousel != nullptr) { if (mCarousel != nullptr) {
assert(carouselItemType != ""); assert(carouselItemType != "");
@ -589,6 +600,13 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
carouselEntry.name = (*it)->getName(); carouselEntry.name = (*it)->getName();
carouselEntry.object = *it; carouselEntry.object = *it;
if (letterCase == LetterCase::UPPERCASE)
carouselEntry.name = Utils::String::toUpper(carouselEntry.name);
else if (letterCase == LetterCase::LOWERCASE)
carouselEntry.name = Utils::String::toLower(carouselEntry.name);
else if (letterCase == LetterCase::CAPITALIZED)
carouselEntry.name = Utils::String::toCapitalized(carouselEntry.name);
if (carouselDefaultItem != "") if (carouselDefaultItem != "")
carouselEntry.data.defaultItemPath = carouselDefaultItem; carouselEntry.data.defaultItemPath = carouselDefaultItem;
@ -646,6 +664,14 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
name = inCollectionPrefix + (*it)->getName(); name = inCollectionPrefix + (*it)->getName();
} }
} }
if (letterCase == LetterCase::UPPERCASE)
name = Utils::String::toUpper(name);
else if (letterCase == LetterCase::LOWERCASE)
name = Utils::String::toLower(name);
else if (letterCase == LetterCase::CAPITALIZED)
name = Utils::String::toCapitalized(name);
color = (*it)->getType() == FOLDER; color = (*it)->getType() == FOLDER;
textListEntry.name = name; textListEntry.name = name;
textListEntry.object = *it; textListEntry.object = *it;

View file

@ -637,17 +637,43 @@ void SystemView::populate()
}); });
} }
auto letterCaseFunc = [&it, this](std::string& name) {
LetterCase letterCase {LetterCase::NONE};
if (it->isCollection()) {
letterCase = mPrimary->getLetterCaseCollections();
if (letterCase == LetterCase::NONE)
letterCase = mPrimary->getLetterCase();
}
else {
letterCase = mPrimary->getLetterCase();
}
if (letterCase == LetterCase::UPPERCASE)
name = Utils::String::toUpper(name);
else if (letterCase == LetterCase::LOWERCASE)
name = Utils::String::toLower(name);
else if (letterCase == LetterCase::CAPITALIZED)
name = Utils::String::toCapitalized(name);
};
if (mCarousel != nullptr) { if (mCarousel != nullptr) {
CarouselComponent<SystemData*>::Entry entry; CarouselComponent<SystemData*>::Entry entry;
// Keep showing only the short name for legacy themes to maintain maximum
// backward compatibility. This also applies to unreadable theme sets.
if (mLegacyMode)
entry.name = it->getName(); entry.name = it->getName();
else
entry.name = it->getFullName();
letterCaseFunc(entry.name);
entry.object = it; entry.object = it;
entry.data.itemPath = itemPath; entry.data.itemPath = itemPath;
entry.data.defaultItemPath = defaultItemPath; entry.data.defaultItemPath = defaultItemPath;
mCarousel->addEntry(entry, theme); mCarousel->addEntry(entry, theme);
} }
if (mTextList != nullptr) { else if (mTextList != nullptr) {
TextListComponent<SystemData*>::Entry entry; TextListComponent<SystemData*>::Entry entry;
entry.name = it->getFullName(); entry.name = it->getFullName();
letterCaseFunc(entry.name);
entry.object = it; entry.object = it;
entry.data.colorId = 0; entry.data.colorId = 0;
mTextList->addEntry(entry); mTextList->addEntry(entry);

View file

@ -42,6 +42,13 @@ enum Alignment {
ALIGN_BOTTOM ALIGN_BOTTOM
}; };
enum class LetterCase {
UPPERCASE,
LOWERCASE,
CAPITALIZED,
NONE
};
class GuiComponent class GuiComponent
{ {
public: public:

View file

@ -316,6 +316,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"fontPath", PATH}, {"fontPath", PATH},
{"fontSize", FLOAT}, {"fontSize", FLOAT},
{"letterCase", STRING}, {"letterCase", STRING},
{"letterCaseCollections", STRING},
{"letterCaseGroupedCollections", STRING},
{"lineSpacing", FLOAT}, {"lineSpacing", FLOAT},
{"fadeAbovePrimary", BOOLEAN}, {"fadeAbovePrimary", BOOLEAN},
{"zIndex", FLOAT}, {"zIndex", FLOAT},
@ -341,6 +343,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
{"alignment", STRING}, // For backward compatibility with legacy themes. {"alignment", STRING}, // For backward compatibility with legacy themes.
{"horizontalMargin", FLOAT}, {"horizontalMargin", FLOAT},
{"letterCase", STRING}, {"letterCase", STRING},
{"letterCaseCollections", STRING},
{"letterCaseGroupedCollections", STRING},
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes. {"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
{"lineSpacing", FLOAT}, {"lineSpacing", FLOAT},
{"indicators", STRING}, {"indicators", STRING},

View file

@ -59,6 +59,12 @@ public:
const std::string& getDefaultItem() { return mDefaultItem; } const std::string& getDefaultItem() { return mDefaultItem; }
void setDefaultItem(std::string defaultItem) { mDefaultItem = defaultItem; } void setDefaultItem(std::string defaultItem) { mDefaultItem = defaultItem; }
bool isScrolling() const override { return List::isScrolling(); } bool isScrolling() const override { return List::isScrolling(); }
const LetterCase getLetterCase() const override { return mLetterCase; }
const LetterCase getLetterCaseCollections() const override { return mLetterCaseCollections; }
const LetterCase getLetterCaseGroupedCollections() const override
{
return mLetterCaseGroupedCollections;
}
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
{ {
@ -116,9 +122,6 @@ private:
bool mPositiveDirection; bool mPositiveDirection;
bool mTriggerJump; bool mTriggerJump;
bool mGamelistView; bool mGamelistView;
bool mUppercase;
bool mLowercase;
bool mCapitalize;
CarouselType mType; CarouselType mType;
std::string mItemType; std::string mItemType;
@ -127,7 +130,6 @@ private:
std::shared_ptr<Font> mFont; std::shared_ptr<Font> mFont;
unsigned int mTextColor; unsigned int mTextColor;
unsigned int mTextBackgroundColor; unsigned int mTextBackgroundColor;
std::string mText;
float mLineSpacing; float mLineSpacing;
Alignment mItemHorizontalAlignment; Alignment mItemHorizontalAlignment;
Alignment mItemVerticalAlignment; Alignment mItemVerticalAlignment;
@ -141,6 +143,9 @@ private:
bool mInstantItemTransitions; bool mInstantItemTransitions;
bool mItemAxisHorizontal; bool mItemAxisHorizontal;
bool mFadeAbovePrimary; bool mFadeAbovePrimary;
LetterCase mLetterCase;
LetterCase mLetterCaseCollections;
LetterCase mLetterCaseGroupedCollections;
float mItemScale; float mItemScale;
float mItemRotation; float mItemRotation;
glm::vec2 mItemRotationOrigin; glm::vec2 mItemRotationOrigin;
@ -167,9 +172,6 @@ CarouselComponent<T>::CarouselComponent()
, mPositiveDirection {false} , mPositiveDirection {false}
, mTriggerJump {false} , mTriggerJump {false}
, mGamelistView {std::is_same_v<T, FileData*> ? true : false} , mGamelistView {std::is_same_v<T, FileData*> ? true : false}
, mUppercase {false}
, mLowercase {false}
, mCapitalize {false}
, mType {CarouselType::HORIZONTAL} , mType {CarouselType::HORIZONTAL}
, mLegacyMode {false} , mLegacyMode {false}
, mFont {Font::get(FONT_SIZE_LARGE)} , mFont {Font::get(FONT_SIZE_LARGE)}
@ -189,6 +191,9 @@ CarouselComponent<T>::CarouselComponent()
, mInstantItemTransitions {false} , mInstantItemTransitions {false}
, mItemAxisHorizontal {false} , mItemAxisHorizontal {false}
, mFadeAbovePrimary {false} , mFadeAbovePrimary {false}
, mLetterCase {LetterCase::NONE}
, mLetterCaseCollections {LetterCase::NONE}
, mLetterCaseGroupedCollections {LetterCase::NONE}
, mItemScale {1.2f} , mItemScale {1.2f}
, mItemRotation {7.5f} , mItemRotation {7.5f}
, mItemRotationOrigin {-3.0f, 0.5f} , mItemRotationOrigin {-3.0f, 0.5f}
@ -263,20 +268,9 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
if (!entry.data.item) { if (!entry.data.item) {
// If no item image is present, add item text as fallback. // If no item image is present, add item text as fallback.
std::string nameEntry;
if (!mGamelistView)
nameEntry = entry.name;
else if (mUppercase)
nameEntry = Utils::String::toUpper(entry.name);
else if (mLowercase)
nameEntry = Utils::String::toLower(entry.name);
else if (mCapitalize)
nameEntry = Utils::String::toCapitalized(entry.name);
else
nameEntry = entry.name;
auto text = std::make_shared<TextComponent>( auto text = std::make_shared<TextComponent>(
nameEntry, mFont, 0x000000FF, mItemHorizontalAlignment, mItemVerticalAlignment, entry.name, mFont, 0x000000FF, mItemHorizontalAlignment, mItemVerticalAlignment,
glm::vec3 {0.0f, 0.0f, 0.0f}, glm::vec3 {0.0f, 0.0f, 0.0f},
glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)), 0x00000000); glm::round(mItemSize * (mItemScale >= 1.0f ? mItemScale : 1.0f)), 0x00000000);
if (legacyMode) { if (legacyMode) {
@ -287,10 +281,8 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
} }
if (!legacyMode) { if (!legacyMode) {
text->setLineSpacing(mLineSpacing); text->setLineSpacing(mLineSpacing);
if (!mGamelistView) { if (!mGamelistView)
if (mText != "") text->setValue(entry.name);
text->setValue(mText);
}
text->setColor(mTextColor); text->setColor(mTextColor);
text->setBackgroundColor(mTextBackgroundColor); text->setBackgroundColor(mTextBackgroundColor);
text->setRenderBackground(true); text->setRenderBackground(true);
@ -317,8 +309,6 @@ void CarouselComponent<T>::addEntry(Entry& entry, const std::shared_ptr<ThemeDat
entry.data.item->setPosition(glm::vec3 {denormalized.x, denormalized.y, 0.0f}); entry.data.item->setPosition(glm::vec3 {denormalized.x, denormalized.y, 0.0f});
List::add(entry); List::add(entry);
mText = "";
} }
template <typename T> template <typename T>
@ -934,10 +924,6 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
mCarouselColor = 0xFFFFFFD8; mCarouselColor = 0xFFFFFFD8;
mCarouselColorEnd = 0xFFFFFFD8; mCarouselColorEnd = 0xFFFFFFD8;
mZIndex = mDefaultZIndex; mZIndex = mDefaultZIndex;
mText = "";
mUppercase = false;
mLowercase = false;
mCapitalize = false;
if (!elem) if (!elem)
return; return;
@ -1229,36 +1215,60 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("lineSpacing")) if (elem->has("lineSpacing"))
mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f); mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f);
std::string letterCase;
bool hasText {!mGamelistView && elem->has("text")};
if (elem->has("letterCase")) { if (elem->has("letterCase")) {
letterCase = elem->get<std::string>("letterCase"); const std::string letterCase {elem->get<std::string>("letterCase")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mUppercase = true; mLetterCase = LetterCase::UPPERCASE;
if (hasText)
mText = Utils::String::toUpper(elem->get<std::string>("text"));
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLowercase = true; mLetterCase = LetterCase::LOWERCASE;
if (hasText)
mText = Utils::String::toLower(elem->get<std::string>("text"));
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mCapitalize = true; mLetterCase = LetterCase::CAPITALIZED;
if (hasText)
mText = Utils::String::toCapitalized(elem->get<std::string>("text"));
} }
else if (hasText && letterCase == "none") { else if (letterCase != "none") {
mText = elem->get<std::string>("text");
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"\"letterCase\" for element \"" "\"letterCase\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
if (hasText) }
mText = elem->get<std::string>("text"); }
if (elem->has("letterCaseCollections")) {
const std::string letterCase {elem->get<std::string>("letterCaseCollections")};
if (letterCase == "uppercase") {
mLetterCaseCollections = LetterCase::UPPERCASE;
}
else if (letterCase == "lowercase") {
mLetterCaseCollections = LetterCase::LOWERCASE;
}
else if (letterCase == "capitalize") {
mLetterCaseCollections = LetterCase::CAPITALIZED;
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"\"letterCaseCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\"";
}
}
if (elem->has("letterCaseGroupedCollections")) {
const std::string letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
if (letterCase == "uppercase") {
mLetterCaseGroupedCollections = LetterCase::UPPERCASE;
}
else if (letterCase == "lowercase") {
mLetterCaseGroupedCollections = LetterCase::LOWERCASE;
}
else if (letterCase == "capitalize") {
mLetterCaseGroupedCollections = LetterCase::CAPITALIZED;
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"\"letterCaseGroupedCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }

View file

@ -43,6 +43,9 @@ public:
virtual int getCursor() = 0; virtual int getCursor() = 0;
virtual const size_t getNumEntries() = 0; virtual const size_t getNumEntries() = 0;
virtual const bool getFadeAbovePrimary() const = 0; virtual const bool getFadeAbovePrimary() const = 0;
virtual const LetterCase getLetterCase() const = 0;
virtual const LetterCase getLetterCaseCollections() const = 0;
virtual const LetterCase getLetterCaseGroupedCollections() const = 0;
// Functions used by some primary components. // Functions used by some primary components.
virtual void onDemandTextureLoad() {} virtual void onDemandTextureLoad() {}

View file

@ -68,45 +68,6 @@ public:
it->data.textCache.reset(); it->data.textCache.reset();
} }
void setUppercase(bool uppercase)
{
mUppercase = uppercase;
if (uppercase) {
mLowercase = false;
mCapitalize = false;
}
for (auto it = mEntries.begin(); it != mEntries.end(); ++it)
it->data.textCache.reset();
}
void setLowercase(bool lowercase)
{
mLowercase = lowercase;
if (lowercase) {
mUppercase = false;
mCapitalize = false;
}
for (auto it = mEntries.begin(); it != mEntries.end(); ++it)
it->data.textCache.reset();
}
void setCapitalize(bool capitalize)
{
mCapitalize = capitalize;
if (capitalize) {
mUppercase = false;
mLowercase = false;
}
for (auto it = mEntries.begin(); it != mEntries.end(); ++it)
it->data.textCache.reset();
}
void setSelectorHeight(float selectorScale) { mSelectorHeight = selectorScale; } void setSelectorHeight(float selectorScale) { mSelectorHeight = selectorScale; }
void setSelectorOffsetY(float selectorOffsetY) { mSelectorOffsetY = selectorOffsetY; } void setSelectorOffsetY(float selectorOffsetY) { mSelectorOffsetY = selectorOffsetY; }
void setSelectorColor(unsigned int color) { mSelectorColor = color; } void setSelectorColor(unsigned int color) { mSelectorColor = color; }
@ -120,6 +81,12 @@ public:
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; } const std::string& getCollectionIndicators() const { return mCollectionIndicators; }
const LetterCase getLetterCase() const override { return mLetterCase; }
const LetterCase getLetterCaseCollections() const override { return mLetterCaseCollections; }
const LetterCase getLetterCaseGroupedCollections() const override
{
return mLetterCaseGroupedCollections;
}
protected: protected:
void onShow() override { mLoopTime = 0; } void onShow() override { mLoopTime = 0; }
@ -169,9 +136,9 @@ private:
std::string mCollectionIndicators; std::string mCollectionIndicators;
bool mLegacyMode; bool mLegacyMode;
bool mFadeAbovePrimary; bool mFadeAbovePrimary;
bool mUppercase; LetterCase mLetterCase;
bool mLowercase; LetterCase mLetterCaseCollections;
bool mCapitalize; LetterCase mLetterCaseGroupedCollections;
float mLineSpacing; float mLineSpacing;
float mSelectorHeight; float mSelectorHeight;
float mSelectorOffsetY; float mSelectorOffsetY;
@ -202,9 +169,9 @@ TextListComponent<T>::TextListComponent()
, mCollectionIndicators {"symbols"} , mCollectionIndicators {"symbols"}
, mLegacyMode {false} , mLegacyMode {false}
, mFadeAbovePrimary {false} , mFadeAbovePrimary {false}
, mUppercase {false} , mLetterCase {LetterCase::NONE}
, mLowercase {false} , mLetterCaseCollections {LetterCase::NONE}
, mCapitalize {false} , mLetterCaseGroupedCollections {LetterCase::NONE}
, mLineSpacing {1.5f} , mLineSpacing {1.5f}
, mSelectorHeight {mFont->getSize() * 1.5f} , mSelectorHeight {mFont->getSize() * 1.5f}
, mSelectorOffsetY {0.0f} , mSelectorOffsetY {0.0f}
@ -435,16 +402,6 @@ template <typename T> void TextListComponent<T>::render(const glm::mat4& parentT
color = mColors[entry.data.colorId]; color = mColors[entry.data.colorId];
if (!entry.data.textCache) { if (!entry.data.textCache) {
if (mUppercase)
entry.data.textCache = std::unique_ptr<TextCache>(
font->buildTextCache(Utils::String::toUpper(entry.name), 0, 0, 0x000000FF));
else if (mLowercase)
entry.data.textCache = std::unique_ptr<TextCache>(
font->buildTextCache(Utils::String::toLower(entry.name), 0, 0, 0x000000FF));
else if (mCapitalize)
entry.data.textCache = std::unique_ptr<TextCache>(font->buildTextCache(
Utils::String::toCapitalized(entry.name), 0, 0, 0x000000FF));
else
entry.data.textCache = entry.data.textCache =
std::unique_ptr<TextCache>(font->buildTextCache(entry.name, 0, 0, 0x000000FF)); std::unique_ptr<TextCache>(font->buildTextCache(entry.name, 0, 0, 0x000000FF));
} }
@ -604,26 +561,64 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
} }
if (properties & LETTER_CASE && elem->has("letterCase")) { if (properties & LETTER_CASE && elem->has("letterCase")) {
std::string letterCase {elem->get<std::string>("letterCase")}; const std::string letterCase {elem->get<std::string>("letterCase")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
setUppercase(true); mLetterCase = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
setLowercase(true); mLetterCase = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
setCapitalize(true); mLetterCase = LetterCase::CAPITALIZED;
} }
else if (letterCase != "none") { else if (letterCase != "none") {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"<letterCase> defined as \"" "\"letterCase\" for element \""
<< letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
}
}
if (properties & LETTER_CASE && elem->has("letterCaseCollections")) {
const std::string letterCase {elem->get<std::string>("letterCaseCollections")};
if (letterCase == "uppercase") {
mLetterCaseCollections = LetterCase::UPPERCASE;
}
else if (letterCase == "lowercase") {
mLetterCaseCollections = LetterCase::LOWERCASE;
}
else if (letterCase == "capitalize") {
mLetterCaseCollections = LetterCase::CAPITALIZED;
}
else {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"\"letterCaseCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\"";
}
}
if (properties & LETTER_CASE && elem->has("letterCaseGroupedCollections")) {
const std::string letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
if (letterCase == "uppercase") {
mLetterCaseGroupedCollections = LetterCase::UPPERCASE;
}
else if (letterCase == "lowercase") {
mLetterCaseGroupedCollections = LetterCase::LOWERCASE;
}
else if (letterCase == "capitalize") {
mLetterCaseGroupedCollections = LetterCase::CAPITALIZED;
}
else {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"\"letterCaseGroupedCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }
// Legacy themes only. // Legacy themes only.
if (properties & FORCE_UPPERCASE && elem->has("forceUppercase")) if (properties & FORCE_UPPERCASE && elem->has("forceUppercase")) {
setUppercase(elem->get<bool>("forceUppercase")); if (elem->get<bool>("forceUppercase"))
mLetterCase = LetterCase::UPPERCASE;
}
if (properties & LINE_SPACING) { if (properties & LINE_SPACING) {
if (elem->has("lineSpacing")) if (elem->has("lineSpacing"))