mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05:38 +00:00
Added support to GuiThemeDownloader for deleting installed themes
This commit is contained in:
parent
610a350429
commit
e8db2a196f
|
@ -197,7 +197,7 @@ GuiThemeDownloader::~GuiThemeDownloader()
|
||||||
git_libgit2_shutdown();
|
git_libgit2_shutdown();
|
||||||
|
|
||||||
if (mHasThemeUpdates) {
|
if (mHasThemeUpdates) {
|
||||||
LOG(LogInfo) << "GuiThemeDownloader: There are updates, repopulating theme sets";
|
LOG(LogInfo) << "GuiThemeDownloader: There are updates, repopulating the themes";
|
||||||
ThemeData::populateThemeSets();
|
ThemeData::populateThemeSets();
|
||||||
ViewController::getInstance()->reloadAll();
|
ViewController::getInstance()->reloadAll();
|
||||||
if (mUpdateCallback)
|
if (mUpdateCallback)
|
||||||
|
@ -666,7 +666,7 @@ void GuiThemeDownloader::parseThemesList()
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LogDebug) << "GuiThemeDownloader::parseThemesList(): Parsed " << mThemeSets.size()
|
LOG(LogDebug) << "GuiThemeDownloader::parseThemesList(): Parsed " << mThemeSets.size()
|
||||||
<< " theme sets";
|
<< " themes";
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiThemeDownloader::populateGUI()
|
void GuiThemeDownloader::populateGUI()
|
||||||
|
@ -1148,6 +1148,36 @@ bool GuiThemeDownloader::input(InputConfig* config, Input input)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config->isMappedTo("y", input) && input.value &&
|
||||||
|
mGrid.getSelectedComponent() == mCenterGrid && mThemeSets[mList->getCursorId()].isCloned) {
|
||||||
|
mWindow->pushGui(new GuiMsgBox(
|
||||||
|
getHelpStyle(),
|
||||||
|
"THIS WILL COMPLETELY DELETE THE THEME INCLUDING ANY "
|
||||||
|
"LOCAL CUSTOMIZATIONS",
|
||||||
|
"PROCEED",
|
||||||
|
[this] {
|
||||||
|
const std::filesystem::path themeDirectory {
|
||||||
|
mThemeDirectory + mThemeSets[mList->getCursorId()].reponame};
|
||||||
|
LOG(LogInfo) << "Deleting theme directory \"" << themeDirectory.string() << "\"";
|
||||||
|
if (!Utils::FileSystem::removeDirectory(themeDirectory, true)) {
|
||||||
|
mWindow->pushGui(new GuiMsgBox(
|
||||||
|
getHelpStyle(), "COULDN'T DELETE THEME, PERMISSION PROBLEMS?", "OK",
|
||||||
|
[] { return; }, "", nullptr, "", nullptr, true));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mMessage = "THEME WAS DELETED";
|
||||||
|
}
|
||||||
|
mHasThemeUpdates = true;
|
||||||
|
makeInventory();
|
||||||
|
updateGUI();
|
||||||
|
},
|
||||||
|
"ABORT", nullptr, "", nullptr, true, true,
|
||||||
|
(mRenderer->getIsVerticalOrientation() ?
|
||||||
|
0.70f :
|
||||||
|
0.44f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return GuiComponent::input(config, input);
|
return GuiComponent::input(config, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1162,10 +1192,14 @@ std::vector<HelpPrompt> GuiThemeDownloader::getHelpPrompts()
|
||||||
if (mGrid.getSelectedComponent() == mCenterGrid)
|
if (mGrid.getSelectedComponent() == mCenterGrid)
|
||||||
prompts.push_back(HelpPrompt("x", "view screenshots"));
|
prompts.push_back(HelpPrompt("x", "view screenshots"));
|
||||||
|
|
||||||
if (mThemeSets[mList->getCursorId()].isCloned)
|
if (mThemeSets[mList->getCursorId()].isCloned) {
|
||||||
prompts.push_back(HelpPrompt("a", "fetch updates"));
|
prompts.push_back(HelpPrompt("a", "fetch updates"));
|
||||||
else
|
if (mGrid.getSelectedComponent() == mCenterGrid)
|
||||||
|
prompts.push_back(HelpPrompt("y", "delete"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
prompts.push_back(HelpPrompt("a", "download"));
|
prompts.push_back(HelpPrompt("a", "download"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
prompts.push_back(HelpPrompt("b", "close"));
|
prompts.push_back(HelpPrompt("b", "close"));
|
||||||
|
|
Loading…
Reference in a new issue