aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-07-02 21:16:36 +0000
committerMax Horn2009-07-02 21:16:36 +0000
commit8aa667e342e8c8dc203fb6811f01523bacfcffab (patch)
tree508be047844114aa0a0588e203fbc76adf122e5c
parent341d875ceabcccd75d7921777c0158f287089b2f (diff)
downloadscummvm-rg350-8aa667e342e8c8dc203fb6811f01523bacfcffab.tar.gz
scummvm-rg350-8aa667e342e8c8dc203fb6811f01523bacfcffab.tar.bz2
scummvm-rg350-8aa667e342e8c8dc203fb6811f01523bacfcffab.zip
Enhanced the quicksearch box in the launcher to match words in the search string individually
svn-id: r42038
-rw-r--r--gui/ListWidget.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp
index e46d5e9b1e..07d22973ac 100644
--- a/gui/ListWidget.cpp
+++ b/gui/ListWidget.cpp
@@ -561,8 +561,10 @@ void ListWidget::setFilter(const String &filter, bool redraw) {
// No filter -> display everything
_list = _dataList;
} else {
- // Restrict the list to everything which contains _filter as a substring,
- // ignoring case.
+ // Restrict the list to everything which contains all words in _filter
+ // as substrings, ignoring case.
+
+ Common::StringTokenizer tok(filter);
String tmp;
int n = 0;
@@ -572,7 +574,16 @@ void ListWidget::setFilter(const String &filter, bool redraw) {
for (StringList::iterator i = _dataList.begin(); i != _dataList.end(); ++i, ++n) {
tmp = *i;
tmp.toLowercase();
- if (tmp.contains(_filter)) {
+ bool matches = true;
+ tok.reset();
+ while (!tok.empty()) {
+ if (!tmp.contains(tok.nextToken())) {
+ matches = false;
+ break;
+ }
+ }
+
+ if (matches) {
_list.push_back(*i);
_listIndex.push_back(n);
}