mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Merge pull request #133 from pjft/RetroPie-master-filter-rebase
Fixing whitespaces and indentation (tabs)
This commit is contained in:
commit
7d43c87757
|
@ -42,17 +42,17 @@ std::string FileFilterIndex::getIndexableKey(FileData* game, FilterIndexType typ
|
|||
boost::trim(key);
|
||||
if (getSecondary && !key.empty()) {
|
||||
std::istringstream f(key);
|
||||
std::string newKey;
|
||||
getline(f, newKey, '/');
|
||||
if (!newKey.empty() && newKey != key)
|
||||
{
|
||||
key = newKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
key = std::string();
|
||||
}
|
||||
}
|
||||
std::string newKey;
|
||||
getline(f, newKey, '/');
|
||||
if (!newKey.empty() && newKey != key)
|
||||
{
|
||||
key = newKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
key = std::string();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PLAYER_FILTER:
|
||||
|
@ -136,11 +136,11 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
|||
*(filterData.filteredByRef) = values->size() > 0;
|
||||
filterData.currentFilteredKeys->clear();
|
||||
for (std::vector<std::string>::iterator vit = values->begin(); vit != values->end(); ++vit ) {
|
||||
// check if exists
|
||||
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->end()) {
|
||||
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
||||
}
|
||||
}
|
||||
// check if exists
|
||||
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->end()) {
|
||||
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -149,7 +149,8 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
|||
|
||||
void FileFilterIndex::clearAllFilters()
|
||||
{
|
||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it ) {
|
||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it )
|
||||
{
|
||||
FilterDataDecl filterData = (*it);
|
||||
*(filterData.filteredByRef) = false;
|
||||
filterData.currentFilteredKeys->clear();
|
||||
|
@ -161,16 +162,16 @@ void FileFilterIndex::debugPrintIndexes()
|
|||
{
|
||||
LOG(LogInfo) << "Printing Indexes...";
|
||||
for (auto x: playersIndexAllKeys) {
|
||||
LOG(LogInfo) << "Multiplayer Index: " << x.first << ": " << x.second;
|
||||
LOG(LogInfo) << "Multiplayer Index: " << x.first << ": " << x.second;
|
||||
}
|
||||
for (auto x: genreIndexAllKeys) {
|
||||
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
||||
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
||||
}
|
||||
for (auto x: ratingsIndexAllKeys) {
|
||||
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
||||
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
||||
}
|
||||
for (auto x: pubDevIndexAllKeys) {
|
||||
LOG(LogInfo) << "PubDev Index: " << x.first << ": " << x.second;
|
||||
LOG(LogInfo) << "PubDev Index: " << x.first << ": " << x.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,25 +200,27 @@ bool FileFilterIndex::showFile(FileData* game)
|
|||
|
||||
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it ) {
|
||||
FilterDataDecl filterData = (*it);
|
||||
if(*(filterData.filteredByRef)) {
|
||||
if(*(filterData.filteredByRef))
|
||||
{
|
||||
// try to find a match
|
||||
std::string key = getIndexableKey(game, filterData.type, false);
|
||||
keepGoing = isKeyBeingFilteredBy(key, filterData.type);
|
||||
|
||||
// if we didn't find a match, try for secondary keys - i.e. publisher and dev, or first genre
|
||||
if (!keepGoing) {
|
||||
if (!filterData.hasSecondaryKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::string secKey = getIndexableKey(game, filterData.type, true);
|
||||
if (secKey != UNKNOWN_LABEL)
|
||||
{
|
||||
keepGoing = isKeyBeingFilteredBy(secKey, filterData.type);
|
||||
}
|
||||
}
|
||||
// if still nothing, then it's not a match
|
||||
if (!keepGoing)
|
||||
if (!keepGoing)
|
||||
{
|
||||
if (!filterData.hasSecondaryKey)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::string secKey = getIndexableKey(game, filterData.type, true);
|
||||
if (secKey != UNKNOWN_LABEL)
|
||||
{
|
||||
keepGoing = isKeyBeingFilteredBy(secKey, filterData.type);
|
||||
}
|
||||
}
|
||||
// if still nothing, then it's not a match
|
||||
if (!keepGoing)
|
||||
return false;
|
||||
|
||||
}
|
||||
|
@ -227,19 +230,23 @@ bool FileFilterIndex::showFile(FileData* game)
|
|||
return keepGoing;
|
||||
}
|
||||
|
||||
bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type) {
|
||||
bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type)
|
||||
{
|
||||
const FilterIndexType filterTypes[4] = { PLAYER_FILTER, RATINGS_FILTER, GENRE_FILTER, PUBDEV_FILTER };
|
||||
std::vector<std::string> filterKeysList[4] = { playersIndexFilteredKeys, ratingsIndexFilteredKeys, genreIndexFilteredKeys, pubDevIndexFilteredKeys };
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (filterTypes[i] == type) {
|
||||
for (std::vector<std::string>::iterator it = filterKeysList[i].begin(); it != filterKeysList[i].end(); ++it ) {
|
||||
if (key == (*it))
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (filterTypes[i] == type)
|
||||
{
|
||||
for (std::vector<std::string>::iterator it = filterKeysList[i].begin(); it != filterKeysList[i].end(); ++it )
|
||||
{
|
||||
if (key == (*it))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,5 +380,5 @@ void FileFilterIndex::manageIndexEntry(std::map<std::string, int>* index, std::s
|
|||
|
||||
void FileFilterIndex::clearIndex(std::map<std::string, int> indexMap)
|
||||
{
|
||||
indexMap.clear();
|
||||
indexMap.clear();
|
||||
}
|
|
@ -45,7 +45,7 @@ void GuiGamelistFilter::resetAllFilters()
|
|||
|
||||
GuiGamelistFilter::~GuiGamelistFilter()
|
||||
{
|
||||
mFilterOptions.clear();
|
||||
mFilterOptions.clear();
|
||||
}
|
||||
|
||||
void GuiGamelistFilter::addFiltersToMenu()
|
||||
|
|
Loading…
Reference in a new issue