[Scummvm-cvs-logs] SF.net SVN: scummvm:[42510] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Wed Jul 15 19:07:45 CEST 2009


Revision: 42510
          http://scummvm.svn.sourceforge.net/scummvm/?rev=42510&view=rev
Author:   lordhoto
Date:     2009-07-15 17:07:45 +0000 (Wed, 15 Jul 2009)

Log Message:
-----------
Fix "search" filter being settings lost in launcher, when using the "Edit Game..." menu for example.

Modified Paths:
--------------
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/launcher.cpp

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2009-07-15 15:54:43 UTC (rev 42509)
+++ scummvm/trunk/gui/ListWidget.cpp	2009-07-15 17:07:45 UTC (rev 42510)
@@ -105,6 +105,22 @@
 }
 
 void ListWidget::setSelected(int item) {
+	// HACK/FIXME: If our _listIndex has a non zero size,
+	// we will need to look up, whether the user selected
+	// item is present in that list
+	if (_listIndex.size()) {
+		int filteredItem = -1;
+
+		for (uint i = 0; i < _listIndex.size(); ++i) {
+			if (_listIndex[i] == item) {
+				filteredItem = i;
+				break;
+			}
+		}
+
+		item = filteredItem;
+	}
+
 	assert(item >= -1 && item < (int)_list.size());
 
 	// We only have to do something if the widget is enabled and the selection actually changes
@@ -131,6 +147,7 @@
 	_dataList = list;
 	_list = list;
 	_filter.clear();
+	_listIndex.clear();
 
 	int size = list.size();
 	if (_currentPos >= size)
@@ -560,6 +577,7 @@
 	if (_filter.empty()) {
 		// No filter -> display everything
 		_list = _dataList;
+		_listIndex.clear();
 	} else {
 		// Restrict the list to everything which contains all words in _filter
 		// as substrings, ignoring case.

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2009-07-15 15:54:43 UTC (rev 42509)
+++ scummvm/trunk/gui/launcher.cpp	2009-07-15 17:07:45 UTC (rev 42510)
@@ -641,6 +641,10 @@
 		// Select the last entry if the list has been reduced
 		_list->setSelected(_list->getList().size() - 1);
 	updateButtons();
+
+	// Update the filter settings, those are lost when "setList"
+	// is called.
+	_list->setFilter(_searchWidget->getEditString());
 }
 
 void LauncherDialog::addGame() {


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