mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-03 23:52:41 +00:00
Fix "search" filter being settings lost in launcher, when using the "Edit Game..." menu for example.
svn-id: r42510
This commit is contained in:
parent
6b3c3a8a12
commit
7b55b5f5e2
@ -105,6 +105,22 @@ Widget *ListWidget::findWidget(int x, int y) {
|
||||
}
|
||||
|
||||
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 @@ void ListWidget::setList(const StringList &list) {
|
||||
_dataList = list;
|
||||
_list = list;
|
||||
_filter.clear();
|
||||
_listIndex.clear();
|
||||
|
||||
int size = list.size();
|
||||
if (_currentPos >= size)
|
||||
@ -560,6 +577,7 @@ void ListWidget::setFilter(const String &filter, bool redraw) {
|
||||
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.
|
||||
|
@ -641,6 +641,10 @@ void LauncherDialog::updateListing() {
|
||||
// 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() {
|
||||
|
Loading…
Reference in New Issue
Block a user