mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Added support for marking themes as deprecated in the theme downloader
This commit is contained in:
parent
47baa3629a
commit
278ba90c14
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// GuiThemeDownloader.cpp
|
// GuiThemeDownloader.cpp
|
||||||
//
|
//
|
||||||
// Theme downloader.
|
// Theme downloader.
|
||||||
|
@ -663,6 +663,9 @@ void GuiThemeDownloader::parseThemesList()
|
||||||
if (theme.HasMember("newEntry") && theme["newEntry"].IsBool())
|
if (theme.HasMember("newEntry") && theme["newEntry"].IsBool())
|
||||||
themeEntry.newEntry = theme["newEntry"].GetBool();
|
themeEntry.newEntry = theme["newEntry"].GetBool();
|
||||||
|
|
||||||
|
if (theme.HasMember("deprecated") && theme["deprecated"].IsBool())
|
||||||
|
themeEntry.deprecated = theme["deprecated"].GetBool();
|
||||||
|
|
||||||
if (theme.HasMember("variants") && theme["variants"].IsArray()) {
|
if (theme.HasMember("variants") && theme["variants"].IsArray()) {
|
||||||
const rapidjson::Value& variants {theme["variants"]};
|
const rapidjson::Value& variants {theme["variants"]};
|
||||||
for (int i {0}; i < static_cast<int>(variants.Size()); ++i)
|
for (int i {0}; i < static_cast<int>(variants.Size()); ++i)
|
||||||
|
@ -746,6 +749,11 @@ void GuiThemeDownloader::populateGUI()
|
||||||
std::shared_ptr<TextComponent> themeNameElement {std::make_shared<TextComponent>(
|
std::shared_ptr<TextComponent> themeNameElement {std::make_shared<TextComponent>(
|
||||||
themeName, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary)};
|
themeName, Font::get(FONT_SIZE_MEDIUM), mMenuColorPrimary)};
|
||||||
|
|
||||||
|
if (theme.deprecated)
|
||||||
|
themeNameElement->setOpacity(0.4f);
|
||||||
|
else
|
||||||
|
themeNameElement->setOpacity(1.0f);
|
||||||
|
|
||||||
ThemeGUIEntry guiEntry;
|
ThemeGUIEntry guiEntry;
|
||||||
guiEntry.themeName = themeNameElement;
|
guiEntry.themeName = themeNameElement;
|
||||||
mThemeGUIEntries.emplace_back(guiEntry);
|
mThemeGUIEntries.emplace_back(guiEntry);
|
||||||
|
@ -907,11 +915,21 @@ void GuiThemeDownloader::updateGUI()
|
||||||
void GuiThemeDownloader::updateInfoPane()
|
void GuiThemeDownloader::updateInfoPane()
|
||||||
{
|
{
|
||||||
assert(static_cast<size_t>(mList->size()) == mThemes.size());
|
assert(static_cast<size_t>(mList->size()) == mThemes.size());
|
||||||
if (!mThemes[mList->getCursorId()].screenshots.empty())
|
if (!mThemes[mList->getCursorId()].screenshots.empty()) {
|
||||||
mScreenshot->setImage(mThemeDirectory + "themes-list/" +
|
mScreenshot->setImage(mThemeDirectory + "themes-list/" +
|
||||||
mThemes[mList->getCursorId()].screenshots.front().image);
|
mThemes[mList->getCursorId()].screenshots.front().image);
|
||||||
else
|
if (mThemes[mList->getCursorId()].deprecated) {
|
||||||
|
mScreenshot->setSaturation(0.0f);
|
||||||
|
mScreenshot->setBrightness(-0.2f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mScreenshot->setSaturation(1.0f);
|
||||||
|
mScreenshot->setBrightness(0.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
mScreenshot->setImage("");
|
mScreenshot->setImage("");
|
||||||
|
}
|
||||||
|
|
||||||
if (mThemes[mList->getCursorId()].isCloned) {
|
if (mThemes[mList->getCursorId()].isCloned) {
|
||||||
mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED");
|
mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED");
|
||||||
|
@ -954,7 +972,11 @@ void GuiThemeDownloader::updateInfoPane()
|
||||||
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()));
|
mFontSizesCount->setText(std::to_string(mThemes[mList->getCursorId()].fontSizes.size()));
|
||||||
mAuthor->setText("CREATED BY " + Utils::String::toUpper(mThemes[mList->getCursorId()].author));
|
if (mThemes[mList->getCursorId()].deprecated)
|
||||||
|
mAuthor->setText("THIS THEME ENTRY WILL BE REMOVED IN THE NEAR FUTURE");
|
||||||
|
else
|
||||||
|
mAuthor->setText("CREATED BY " +
|
||||||
|
Utils::String::toUpper(mThemes[mList->getCursorId()].author));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiThemeDownloader::setupFullscreenViewer()
|
void GuiThemeDownloader::setupFullscreenViewer()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
//
|
//
|
||||||
// ES-DE
|
// ES-DE Frontend
|
||||||
// GuiThemeDownloader.h
|
// GuiThemeDownloader.h
|
||||||
//
|
//
|
||||||
// Theme downloader.
|
// Theme downloader.
|
||||||
|
@ -68,6 +68,7 @@ private:
|
||||||
std::vector<std::string> transitions;
|
std::vector<std::string> transitions;
|
||||||
std::vector<Screenshot> screenshots;
|
std::vector<Screenshot> screenshots;
|
||||||
bool newEntry;
|
bool newEntry;
|
||||||
|
bool deprecated;
|
||||||
bool invalidRepository;
|
bool invalidRepository;
|
||||||
bool corruptRepository;
|
bool corruptRepository;
|
||||||
bool shallowRepository;
|
bool shallowRepository;
|
||||||
|
@ -76,6 +77,7 @@ private:
|
||||||
bool isCloned;
|
bool isCloned;
|
||||||
ThemeEntry()
|
ThemeEntry()
|
||||||
: newEntry {false}
|
: newEntry {false}
|
||||||
|
, deprecated {false}
|
||||||
, invalidRepository {false}
|
, invalidRepository {false}
|
||||||
, corruptRepository {false}
|
, corruptRepository {false}
|
||||||
, shallowRepository {false}
|
, shallowRepository {false}
|
||||||
|
|
Loading…
Reference in a new issue