Made filters applicable per custom collection (if grouped).

This commit is contained in:
Leon Styhre 2020-10-25 18:55:01 +01:00
parent 127d900212
commit e51c7ddf8c
4 changed files with 12 additions and 9 deletions

View file

@ -312,7 +312,7 @@ const std::string FileData::getVideoPath() const
const std::vector<FileData*>& FileData::getChildrenListToDisplay()
{
FileFilterIndex* idx = CollectionSystemManager::get()->getSystemToView(mSystem)->getIndex();
FileFilterIndex* idx = mSystem->getIndex();
if (idx->isFiltered()) {
mFilteredChildren.clear();
for (auto it = mChildren.cbegin(); it != mChildren.cend(); it++) {

View file

@ -102,9 +102,9 @@ void GuiGamelistFilter::addFiltersToMenu()
void GuiGamelistFilter::applyFilters()
{
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
for (std::map<FilterIndexType, std::shared_ptr< OptionListComponent<std::string>
>>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) {
std::shared_ptr< OptionListComponent<std::string> > optionList = it->second;
for (std::map<FilterIndexType, std::shared_ptr<OptionListComponent<std::string>>>::
const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it ) {
std::shared_ptr<OptionListComponent<std::string>> optionList = it->second;
std::vector<std::string> filters = optionList->getSelectedObjects();
mFilterIndex->setFilter(it->first, &filters);
}

View file

@ -61,7 +61,7 @@ GuiGamelistOptions::GuiGamelistOptions(
// Read the applicable favorite sorting setting depending on whether the
// system is a custom collection or not.
if (CollectionSystemManager::get()->getIsCustomCollection(file->getSystem()))
if (isCustomCollection)
mFavoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
else
mFavoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
@ -253,8 +253,14 @@ GuiGamelistOptions::~GuiGamelistOptions()
void GuiGamelistOptions::openGamelistFilter()
{
GuiGamelistFilter* ggf;
mFiltersChanged = true;
GuiGamelistFilter* ggf = new GuiGamelistFilter(mWindow, mSystem);
if (isCustomCollection)
ggf = new GuiGamelistFilter(mWindow, getGamelist()->getCursor()->getSystem());
else
ggf = new GuiGamelistFilter(mWindow, mSystem);
mWindow->pushGui(ggf);
}

View file

@ -134,9 +134,6 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
onFocusLost();
stopListScrolling();
SystemData* systemToView = getCursor()->getSystem();
if (systemToView->isCollection())
systemToView = CollectionSystemManager::get()->getSystemToView(systemToView);
ViewController::get()->goToSystemView(systemToView);
}