Added the theme font size count to the theme downloader interface

This commit is contained in:
Leon Styhre 2023-12-20 22:30:11 +01:00
parent 830e57a65a
commit c87d92a16d
2 changed files with 15 additions and 6 deletions

View file

@ -67,9 +67,9 @@ GuiThemeDownloader::GuiThemeDownloader(std::function<void()> updateCallback)
std::make_shared<TextComponent>("", Font::get(fontSizeSmall), mMenuColorTitle, ALIGN_LEFT); std::make_shared<TextComponent>("", Font::get(fontSizeSmall), mMenuColorTitle, ALIGN_LEFT);
mCenterGrid->setEntry(mAspectRatiosLabel, glm::ivec2 {3, 0}, false, true, glm::ivec2 {1, 1}); mCenterGrid->setEntry(mAspectRatiosLabel, glm::ivec2 {3, 0}, false, true, glm::ivec2 {1, 1});
mFutureUseLabel = mFontSizesLabel =
std::make_shared<TextComponent>("", Font::get(fontSizeSmall), mMenuColorTitle, ALIGN_LEFT); std::make_shared<TextComponent>("", 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<GuiComponent>(), glm::ivec2 {5, 0}, false, false, mCenterGrid->setEntry(std::make_shared<GuiComponent>(), glm::ivec2 {5, 0}, false, false,
glm::ivec2 {1, 5}); glm::ivec2 {1, 5});
@ -86,9 +86,9 @@ GuiThemeDownloader::GuiThemeDownloader(std::function<void()> updateCallback)
"", Font::get(fontSizeSmall, FONT_PATH_LIGHT), mMenuColorTitle, ALIGN_LEFT); "", Font::get(fontSizeSmall, FONT_PATH_LIGHT), mMenuColorTitle, ALIGN_LEFT);
mCenterGrid->setEntry(mAspectRatiosCount, glm::ivec2 {4, 0}, false, true, glm::ivec2 {1, 1}); mCenterGrid->setEntry(mAspectRatiosCount, glm::ivec2 {4, 0}, false, true, glm::ivec2 {1, 1});
mFutureUseCount = std::make_shared<TextComponent>("", Font::get(fontSizeSmall, FONT_PATH_LIGHT), mFontSizesCount = std::make_shared<TextComponent>("", Font::get(fontSizeSmall, FONT_PATH_LIGHT),
mMenuColorTitle, ALIGN_LEFT); 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<TextComponent>("", Font::get(fontSizeSmall, FONT_PATH_BOLD), mDownloadStatus = std::make_shared<TextComponent>("", Font::get(fontSizeSmall, FONT_PATH_BOLD),
mMenuColorTitle, ALIGN_LEFT); mMenuColorTitle, ALIGN_LEFT);
@ -674,6 +674,12 @@ void GuiThemeDownloader::parseThemesList()
themeEntry.aspectRatios.emplace_back(aspectRatios[i].GetString()); 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<int>(fontSizes.Size()); ++i)
themeEntry.fontSizes.emplace_back(fontSizes[i].GetString());
}
if (theme.HasMember("transitions") && theme["transitions"].IsArray()) { if (theme.HasMember("transitions") && theme["transitions"].IsArray()) {
const rapidjson::Value& transitions {theme["transitions"]}; const rapidjson::Value& transitions {theme["transitions"]};
for (int i {0}; i < static_cast<int>(transitions.Size()); ++i) for (int i {0}; i < static_cast<int>(transitions.Size()); ++i)
@ -855,6 +861,7 @@ void GuiThemeDownloader::populateGUI()
mVariantsLabel->setText("VARIANTS:"); mVariantsLabel->setText("VARIANTS:");
mColorSchemesLabel->setText("COLOR SCHEMES:"); mColorSchemesLabel->setText("COLOR SCHEMES:");
mAspectRatiosLabel->setText("ASPECT RATIOS:"); mAspectRatiosLabel->setText("ASPECT RATIOS:");
mFontSizesLabel->setText("FONT SIZES:");
updateInfoPane(); updateInfoPane();
updateHelpPrompts(); updateHelpPrompts();
@ -930,6 +937,7 @@ void GuiThemeDownloader::updateInfoPane()
mVariantCount->setText(std::to_string(mThemes[mList->getCursorId()].variants.size())); mVariantCount->setText(std::to_string(mThemes[mList->getCursorId()].variants.size()));
mColorSchemesCount->setText(std::to_string(mThemes[mList->getCursorId()].colorSchemes.size())); mColorSchemesCount->setText(std::to_string(mThemes[mList->getCursorId()].colorSchemes.size()));
mAspectRatiosCount->setText(std::to_string(mThemes[mList->getCursorId()].aspectRatios.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)); mAuthor->setText("CREATED BY " + Utils::String::toUpper(mThemes[mList->getCursorId()].author));
} }

View file

@ -64,6 +64,7 @@ private:
std::vector<std::string> variants; std::vector<std::string> variants;
std::vector<std::string> colorSchemes; std::vector<std::string> colorSchemes;
std::vector<std::string> aspectRatios; std::vector<std::string> aspectRatios;
std::vector<std::string> fontSizes;
std::vector<std::string> transitions; std::vector<std::string> transitions;
std::vector<Screenshot> screenshots; std::vector<Screenshot> screenshots;
bool newEntry; bool newEntry;
@ -165,12 +166,12 @@ private:
std::shared_ptr<TextComponent> mVariantsLabel; std::shared_ptr<TextComponent> mVariantsLabel;
std::shared_ptr<TextComponent> mColorSchemesLabel; std::shared_ptr<TextComponent> mColorSchemesLabel;
std::shared_ptr<TextComponent> mAspectRatiosLabel; std::shared_ptr<TextComponent> mAspectRatiosLabel;
std::shared_ptr<TextComponent> mFutureUseLabel; std::shared_ptr<TextComponent> mFontSizesLabel;
std::shared_ptr<TextComponent> mAuthor; std::shared_ptr<TextComponent> mAuthor;
std::shared_ptr<TextComponent> mVariantCount; std::shared_ptr<TextComponent> mVariantCount;
std::shared_ptr<TextComponent> mColorSchemesCount; std::shared_ptr<TextComponent> mColorSchemesCount;
std::shared_ptr<TextComponent> mAspectRatiosCount; std::shared_ptr<TextComponent> mAspectRatiosCount;
std::shared_ptr<TextComponent> mFutureUseCount; std::shared_ptr<TextComponent> mFontSizesCount;
}; };
#endif // ES_APP_GUIS_GUI_THEME_DOWNLOADER_H #endif // ES_APP_GUIS_GUI_THEME_DOWNLOADER_H