Standardized some theme warning log output.

This commit is contained in:
Leon Styhre 2022-03-18 20:31:04 +01:00
parent a115b3f941
commit 44fe2f8fe7
9 changed files with 51 additions and 46 deletions

View file

@ -197,9 +197,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("horizontalAlignment")) {
const std::string horizontalAlignment {elem->get<std::string>("horizontalAlignment")};
if (horizontalAlignment != "left" && horizontalAlignment != "right") {
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <horizontalAlignment> set to \""
<< horizontalAlignment << "\"";
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <horizontalAlignment> "
"defined as \""
<< horizontalAlignment << "\"";
}
else {
mFlexboxComponent.setAlignment(horizontalAlignment);
@ -209,8 +209,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else if (elem->has("alignment")) {
const std::string alignment {elem->get<std::string>("alignment")};
if (alignment != "left" && alignment != "right") {
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <alignment> set to \""
<< alignment << "\"";
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <alignment> defined as \""
<< alignment << "\"";
}
else {
mFlexboxComponent.setAlignment(alignment);
@ -220,8 +221,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("direction")) {
const std::string direction {elem->get<std::string>("direction")};
if (direction != "row" && direction != "column") {
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <direction> set to \""
<< direction << "\"";
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <direction> defined as \""
<< direction << "\"";
}
else {
mFlexboxComponent.setDirection(direction);
@ -231,7 +233,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("lines")) {
const unsigned int lines {elem->get<unsigned int>("lines")};
if (lines < 1 || lines > 10) {
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <lines> set to \""
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <lines> defined as \""
<< lines << "\"";
}
else {
@ -243,7 +245,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
const unsigned int itemsPerLine {elem->get<unsigned int>("itemsPerLine")};
if (itemsPerLine < 1 || itemsPerLine > 10) {
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <itemsPerLine> set to \""
<< "BadgeComponent: Invalid theme configuration, <itemsPerLine> defined as \""
<< itemsPerLine << "\"";
}
else {
@ -256,8 +258,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if ((itemMargin.x != -1.0 && itemMargin.y != -1.0) &&
(itemMargin.x < 0.0f || itemMargin.x > 0.2f || itemMargin.y < 0.0f ||
itemMargin.y > 0.2f)) {
LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, <itemMargin> set to \""
<< itemMargin.x << " " << itemMargin.y << "\"";
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <itemMargin> defined as \""
<< itemMargin.x << " " << itemMargin.y << "\"";
}
else {
mFlexboxComponent.setItemMargin(itemMargin);
@ -269,7 +272,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (controllerPos.x < -1.0f || controllerPos.x > 2.0f || controllerPos.y < -1.0f ||
controllerPos.y > 2.0f) {
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <controllerPos> set to \""
<< "BadgeComponent: Invalid theme configuration, <controllerPos> defined as \""
<< controllerPos.x << " " << controllerPos.y << "\"";
}
else {
@ -281,7 +284,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
const float controllerSize = elem->get<float>("controllerSize");
if (controllerSize < 0.1f || controllerSize > 2.0f) {
LOG(LogWarning)
<< "BadgeComponent: Invalid theme configuration, <controllerSize> set to \""
<< "BadgeComponent: Invalid theme configuration, <controllerSize> defined as \""
<< controllerSize << "\"";
}
else {

View file

@ -334,7 +334,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<type> set to \""
"<type> defined as \""
<< type << "\"";
mType = HORIZONTAL;
}
@ -358,7 +358,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else {
mColorGradientHorizontal = true;
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<gradientType> set to \""
"<gradientType> defined as \""
<< gradientType << "\"";
}
}
@ -406,7 +406,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<logoHorizontalAlignment> set to \""
"<logoHorizontalAlignment> defined as \""
<< alignment << "\"";
mLogoHorizontalAlignment = ALIGN_CENTER;
}
@ -425,7 +425,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<logoVerticalAlignment> set to \""
"<logoVerticalAlignment> defined as \""
<< alignment << "\"";
mLogoVerticalAlignment = ALIGN_CENTER;
}
@ -456,7 +456,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else {
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<logoAlignment> set to \""
"<logoAlignment> defined as \""
<< alignment << "\"";
mLogoHorizontalAlignment = ALIGN_CENTER;
mLogoVerticalAlignment = ALIGN_CENTER;
@ -492,9 +492,9 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
mText = elem->get<std::string>("text");
}
else {
LOG(LogWarning)
<< "CarouselComponent: Invalid theme configuration, property <letterCase> set to \""
<< letterCase << "\"";
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
"<letterCase> defined as \""
<< letterCase << "\"";
mText = elem->get<std::string>("text");
}
}

View file

@ -139,7 +139,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
setHorizontalAlignment(ALIGN_RIGHT);
else
LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property "
"<horizontalAlignment> set to \""
"<horizontalAlignment> defined as \""
<< str << "\"";
}
@ -153,7 +153,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
setVerticalAlignment(ALIGN_BOTTOM);
else
LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property "
"<verticalAlignment> set to \""
"<verticalAlignment> defined as \""
<< str << "\"";
}
@ -168,7 +168,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
setHorizontalAlignment(ALIGN_RIGHT);
else
LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property "
"<alignment> set to \""
"<alignment> defined as \""
<< str << "\"";
}
@ -193,9 +193,9 @@ void DateTimeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
setCapitalize(true);
}
else if (letterCase != "none") {
LOG(LogWarning)
<< "DateTimeComponent: Invalid theme configuration, property <letterCase> set to \""
<< letterCase << "\"";
LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property "
"<letterCase> defined as \""
<< letterCase << "\"";
}
}

