From 44fe2f8fe757cf2bbaaac9b6575578066628ce28 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 18 Mar 2022 20:31:04 +0100 Subject: [PATCH] Standardized some theme warning log output. --- es-core/src/components/BadgeComponent.cpp | 29 ++++++++++--------- es-core/src/components/CarouselComponent.cpp | 16 +++++----- es-core/src/components/DateTimeComponent.cpp | 12 ++++---- .../src/components/GameSelectorComponent.h | 2 +- es-core/src/components/ImageComponent.cpp | 4 +-- .../src/components/LottieAnimComponent.cpp | 12 ++++---- es-core/src/components/TextComponent.cpp | 8 ++--- es-core/src/components/TextListComponent.h | 12 ++++---- es-core/src/components/VideoComponent.cpp | 2 +- 9 files changed, 51 insertions(+), 46 deletions(-) diff --git a/es-core/src/components/BadgeComponent.cpp b/es-core/src/components/BadgeComponent.cpp index 54ded9daf..ee76b0e10 100644 --- a/es-core/src/components/BadgeComponent.cpp +++ b/es-core/src/components/BadgeComponent.cpp @@ -197,9 +197,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("horizontalAlignment")) { const std::string horizontalAlignment {elem->get("horizontalAlignment")}; if (horizontalAlignment != "left" && horizontalAlignment != "right") { - LOG(LogWarning) - << "BadgeComponent: Invalid theme configuration, set to \"" - << horizontalAlignment << "\""; + LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, " + "defined as \"" + << horizontalAlignment << "\""; } else { mFlexboxComponent.setAlignment(horizontalAlignment); @@ -209,8 +209,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, else if (elem->has("alignment")) { const std::string alignment {elem->get("alignment")}; if (alignment != "left" && alignment != "right") { - LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, set to \"" - << alignment << "\""; + LOG(LogWarning) + << "BadgeComponent: Invalid theme configuration, defined as \"" + << alignment << "\""; } else { mFlexboxComponent.setAlignment(alignment); @@ -220,8 +221,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("direction")) { const std::string direction {elem->get("direction")}; if (direction != "row" && direction != "column") { - LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, set to \"" - << direction << "\""; + LOG(LogWarning) + << "BadgeComponent: Invalid theme configuration, defined as \"" + << direction << "\""; } else { mFlexboxComponent.setDirection(direction); @@ -231,7 +233,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("lines")) { const unsigned int lines {elem->get("lines")}; if (lines < 1 || lines > 10) { - LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, set to \"" + LOG(LogWarning) << "BadgeComponent: Invalid theme configuration, defined as \"" << lines << "\""; } else { @@ -243,7 +245,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, const unsigned int itemsPerLine {elem->get("itemsPerLine")}; if (itemsPerLine < 1 || itemsPerLine > 10) { LOG(LogWarning) - << "BadgeComponent: Invalid theme configuration, set to \"" + << "BadgeComponent: Invalid theme configuration, defined as \"" << itemsPerLine << "\""; } else { @@ -256,8 +258,9 @@ void BadgeComponent::applyTheme(const std::shared_ptr& 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, set to \"" - << itemMargin.x << " " << itemMargin.y << "\""; + LOG(LogWarning) + << "BadgeComponent: Invalid theme configuration, defined as \"" + << itemMargin.x << " " << itemMargin.y << "\""; } else { mFlexboxComponent.setItemMargin(itemMargin); @@ -269,7 +272,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, if (controllerPos.x < -1.0f || controllerPos.x > 2.0f || controllerPos.y < -1.0f || controllerPos.y > 2.0f) { LOG(LogWarning) - << "BadgeComponent: Invalid theme configuration, set to \"" + << "BadgeComponent: Invalid theme configuration, defined as \"" << controllerPos.x << " " << controllerPos.y << "\""; } else { @@ -281,7 +284,7 @@ void BadgeComponent::applyTheme(const std::shared_ptr& theme, const float controllerSize = elem->get("controllerSize"); if (controllerSize < 0.1f || controllerSize > 2.0f) { LOG(LogWarning) - << "BadgeComponent: Invalid theme configuration, set to \"" + << "BadgeComponent: Invalid theme configuration, defined as \"" << controllerSize << "\""; } else { diff --git a/es-core/src/components/CarouselComponent.cpp b/es-core/src/components/CarouselComponent.cpp index 7bdc1a659..7dcda6872 100644 --- a/es-core/src/components/CarouselComponent.cpp +++ b/es-core/src/components/CarouselComponent.cpp @@ -334,7 +334,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, } else { LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << type << "\""; mType = HORIZONTAL; } @@ -358,7 +358,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, else { mColorGradientHorizontal = true; LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << gradientType << "\""; } } @@ -406,7 +406,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, } else { LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << alignment << "\""; mLogoHorizontalAlignment = ALIGN_CENTER; } @@ -425,7 +425,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, } else { LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << alignment << "\""; mLogoVerticalAlignment = ALIGN_CENTER; } @@ -456,7 +456,7 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, } else { LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << alignment << "\""; mLogoHorizontalAlignment = ALIGN_CENTER; mLogoVerticalAlignment = ALIGN_CENTER; @@ -492,9 +492,9 @@ void CarouselComponent::applyTheme(const std::shared_ptr& theme, mText = elem->get("text"); } else { - LOG(LogWarning) - << "CarouselComponent: Invalid theme configuration, property set to \"" - << letterCase << "\""; + LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property " + " defined as \"" + << letterCase << "\""; mText = elem->get("text"); } } diff --git a/es-core/src/components/DateTimeComponent.cpp b/es-core/src/components/DateTimeComponent.cpp index b86d7e601..37667e4da 100644 --- a/es-core/src/components/DateTimeComponent.cpp +++ b/es-core/src/components/DateTimeComponent.cpp @@ -139,7 +139,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr& theme, setHorizontalAlignment(ALIGN_RIGHT); else LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -153,7 +153,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr& theme, setVerticalAlignment(ALIGN_BOTTOM); else LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -168,7 +168,7 @@ void DateTimeComponent::applyTheme(const std::shared_ptr& theme, setHorizontalAlignment(ALIGN_RIGHT); else LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -193,9 +193,9 @@ void DateTimeComponent::applyTheme(const std::shared_ptr& theme, setCapitalize(true); } else if (letterCase != "none") { - LOG(LogWarning) - << "DateTimeComponent: Invalid theme configuration, property set to \"" - << letterCase << "\""; + LOG(LogWarning) << "DateTimeComponent: Invalid theme configuration, property " + " defined as \"" + << letterCase << "\""; } } diff --git a/es-core/src/components/GameSelectorComponent.h b/es-core/src/components/GameSelectorComponent.h index 8a7f7a2c0..7c4a06b78 100644 --- a/es-core/src/components/GameSelectorComponent.h +++ b/es-core/src/components/GameSelectorComponent.h @@ -126,7 +126,7 @@ public: else { mGameSelection = GameSelection::RANDOM; LOG(LogWarning) << "GameSelectorComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << selection << "\""; } } diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index c9fe5f5d6..82a115e0a 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -514,7 +514,7 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, else { mLinearInterpolation = false; LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << interpolation << "\""; } } @@ -553,7 +553,7 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, else { setColorGradientHorizontal(true); LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << gradientType << "\""; } } diff --git a/es-core/src/components/LottieAnimComponent.cpp b/es-core/src/components/LottieAnimComponent.cpp index 0ec026af9..1d4533f67 100644 --- a/es-core/src/components/LottieAnimComponent.cpp +++ b/es-core/src/components/LottieAnimComponent.cpp @@ -231,8 +231,9 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("size")) { glm::vec2 size = elem->get("size"); if (size.x == 0.0f && size.y == 0.0f) { - LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, set to \"" - << size.x << " " << size.y << "\""; + LOG(LogWarning) + << "LottieAnimComponent: Invalid theme configuration, defined as \"" + << size.x << " " << size.y << "\""; return; } } @@ -240,8 +241,9 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr& theme, if (elem->has("speed")) { const float speed {elem->get("speed")}; if (speed < 0.2f || speed > 3.0f) { - LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, set to \"" - << std::fixed << std::setprecision(1) << speed << "\""; + LOG(LogWarning) + << "LottieAnimComponent: Invalid theme configuration, defined as \"" + << std::fixed << std::setprecision(1) << speed << "\""; } else { mSpeedModifier = speed; @@ -271,7 +273,7 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr& theme, } else { LOG(LogWarning) - << "LottieAnimComponent: Invalid theme configuration, set to \"" + << "LottieAnimComponent: Invalid theme configuration, defined as \"" << direction << "\""; mStartDirection = "normal"; mAlternate = false; diff --git a/es-core/src/components/TextComponent.cpp b/es-core/src/components/TextComponent.cpp index 2973b5a00..f95b0bd86 100644 --- a/es-core/src/components/TextComponent.cpp +++ b/es-core/src/components/TextComponent.cpp @@ -398,7 +398,7 @@ void TextComponent::applyTheme(const std::shared_ptr& theme, else LOG(LogWarning) << componentName << ": Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -413,7 +413,7 @@ void TextComponent::applyTheme(const std::shared_ptr& theme, else LOG(LogWarning) << componentName << ": Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -429,7 +429,7 @@ void TextComponent::applyTheme(const std::shared_ptr& theme, else LOG(LogWarning) << componentName << ": Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } @@ -455,7 +455,7 @@ void TextComponent::applyTheme(const std::shared_ptr& theme, } else if (letterCase != "none") { LOG(LogWarning) - << "TextComponent: Invalid theme configuration, property set to \"" + << "TextComponent: Invalid theme configuration, property defined as \"" << letterCase << "\""; } } diff --git a/es-core/src/components/TextListComponent.h b/es-core/src/components/TextListComponent.h index 0a7d9526b..56bfb15d3 100644 --- a/es-core/src/components/TextListComponent.h +++ b/es-core/src/components/TextListComponent.h @@ -487,7 +487,7 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, else { setSelectorColorGradientHorizontal(true); LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << gradientType << "\""; } } @@ -515,7 +515,7 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, setAlignment(ALIGN_RIGHT); else LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } // Legacy themes only. @@ -529,7 +529,7 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, setAlignment(ALIGN_RIGHT); else LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << str << "\""; } if (elem->has("horizontalMargin")) { @@ -551,9 +551,9 @@ void TextListComponent::applyTheme(const std::shared_ptr& theme, setCapitalize(true); } else if (letterCase != "none") { - LOG(LogWarning) - << "TextListComponent: Invalid theme configuration, property set to \"" - << letterCase << "\""; + LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property " + " defined as \"" + << letterCase << "\""; } } diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index 64a1c3fc9..35e58baa7 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -147,7 +147,7 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, else { mStaticImage.setLinearInterpolation(false); LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property " - " set to \"" + " defined as \"" << interpolation << "\""; } }