summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yuzu/game_list.cpp10
-rw-r--r--src/yuzu/game_list.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 0132a050d..5f43eb177 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -138,10 +138,12 @@ GameList::SearchField::SearchField(GameList* parent) : QWidget{parent} {
138 * @param userinput String containing all words getting checked 138 * @param userinput String containing all words getting checked
139 * @return true if the haystack contains all words of userinput 139 * @return true if the haystack contains all words of userinput
140 */ 140 */
141bool GameList::containsAllWords(QString haystack, QString userinput) { 141bool GameList::ContainsAllWords(const QString& haystack, const QString& userinput) const {
142 QStringList userinput_split = userinput.split(" ", QString::SplitBehavior::SkipEmptyParts); 142 const QStringList userinput_split =
143 userinput.split(' ', QString::SplitBehavior::SkipEmptyParts);
144
143 return std::all_of(userinput_split.begin(), userinput_split.end(), 145 return std::all_of(userinput_split.begin(), userinput_split.end(),
144 [haystack](QString s) { return haystack.contains(s); }); 146 [&haystack](const QString& s) { return haystack.contains(s); });
145} 147}
146 148
147// Event in order to filter the gamelist after editing the searchfield 149// Event in order to filter the gamelist after editing the searchfield
@@ -175,7 +177,7 @@ void GameList::onTextChanged(const QString& newText) {
175 // The search is case insensitive because of toLower() 177 // The search is case insensitive because of toLower()
176 // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent 178 // I decided not to use Qt::CaseInsensitive in containsAllWords to prevent
177 // multiple conversions of edit_filter_text for each game in the gamelist 179 // multiple conversions of edit_filter_text for each game in the gamelist
178 if (containsAllWords(file_name.append(" ").append(file_title), edit_filter_text) || 180 if (ContainsAllWords(file_name.append(' ').append(file_title), edit_filter_text) ||
179 (file_programmid.count() == 16 && edit_filter_text.contains(file_programmid))) { 181 (file_programmid.count() == 16 && edit_filter_text.contains(file_programmid))) {
180 tree_view->setRowHidden(i, root_index, false); 182 tree_view->setRowHidden(i, root_index, false);
181 ++result_count; 183 ++result_count;
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h
index 7aff597b7..14db3956d 100644
--- a/src/yuzu/game_list.h
+++ b/src/yuzu/game_list.h
@@ -89,7 +89,7 @@ private:
89 89
90 void PopupContextMenu(const QPoint& menu_location); 90 void PopupContextMenu(const QPoint& menu_location);
91 void RefreshGameDirectory(); 91 void RefreshGameDirectory();
92 bool containsAllWords(QString haystack, QString userinput); 92 bool ContainsAllWords(const QString& haystack, const QString& userinput) const;
93 93
94 SearchField* search_field; 94 SearchField* search_field;
95 GMainWindow* main_window = nullptr; 95 GMainWindow* main_window = nullptr;