From c87d92a16dc7786baaf3e33336c5f21a9af83148 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Wed, 20 Dec 2023 22:30:11 +0100 Subject: [PATCH] Added the theme font size count to the theme downloader interface --- es-app/src/guis/GuiThemeDownloader.cpp | 16 ++++++++++++---- es-app/src/guis/GuiThemeDownloader.h | 5 +++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/es-app/src/guis/GuiThemeDownloader.cpp b/es-app/src/guis/GuiThemeDownloader.cpp index 93906889d..f6623e51b 100644 --- a/es-app/src/guis/GuiThemeDownloader.cpp +++ b/es-app/src/guis/GuiThemeDownloader.cpp @@ -67,9 +67,9 @@ GuiThemeDownloader::GuiThemeDownloader(std::function updateCallback) std::make_shared("", Font::get(fontSizeSmall), mMenuColorTitle, ALIGN_LEFT); mCenterGrid->setEntry(mAspectRatiosLabel, glm::ivec2 {3, 0}, false, true, glm::ivec2 {1, 1}); - mFutureUseLabel = + mFontSizesLabel = std::make_shared("", Font::get(fontSizeSmall), mMenuColorTitle, ALIGN_LEFT); - mCenterGrid->setEntry(mFutureUseLabel, glm::ivec2 {3, 1}, false, true, glm::ivec2 {1, 1}); + mCenterGrid->setEntry(mFontSizesLabel, glm::ivec2 {3, 1}, false, true, glm::ivec2 {1, 1}); mCenterGrid->setEntry(std::make_shared(), glm::ivec2 {5, 0}, false, false, glm::ivec2 {1, 5}); @@ -86,9 +86,9 @@ GuiThemeDownloader::GuiThemeDownloader(std::function updateCallback) "", Font::get(fontSizeSmall, FONT_PATH_LIGHT), mMenuColorTitle, ALIGN_LEFT); mCenterGrid->setEntry(mAspectRatiosCount, glm::ivec2 {4, 0}, false, true, glm::ivec2 {1, 1}); - mFutureUseCount = std::make_shared("", Font::get(fontSizeSmall, FONT_PATH_LIGHT), + mFontSizesCount = std::make_shared("", Font::get(fontSizeSmall, FONT_PATH_LIGHT), mMenuColorTitle, ALIGN_LEFT); - mCenterGrid->setEntry(mFutureUseCount, glm::ivec2 {4, 1}, false, true, glm::ivec2 {1, 1}); + mCenterGrid->setEntry(mFontSizesCount, glm::ivec2 {4, 1}, false, true, glm::ivec2 {1, 1}); mDownloadStatus = std::make_shared("", Font::get(fontSizeSmall, FONT_PATH_BOLD), mMenuColorTitle, ALIGN_LEFT); @@ -674,6 +674,12 @@ void GuiThemeDownloader::parseThemesList() themeEntry.aspectRatios.emplace_back(aspectRatios[i].GetString()); } + if (theme.HasMember("fontSizes") && theme["fontSizes"].IsArray()) { + const rapidjson::Value& fontSizes {theme["fontSizes"]}; + for (int i {0}; i < static_cast(fontSizes.Size()); ++i) + themeEntry.fontSizes.emplace_back(fontSizes[i].GetString()); + } + if (theme.HasMember("transitions") && theme["transitions"].IsArray()) { const rapidjson::Value& transitions {theme["transitions"]}; for (int i {0}; i < static_cast(transitions.Size()); ++i) @@ -855,6 +861,7 @@ void GuiThemeDownloader::populateGUI() mVariantsLabel->setText("VARIANTS:"); mColorSchemesLabel->setText("COLOR SCHEMES:"); mAspectRatiosLabel->setText("ASPECT RATIOS:"); + mFontSizesLabel->setText("FONT SIZES:"); updateInfoPane(); updateHelpPrompts(); @@ -930,6 +937,7 @@ void GuiThemeDownloader::updateInfoPane() mVariantCount->setText(std::to_string(mThemes[mList->getCursorId()].variants.size())); mColorSchemesCount->setText(std::to_string(mThemes[mList->getCursorId()].colorSchemes.size())); mAspectRatiosCount->setText(std::to_string(mThemes[mList->getCursorId()].aspectRatios.size())); + mFontSizesCount->setText(std::to_string(mThemes[mList->getCursorId()].fontSizes.size())); mAuthor->setText("CREATED BY " + Utils::String::toUpper(mThemes[mList->getCursorId()].author)); } diff --git a/es-app/src/guis/GuiThemeDownloader.h b/es-app/src/guis/GuiThemeDownloader.h index ce1e8dd18..2a807756e 100644 --- a/es-app/src/guis/GuiThemeDownloader.h +++ b/es-app/src/guis/GuiThemeDownloader.h @@ -64,6 +64,7 @@ private: std::vector variants; std::vector colorSchemes; std::vector aspectRatios; + std::vector fontSizes; std::vector transitions; std::vector screenshots; bool newEntry; @@ -165,12 +166,12 @@ private: std::shared_ptr mVariantsLabel; std::shared_ptr mColorSchemesLabel; std::shared_ptr mAspectRatiosLabel; - std::shared_ptr mFutureUseLabel; + std::shared_ptr mFontSizesLabel; std::shared_ptr mAuthor; std::shared_ptr mVariantCount; std::shared_ptr mColorSchemesCount; std::shared_ptr mAspectRatiosCount; - std::shared_ptr mFutureUseCount; + std::shared_ptr mFontSizesCount; }; #endif // ES_APP_GUIS_GUI_THEME_DOWNLOADER_H