View file

@ -126,7 +126,7 @@ public:
else {
mGameSelection = GameSelection::RANDOM;
LOG(LogWarning) << "GameSelectorComponent: Invalid theme configuration, property "
"<selection> set to \""
"<selection> defined as \""
<< selection << "\"";
}
}

View file

@ -514,7 +514,7 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else {
mLinearInterpolation = false;
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
"<interpolation> set to \""
"<interpolation> defined as \""
<< interpolation << "\"";
}
}
@ -553,7 +553,7 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else {
setColorGradientHorizontal(true);
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
"<gradientType> set to \""
"<gradientType> defined as \""
<< gradientType << "\"";
}
}

View file

@ -231,8 +231,9 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("size")) {
glm::vec2 size = elem->get<glm::vec2>("size");
if (size.x == 0.0f && size.y == 0.0f) {
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, <size> set to \""
<< size.x << " " << size.y << "\"";
LOG(LogWarning)
<< "LottieAnimComponent: Invalid theme configuration, <size> defined as \""
<< size.x << " " << size.y << "\"";
return;
}
}
@ -240,8 +241,9 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
if (elem->has("speed")) {
const float speed {elem->get<float>("speed")};
if (speed < 0.2f || speed > 3.0f) {
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, <speed> set to \""
<< std::fixed << std::setprecision(1) << speed << "\"";
LOG(LogWarning)
<< "LottieAnimComponent: Invalid theme configuration, <speed> defined as \""
<< std::fixed << std::setprecision(1) << speed << "\"";
}
else {
mSpeedModifier = speed;
@ -271,7 +273,7 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else {
LOG(LogWarning)
<< "LottieAnimComponent: Invalid theme configuration, <direction> set to \""
<< "LottieAnimComponent: Invalid theme configuration, <direction> defined as \""
<< direction << "\"";
mStartDirection = "normal";
mAlternate = false;

View file

@ -398,7 +398,7 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else
LOG(LogWarning) << componentName
<< ": Invalid theme configuration, property "
"<horizontalAlignment> set to \""
"<horizontalAlignment> defined as \""
<< str << "\"";
}
@ -413,7 +413,7 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else
LOG(LogWarning) << componentName
<< ": Invalid theme configuration, property "
"<verticalAlignment> set to \""
"<verticalAlignment> defined as \""
<< str << "\"";
}
@ -429,7 +429,7 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else
LOG(LogWarning) << componentName
<< ": Invalid theme configuration, property "
"<alignment> set to \""
"<alignment> defined as \""
<< str << "\"";
}
@ -455,7 +455,7 @@ void TextComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
}
else if (letterCase != "none") {
LOG(LogWarning)
<< "TextComponent: Invalid theme configuration, property <letterCase> set to \""
<< "TextComponent: Invalid theme configuration, property <letterCase> defined as \""
<< letterCase << "\"";
}
}

View file

@ -487,7 +487,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
else {
setSelectorColorGradientHorizontal(true);
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"<selectorGradientType> set to \""
"<selectorGradientType> defined as \""
<< gradientType << "\"";
}
}
@ -515,7 +515,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
setAlignment(ALIGN_RIGHT);
else
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"<horizontalAlignment> set to \""
"<horizontalAlignment> defined as \""
<< str << "\"";
}
// Legacy themes only.
@ -529,7 +529,7 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
setAlignment(ALIGN_RIGHT);
else
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"<alignment> set to \""
"<alignment> defined as \""
<< str << "\"";
}
if (elem->has("horizontalMargin")) {
@ -551,9 +551,9 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
setCapitalize(true);
}
else if (letterCase != "none") {
LOG(LogWarning)
<< "TextListComponent: Invalid theme configuration, property <letterCase> set to \""
<< letterCase << "\"";
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
"<letterCase> defined as \""
<< letterCase << "\"";
}
}

View file

@ -147,7 +147,7 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
else {
mStaticImage.setLinearInterpolation(false);
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
"<interpolation> set to \""
"<interpolation> defined as \""
<< interpolation << "\"";
}
}