Modified and added some variables and properties to support better letter case controls for collection names.

This commit is contained in:
Leon Styhre 2023-01-13 11:03:23 +01:00
parent 918ffd9b9e
commit f2fd8cf6a8
9 changed files with 153 additions and 88 deletions

View file

@ -1328,13 +1328,37 @@ void SystemData::loadTheme(ThemeTriggers::TriggerType trigger)
sysData.insert(std::pair<std::string, std::string>("system.name", getName())); sysData.insert(std::pair<std::string, std::string>("system.name", getName()));
sysData.insert(std::pair<std::string, std::string>("system.theme", getThemeFolder())); sysData.insert(std::pair<std::string, std::string>("system.theme", getThemeFolder()));
sysData.insert(std::pair<std::string, std::string>("system.fullName", getFullName())); sysData.insert(std::pair<std::string, std::string>("system.fullName", getFullName()));
if (isCollection()) { if (isCollection() && isCustomCollection()) {
sysData.insert( sysData.insert(
std::pair<std::string, std::string>("system.name.collections", getName())); std::pair<std::string, std::string>("system.name.customCollections", getName()));
sysData.insert(std::pair<std::string, std::string>("system.fullName.customCollections",
getFullName()));
sysData.insert(std::pair<std::string, std::string>("system.theme.customCollections",
getThemeFolder()));
sysData.insert( sysData.insert(
std::pair<std::string, std::string>("system.fullName.collections", getFullName())); std::pair<std::string, std::string>("system.name.autoCollections", "\b"));
sysData.insert( sysData.insert(
std::pair<std::string, std::string>("system.theme.collections", getThemeFolder())); std::pair<std::string, std::string>("system.fullName.autoCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.theme.autoCollections", "\b"));
sysData.insert(std::pair<std::string, std::string>("system.name.noCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.fullName.noCollections", "\b"));
sysData.insert(std::pair<std::string, std::string>("system.theme.noCollections", "\b"));
}
else if (isCollection()) {
sysData.insert(
std::pair<std::string, std::string>("system.name.autoCollections", getName()));
sysData.insert(std::pair<std::string, std::string>("system.fullName.autoCollections",
getFullName()));
sysData.insert(std::pair<std::string, std::string>("system.theme.autoCollections",
getThemeFolder()));
sysData.insert(
std::pair<std::string, std::string>("system.name.customCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.fullName.customCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.theme.customCollections", "\b"));
sysData.insert(std::pair<std::string, std::string>("system.name.noCollections", "\b")); sysData.insert(std::pair<std::string, std::string>("system.name.noCollections", "\b"));
sysData.insert( sysData.insert(
std::pair<std::string, std::string>("system.fullName.noCollections", "\b")); std::pair<std::string, std::string>("system.fullName.noCollections", "\b"));
@ -1347,10 +1371,18 @@ void SystemData::loadTheme(ThemeTriggers::TriggerType trigger)
getFullName())); getFullName()));
sysData.insert(std::pair<std::string, std::string>("system.theme.noCollections", sysData.insert(std::pair<std::string, std::string>("system.theme.noCollections",
getThemeFolder())); getThemeFolder()));
sysData.insert(std::pair<std::string, std::string>("system.name.collections", "\b"));
sysData.insert( sysData.insert(
std::pair<std::string, std::string>("system.fullName.collections", "\b")); std::pair<std::string, std::string>("system.name.autoCollections", "\b"));
sysData.insert(std::pair<std::string, std::string>("system.theme.collections", "\b")); sysData.insert(
std::pair<std::string, std::string>("system.fullName.autoCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.theme.autoCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.name.customCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.fullName.customCollections", "\b"));
sysData.insert(
std::pair<std::string, std::string>("system.theme.customCollections", "\b"));
} }
mTheme->loadFile(sysData, path, trigger, isCustomCollection()); mTheme->loadFile(sysData, path, trigger, isCustomCollection());

View file

