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

View file

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

View file

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

View file

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