mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Improved some theme warning messages in TextListComponent.
Also changed some theme values to be read by reference instead of by copy in CarouselComponent.
This commit is contained in:
parent
7684c92646
commit
b43c8cdd55
|
@ -931,7 +931,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mLegacyMode = theme->isLegacyTheme();
|
||||
|
||||
if (elem->has("type")) {
|
||||
const std::string type {elem->get<std::string>("type")};
|
||||
const std::string& type {elem->get<std::string>("type")};
|
||||
if (type == "horizontal") {
|
||||
mType = CarouselType::HORIZONTAL;
|
||||
}
|
||||
|
@ -960,7 +960,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mCarouselColorEnd = elem->get<unsigned int>("colorEnd");
|
||||
|
||||
if (elem->has("gradientType")) {
|
||||
const std::string gradientType {elem->get<std::string>("gradientType")};
|
||||
const std::string& gradientType {elem->get<std::string>("gradientType")};
|
||||
if (gradientType == "horizontal") {
|
||||
mColorGradientHorizontal = true;
|
||||
}
|
||||
|
@ -1009,7 +1009,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mItemScale = glm::clamp(elem->get<float>("itemScale"), 0.2f, 3.0f);
|
||||
|
||||
if (elem->has("itemTransitions")) {
|
||||
const std::string itemTransitions {elem->get<std::string>("itemTransitions")};
|
||||
const std::string& itemTransitions {elem->get<std::string>("itemTransitions")};
|
||||
if (itemTransitions == "slide") {
|
||||
mInstantItemTransitions = false;
|
||||
}
|
||||
|
@ -1026,7 +1026,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("itemInterpolation")) {
|
||||
const std::string itemInterpolation {elem->get<std::string>("itemInterpolation")};
|
||||
const std::string& itemInterpolation {elem->get<std::string>("itemInterpolation")};
|
||||
if (itemInterpolation == "linear") {
|
||||
mLinearInterpolation = true;
|
||||
}
|
||||
|
@ -1052,7 +1052,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
(elem->has("itemAxisHorizontal") && elem->get<bool>("itemAxisHorizontal"));
|
||||
|
||||
if (elem->has("itemHorizontalAlignment")) {
|
||||
const std::string alignment {elem->get<std::string>("itemHorizontalAlignment")};
|
||||
const std::string& alignment {elem->get<std::string>("itemHorizontalAlignment")};
|
||||
if (alignment == "left" && mType != CarouselType::HORIZONTAL) {
|
||||
mItemHorizontalAlignment = ALIGN_LEFT;
|
||||
}
|
||||
|
@ -1071,7 +1071,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("itemVerticalAlignment")) {
|
||||
const std::string alignment {elem->get<std::string>("itemVerticalAlignment")};
|
||||
const std::string& alignment {elem->get<std::string>("itemVerticalAlignment")};
|
||||
if (alignment == "top" && mType != CarouselType::VERTICAL) {
|
||||
mItemVerticalAlignment = ALIGN_TOP;
|
||||
}
|
||||
|
@ -1090,7 +1090,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("wheelHorizontalAlignment")) {
|
||||
const std::string alignment {elem->get<std::string>("wheelHorizontalAlignment")};
|
||||
const std::string& alignment {elem->get<std::string>("wheelHorizontalAlignment")};
|
||||
if (alignment == "left") {
|
||||
mWheelHorizontalAlignment = ALIGN_LEFT;
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mItemRotationOrigin = elem->get<glm::vec2>("logoRotationOrigin");
|
||||
|
||||
if (elem->has("logoAlignment")) {
|
||||
const std::string alignment {elem->get<std::string>("logoAlignment")};
|
||||
const std::string& alignment {elem->get<std::string>("logoAlignment")};
|
||||
if (alignment == "left" && mType != CarouselType::HORIZONTAL) {
|
||||
mItemHorizontalAlignment = ALIGN_LEFT;
|
||||
mItemVerticalAlignment = ALIGN_CENTER;
|
||||
|
@ -1216,7 +1216,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mLineSpacing = glm::clamp(elem->get<float>("lineSpacing"), 0.5f, 3.0f);
|
||||
|
||||
if (elem->has("letterCase")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCase")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCase")};
|
||||
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCase = LetterCase::UPPERCASE;
|
||||
|
@ -1235,7 +1235,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("letterCaseCollections")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCaseCollections")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCaseCollections")};
|
||||
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCaseCollections = LetterCase::UPPERCASE;
|
||||
|
@ -1254,7 +1254,7 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("letterCaseGroupedCollections")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
|
||||
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCaseGroupedCollections = LetterCase::UPPERCASE;
|
||||
|
|
|
@ -499,7 +499,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if (elem->has("selectorColorEnd"))
|
||||
setSelectorColorEnd(elem->get<unsigned int>("selectorColorEnd"));
|
||||
if (elem->has("selectorGradientType")) {
|
||||
const std::string gradientType {elem->get<std::string>("selectorGradientType")};
|
||||
const std::string& gradientType {elem->get<std::string>("selectorGradientType")};
|
||||
if (gradientType == "horizontal") {
|
||||
setSelectorColorGradientHorizontal(true);
|
||||
}
|
||||
|
@ -509,8 +509,8 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
else {
|
||||
setSelectorColorGradientHorizontal(true);
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<selectorGradientType> defined as \""
|
||||
<< gradientType << "\"";
|
||||
"\"selectorGradientType\" for element \""
|
||||
<< element.substr(9) << "\" defined as \"" << gradientType << "\"";
|
||||
}
|
||||
}
|
||||
if (elem->has("selectedColor"))
|
||||
|
@ -527,31 +527,40 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
|
||||
if (properties & ALIGNMENT) {
|
||||
if (elem->has("horizontalAlignment")) {
|
||||
const std::string& str {elem->get<std::string>("horizontalAlignment")};
|
||||
if (str == "left")
|
||||
const std::string& horizontalAlignment {elem->get<std::string>("horizontalAlignment")};
|
||||
if (horizontalAlignment == "left") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_LEFT);
|
||||
else if (str == "center")
|
||||
}
|
||||
else if (horizontalAlignment == "center") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_CENTER);
|
||||
else if (str == "right")
|
||||
}
|
||||
else if (horizontalAlignment == "right") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_RIGHT);
|
||||
else
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<horizontalAlignment> defined as \""
|
||||
<< str << "\"";
|
||||
"\"horizontalAlignment\" for element \""
|
||||
<< element.substr(9) << "\" defined as \"" << horizontalAlignment
|
||||
<< "\"";
|
||||
}
|
||||
}
|
||||
// Legacy themes only.
|
||||
else if (elem->has("alignment")) {
|
||||
const std::string& str {elem->get<std::string>("alignment")};
|
||||
if (str == "left")
|
||||
const std::string& alignment {elem->get<std::string>("alignment")};
|
||||
if (alignment == "left") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_LEFT);
|
||||
else if (str == "center")
|
||||
}
|
||||
else if (alignment == "center") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_CENTER);
|
||||
else if (str == "right")
|
||||
}
|
||||
else if (alignment == "right") {
|
||||
setAlignment(PrimaryAlignment::ALIGN_RIGHT);
|
||||
else
|
||||
}
|
||||
else {
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<alignment> defined as \""
|
||||
<< str << "\"";
|
||||
"\"alignment\" for element \""
|
||||
<< element.substr(9) << "\" defined as \"" << alignment << "\"";
|
||||
}
|
||||
}
|
||||
if (elem->has("horizontalMargin")) {
|
||||
mHorizontalMargin =
|
||||
|
@ -561,7 +570,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (properties & LETTER_CASE && elem->has("letterCase")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCase")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCase")};
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCase = LetterCase::UPPERCASE;
|
||||
}
|
||||
|
@ -579,7 +588,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (properties & LETTER_CASE && elem->has("letterCaseCollections")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCaseCollections")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCaseCollections")};
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCaseCollections = LetterCase::UPPERCASE;
|
||||
}
|
||||
|
@ -597,7 +606,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (properties & LETTER_CASE && elem->has("letterCaseGroupedCollections")) {
|
||||
const std::string letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
|
||||
const std::string& letterCase {elem->get<std::string>("letterCaseGroupedCollections")};
|
||||
if (letterCase == "uppercase") {
|
||||
mLetterCaseGroupedCollections = LetterCase::UPPERCASE;
|
||||
}
|
||||
|
@ -636,33 +645,34 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
|
||||
if (elem->has("indicators")) {
|
||||
std::string indicators {elem->get<std::string>("indicators")};
|
||||
const std::string& indicators {elem->get<std::string>("indicators")};
|
||||
if (indicators == "symbols" || indicators == "ascii" || indicators == "none") {
|
||||
mIndicators = indicators;
|
||||
}
|
||||
else {
|
||||
mIndicators = "symbols";
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<indicators> defined as \""
|
||||
<< indicators << "\"";
|
||||
"\"indicators\" for element \""
|
||||
<< element.substr(9) << "\" defined as \"" << indicators << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("collectionIndicators")) {
|
||||
std::string collectionIndicators {elem->get<std::string>("collectionIndicators")};
|
||||
const 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 << "\"";
|
||||
"\"collectionIndicators\" for element \""
|
||||
<< element.substr(9) << "\" defined as \"" << collectionIndicators
|
||||
<< "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("selectorImagePath")) {
|
||||
std::string path {elem->get<std::string>("selectorImagePath")};
|
||||
const std::string& path {elem->get<std::string>("selectorImagePath")};
|
||||
bool tile {elem->has("selectorImageTile") && elem->get<bool>("selectorImageTile")};
|
||||
mSelectorImage.setImage(path, tile);
|
||||
mSelectorImage.setSize(mSize.x, mSelectorHeight);
|
||||
|
|
Loading…
Reference in a new issue