@ -597,8 +597,8 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
mFirstGameEntry = (*it); mFirstGameEntry = (*it);
if (customCollection && (*it)->getType() == FOLDER) { if (customCollection && (*it)->getType() == FOLDER) {
letterCase = mPrimary->getLetterCaseGroupedCollections(); letterCase = mPrimary->getLetterCaseCustomCollections();
if (letterCase == LetterCase::NONE) if (letterCase == LetterCase::UNDEFINED)
letterCase = mPrimary->getLetterCase(); letterCase = mPrimary->getLetterCase();
} }
else { else {
@ -614,7 +614,7 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
carouselEntry.name = Utils::String::toUpper(carouselEntry.name); carouselEntry.name = Utils::String::toUpper(carouselEntry.name);
else if (letterCase == LetterCase::LOWERCASE) else if (letterCase == LetterCase::LOWERCASE)
carouselEntry.name = Utils::String::toLower(carouselEntry.name); carouselEntry.name = Utils::String::toLower(carouselEntry.name);
else if (letterCase == LetterCase::CAPITALIZED) else if (letterCase == LetterCase::CAPITALIZE)
carouselEntry.name = Utils::String::toCapitalized(carouselEntry.name); carouselEntry.name = Utils::String::toCapitalized(carouselEntry.name);
if (defaultImage != "") if (defaultImage != "")
@ -631,7 +631,7 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
gridEntry.name = Utils::String::toUpper(gridEntry.name); gridEntry.name = Utils::String::toUpper(gridEntry.name);
else if (letterCase == LetterCase::LOWERCASE) else if (letterCase == LetterCase::LOWERCASE)
gridEntry.name = Utils::String::toLower(gridEntry.name); gridEntry.name = Utils::String::toLower(gridEntry.name);
else if (letterCase == LetterCase::CAPITALIZED) else if (letterCase == LetterCase::CAPITALIZE)
gridEntry.name = Utils::String::toCapitalized(gridEntry.name); gridEntry.name = Utils::String::toCapitalized(gridEntry.name);
if (defaultImage != "") if (defaultImage != "")
@ -695,7 +695,7 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
name = Utils::String::toUpper(name); name = Utils::String::toUpper(name);
else if (letterCase == LetterCase::LOWERCASE) else if (letterCase == LetterCase::LOWERCASE)
name = Utils::String::toLower(name); name = Utils::String::toLower(name);
else if (letterCase == LetterCase::CAPITALIZED) else if (letterCase == LetterCase::CAPITALIZE)
name = Utils::String::toCapitalized(name); name = Utils::String::toCapitalized(name);
textListEntry.name = name; textListEntry.name = name;
@ -735,7 +735,7 @@ void GamelistBase::addPlaceholder(FileData* firstEntry)
name = Utils::String::toUpper(name); name = Utils::String::toUpper(name);
else if (letterCase == LetterCase::LOWERCASE) else if (letterCase == LetterCase::LOWERCASE)
name = Utils::String::toLower(name); name = Utils::String::toLower(name);
else if (letterCase == LetterCase::CAPITALIZED) else if (letterCase == LetterCase::CAPITALIZE)
name = Utils::String::toCapitalized(name); name = Utils::String::toCapitalized(name);
}; };

View file

