Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game List: Add initials-only search #14524

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions rpcs3/rpcs3qt/game_list_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,30 @@ bool game_list_frame::SearchMatchesApp(const QString& name, const QString& seria
{
return true;
}

// Initials-only search
if (search_text.size() >= 2 && search_text.count(QRegularExpression(QStringLiteral("[a-z0-9]"))) >= 2 && !search_text.contains(QRegularExpression(QStringLiteral("[^a-z0-9 ]"))))
{
QString initials = QStringLiteral("\\b");

for (auto it = search_text.begin(); it != search_text.end(); it++)
{
if (it->isSpace())
{
continue;
}

initials += *it;
initials += QStringLiteral("\\w*\\b ");
}

initials += QChar('?');

if (title_name_replaced_trademarks_with_spaces.contains(QRegularExpression(initials)))
{
return true;
}
}
}

return title_name.contains(search_text) || serial.toLower().contains(search_text);
Expand Down