[Scummvm-cvs-logs] SF.net SVN: scummvm:[42038] scummvm/trunk/gui/ListWidget.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu Jul 2 23:16:36 CEST 2009
Revision: 42038
http://scummvm.svn.sourceforge.net/scummvm/?rev=42038&view=rev
Author: fingolfin
Date: 2009-07-02 21:16:36 +0000 (Thu, 02 Jul 2009)
Log Message:
-----------
Enhanced the quicksearch box in the launcher to match words in the search string individually
Modified Paths:
--------------
scummvm/trunk/gui/ListWidget.cpp
Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp 2009-07-02 20:58:57 UTC (rev 42037)
+++ scummvm/trunk/gui/ListWidget.cpp 2009-07-02 21:16:36 UTC (rev 42038)
@@ -561,8 +561,10 @@
// 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 @@
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);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list