@ -762,9 +762,14 @@ void SystemView::populate()
auto letterCaseFunc = [&it, this](std::string& name) { auto letterCaseFunc = [&it, this](std::string& name) {
LetterCase letterCase {LetterCase::NONE}; LetterCase letterCase {LetterCase::NONE};
if (it->isCollection()) { if (it->isCustomCollection()) {
letterCase = mPrimary->getLetterCaseCollections(); letterCase = mPrimary->getLetterCaseCustomCollections();
if (letterCase == LetterCase::NONE) if (letterCase == LetterCase::UNDEFINED)
letterCase = mPrimary->getLetterCase();
}
else if (it->isCollection()) {
letterCase = mPrimary->getLetterCaseAutoCollections();
if (letterCase == LetterCase::UNDEFINED)
letterCase = mPrimary->getLetterCase(); letterCase = mPrimary->getLetterCase();
} }
else { else {
@ -775,7 +780,7 @@ void SystemView::populate()
name = Utils::String::toUpper(name); name = Utils::String::toUpper(name);
else if (letterCase == LetterCase::LOWERCASE) else if (letterCase == LetterCase::LOWERCASE)
name = Utils::String::toLower(name); name = Utils::String::toLower(name);
else if (letterCase == LetterCase::CAPITALIZED) else if (letterCase == LetterCase::CAPITALIZE)
name = Utils::String::toCapitalized(name); name = Utils::String::toCapitalized(name);
}; };

View file

@ -60,8 +60,9 @@ enum Alignment {
enum class LetterCase { enum class LetterCase {
UPPERCASE, UPPERCASE,
LOWERCASE, LOWERCASE,
CAPITALIZED, CAPITALIZE,
NONE NONE,
UNDEFINED
}; };
class GuiComponent class GuiComponent

View file

@ -179,8 +179,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}, {"letterCaseAutoCollections", STRING},
{"letterCaseGroupedCollections", STRING}, {"letterCaseCustomCollections", STRING},
{"lineSpacing", FLOAT}, {"lineSpacing", FLOAT},
{"fadeAbovePrimary", BOOLEAN}, {"fadeAbovePrimary", BOOLEAN},
{"zIndex", FLOAT}, {"zIndex", FLOAT},
@ -224,8 +224,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}, {"letterCaseAutoCollections", STRING},
{"letterCaseGroupedCollections", STRING}, {"letterCaseCustomCollections", STRING},
{"lineSpacing", FLOAT}, {"lineSpacing", FLOAT},
{"fadeAbovePrimary", BOOLEAN}, {"fadeAbovePrimary", BOOLEAN},
{"zIndex", FLOAT}}}, {"zIndex", FLOAT}}},
@ -253,8 +253,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}, {"letterCaseAutoCollections", STRING},
{"letterCaseGroupedCollections", STRING}, {"letterCaseCustomCollections", 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},
@ -1853,7 +1853,7 @@ void ThemeData::parseElement(const pugi::xml_node& root,
std::string str {resolvePlaceholders(node.text().as_string())}; std::string str {resolvePlaceholders(node.text().as_string())};
// Handle the special case with mutually exclusive system variables, for example // Handle the special case with mutually exclusive system variables, for example
// system.fullName.collections and system.fullName.noCollections which can never // system.fullName.autoCollections and system.fullName.noCollections which can never
// exist at the same time. A backspace is assigned in SystemData to flag the // exist at the same time. A backspace is assigned in SystemData to flag the
// variables that do not apply and if it's encountered here we simply skip the // variables that do not apply and if it's encountered here we simply skip the
// property. // property.

View file

@ -65,10 +65,13 @@ public:
void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; } void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; }
bool isScrolling() const override { return List::isScrolling(); } bool isScrolling() const override { return List::isScrolling(); }
const LetterCase getLetterCase() const override { return mLetterCase; } const LetterCase getLetterCase() const override { return mLetterCase; }
const LetterCase getLetterCaseCollections() const override { return mLetterCaseCollections; } const LetterCase getLetterCaseAutoCollections() const override
const LetterCase getLetterCaseGroupedCollections() const override
{ {
return mLetterCaseGroupedCollections; return mLetterCaseAutoCollections;
}
const LetterCase getLetterCaseCustomCollections() const override
{
return mLetterCaseCustomCollections;
} }
void setCancelTransitionsCallback(const std::function<void()>& func) override void setCancelTransitionsCallback(const std::function<void()>& func) override
@ -170,8 +173,8 @@ private:
unsigned int mTextBackgroundColor; unsigned int mTextBackgroundColor;
std::shared_ptr<Font> mFont; std::shared_ptr<Font> mFont;
LetterCase mLetterCase; LetterCase mLetterCase;
LetterCase mLetterCaseCollections; LetterCase mLetterCaseAutoCollections;
LetterCase mLetterCaseGroupedCollections; LetterCase mLetterCaseCustomCollections;
float mLineSpacing; float mLineSpacing;
bool mFadeAbovePrimary; bool mFadeAbovePrimary;
}; };
@ -227,8 +230,8 @@ CarouselComponent<T>::CarouselComponent()
, mTextBackgroundColor {0xFFFFFF00} , mTextBackgroundColor {0xFFFFFF00}
, mFont {Font::get(FONT_SIZE_LARGE)} , mFont {Font::get(FONT_SIZE_LARGE)}
, mLetterCase {LetterCase::NONE} , mLetterCase {LetterCase::NONE}
, mLetterCaseCollections {LetterCase::NONE} , mLetterCaseAutoCollections {LetterCase::UNDEFINED}
, mLetterCaseGroupedCollections {LetterCase::NONE} , mLetterCaseCustomCollections {LetterCase::UNDEFINED}
, mLineSpacing {1.5f} , mLineSpacing {1.5f}
, mFadeAbovePrimary {false} , mFadeAbovePrimary {false}
{ {
@ -1555,7 +1558,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
mLetterCase = LetterCase::LOWERCASE; mLetterCase = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCase = LetterCase::CAPITALIZED; mLetterCase = LetterCase::CAPITALIZE;
} }
else if (letterCase != "none") { else if (letterCase != "none") {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
@ -1564,40 +1567,46 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
} }
} }
if (elem->has("letterCaseCollections")) { if (elem->has("letterCaseAutoCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseAutoCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseCollections = LetterCase::UPPERCASE; mLetterCaseAutoCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseCollections = LetterCase::LOWERCASE; mLetterCaseAutoCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseCollections = LetterCase::CAPITALIZED; mLetterCaseAutoCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseAutoCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"\"letterCaseCollections\" for element \"" "\"letterCaseAutoCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }
if (elem->has("letterCaseGroupedCollections")) { if (elem->has("letterCaseCustomCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseGroupedCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseCustomCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseGroupedCollections = LetterCase::UPPERCASE; mLetterCaseCustomCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseGroupedCollections = LetterCase::LOWERCASE; mLetterCaseCustomCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseGroupedCollections = LetterCase::CAPITALIZED; mLetterCaseCustomCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseCustomCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"\"letterCaseGroupedCollections\" for element \"" "\"letterCaseCustomCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }

View file

@ -58,10 +58,13 @@ public:
const size_t getNumEntries() override { return mEntries.size(); } const size_t getNumEntries() override { return mEntries.size(); }
const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; } const bool getFadeAbovePrimary() const override { return mFadeAbovePrimary; }
const LetterCase getLetterCase() const override { return mLetterCase; } const LetterCase getLetterCase() const override { return mLetterCase; }
const LetterCase getLetterCaseCollections() const override { return mLetterCaseCollections; } const LetterCase getLetterCaseAutoCollections() const override
const LetterCase getLetterCaseGroupedCollections() const override
{ {
return mLetterCaseGroupedCollections; return mLetterCaseAutoCollections;
}
const LetterCase getLetterCaseCustomCollections() const override
{
return mLetterCaseCustomCollections;
} }
const std::string& getDefaultGridImage() const { return mDefaultImage; } const std::string& getDefaultGridImage() const { return mDefaultImage; }
void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; } void setDefaultImage(std::string defaultImage) { mDefaultImage = defaultImage; }
@ -170,8 +173,8 @@ private:
unsigned int mTextBackgroundColor; unsigned int mTextBackgroundColor;
std::shared_ptr<Font> mFont; std::shared_ptr<Font> mFont;
LetterCase mLetterCase; LetterCase mLetterCase;
LetterCase mLetterCaseCollections; LetterCase mLetterCaseAutoCollections;
LetterCase mLetterCaseGroupedCollections; LetterCase mLetterCaseCustomCollections;
float mLineSpacing; float mLineSpacing;
bool mFadeAbovePrimary; bool mFadeAbovePrimary;
}; };
@ -223,8 +226,8 @@ GridComponent<T>::GridComponent()
, mTextColor {0x000000FF} , mTextColor {0x000000FF}
, mTextBackgroundColor {0xFFFFFF00} , mTextBackgroundColor {0xFFFFFF00}
, mLetterCase {LetterCase::NONE} , mLetterCase {LetterCase::NONE}
, mLetterCaseCollections {LetterCase::NONE} , mLetterCaseAutoCollections {LetterCase::UNDEFINED}
, mLetterCaseGroupedCollections {LetterCase::NONE} , mLetterCaseCustomCollections {LetterCase::UNDEFINED}
, mLineSpacing {1.5f} , mLineSpacing {1.5f}
, mFadeAbovePrimary {false} , mFadeAbovePrimary {false}
{ {
@ -1124,7 +1127,7 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
mLetterCase = LetterCase::LOWERCASE; mLetterCase = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCase = LetterCase::CAPITALIZED; mLetterCase = LetterCase::CAPITALIZE;
} }
else if (letterCase != "none") { else if (letterCase != "none") {
LOG(LogWarning) << "GridComponent: Invalid theme configuration, property " LOG(LogWarning) << "GridComponent: Invalid theme configuration, property "
@ -1133,40 +1136,46 @@ void GridComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
} }
} }
if (elem->has("letterCaseCollections")) { if (elem->has("letterCaseAutoCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseAutoCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseCollections = LetterCase::UPPERCASE; mLetterCaseAutoCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseCollections = LetterCase::LOWERCASE; mLetterCaseAutoCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseCollections = LetterCase::CAPITALIZED; mLetterCaseAutoCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseAutoCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "GridComponent: Invalid theme configuration, property " LOG(LogWarning) << "GridComponent: Invalid theme configuration, property "
"\"letterCaseCollections\" for element \"" "\"letterCaseAutoCollections\" for element \""
<< element.substr(5) << "\" defined as \"" << letterCase << "\""; << element.substr(5) << "\" defined as \"" << letterCase << "\"";
} }
} }
if (elem->has("letterCaseGroupedCollections")) { if (elem->has("letterCaseCustomCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseGroupedCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseCustomCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseGroupedCollections = LetterCase::UPPERCASE; mLetterCaseCustomCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseGroupedCollections = LetterCase::LOWERCASE; mLetterCaseCustomCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseGroupedCollections = LetterCase::CAPITALIZED; mLetterCaseCustomCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseCustomCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "GridComponent: Invalid theme configuration, property " LOG(LogWarning) << "GridComponent: Invalid theme configuration, property "
"\"letterCaseGroupedCollections\" for element \"" "\"letterCaseCustomCollections\" for element \""
<< element.substr(5) << "\" defined as \"" << letterCase << "\""; << element.substr(5) << "\" defined as \"" << letterCase << "\"";
} }
} }

