Added an error dialog to GuiThemeDownloader for when the themes.json file can't be parsed

Also added error handling for missing image files in the themes.json file
This commit is contained in:
Leon Styhre 2023-04-01 19:59:47 +02:00
parent 8a54b0d6fe
commit e4e58f036b

View file

@ -491,7 +491,14 @@ void GuiThemeDownloader::parseThemesList()
doc.Parse(reinterpret_cast<const char*>(themesFileData.ptr.get()), themesFileData.length);
if (doc.HasParseError()) {
LOG(LogWarning) << "GuiThemeDownloader: Couldn't parse the themes.json file";
LOG(LogError) << "GuiThemeDownloader: Couldn't parse the themes.json file";
mWindow->pushGui(new GuiMsgBox(
getHelpStyle(),
"COULDN'T PARSE THE THEMES LIST CONFIGURATION FILE, MAYBE THE LOCAL REPOSITORY IS "
"CORRUPT?",
"OK", [] { return; }, "", nullptr, "", nullptr, true));
mGrid.removeEntry(mCenterGrid);
mGrid.setCursorTo(mButtons);
return;
}
@ -723,6 +730,8 @@ void GuiThemeDownloader::updateInfoPane()
if (!mThemeSets[mList->getCursorId()].screenshots.empty())
mScreenshot->setImage(mThemeDirectory + "themes-list/" +
mThemeSets[mList->getCursorId()].screenshots.front().image);
else
mScreenshot->setImage("");
if (mThemeSets[mList->getCursorId()].isCloned) {
mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED");
@ -803,6 +812,9 @@ void GuiThemeDownloader::setupFullscreenViewer()
mViewerScreenshots.front()->getSize().x + (mViewerIndicatorRight->getSize().x * 3.0f);
mViewerIndicatorRight->setPosition(indicatorPos);
}
else {
mFullscreenViewing = false;
}
}
void GuiThemeDownloader::update(int deltaTime)