From 92a3286fc835dc03fb422f15a7f46cac9769c32a Mon Sep 17 00:00:00 2001 From: Tomas Jakobsson Date: Sat, 4 Nov 2017 17:03:24 +0100 Subject: [PATCH] Add SystemData::indexAllGameFilters that loops through all added games and add's their tags to the filter indexes This fixes the hidden filtering in Kiosk mode when not using gamelist.xml --- es-app/src/Gamelist.cpp | 8 -------- es-app/src/SystemData.cpp | 16 ++++++++++++++++ es-app/src/SystemData.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/es-app/src/Gamelist.cpp b/es-app/src/Gamelist.cpp index e1994e9c7..8581d3329 100644 --- a/es-app/src/Gamelist.cpp +++ b/es-app/src/Gamelist.cpp @@ -144,14 +144,6 @@ void parseGamelist(SystemData* system) file->metadata.set("name", defaultName); file->metadata.resetChangedFlag(); - - // index if it's a game! - if(type == GAME) - { - FileFilterIndex* index = system->getIndex(); - index->addToIndex(file); - } - } } } diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 148b91c13..2ee2d7bb5 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -36,6 +36,8 @@ SystemData::SystemData(const std::string& name, const std::string& fullName, Sys parseGamelist(this); mRootFolder->sort(FileSorts::SortTypes.at(0)); + + indexAllGameFilters(mRootFolder); } else { @@ -145,6 +147,20 @@ void SystemData::populateFolder(FileData* folder) } } +void SystemData::indexAllGameFilters(const FileData* folder) +{ + const std::vector& children = folder->getChildren(); + + for(std::vector::const_iterator it = children.begin(); it != children.end(); ++it) + { + switch((*it)->getType()) + { + case GAME: { mFilterIndex->addToIndex(*it); } break; + case FOLDER: { indexAllGameFilters(*it); } break; + } + } +} + std::vector readList(const std::string& str, const char* delims = " \t\r\n,") { std::vector ret; diff --git a/es-app/src/SystemData.h b/es-app/src/SystemData.h index ede8edcd7..73247f7e8 100644 --- a/es-app/src/SystemData.h +++ b/es-app/src/SystemData.h @@ -77,6 +77,7 @@ private: std::shared_ptr mTheme; void populateFolder(FileData* folder); + void indexAllGameFilters(const FileData* folder); void setIsGameSystemStatus(); FileFilterIndex* mFilterIndex;