Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11583 from danielgarzaf/seach-results-filename
Qt/GameList: Also filter by filename when searching.
  • Loading branch information
AdmiralCurtiss committed Feb 26, 2023
2 parents 26adf78 + 02f7c02 commit 4fb3042
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions Source/Core/DolphinQt/GameList/GameListModel.cpp
Expand Up @@ -257,10 +257,19 @@ bool GameListModel::ShouldDisplayGameListItem(int index) const
{
const UICommon::GameFile& game = *m_games[index];

if (!m_term.isEmpty() &&
!QString::fromStdString(game.GetName(m_title_database)).contains(m_term, Qt::CaseInsensitive))
if (!m_term.isEmpty())
{
return false;
const bool matches_title = QString::fromStdString(game.GetName(m_title_database))
.contains(m_term, Qt::CaseInsensitive);
const bool filename_visible = Config::Get(Config::MAIN_GAMELIST_COLUMN_FILE_NAME);
const bool list_view_selected = Settings::Instance().GetPreferredView();
const bool matches_filename =
filename_visible && list_view_selected &&
QString::fromStdString(game.GetFileName()).contains(m_term, Qt::CaseInsensitive);
if (!(matches_title || matches_filename))
{
return false;
}
}

const bool show_platform = [&game] {
Expand Down

0 comments on commit 4fb3042

Please sign in to comment.