diff options
Diffstat (limited to 'src/yuzu/game/game_tree.cpp')
| -rw-r--r-- | src/yuzu/game/game_tree.cpp | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/src/yuzu/game/game_tree.cpp b/src/yuzu/game/game_tree.cpp index f670d03dc6..b197eaad03 100644 --- a/src/yuzu/game/game_tree.cpp +++ b/src/yuzu/game/game_tree.cpp @@ -8,8 +8,9 @@ #include "qt_common/config/uisettings.h" #include "qt_common/game_list/game_list_p.h" -#include "yuzu/game/game_tree.h" #include "qt_common/game_list/model.h" +#include "yuzu/game/common.h" +#include "yuzu/game/game_tree.h" GameTree::GameTree(QWidget* parent) : QTreeView{parent} { setAlternatingRowColors(true); @@ -139,28 +140,7 @@ void GameTree::ApplyFilter(const QString& edit_filter_text, GameListModel* model const QStandardItem* child = folder->child(j, 0); - const auto program_id = child->data(GameListItemPath::ProgramIdRole).toULongLong(); - - const QString file_path = - child->data(GameListItemPath::FullPathRole).toString().toLower(); - const QString file_title = - child->data(GameListItemPath::TitleRole).toString().toLower(); - const QString file_program_id = - QStringLiteral("%1").arg(program_id, 16, 16, QLatin1Char{'0'}); - - const QString file_name = - file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} + - file_title; - - auto ContainsAllWords = [](const QString& haystack, const QString& userinput) { - const QStringList userinput_split = - userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts); - return std::all_of(userinput_split.begin(), userinput_split.end(), - [&haystack](const QString& s) { return haystack.contains(s); }); - }; - - if (ContainsAllWords(file_name, edit_filter_text) || - (file_program_id.size() == 16 && file_program_id.contains(edit_filter_text))) { + if (Yuzu::FilterMatches(edit_filter_text, child)) { setRowHidden(j, folder_index, false); ++result_count; } else { |
