mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Generalized the carousel property names and added support for setting media types for gamelist carousels.
This commit is contained in:
parent
b5ffd4a2c4
commit
f463766497
|
@ -557,15 +557,43 @@ void GamelistBase::populateList(const std::vector<FileData*>& files, FileData* f
|
||||||
|
|
||||||
auto theme = mRoot->getSystem()->getTheme();
|
auto theme = mRoot->getSystem()->getTheme();
|
||||||
std::string name;
|
std::string name;
|
||||||
|
std::string carouselItemType;
|
||||||
|
std::string carouselDefaultItem;
|
||||||
unsigned int color {0};
|
unsigned int color {0};
|
||||||
|
|
||||||
|
if (mCarousel != nullptr) {
|
||||||
|
carouselItemType = mCarousel->getItemType();
|
||||||
|
carouselDefaultItem = mCarousel->getDefaultItem();
|
||||||
|
}
|
||||||
|
|
||||||
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 (mCarousel != nullptr) {
|
if (mCarousel != nullptr) {
|
||||||
|
assert(carouselItemType != "");
|
||||||
|
|
||||||
CarouselComponent<FileData*>::Entry carouselEntry;
|
CarouselComponent<FileData*>::Entry carouselEntry;
|
||||||
carouselEntry.name = (*it)->getName();
|
carouselEntry.name = (*it)->getName();
|
||||||
carouselEntry.object = *it;
|
carouselEntry.object = *it;
|
||||||
carouselEntry.data.logoPath = (*it)->getMarqueePath();
|
if (carouselItemType == "" || carouselItemType == "marquee")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getMarqueePath();
|
||||||
|
else if (carouselItemType == "cover")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getCoverPath();
|
||||||
|
else if (carouselItemType == "3dbox")
|
||||||
|
carouselEntry.data.logoPath = (*it)->get3DBoxPath();
|
||||||
|
else if (carouselItemType == "screenshot")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getScreenshotPath();
|
||||||
|
else if (carouselItemType == "titlescreen")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getTitleScreenPath();
|
||||||
|
else if (carouselItemType == "backcover")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getBackCoverPath();
|
||||||
|
else if (carouselItemType == "miximage")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getMiximagePath();
|
||||||
|
else if (carouselItemType == "fanart")
|
||||||
|
carouselEntry.data.logoPath = (*it)->getFanArtPath();
|
||||||
|
|
||||||
|
if (carouselDefaultItem != "")
|
||||||
|
carouselEntry.data.defaultLogoPath = carouselDefaultItem;
|
||||||
|
|
||||||
mCarousel->addEntry(carouselEntry, theme);
|
mCarousel->addEntry(carouselEntry, theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,6 +136,27 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||||
if (element.second.type == "carousel") {
|
if (element.second.type == "carousel") {
|
||||||
if (mCarousel == nullptr) {
|
if (mCarousel == nullptr) {
|
||||||
mCarousel = std::make_unique<CarouselComponent<FileData*>>();
|
mCarousel = std::make_unique<CarouselComponent<FileData*>>();
|
||||||
|
if (element.second.has("itemType")) {
|
||||||
|
const std::string itemType {element.second.get<std::string>("itemType")};
|
||||||
|
if (itemType == "marquee" || itemType == "cover" || itemType == "3dbox" ||
|
||||||
|
itemType == "screenshot" || itemType == "titlescreen" ||
|
||||||
|
itemType == "backcover" || itemType == "miximage" ||
|
||||||
|
itemType == "fanart") {
|
||||||
|
mCarousel->setItemType(itemType);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG(LogWarning)
|
||||||
|
<< "GamelistView::onThemeChanged(): Invalid theme configuration, "
|
||||||
|
"<itemType> property defined as \""
|
||||||
|
<< itemType << "\"";
|
||||||
|
mCarousel->setItemType("marquee");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mCarousel->setItemType("marquee");
|
||||||
|
}
|
||||||
|
if (element.second.has("defaultItem"))
|
||||||
|
mCarousel->setDefaultItem(element.second.get<std::string>("defaultItem"));
|
||||||
mPrimary = mCarousel.get();
|
mPrimary = mCarousel.get();
|
||||||
}
|
}
|
||||||
mPrimary->setCursorChangedCallback(
|
mPrimary->setCursorChangedCallback(
|
||||||
|
|
|
@ -466,10 +466,10 @@ void SystemView::populate()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (mCarousel != nullptr) {
|
if (mCarousel != nullptr) {
|
||||||
if (element.second.has("logo"))
|
if (element.second.has("staticItem"))
|
||||||
logoPath = element.second.get<std::string>("logo");
|
logoPath = element.second.get<std::string>("staticItem");
|
||||||
if (element.second.has("defaultLogo"))
|
if (element.second.has("defaultItem"))
|
||||||
defaultLogoPath = element.second.get<std::string>("defaultLogo");
|
defaultLogoPath = element.second.get<std::string>("defaultItem");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (element.second.type == "image") {
|
else if (element.second.type == "image") {
|
||||||
|
|
|
@ -48,7 +48,13 @@ std::vector<std::string> ThemeData::sLegacyElements {
|
||||||
{"showSnapshotDelay"},
|
{"showSnapshotDelay"},
|
||||||
{"forceUppercase"},
|
{"forceUppercase"},
|
||||||
{"alignment"},
|
{"alignment"},
|
||||||
{"logoAlignment"}};
|
{"defaultLogo"},
|
||||||
|
{"logoSize"},
|
||||||
|
{"logoScale"},
|
||||||
|
{"logoRotation"},
|
||||||
|
{"logoRotationOrigin"},
|
||||||
|
{"logoAlignment"},
|
||||||
|
{"maxLogoCount"}};
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> ThemeData::sSupportedAspectRatios {
|
std::vector<std::pair<std::string, std::string>> ThemeData::sSupportedAspectRatios {
|
||||||
{"16:9", "16:9"},
|
{"16:9", "16:9"},
|
||||||
|
@ -120,8 +126,8 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"saturation", FLOAT},
|
{"saturation", FLOAT},
|
||||||
{"visible", BOOLEAN},
|
{"visible", BOOLEAN},
|
||||||
{"zIndex", FLOAT},
|
{"zIndex", FLOAT},
|
||||||
{"showSnapshotNoVideo", BOOLEAN}, // For backward compatibility with legacy themes.
|
{"showSnapshotNoVideo", BOOLEAN}, // For backward compatibility with legacy themes.
|
||||||
{"showSnapshotDelay", BOOLEAN}}}, // For backward compatibility with legacy themes.
|
{"showSnapshotDelay", BOOLEAN}}}, // For backward compatibility with legacy themes.
|
||||||
{"animation",
|
{"animation",
|
||||||
{{"pos", NORMALIZED_PAIR},
|
{{"pos", NORMALIZED_PAIR},
|
||||||
{"size", NORMALIZED_PAIR},
|
{"size", NORMALIZED_PAIR},
|
||||||
|
@ -144,7 +150,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"rotation", FLOAT},
|
{"rotation", FLOAT},
|
||||||
{"rotationOrigin", NORMALIZED_PAIR},
|
{"rotationOrigin", NORMALIZED_PAIR},
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"direction", STRING},
|
{"direction", STRING},
|
||||||
{"lines", UNSIGNED_INTEGER},
|
{"lines", UNSIGNED_INTEGER},
|
||||||
{"itemsPerLine", UNSIGNED_INTEGER},
|
{"itemsPerLine", UNSIGNED_INTEGER},
|
||||||
|
@ -178,11 +184,11 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
{"verticalAlignment", STRING},
|
{"verticalAlignment", STRING},
|
||||||
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"color", COLOR},
|
{"color", COLOR},
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"letterCase", STRING},
|
{"letterCase", STRING},
|
||||||
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
{"opacity", FLOAT},
|
{"opacity", FLOAT},
|
||||||
{"visible", BOOLEAN},
|
{"visible", BOOLEAN},
|
||||||
|
@ -199,11 +205,11 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
{"verticalAlignment", STRING},
|
{"verticalAlignment", STRING},
|
||||||
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"color", COLOR},
|
{"color", COLOR},
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"letterCase", STRING},
|
{"letterCase", STRING},
|
||||||
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
{"forceUppercase", BOOLEAN}, // For backward compatibility with legacy themes.
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
{"format", STRING},
|
{"format", STRING},
|
||||||
{"displayRelative", BOOLEAN},
|
{"displayRelative", BOOLEAN},
|
||||||
|
@ -222,7 +228,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"backgroundColor", COLOR},
|
{"backgroundColor", COLOR},
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
{"verticalAlignment", STRING},
|
{"verticalAlignment", STRING},
|
||||||
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"opacity", FLOAT},
|
{"opacity", FLOAT},
|
||||||
{"visible", BOOLEAN},
|
{"visible", BOOLEAN},
|
||||||
{"zIndex", FLOAT}}},
|
{"zIndex", FLOAT}}},
|
||||||
|
@ -247,16 +253,23 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"color", COLOR},
|
{"color", COLOR},
|
||||||
{"colorEnd", COLOR},
|
{"colorEnd", COLOR},
|
||||||
{"gradientType", STRING},
|
{"gradientType", STRING},
|
||||||
{"logo", PATH},
|
{"staticItem", PATH},
|
||||||
{"defaultLogo", PATH},
|
{"itemType", STRING},
|
||||||
{"logoSize", NORMALIZED_PAIR},
|
{"defaultItem", PATH},
|
||||||
{"logoScale", FLOAT},
|
{"itemSize", NORMALIZED_PAIR},
|
||||||
{"logoRotation", FLOAT},
|
{"itemScale", FLOAT},
|
||||||
{"logoRotationOrigin", NORMALIZED_PAIR},
|
{"itemRotation", FLOAT},
|
||||||
{"logoHorizontalAlignment", STRING},
|
{"itemRotationOrigin", NORMALIZED_PAIR},
|
||||||
{"logoVerticalAlignment", STRING},
|
{"itemHorizontalAlignment", STRING},
|
||||||
{"logoAlignment", STRING}, // For backward compatibility with legacy themes.
|
{"itemVerticalAlignment", STRING},
|
||||||
{"maxLogoCount", FLOAT},
|
{"maxItemCount", FLOAT},
|
||||||
|
{"defaultLogo", PATH}, // For backward compatibility with legacy themes.
|
||||||
|
{"logoSize", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
||||||
|
{"logoScale", FLOAT}, // For backward compatibility with legacy themes.
|
||||||
|
{"logoRotation", FLOAT}, // For backward compatibility with legacy themes.
|
||||||
|
{"logoRotationOrigin", NORMALIZED_PAIR}, // For backward compatibility with legacy themes.
|
||||||
|
{"logoAlignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
|
{"maxLogoCount", FLOAT}, // For backward compatibility with legacy themes.
|
||||||
{"text", STRING},
|
{"text", STRING},
|
||||||
{"textColor", COLOR},
|
{"textColor", COLOR},
|
||||||
{"textBackgroundColor", COLOR},
|
{"textBackgroundColor", COLOR},
|
||||||
|
@ -265,7 +278,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"lineSpacing", FLOAT},
|
{"lineSpacing", FLOAT},
|
||||||
{"zIndex", FLOAT},
|
{"zIndex", FLOAT},
|
||||||
{"legacyZIndexMode", STRING}}}, // For backward compatibility with legacy themes.
|
{"legacyZIndexMode", STRING}}}, // For backward compatibility with legacy themes.
|
||||||
{"textlist",
|
{"textlist",
|
||||||
{{"pos", NORMALIZED_PAIR},
|
{{"pos", NORMALIZED_PAIR},
|
||||||
{"size", NORMALIZED_PAIR},
|
{"size", NORMALIZED_PAIR},
|
||||||
|
@ -282,12 +295,12 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"secondaryColor", COLOR},
|
{"secondaryColor", COLOR},
|
||||||
{"fontPath", PATH},
|
{"fontPath", PATH},
|
||||||
{"fontSize", FLOAT},
|
{"fontSize", FLOAT},
|
||||||
{"scrollSound", PATH}, // For backward compatibility with legacy themes.
|
{"scrollSound", PATH}, // For backward compatibility with legacy themes.
|
||||||
{"horizontalAlignment", STRING},
|
{"horizontalAlignment", STRING},
|
||||||
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
{"alignment", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"horizontalMargin", FLOAT},
|
{"horizontalMargin", FLOAT},
|
||||||
{"letterCase", STRING},
|
{"letterCase", 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},
|
||||||
{"collectionIndicators", STRING},
|
{"collectionIndicators", STRING},
|
||||||
|
@ -307,7 +320,7 @@ std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>>
|
||||||
{"entrySpacing", FLOAT},
|
{"entrySpacing", FLOAT},
|
||||||
{"iconTextSpacing", FLOAT},
|
{"iconTextSpacing", FLOAT},
|
||||||
{"letterCase", STRING},
|
{"letterCase", STRING},
|
||||||
{"textStyle", STRING}, // For backward compatibility with legacy themes.
|
{"textStyle", STRING}, // For backward compatibility with legacy themes.
|
||||||
{"opacity", FLOAT},
|
{"opacity", FLOAT},
|
||||||
{"customButtonIcon", PATH}}},
|
{"customButtonIcon", PATH}}},
|
||||||
{"sound",
|
{"sound",
|
||||||
|
|
|
@ -55,6 +55,10 @@ public:
|
||||||
void addEntry(Entry& entry, const std::shared_ptr<ThemeData>& theme = nullptr);
|
void addEntry(Entry& entry, const std::shared_ptr<ThemeData>& theme = nullptr);
|
||||||
Entry& getEntry(int index) { return mEntries.at(index); }
|
Entry& getEntry(int index) { return mEntries.at(index); }
|
||||||
const CarouselType getType() { return mType; }
|
const CarouselType getType() { return mType; }
|
||||||
|
const std::string& getItemType() { return mItemType; }
|
||||||
|
void setItemType(std::string itemType) { mItemType = itemType; }
|
||||||
|
const std::string& getDefaultItem() { return mDefaultItem; }
|
||||||
|
void setDefaultItem(std::string defaultItem) { mDefaultItem = defaultItem; }
|
||||||
|
|
||||||
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
|
void setCursorChangedCallback(const std::function<void(CursorState state)>& func) override
|
||||||
{
|
{
|
||||||
|
@ -111,6 +115,8 @@ private:
|
||||||
bool mTriggerJump;
|
bool mTriggerJump;
|
||||||
|
|
||||||
CarouselType mType;
|
CarouselType mType;
|
||||||
|
std::string mItemType;
|
||||||
|
std::string mDefaultItem;
|
||||||
std::shared_ptr<Font> mFont;
|
std::shared_ptr<Font> mFont;
|
||||||
unsigned int mTextColor;
|
unsigned int mTextColor;
|
||||||
unsigned int mTextBackgroundColor;
|
unsigned int mTextBackgroundColor;
|
||||||
|
@ -547,6 +553,75 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!theme->isLegacyTheme()) {
|
||||||
|
if (elem->has("itemScale"))
|
||||||
|
mLogoScale = glm::clamp(elem->get<float>("itemScale"), 0.5f, 3.0f);
|
||||||
|
if (elem->has("itemSize")) {
|
||||||
|
// Keep size within a 0.05 and 1.0 multiple of the screen size.
|
||||||
|
glm::vec2 logoSize {elem->get<glm::vec2>("itemSize")};
|
||||||
|
if (std::max(logoSize.x, logoSize.y) > 1.0f) {
|
||||||
|
logoSize /= std::max(logoSize.x, logoSize.y);
|
||||||
|
}
|
||||||
|
else if (std::min(logoSize.x, logoSize.y) < 0.005f) {
|
||||||
|
float ratio {std::min(logoSize.x, logoSize.y) / 0.005f};
|
||||||
|
logoSize /= ratio;
|
||||||
|
// Just an extra precaution if a crazy ratio was used.
|
||||||
|
logoSize.x = glm::clamp(logoSize.x, 0.005f, 1.0f);
|
||||||
|
logoSize.y = glm::clamp(logoSize.y, 0.005f, 1.0f);
|
||||||
|
}
|
||||||
|
mLogoSize =
|
||||||
|
logoSize * glm::vec2(Renderer::getScreenWidth(), Renderer::getScreenHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem->has("maxItemCount"))
|
||||||
|
mMaxLogoCount = glm::clamp(elem->get<float>("maxItemCount"), 0.5f, 30.0f);
|
||||||
|
|
||||||
|
if (elem->has("itemRotation"))
|
||||||
|
mLogoRotation = elem->get<float>("itemRotation");
|
||||||
|
if (elem->has("itemRotationOrigin"))
|
||||||
|
mLogoRotationOrigin = elem->get<glm::vec2>("itemRotationOrigin");
|
||||||
|
|
||||||
|
if (elem->has("itemHorizontalAlignment")) {
|
||||||
|
const std::string alignment {elem->get<std::string>("itemHorizontalAlignment")};
|
||||||
|
if (alignment == "left" && mType != CarouselType::HORIZONTAL) {
|
||||||
|
mLogoHorizontalAlignment = ALIGN_LEFT;
|
||||||
|
}
|
||||||
|
else if (alignment == "right" && mType != CarouselType::HORIZONTAL) {
|
||||||
|
mLogoHorizontalAlignment = ALIGN_RIGHT;
|
||||||
|
}
|
||||||
|
else if (alignment == "center") {
|
||||||
|
mLogoHorizontalAlignment = ALIGN_CENTER;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
|
||||||
|
"<itemHorizontalAlignment> defined as \""
|
||||||
|
<< alignment << "\"";
|
||||||
|
mLogoHorizontalAlignment = ALIGN_CENTER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (elem->has("itemVerticalAlignment")) {
|
||||||
|
const std::string alignment {elem->get<std::string>("itemVerticalAlignment")};
|
||||||
|
if (alignment == "top" && mType != CarouselType::VERTICAL) {
|
||||||
|
mLogoVerticalAlignment = ALIGN_TOP;
|
||||||
|
}
|
||||||
|
else if (alignment == "bottom" && mType != CarouselType::VERTICAL) {
|
||||||
|
mLogoVerticalAlignment = ALIGN_BOTTOM;
|
||||||
|
}
|
||||||
|
else if (alignment == "center") {
|
||||||
|
mLogoVerticalAlignment = ALIGN_CENTER;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
|
||||||
|
"<itemVerticalAlignment> defined as \""
|
||||||
|
<< alignment << "\"";
|
||||||
|
mLogoVerticalAlignment = ALIGN_CENTER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start of legacy themes only section.
|
||||||
|
|
||||||
if (elem->has("logoScale"))
|
if (elem->has("logoScale"))
|
||||||
mLogoScale = glm::clamp(elem->get<float>("logoScale"), 0.5f, 3.0f);
|
mLogoScale = glm::clamp(elem->get<float>("logoScale"), 0.5f, 3.0f);
|
||||||
if (elem->has("logoSize")) {
|
if (elem->has("logoSize")) {
|
||||||
|
@ -577,45 +652,6 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
if (elem->has("logoRotationOrigin"))
|
if (elem->has("logoRotationOrigin"))
|
||||||
mLogoRotationOrigin = elem->get<glm::vec2>("logoRotationOrigin");
|
mLogoRotationOrigin = elem->get<glm::vec2>("logoRotationOrigin");
|
||||||
|
|
||||||
if (elem->has("logoHorizontalAlignment")) {
|
|
||||||
const std::string alignment {elem->get<std::string>("logoHorizontalAlignment")};
|
|
||||||
if (alignment == "left" && mType != CarouselType::HORIZONTAL) {
|
|
||||||
mLogoHorizontalAlignment = ALIGN_LEFT;
|
|
||||||
}
|
|
||||||
else if (alignment == "right" && mType != CarouselType::HORIZONTAL) {
|
|
||||||
mLogoHorizontalAlignment = ALIGN_RIGHT;
|
|
||||||
}
|
|
||||||
else if (alignment == "center") {
|
|
||||||
mLogoHorizontalAlignment = ALIGN_CENTER;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
|
|
||||||
"<logoHorizontalAlignment> defined as \""
|
|
||||||
<< alignment << "\"";
|
|
||||||
mLogoHorizontalAlignment = ALIGN_CENTER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (elem->has("logoVerticalAlignment")) {
|
|
||||||
const std::string alignment {elem->get<std::string>("logoVerticalAlignment")};
|
|
||||||
if (alignment == "top" && mType != CarouselType::VERTICAL) {
|
|
||||||
mLogoVerticalAlignment = ALIGN_TOP;
|
|
||||||
}
|
|
||||||
else if (alignment == "bottom" && mType != CarouselType::VERTICAL) {
|
|
||||||
mLogoVerticalAlignment = ALIGN_BOTTOM;
|
|
||||||
}
|
|
||||||
else if (alignment == "center") {
|
|
||||||
mLogoVerticalAlignment = ALIGN_CENTER;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
|
|
||||||
"<logoVerticalAlignment> defined as \""
|
|
||||||
<< alignment << "\"";
|
|
||||||
mLogoVerticalAlignment = ALIGN_CENTER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy themes only.
|
|
||||||
if (elem->has("logoAlignment")) {
|
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) {
|
if (alignment == "left" && mType != CarouselType::HORIZONTAL) {
|
||||||
|
@ -647,6 +683,8 @@ void CarouselComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// End of legacy theme section.
|
||||||
|
|
||||||
mFont = Font::getFromTheme(elem, properties, mFont);
|
mFont = Font::getFromTheme(elem, properties, mFont);
|
||||||
|
|
||||||
if (elem->has("textColor"))
|
if (elem->has("textColor"))
|
||||||
|
|
Loading…
Reference in a new issue