mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55: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);
|
boost::trim(key);
|
||||||
if (getSecondary && !key.empty()) {
|
if (getSecondary && !key.empty()) {
|
||||||
std::istringstream f(key);
|
std::istringstream f(key);
|
||||||
std::string newKey;
|
std::string newKey;
|
||||||
getline(f, newKey, '/');
|
getline(f, newKey, '/');
|
||||||
if (!newKey.empty() && newKey != key)
|
if (!newKey.empty() && newKey != key)
|
||||||
{
|
{
|
||||||
key = newKey;
|
key = newKey;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
key = std::string();
|
key = std::string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PLAYER_FILTER:
|
case PLAYER_FILTER:
|
||||||
|
@ -136,11 +136,11 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
||||||
*(filterData.filteredByRef) = values->size() > 0;
|
*(filterData.filteredByRef) = values->size() > 0;
|
||||||
filterData.currentFilteredKeys->clear();
|
filterData.currentFilteredKeys->clear();
|
||||||
for (std::vector<std::string>::iterator vit = values->begin(); vit != values->end(); ++vit ) {
|
for (std::vector<std::string>::iterator vit = values->begin(); vit != values->end(); ++vit ) {
|
||||||
// check if exists
|
// check if exists
|
||||||
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->end()) {
|
if (filterData.allIndexKeys->find(*vit) != filterData.allIndexKeys->end()) {
|
||||||
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
filterData.currentFilteredKeys->push_back(std::string(*vit));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,8 @@ void FileFilterIndex::setFilter(FilterIndexType type, std::vector<std::string>*
|
||||||
|
|
||||||
void FileFilterIndex::clearAllFilters()
|
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);
|
FilterDataDecl filterData = (*it);
|
||||||
*(filterData.filteredByRef) = false;
|
*(filterData.filteredByRef) = false;
|
||||||
filterData.currentFilteredKeys->clear();
|
filterData.currentFilteredKeys->clear();
|
||||||
|
@ -161,16 +162,16 @@ void FileFilterIndex::debugPrintIndexes()
|
||||||
{
|
{
|
||||||
LOG(LogInfo) << "Printing Indexes...";
|
LOG(LogInfo) << "Printing Indexes...";
|
||||||
for (auto x: playersIndexAllKeys) {
|
for (auto x: playersIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Multiplayer Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Multiplayer Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x: genreIndexAllKeys) {
|
for (auto x: genreIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x: ratingsIndexAllKeys) {
|
for (auto x: ratingsIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x: pubDevIndexAllKeys) {
|
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 ) {
|
for (std::vector<FilterDataDecl>::iterator it = filterDataDecl.begin(); it != filterDataDecl.end(); ++it ) {
|
||||||
FilterDataDecl filterData = (*it);
|
FilterDataDecl filterData = (*it);
|
||||||
if(*(filterData.filteredByRef)) {
|
if(*(filterData.filteredByRef))
|
||||||
|
{
|
||||||
// try to find a match
|
// try to find a match
|
||||||
std::string key = getIndexableKey(game, filterData.type, false);
|
std::string key = getIndexableKey(game, filterData.type, false);
|
||||||
keepGoing = isKeyBeingFilteredBy(key, filterData.type);
|
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 we didn't find a match, try for secondary keys - i.e. publisher and dev, or first genre
|
||||||
if (!keepGoing) {
|
if (!keepGoing)
|
||||||
if (!filterData.hasSecondaryKey)
|
{
|
||||||
{
|
if (!filterData.hasSecondaryKey)
|
||||||
return false;
|
{
|
||||||
}
|
return false;
|
||||||
std::string secKey = getIndexableKey(game, filterData.type, true);
|
}
|
||||||
if (secKey != UNKNOWN_LABEL)
|
std::string secKey = getIndexableKey(game, filterData.type, true);
|
||||||
{
|
if (secKey != UNKNOWN_LABEL)
|
||||||
keepGoing = isKeyBeingFilteredBy(secKey, filterData.type);
|
{
|
||||||
}
|
keepGoing = isKeyBeingFilteredBy(secKey, filterData.type);
|
||||||
}
|
}
|
||||||
// if still nothing, then it's not a match
|
}
|
||||||
if (!keepGoing)
|
// if still nothing, then it's not a match
|
||||||
|
if (!keepGoing)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -227,19 +230,23 @@ bool FileFilterIndex::showFile(FileData* game)
|
||||||
return keepGoing;
|
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 };
|
const FilterIndexType filterTypes[4] = { PLAYER_FILTER, RATINGS_FILTER, GENRE_FILTER, PUBDEV_FILTER };
|
||||||
std::vector<std::string> filterKeysList[4] = { playersIndexFilteredKeys, ratingsIndexFilteredKeys, genreIndexFilteredKeys, pubDevIndexFilteredKeys };
|
std::vector<std::string> filterKeysList[4] = { playersIndexFilteredKeys, ratingsIndexFilteredKeys, genreIndexFilteredKeys, pubDevIndexFilteredKeys };
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++) {
|
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 (filterTypes[i] == type)
|
||||||
if (key == (*it))
|
{
|
||||||
|
for (std::vector<std::string>::iterator it = filterKeysList[i].begin(); it != filterKeysList[i].end(); ++it )
|
||||||
|
{
|
||||||
|
if (key == (*it))
|
||||||
{
|
{
|
||||||
return true;
|
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)
|
void FileFilterIndex::clearIndex(std::map<std::string, int> indexMap)
|
||||||
{
|
{
|
||||||
indexMap.clear();
|
indexMap.clear();
|
||||||
}
|
}
|
|
@ -45,7 +45,7 @@ void GuiGamelistFilter::resetAllFilters()
|
||||||
|
|
||||||
GuiGamelistFilter::~GuiGamelistFilter()
|
GuiGamelistFilter::~GuiGamelistFilter()
|
||||||
{
|
{
|
||||||
mFilterOptions.clear();
|
mFilterOptions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiGamelistFilter::addFiltersToMenu()
|
void GuiGamelistFilter::addFiltersToMenu()
|
||||||
|
|
Loading…
Reference in a new issue