mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Removed legacy theme support from GuiThemeDownloader.
This commit is contained in:
parent
875a6bf7d7
commit
b1fec4683e
|
@ -57,77 +57,68 @@ void GuiThemeDownloader::parseThemesList()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> themeObjects {"themeSets", "legacyThemeSets"};
|
if (doc.HasMember("themeSets") && doc["themeSets"].IsArray()) {
|
||||||
|
const rapidjson::Value& themeSets {doc["themeSets"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(themeSets.Size()); ++i) {
|
||||||
|
ThemeEntry themeEntry;
|
||||||
|
const rapidjson::Value& theme {themeSets[i]};
|
||||||
|
|
||||||
for (auto& themeObject : themeObjects) {
|
if (theme.HasMember("name") && theme["name"].IsString())
|
||||||
if (doc.HasMember(themeObject.c_str()) && doc[themeObject.c_str()].IsArray()) {
|
themeEntry.name = theme["name"].GetString();
|
||||||
const rapidjson::Value& themeSets {doc[themeObject.c_str()]};
|
|
||||||
for (int i {0}; i < static_cast<int>(themeSets.Size()); ++i) {
|
|
||||||
ThemeEntry themeEntry;
|
|
||||||
const rapidjson::Value& theme {themeSets[i]};
|
|
||||||
|
|
||||||
if (theme.HasMember("name") && theme["name"].IsString())
|
if (theme.HasMember("reponame") && theme["reponame"].IsString())
|
||||||
themeEntry.name = theme["name"].GetString();
|
themeEntry.reponame = theme["reponame"].GetString();
|
||||||
|
|
||||||
if (theme.HasMember("reponame") && theme["reponame"].IsString())
|
if (theme.HasMember("url") && theme["url"].IsString())
|
||||||
themeEntry.reponame = theme["reponame"].GetString();
|
themeEntry.url = theme["url"].GetString();
|
||||||
|
|
||||||
if (theme.HasMember("url") && theme["url"].IsString())
|
if (theme.HasMember("bundled") && theme["bundled"].IsBool())
|
||||||
themeEntry.url = theme["url"].GetString();
|
themeEntry.bundled = theme["bundled"].GetBool();
|
||||||
|
|
||||||
if (theme.HasMember("bundled") && theme["bundled"].IsBool())
|
if (theme.HasMember("variants") && theme["variants"].IsArray()) {
|
||||||
themeEntry.bundled = theme["bundled"].GetBool();
|
const rapidjson::Value& variants {theme["variants"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(variants.Size()); ++i)
|
||||||
if (theme.HasMember("variants") && theme["variants"].IsArray()) {
|
themeEntry.variants.emplace_back(variants[i].GetString());
|
||||||
const rapidjson::Value& variants {theme["variants"]};
|
|
||||||
for (int i {0}; i < static_cast<int>(variants.Size()); ++i)
|
|
||||||
themeEntry.variants.emplace_back(variants[i].GetString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme.HasMember("colorSchemes") && theme["colorSchemes"].IsArray()) {
|
|
||||||
const rapidjson::Value& colorSchemes {theme["colorSchemes"]};
|
|
||||||
for (int i {0}; i < static_cast<int>(colorSchemes.Size()); ++i)
|
|
||||||
themeEntry.colorSchemes.emplace_back(colorSchemes[i].GetString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme.HasMember("aspectRatios") && theme["aspectRatios"].IsArray()) {
|
|
||||||
const rapidjson::Value& aspectRatios {theme["aspectRatios"]};
|
|
||||||
for (int i {0}; i < static_cast<int>(aspectRatios.Size()); ++i)
|
|
||||||
themeEntry.aspectRatios.emplace_back(aspectRatios[i].GetString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme.HasMember("transitions") && theme["transitions"].IsArray()) {
|
|
||||||
const rapidjson::Value& transitions {theme["transitions"]};
|
|
||||||
for (int i {0}; i < static_cast<int>(transitions.Size()); ++i)
|
|
||||||
themeEntry.transitions.emplace_back(transitions[i].GetString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (theme.HasMember("screenshots") && theme["screenshots"].IsArray()) {
|
|
||||||
const rapidjson::Value& screenshots {theme["screenshots"]};
|
|
||||||
for (int i {0}; i < static_cast<int>(screenshots.Size()); ++i) {
|
|
||||||
Screenshot screenshotEntry;
|
|
||||||
if (screenshots[i].HasMember("image") && screenshots[i]["image"].IsString())
|
|
||||||
screenshotEntry.image = screenshots[i]["image"].GetString();
|
|
||||||
|
|
||||||
if (screenshots[i].HasMember("caption") &&
|
|
||||||
screenshots[i]["caption"].IsString())
|
|
||||||
screenshotEntry.caption = screenshots[i]["caption"].GetString();
|
|
||||||
|
|
||||||
if (screenshotEntry.image != "" && screenshotEntry.caption != "")
|
|
||||||
themeEntry.screenshots.emplace_back(screenshotEntry);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (themeObject == "themeSets")
|
|
||||||
mThemeSets.emplace_back(themeEntry);
|
|
||||||
else
|
|
||||||
mLegacyThemeSets.emplace_back(themeEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (theme.HasMember("colorSchemes") && theme["colorSchemes"].IsArray()) {
|
||||||
|
const rapidjson::Value& colorSchemes {theme["colorSchemes"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(colorSchemes.Size()); ++i)
|
||||||
|
themeEntry.colorSchemes.emplace_back(colorSchemes[i].GetString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theme.HasMember("aspectRatios") && theme["aspectRatios"].IsArray()) {
|
||||||
|
const rapidjson::Value& aspectRatios {theme["aspectRatios"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(aspectRatios.Size()); ++i)
|
||||||
|
themeEntry.aspectRatios.emplace_back(aspectRatios[i].GetString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theme.HasMember("transitions") && theme["transitions"].IsArray()) {
|
||||||
|
const rapidjson::Value& transitions {theme["transitions"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(transitions.Size()); ++i)
|
||||||
|
themeEntry.transitions.emplace_back(transitions[i].GetString());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theme.HasMember("screenshots") && theme["screenshots"].IsArray()) {
|
||||||
|
const rapidjson::Value& screenshots {theme["screenshots"]};
|
||||||
|
for (int i {0}; i < static_cast<int>(screenshots.Size()); ++i) {
|
||||||
|
Screenshot screenshotEntry;
|
||||||
|
if (screenshots[i].HasMember("image") && screenshots[i]["image"].IsString())
|
||||||
|
screenshotEntry.image = screenshots[i]["image"].GetString();
|
||||||
|
|
||||||
|
if (screenshots[i].HasMember("caption") && screenshots[i]["caption"].IsString())
|
||||||
|
screenshotEntry.caption = screenshots[i]["caption"].GetString();
|
||||||
|
|
||||||
|
if (screenshotEntry.image != "" && screenshotEntry.caption != "")
|
||||||
|
themeEntry.screenshots.emplace_back(screenshotEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mThemeSets.emplace_back(themeEntry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LogInfo) << "GuiThemeDownloader: Parsed " << mThemeSets.size() << " theme sets and "
|
LOG(LogInfo) << "GuiThemeDownloader: Parsed " << mThemeSets.size() << " theme sets";
|
||||||
<< mLegacyThemeSets.size() << " legacy theme sets";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiThemeDownloader::onSizeChanged()
|
void GuiThemeDownloader::onSizeChanged()
|
||||||
|
|
|
@ -54,7 +54,6 @@ private:
|
||||||
|
|
||||||
std::shared_ptr<TextComponent> mTitle;
|
std::shared_ptr<TextComponent> mTitle;
|
||||||
std::vector<ThemeEntry> mThemeSets;
|
std::vector<ThemeEntry> mThemeSets;
|
||||||
std::vector<ThemeEntry> mLegacyThemeSets;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ES_APP_GUIS_GUI_THEME_DOWNLOADER_H
|
#endif // ES_APP_GUIS_GUI_THEME_DOWNLOADER_H
|
||||||
|
|
Loading…
Reference in a new issue