View file

@ -45,8 +45,8 @@ public:
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 getLetterCase() const = 0;
virtual const LetterCase getLetterCaseCollections() const = 0; virtual const LetterCase getLetterCaseAutoCollections() const = 0;
virtual const LetterCase getLetterCaseGroupedCollections() const = 0; virtual const LetterCase getLetterCaseCustomCollections() const = 0;
// Functions used by some primary components. // Functions used by some primary components.
virtual void onDemandTextureLoad() {} virtual void onDemandTextureLoad() {}

View file

@ -76,10 +76,13 @@ public:
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 getLetterCase() const override { return mLetterCase; }
const LetterCase getLetterCaseCollections() const override { return mLetterCaseCollections; } const LetterCase getLetterCaseAutoCollections() const override
const LetterCase getLetterCaseGroupedCollections() const override
{ {
return mLetterCaseGroupedCollections; return mLetterCaseAutoCollections;
}
const LetterCase getLetterCaseCustomCollections() const override
{
return mLetterCaseCustomCollections;
} }
private: private:
@ -133,8 +136,8 @@ private:
bool mLegacyMode; bool mLegacyMode;
bool mFadeAbovePrimary; bool mFadeAbovePrimary;
LetterCase mLetterCase; LetterCase mLetterCase;
LetterCase mLetterCaseCollections; LetterCase mLetterCaseAutoCollections;
LetterCase mLetterCaseGroupedCollections; LetterCase mLetterCaseCustomCollections;
float mLineSpacing; float mLineSpacing;
float mSelectorHeight; float mSelectorHeight;
float mSelectorHorizontalOffset; float mSelectorHorizontalOffset;
@ -169,8 +172,8 @@ TextListComponent<T>::TextListComponent()
, mLegacyMode {false} , mLegacyMode {false}
, mFadeAbovePrimary {false} , mFadeAbovePrimary {false}
, mLetterCase {LetterCase::NONE} , mLetterCase {LetterCase::NONE}
, mLetterCaseCollections {LetterCase::NONE} , mLetterCaseAutoCollections {LetterCase::UNDEFINED}
, mLetterCaseGroupedCollections {LetterCase::NONE} , mLetterCaseCustomCollections {LetterCase::UNDEFINED}
, mLineSpacing {1.5f} , mLineSpacing {1.5f}
, mSelectorHeight {mFont->getSize() * 1.5f} , mSelectorHeight {mFont->getSize() * 1.5f}
, mSelectorHorizontalOffset {0.0f} , mSelectorHorizontalOffset {0.0f}
@ -597,7 +600,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
mLetterCase = LetterCase::LOWERCASE; mLetterCase = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCase = LetterCase::CAPITALIZED; mLetterCase = LetterCase::CAPITALIZE;
} }
else if (letterCase != "none") { else if (letterCase != "none") {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
@ -606,38 +609,44 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
} }
} }
if (properties & LETTER_CASE && elem->has("letterCaseCollections")) { if (properties & LETTER_CASE && elem->has("letterCaseAutoCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseAutoCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseCollections = LetterCase::UPPERCASE; mLetterCaseAutoCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseCollections = LetterCase::LOWERCASE; mLetterCaseAutoCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseCollections = LetterCase::CAPITALIZED; mLetterCaseAutoCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseAutoCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"\"letterCaseCollections\" for element \"" "\"letterCaseAutoCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }
if (properties & LETTER_CASE && elem->has("letterCaseGroupedCollections")) { if (properties & LETTER_CASE && elem->has("letterCaseCustomCollections")) {
const std::string& letterCase {elem->get<std::string>("letterCaseGroupedCollections")}; const std::string& letterCase {elem->get<std::string>("letterCaseCustomCollections")};
if (letterCase == "uppercase") { if (letterCase == "uppercase") {
mLetterCaseGroupedCollections = LetterCase::UPPERCASE; mLetterCaseCustomCollections = LetterCase::UPPERCASE;
} }
else if (letterCase == "lowercase") { else if (letterCase == "lowercase") {
mLetterCaseGroupedCollections = LetterCase::LOWERCASE; mLetterCaseCustomCollections = LetterCase::LOWERCASE;
} }
else if (letterCase == "capitalize") { else if (letterCase == "capitalize") {
mLetterCaseGroupedCollections = LetterCase::CAPITALIZED; mLetterCaseCustomCollections = LetterCase::CAPITALIZE;
}
else if (letterCase == "none") {
mLetterCaseCustomCollections = LetterCase::NONE;
} }
else { else {
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"\"letterCaseGroupedCollections\" for element \"" "\"letterCaseCustomCollections\" for element \""
<< element.substr(9) << "\" defined as \"" << letterCase << "\""; << element.substr(9) << "\" defined as \"" << letterCase << "\"";
} }
} }