Blank/unknown values can now be filtered for Genre, Player, Publisher/Developer and Alternative emulator.

This commit is contained in:
Leon Styhre 2021-09-25 16:53:30 +02:00
parent c85700571d
commit 53630e3a7a

View file

@ -13,6 +13,7 @@
#include "Settings.h" #include "Settings.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h"
#include <cmath> #include <cmath>
@ -222,9 +223,16 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
break; break;
} }
key = Utils::String::trim(key); key = Utils::String::trim(key);
if (key.empty() || (type == RATINGS_FILTER && key == "0 STARS")) {
// Add a dummy value in case there is no metadata defined so we can filter based on this.
if ((type == GENRE_FILTER || type == PLAYER_FILTER || type == PUBDEV_FILTER) &&
Utils::String::toUpper(key) == UNKNOWN_LABEL)
key = ViewController::CROSSEDCIRCLE_CHAR + " UNKNOWN";
else if (type == ALTEMULATOR_FILTER && key.empty())
key = ViewController::CROSSEDCIRCLE_CHAR + " NONE DEFINED";
else if (key.empty() || (type == RATINGS_FILTER && key == "0 STARS"))
key = UNKNOWN_LABEL; key = UNKNOWN_LABEL;
}
return key; return key;
} }