mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
Fixed an issue where game names could not be refined when multi-scraping.
Also fixed some refine game name inconsistencies when alternating between using the button shortcut and the ComponentGrid button.
This commit is contained in:
parent
db5fb48cf8
commit
64397bc6f0
|
@ -79,13 +79,36 @@ GuiScraperMulti::GuiScraperMulti(Window* window,
|
|||
if (mApproveResults) {
|
||||
buttons.push_back(
|
||||
std::make_shared<ButtonComponent>(mWindow, "REFINE SEARCH", "refine search", [&] {
|
||||
// Refine the search, unless the result has already been accepted or we're in
|
||||
// semi-automatic mode and there are less than 2 search results.
|
||||
if (!mSearchComp->getAcceptedResult() &&
|
||||
!(mSearchComp->getSearchType() == GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
|
||||
mSearchComp->getScraperResultsSize() < 2)) {
|
||||
mSearchComp->openInputScreen(mSearchQueue.front());
|
||||
mGrid.resetCursor();
|
||||
// Check whether we should allow a refine of the game name.
|
||||
if (!mSearchComp->getAcceptedResult()) {
|
||||
bool allowRefine = false;
|
||||
|
||||
// Previously refined.
|
||||
if (mSearchComp->getRefinedSearch())
|
||||
allowRefine = true;
|
||||
// Interactive mode and "Auto-accept single game matches" not enabled.
|
||||
else if (mSearchComp->getSearchType() !=
|
||||
GuiScraperSearch::ACCEPT_SINGLE_MATCHES)
|
||||
allowRefine = true;
|
||||
// Interactive mode with "Auto-accept single game matches" enabled and more
|
||||
// than one result.
|
||||
else if (mSearchComp->getSearchType() ==
|
||||
GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
|
||||
mSearchComp->getScraperResultsSize() > 1)
|
||||
allowRefine = true;
|
||||
// Dito but there were no games found, or the search has not been completed.
|
||||
else if (mSearchComp->getSearchType() ==
|
||||
GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
|
||||
!mSearchComp->getFoundGame())
|
||||
allowRefine = true;
|
||||
|
||||
if (allowRefine) {
|
||||
// Copy any search refine that may have been previously entered by opening
|
||||
// the input screen using the "Y" button shortcut.
|
||||
mSearchQueue.front().nameOverride = mSearchComp->getNameOverride();
|
||||
mSearchComp->openInputScreen(mSearchQueue.front());
|
||||
mGrid.resetCursor();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
@ -324,6 +324,7 @@ void GuiScraperSearch::search(const ScraperSearchParams& params)
|
|||
mBlockAccept = true;
|
||||
mAcceptedResult = false;
|
||||
mMiximageResult = false;
|
||||
mFoundGame = false;
|
||||
mScrapeResult = {};
|
||||
|
||||
mResultList->clear();
|
||||
|
@ -545,13 +546,25 @@ bool GuiScraperSearch::input(InputConfig* config, Input input)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Refine the search, unless the result has already been accepted or we're in semi-automatic
|
||||
// mode and there are less than 2 search results.
|
||||
// Check whether we should allow a refine of the game name.
|
||||
if (!mAcceptedResult && config->isMappedTo("y", input) && input.value != 0) {
|
||||
if (mSearchType != ACCEPT_SINGLE_MATCHES ||
|
||||
(mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)) {
|
||||
bool allowRefine = false;
|
||||
|
||||
// Previously refined.
|
||||
if (mRefinedSearch)
|
||||
allowRefine = true;
|
||||
// Interactive mode and "Auto-accept single game matches" not enabled.
|
||||
else if (mSearchType != ACCEPT_SINGLE_MATCHES)
|
||||
allowRefine = true;
|
||||
// Interactive mode with "Auto-accept single game matches" enabled and more than one result.
|
||||
else if (mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)
|
||||
allowRefine = true;
|
||||
// Dito but there were no games found, or the search has not been completed.
|
||||
else if (mSearchType == ACCEPT_SINGLE_MATCHES && !mFoundGame)
|
||||
allowRefine = true;
|
||||
|
||||
if (allowRefine)
|
||||
openInputScreen(mLastSearch);
|
||||
}
|
||||
}
|
||||
|
||||
// Skip game, unless the result has already been accepted.
|
||||
|
|
|
@ -81,6 +81,10 @@ public:
|
|||
void onSizeChanged() override;
|
||||
|
||||
void unsetRefinedSearch() { mRefinedSearch = false; }
|
||||
bool getRefinedSearch() { return mRefinedSearch; }
|
||||
bool getFoundGame() { return mFoundGame; }
|
||||
const std::string& getNameOverride() { return mLastSearch.nameOverride; }
|
||||
|
||||
void onFocusGained() override { mGrid.onFocusGained(); }
|
||||
void onFocusLost() override { mGrid.onFocusLost(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue