Fixed an issue with the scraper error dialog.

This commit is contained in:
Leon Styhre 2020-07-31 14:24:14 +02:00
parent af37173a0b
commit 317719b678
5 changed files with 25 additions and 12 deletions

View file

@ -63,6 +63,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
* Non-transparent favorite icons were not rendered correctly
* Restart and power-off menu entries not working
* Unknown command line options were silently accepted instead of generating an error and notifying the user
* The scraper didn't handle error conditions correctly
* Toggling the screensaver didn't work as expected
* The setting to enable or disable audio for the video screensaver only worked on Raspberry Pi
* The screensaver random function did not consider the previously selected game and could potentially show the same image or video over and over again

View file

@ -48,7 +48,7 @@ GuiGameScraper::GuiGameScraper(
// GuiScraperSearch.
mSearch = std::make_shared<GuiScraperSearch>(window,
GuiScraperSearch::NEVER_AUTO_ACCEPT);
GuiScraperSearch::NEVER_AUTO_ACCEPT, 1);
mGrid.setEntry(mSearch, Vector2i(0, 5), true);
// Buttons

View file

@ -57,13 +57,13 @@ GuiScraperMulti::GuiScraperMulti(
if (approveResults && !Settings::getInstance()->getBool("ScraperSemiautomatic"))
mSearchComp = std::make_shared<GuiScraperSearch>(mWindow,
GuiScraperSearch::NEVER_AUTO_ACCEPT);
GuiScraperSearch::NEVER_AUTO_ACCEPT, mTotalGames);
else if (approveResults && Settings::getInstance()->getBool("ScraperSemiautomatic"))
mSearchComp = std::make_shared<GuiScraperSearch>(mWindow,
GuiScraperSearch::ACCEPT_SINGLE_MATCHES);
GuiScraperSearch::ACCEPT_SINGLE_MATCHES, mTotalGames);
else if (!approveResults)
mSearchComp = std::make_shared<GuiScraperSearch>(mWindow,
GuiScraperSearch::ALWAYS_ACCEPT_FIRST_RESULT);
GuiScraperSearch::ALWAYS_ACCEPT_FIRST_RESULT, mTotalGames);
mSearchComp->setAcceptCallback(std::bind(&GuiScraperMulti::acceptResult,
this, std::placeholders::_1));
mSearchComp->setSkipCallback(std::bind(&GuiScraperMulti::skip, this));

View file

@ -34,11 +34,13 @@
GuiScraperSearch::GuiScraperSearch(
Window* window,
SearchType type)
SearchType type,
unsigned int scrapeCount)
: GuiComponent(window),
mGrid(window, Vector2i(4, 3)),
mBusyAnim(window),
mSearchType(type),
mScrapeCount(scrapeCount),
mScrapeRatings(false)
{
addChild(&mGrid);
@ -346,11 +348,19 @@ void GuiScraperSearch::onSearchDone(const std::vector<ScraperSearchResult>& resu
void GuiScraperSearch::onSearchError(const std::string& error)
{
LOG(LogInfo) << "GuiScraperSearch search error: " << error;
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(), Utils::String::toUpper(error),
"RETRY", std::bind(&GuiScraperSearch::search, this, mLastSearch),
"SKIP", mSkipCallback,
"CANCEL", mCancelCallback));
if (mScrapeCount > 1) {
LOG(LogInfo) << "GuiScraperSearch search error: " << error;
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(), Utils::String::toUpper(error),
"RETRY", std::bind(&GuiScraperSearch::search, this, mLastSearch),
"SKIP", mSkipCallback,
"CANCEL", mCancelCallback));
}
else {
LOG(LogInfo) << "GuiScraperSearch search error: " << error;
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(), Utils::String::toUpper(error),
"RETRY", std::bind(&GuiScraperSearch::search, this, mLastSearch),
"CANCEL", mCancelCallback));
}
}
int GuiScraperSearch::getSelectedIndex()
@ -465,6 +475,7 @@ void GuiScraperSearch::returnResult(ScraperSearchResult result)
return;
}
mScrapeCount -= 1;
mAcceptCallback(result);
}

View file

@ -36,7 +36,7 @@ public:
NEVER_AUTO_ACCEPT
};
GuiScraperSearch(Window* window, SearchType searchType = NEVER_AUTO_ACCEPT);
GuiScraperSearch(Window* window, SearchType searchType, unsigned int scrapeCount = 1);
void search(const ScraperSearchParams& params);
void openInputScreen(ScraperSearchParams& from);
@ -51,7 +51,7 @@ public:
inline void setSkipCallback(const std::function<void()>&
skipCallback) { mSkipCallback = skipCallback; };
inline void setCancelCallback(const std::function<void()>&
cancelCallback) { mCancelCallback = cancelCallback; }
cancelCallback) { mScrapeCount -= 1; mCancelCallback = cancelCallback; }
bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override;
@ -116,6 +116,7 @@ private:
std::function<void(const ScraperSearchResult&)> mAcceptCallback;
std::function<void()> mSkipCallback;
std::function<void()> mCancelCallback;
unsigned int mScrapeCount;
bool mBlockAccept;
bool mFoundGame;
bool mScrapeRatings;