Add number of games skipped to scraper result dialog.

After pressing the "SKIP" button, the cursor is now reset to the result list.
This commit is contained in:
Aloshi 2014-04-27 21:47:06 -05:00
parent 0b3a0d0e4e
commit 2abc4f2f3a
2 changed files with 10 additions and 2 deletions

View file

@ -22,6 +22,7 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
mTotalGames = mSearchQueue.size(); mTotalGames = mSearchQueue.size();
mCurrentGame = 0; mCurrentGame = 0;
mTotalSuccessful = 0; mTotalSuccessful = 0;
mTotalSkipped = 0;
// set up grid // set up grid
mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER); mTitle = std::make_shared<TextComponent>(mWindow, "SCRAPING IN PROGRESS", Font::get(FONT_SIZE_LARGE), 0x555555FF, TextComponent::ALIGN_CENTER);
@ -49,7 +50,10 @@ GuiScraperMulti::GuiScraperMulti(Window* window, const std::queue<ScraperSearchP
mGrid.resetCursor(); mGrid.resetCursor();
})); }));
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "SKIP", "skip", std::bind(&GuiScraperMulti::skip, this))); buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "SKIP", "skip", [&] {
skip();
mGrid.resetCursor();
}));
} }
buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "STOP", "stop (progress saved)", std::bind(&GuiScraperMulti::finish, this))); buttons.push_back(std::make_shared<ButtonComponent>(mWindow, "STOP", "stop (progress saved)", std::bind(&GuiScraperMulti::finish, this)));
@ -110,6 +114,7 @@ void GuiScraperMulti::skip()
{ {
mSearchQueue.pop(); mSearchQueue.pop();
mCurrentGame++; mCurrentGame++;
mTotalSkipped++;
doNextSearch(); doNextSearch();
} }
@ -120,6 +125,8 @@ void GuiScraperMulti::finish()
ss << "NO GAMES SUCCESSFULLY SCRAPED."; ss << "NO GAMES SUCCESSFULLY SCRAPED.";
else else
ss << mTotalSuccessful << " GAME" << ((mTotalSuccessful > 1) ? "S" : "") << " SUCCESSFULLY SCRAPED!"; ss << mTotalSuccessful << " GAME" << ((mTotalSuccessful > 1) ? "S" : "") << " SUCCESSFULLY SCRAPED!";
if(mTotalSkipped > 0)
ss << "\n" << mTotalSkipped << " GAME" << ((mTotalSkipped > 1) ? "S" : "") << " SKIPPED.";
mWindow->pushGui(new GuiMsgBox(mWindow, ss.str(), mWindow->pushGui(new GuiMsgBox(mWindow, ss.str(),
"OK", [&] { delete this; })); "OK", [&] { delete this; }));

View file

@ -28,6 +28,7 @@ private:
unsigned int mTotalGames; unsigned int mTotalGames;
unsigned int mCurrentGame; unsigned int mCurrentGame;
unsigned int mTotalSuccessful; unsigned int mTotalSuccessful;
unsigned int mTotalSkipped;
std::queue<ScraperSearchParams> mSearchQueue; std::queue<ScraperSearchParams> mSearchQueue;
NinePatchComponent mBackground; NinePatchComponent mBackground;