summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-18 19:02:58 +0200
committerGitHub <noreply@github.com>2018-07-18 19:02:58 +0200
commit3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197 (patch)
treeba934f01c57347df7d8178eb3a55f171ef274011 /src
parentMerge pull request #682 from lioncash/telemetry (diff)
parentgame_list: Upper-case containsAllWords to ContainsAllWords() (diff)
downloadyuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar.gz
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar.bz2
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar.lz
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar.xz
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.tar.zst
yuzu-3d1e8f750cb7ca4f06a04ed4b1dca61d11b94197.zip
Diffstat (limited to 'src')
-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} {
* @param userinput String containing all words getting checked
* @return true if the haystack contains all words of userinput
*/
-bool GameList::containsAllWords(QString haystack, QString userinput) {
- QStringList userinput_split = userinput.split(" ", QString::SplitBehavior::SkipEmptyParts);
+bool GameList::ContainsAllWords(const QString& haystack, const QString& userinput) const {
+ const QStringList userinput_split =
+ userinput.split(' ', QString::SplitBehavior::SkipEmptyParts);
+
return std::all_of(userinput_split.begin(), userinput_split.end(),
- [haystack](QString s) { return haystack.contains(s); });
+ [&haystack](const QString& s) { return haystack.contains(s); });
}
// Event in order to filter the gamelist after editing the searchfield
@@ -175,7 +177,7 @@ void GameList::onTextChanged(const QString& newText) {
// The search is case insensitive because of toLower()
// I decided not to use Qt::CaseInsensitive in containsAllWords to prevent
// multiple conversions of edit_filter_text for each game in the gamelist
- if (containsAllWords(file_name.append(" ").append(file_title), edit_filter_text) ||
+ if (ContainsAllWords(file_name.append(' ').append(file_title), edit_filter_text) ||
(file_programmid.count() == 16 && edit_filter_text.contains(file_programmid))) {
tree_view->setRowHidden(i, root_index, false);
++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:
void PopupContextMenu(const QPoint& menu_location);
void RefreshGameDirectory();
- bool containsAllWords(QString haystack, QString userinput);
+ bool ContainsAllWords(const QString& haystack, const QString& userinput) const;
SearchField* search_field;
GMainWindow* main_window = nullptr;