mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +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) {
|
if (mApproveResults) {
|
||||||
buttons.push_back(
|
buttons.push_back(
|
||||||
std::make_shared<ButtonComponent>(mWindow, "REFINE SEARCH", "refine search", [&] {
|
std::make_shared<ButtonComponent>(mWindow, "REFINE SEARCH", "refine search", [&] {
|
||||||
// Refine the search, unless the result has already been accepted or we're in
|
// Check whether we should allow a refine of the game name.
|
||||||
// semi-automatic mode and there are less than 2 search results.
|
if (!mSearchComp->getAcceptedResult()) {
|
||||||
if (!mSearchComp->getAcceptedResult() &&
|
bool allowRefine = false;
|
||||||
!(mSearchComp->getSearchType() == GuiScraperSearch::ACCEPT_SINGLE_MATCHES &&
|
|
||||||
mSearchComp->getScraperResultsSize() < 2)) {
|
// Previously refined.
|
||||||
mSearchComp->openInputScreen(mSearchQueue.front());
|
if (mSearchComp->getRefinedSearch())
|
||||||
mGrid.resetCursor();
|
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;
|
mBlockAccept = true;
|
||||||
mAcceptedResult = false;
|
mAcceptedResult = false;
|
||||||
mMiximageResult = false;
|
mMiximageResult = false;
|
||||||
|
mFoundGame = false;
|
||||||
mScrapeResult = {};
|
mScrapeResult = {};
|
||||||
|
|
||||||
mResultList->clear();
|
mResultList->clear();
|
||||||
|
@ -545,13 +546,25 @@ bool GuiScraperSearch::input(InputConfig* config, Input input)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refine the search, unless the result has already been accepted or we're in semi-automatic
|
// Check whether we should allow a refine of the game name.
|
||||||
// mode and there are less than 2 search results.
|
|
||||||
if (!mAcceptedResult && config->isMappedTo("y", input) && input.value != 0) {
|
if (!mAcceptedResult && config->isMappedTo("y", input) && input.value != 0) {
|
||||||
if (mSearchType != ACCEPT_SINGLE_MATCHES ||
|
bool allowRefine = false;
|
||||||
(mSearchType == ACCEPT_SINGLE_MATCHES && mScraperResults.size() > 1)) {
|
|
||||||
|
// 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);
|
openInputScreen(mLastSearch);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip game, unless the result has already been accepted.
|
// Skip game, unless the result has already been accepted.
|
||||||
|
|
|
@ -81,6 +81,10 @@ public:
|
||||||
void onSizeChanged() override;
|
void onSizeChanged() override;
|
||||||
|
|
||||||
void unsetRefinedSearch() { mRefinedSearch = false; }
|
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 onFocusGained() override { mGrid.onFocusGained(); }
|
||||||
void onFocusLost() override { mGrid.onFocusLost(); }
|
void onFocusLost() override { mGrid.onFocusLost(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue