Fix problem with settings filter/search functionality

Fixes #21143 (which also affected Mac and Linux)
This commit is contained in:
Henrik Rydgård committed 2026-01-30 14:20:43 +01:00
1 parent 10759dc8b9
commit 1d436bae53
3 files changed
+19 -16

No files matched your search

+8 -3
View File
@@ -114,12 +114,12 @@ void UITabbedBaseDialogScreen::CreateViews() {
auto se = GetI18NCategory(I18NCat::SEARCH);
searchSettings->Add(new ItemHeader(se->T("Find settings")));
searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([=](UI::EventParams &e) {
searchSettings->Add(new PopupTextInputChoice(GetRequesterToken(), &searchFilter_, se->T("Filter"), "", 64, screenManager()))->OnChange.Add([this](UI::EventParams &e) {
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, StripSpaces(searchFilter_));
});
clearSearchChoice_ = searchSettings->Add(new Choice(se->T("Clear filter")));
clearSearchChoice_->OnClick.Add([=](UI::EventParams &e) {
clearSearchChoice_->OnClick.Add([](UI::EventParams &e) {
System_PostUIMessage(UIMessage::GAMESETTINGS_SEARCH, "");
});
clearSearchChoice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
@@ -128,6 +128,11 @@ void UITabbedBaseDialogScreen::CreateViews() {
});
}
}
// Need to handle recreates, both important and accidental ones.
if (!searchFilter_.empty()) {
ApplySearchFilter();
}
}
void UITabbedBaseDialogScreen::sendMessage(UIMessage message, const char *value) {
@@ -205,7 +210,7 @@ void UITabbedBaseDialogScreen::ApplySearchFilter() {
if (match && lastHeading)
lastHeading->SetVisibility(UI::V_VISIBLE);
v->SetVisibility(searchFilter_.empty() || match ? UI::V_VISIBLE : UI::V_GONE);
v->SetVisibility((searchFilter_.empty() || match) ? UI::V_VISIBLE : UI::V_GONE);
}
tabHolder_->EnableTab(t, tabMatches);
matches = matches || tabMatches;