mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +00:00
Sorted the filters in the same order as the metadata editor fields.
This commit is contained in:
parent
5f3abed826
commit
e930848645
|
@ -23,16 +23,16 @@
|
||||||
FileFilterIndex::FileFilterIndex()
|
FileFilterIndex::FileFilterIndex()
|
||||||
: mFilterByText(false)
|
: mFilterByText(false)
|
||||||
, mTextRemoveSystem(false)
|
, mTextRemoveSystem(false)
|
||||||
, mFilterByFavorites(false)
|
, mFilterByRatings(false)
|
||||||
, mFilterByGenre(false)
|
|
||||||
, mFilterByPlayers(false)
|
|
||||||
, mFilterByDeveloper(false)
|
, mFilterByDeveloper(false)
|
||||||
, mFilterByPublisher(false)
|
, mFilterByPublisher(false)
|
||||||
, mFilterByRatings(false)
|
, mFilterByGenre(false)
|
||||||
, mFilterByKidGame(false)
|
, mFilterByPlayers(false)
|
||||||
|
, mFilterByFavorites(false)
|
||||||
, mFilterByCompleted(false)
|
, mFilterByCompleted(false)
|
||||||
, mFilterByBroken(false)
|
, mFilterByKidGame(false)
|
||||||
, mFilterByHidden(false)
|
, mFilterByHidden(false)
|
||||||
|
, mFilterByBroken(false)
|
||||||
, mFilterByAltemulator(false)
|
, mFilterByAltemulator(false)
|
||||||
{
|
{
|
||||||
clearAllFilters();
|
clearAllFilters();
|
||||||
|
@ -40,16 +40,16 @@ FileFilterIndex::FileFilterIndex()
|
||||||
// clang-format off
|
// clang-format off
|
||||||
FilterDataDecl filterDecls[] = {
|
FilterDataDecl filterDecls[] = {
|
||||||
//type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel
|
//type //allKeys //filteredBy //filteredKeys //primaryKey //hasSecondaryKey //secondaryKey //menuLabel
|
||||||
{FAVORITES_FILTER, &mFavoritesIndexAllKeys, &mFilterByFavorites, &mFavoritesIndexFilteredKeys, "favorite", false, "", "FAVORITES"},
|
{RATINGS_FILTER, &mRatingsIndexAllKeys, &mFilterByRatings, &mRatingsIndexFilteredKeys, "rating", false, "", "RATING"},
|
||||||
{GENRE_FILTER, &mGenreIndexAllKeys, &mFilterByGenre, &mGenreIndexFilteredKeys, "genre", true, "genre", "GENRE"},
|
|
||||||
{PLAYER_FILTER, &mPlayersIndexAllKeys, &mFilterByPlayers, &mPlayersIndexFilteredKeys, "players", false, "", "PLAYERS"},
|
|
||||||
{DEVELOPER_FILTER, &mDeveloperIndexAllKeys, &mFilterByDeveloper, &mDeveloperIndexFilteredKeys, "developer", false, "", "DEVELOPER"},
|
{DEVELOPER_FILTER, &mDeveloperIndexAllKeys, &mFilterByDeveloper, &mDeveloperIndexFilteredKeys, "developer", false, "", "DEVELOPER"},
|
||||||
{PUBLISHER_FILTER, &mPublisherIndexAllKeys, &mFilterByPublisher, &mPublisherIndexFilteredKeys, "publisher", false, "", "PUBLISHER"},
|
{PUBLISHER_FILTER, &mPublisherIndexAllKeys, &mFilterByPublisher, &mPublisherIndexFilteredKeys, "publisher", false, "", "PUBLISHER"},
|
||||||
{RATINGS_FILTER, &mRatingsIndexAllKeys, &mFilterByRatings, &mRatingsIndexFilteredKeys, "rating", false, "", "RATING"},
|
{GENRE_FILTER, &mGenreIndexAllKeys, &mFilterByGenre, &mGenreIndexFilteredKeys, "genre", true, "genre", "GENRE"},
|
||||||
{KIDGAME_FILTER, &mKidGameIndexAllKeys, &mFilterByKidGame, &mKidGameIndexFilteredKeys, "kidgame", false, "", "KIDGAME"},
|
{PLAYER_FILTER, &mPlayersIndexAllKeys, &mFilterByPlayers, &mPlayersIndexFilteredKeys, "players", false, "", "PLAYERS"},
|
||||||
|
{FAVORITES_FILTER, &mFavoritesIndexAllKeys, &mFilterByFavorites, &mFavoritesIndexFilteredKeys, "favorite", false, "", "FAVORITE"},
|
||||||
{COMPLETED_FILTER, &mCompletedIndexAllKeys, &mFilterByCompleted, &mCompletedIndexFilteredKeys, "completed", false, "", "COMPLETED"},
|
{COMPLETED_FILTER, &mCompletedIndexAllKeys, &mFilterByCompleted, &mCompletedIndexFilteredKeys, "completed", false, "", "COMPLETED"},
|
||||||
{BROKEN_FILTER, &mBrokenIndexAllKeys, &mFilterByBroken, &mBrokenIndexFilteredKeys, "broken", false, "", "BROKEN"},
|
{KIDGAME_FILTER, &mKidGameIndexAllKeys, &mFilterByKidGame, &mKidGameIndexFilteredKeys, "kidgame", false, "", "KIDGAME"},
|
||||||
{HIDDEN_FILTER, &mHiddenIndexAllKeys, &mFilterByHidden, &mHiddenIndexFilteredKeys, "hidden", false, "", "HIDDEN"},
|
{HIDDEN_FILTER, &mHiddenIndexAllKeys, &mFilterByHidden, &mHiddenIndexFilteredKeys, "hidden", false, "", "HIDDEN"},
|
||||||
|
{BROKEN_FILTER, &mBrokenIndexAllKeys, &mFilterByBroken, &mBrokenIndexFilteredKeys, "broken", false, "", "BROKEN"},
|
||||||
{ALTEMULATOR_FILTER, &mAltemulatorIndexAllKeys, &mFilterByAltemulator, &mAltemulatorIndexFilteredKeys, "altemulator", false, "", "ALTERNATIVE EMULATOR"}
|
{ALTEMULATOR_FILTER, &mAltemulatorIndexAllKeys, &mFilterByAltemulator, &mAltemulatorIndexFilteredKeys, "altemulator", false, "", "ALTERNATIVE EMULATOR"}
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
@ -72,16 +72,16 @@ void FileFilterIndex::importIndex(FileFilterIndex* indexToImport)
|
||||||
};
|
};
|
||||||
|
|
||||||
IndexImportStructure indexStructDecls[] = {
|
IndexImportStructure indexStructDecls[] = {
|
||||||
{&mFavoritesIndexAllKeys, &(indexToImport->mFavoritesIndexAllKeys)},
|
{&mRatingsIndexAllKeys, &(indexToImport->mRatingsIndexAllKeys)},
|
||||||
{&mGenreIndexAllKeys, &(indexToImport->mGenreIndexAllKeys)},
|
|
||||||
{&mPlayersIndexAllKeys, &(indexToImport->mPlayersIndexAllKeys)},
|
|
||||||
{&mDeveloperIndexAllKeys, &(indexToImport->mDeveloperIndexAllKeys)},
|
{&mDeveloperIndexAllKeys, &(indexToImport->mDeveloperIndexAllKeys)},
|
||||||
{&mPublisherIndexAllKeys, &(indexToImport->mPublisherIndexAllKeys)},
|
{&mPublisherIndexAllKeys, &(indexToImport->mPublisherIndexAllKeys)},
|
||||||
{&mRatingsIndexAllKeys, &(indexToImport->mRatingsIndexAllKeys)},
|
{&mGenreIndexAllKeys, &(indexToImport->mGenreIndexAllKeys)},
|
||||||
{&mKidGameIndexAllKeys, &(indexToImport->mKidGameIndexAllKeys)},
|
{&mPlayersIndexAllKeys, &(indexToImport->mPlayersIndexAllKeys)},
|
||||||
|
{&mFavoritesIndexAllKeys, &(indexToImport->mFavoritesIndexAllKeys)},
|
||||||
{&mCompletedIndexAllKeys, &(indexToImport->mCompletedIndexAllKeys)},
|
{&mCompletedIndexAllKeys, &(indexToImport->mCompletedIndexAllKeys)},
|
||||||
{&mBrokenIndexAllKeys, &(indexToImport->mBrokenIndexAllKeys)},
|
{&mKidGameIndexAllKeys, &(indexToImport->mKidGameIndexAllKeys)},
|
||||||
{&mHiddenIndexAllKeys, &(indexToImport->mHiddenIndexAllKeys)},
|
{&mHiddenIndexAllKeys, &(indexToImport->mHiddenIndexAllKeys)},
|
||||||
|
{&mBrokenIndexAllKeys, &(indexToImport->mBrokenIndexAllKeys)},
|
||||||
{&mAltemulatorIndexAllKeys, &(indexToImport->mAltemulatorIndexAllKeys)},
|
{&mAltemulatorIndexAllKeys, &(indexToImport->mAltemulatorIndexAllKeys)},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,16 +109,16 @@ void FileFilterIndex::importIndex(FileFilterIndex* indexToImport)
|
||||||
void FileFilterIndex::resetIndex()
|
void FileFilterIndex::resetIndex()
|
||||||
{
|
{
|
||||||
clearAllFilters();
|
clearAllFilters();
|
||||||
clearIndex(mFavoritesIndexAllKeys);
|
clearIndex(mRatingsIndexAllKeys);
|
||||||
clearIndex(mGenreIndexAllKeys);
|
|
||||||
clearIndex(mPlayersIndexAllKeys);
|
|
||||||
clearIndex(mDeveloperIndexAllKeys);
|
clearIndex(mDeveloperIndexAllKeys);
|
||||||
clearIndex(mPublisherIndexAllKeys);
|
clearIndex(mPublisherIndexAllKeys);
|
||||||
clearIndex(mRatingsIndexAllKeys);
|
clearIndex(mGenreIndexAllKeys);
|
||||||
clearIndex(mKidGameIndexAllKeys);
|
clearIndex(mPlayersIndexAllKeys);
|
||||||
|
clearIndex(mFavoritesIndexAllKeys);
|
||||||
clearIndex(mCompletedIndexAllKeys);
|
clearIndex(mCompletedIndexAllKeys);
|
||||||
clearIndex(mBrokenIndexAllKeys);
|
clearIndex(mKidGameIndexAllKeys);
|
||||||
clearIndex(mHiddenIndexAllKeys);
|
clearIndex(mHiddenIndexAllKeys);
|
||||||
|
clearIndex(mBrokenIndexAllKeys);
|
||||||
clearIndex(mAltemulatorIndexAllKeys);
|
clearIndex(mAltemulatorIndexAllKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,39 +128,6 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
|
||||||
{
|
{
|
||||||
std::string key = "";
|
std::string key = "";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case FAVORITES_FILTER: {
|
|
||||||
if (game->getType() != GAME)
|
|
||||||
return "FALSE";
|
|
||||||
key = Utils::String::toUpper(game->metadata.get("favorite"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GENRE_FILTER: {
|
|
||||||
key = Utils::String::toUpper(game->metadata.get("genre"));
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PLAYER_FILTER: {
|
|
||||||
if (getSecondary)
|
|
||||||
break;
|
|
||||||
key = Utils::String::toUpper(game->metadata.get("players"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DEVELOPER_FILTER: {
|
|
||||||
key = Utils::String::toUpper(game->metadata.get("developer"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PUBLISHER_FILTER: {
|
|
||||||
key = Utils::String::toUpper(game->metadata.get("publisher"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case RATINGS_FILTER: {
|
case RATINGS_FILTER: {
|
||||||
int ratingNumber = 0;
|
int ratingNumber = 0;
|
||||||
if (!getSecondary) {
|
if (!getSecondary) {
|
||||||
|
@ -191,10 +158,37 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case KIDGAME_FILTER: {
|
case DEVELOPER_FILTER: {
|
||||||
|
key = Utils::String::toUpper(game->metadata.get("developer"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PUBLISHER_FILTER: {
|
||||||
|
key = Utils::String::toUpper(game->metadata.get("publisher"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GENRE_FILTER: {
|
||||||
|
key = Utils::String::toUpper(game->metadata.get("genre"));
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PLAYER_FILTER: {
|
||||||
|
if (getSecondary)
|
||||||
|
break;
|
||||||
|
key = Utils::String::toUpper(game->metadata.get("players"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FAVORITES_FILTER: {
|
||||||
if (game->getType() != GAME)
|
if (game->getType() != GAME)
|
||||||
return "FALSE";
|
return "FALSE";
|
||||||
key = Utils::String::toUpper(game->metadata.get("kidgame"));
|
key = Utils::String::toUpper(game->metadata.get("favorite"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case COMPLETED_FILTER: {
|
case COMPLETED_FILTER: {
|
||||||
|
@ -203,10 +197,10 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
|
||||||
key = Utils::String::toUpper(game->metadata.get("completed"));
|
key = Utils::String::toUpper(game->metadata.get("completed"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BROKEN_FILTER: {
|
case KIDGAME_FILTER: {
|
||||||
if (game->getType() != GAME)
|
if (game->getType() != GAME)
|
||||||
return "FALSE";
|
return "FALSE";
|
||||||
key = Utils::String::toUpper(game->metadata.get("broken"));
|
key = Utils::String::toUpper(game->metadata.get("kidgame"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HIDDEN_FILTER: {
|
case HIDDEN_FILTER: {
|
||||||
|
@ -215,6 +209,12 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
|
||||||
key = Utils::String::toUpper(game->metadata.get("hidden"));
|
key = Utils::String::toUpper(game->metadata.get("hidden"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BROKEN_FILTER: {
|
||||||
|
if (game->getType() != GAME)
|
||||||
|
return "FALSE";
|
||||||
|
key = Utils::String::toUpper(game->metadata.get("broken"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ALTEMULATOR_FILTER: {
|
case ALTEMULATOR_FILTER: {
|
||||||
if (getSecondary)
|
if (getSecondary)
|
||||||
break;
|
break;
|
||||||
|
@ -241,31 +241,31 @@ std::string FileFilterIndex::getIndexableKey(FileData* game,
|
||||||
|
|
||||||
void FileFilterIndex::addToIndex(FileData* game)
|
void FileFilterIndex::addToIndex(FileData* game)
|
||||||
{
|
{
|
||||||
manageFavoritesEntryInIndex(game);
|
manageRatingsEntryInIndex(game);
|
||||||
manageGenreEntryInIndex(game);
|
|
||||||
managePlayerEntryInIndex(game);
|
|
||||||
manageDeveloperEntryInIndex(game);
|
manageDeveloperEntryInIndex(game);
|
||||||
managePublisherEntryInIndex(game);
|
managePublisherEntryInIndex(game);
|
||||||
manageRatingsEntryInIndex(game);
|
manageGenreEntryInIndex(game);
|
||||||
manageKidGameEntryInIndex(game);
|
managePlayerEntryInIndex(game);
|
||||||
|
manageFavoritesEntryInIndex(game);
|
||||||
manageCompletedEntryInIndex(game);
|
manageCompletedEntryInIndex(game);
|
||||||
manageBrokenEntryInIndex(game);
|
manageKidGameEntryInIndex(game);
|
||||||
manageHiddenEntryInIndex(game);
|
manageHiddenEntryInIndex(game);
|
||||||
|
manageBrokenEntryInIndex(game);
|
||||||
manageAltemulatorEntryInIndex(game);
|
manageAltemulatorEntryInIndex(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::removeFromIndex(FileData* game)
|
void FileFilterIndex::removeFromIndex(FileData* game)
|
||||||
{
|
{
|
||||||
manageFavoritesEntryInIndex(game, true);
|
manageRatingsEntryInIndex(game, true);
|
||||||
manageGenreEntryInIndex(game, true);
|
|
||||||
managePlayerEntryInIndex(game, true);
|
|
||||||
manageDeveloperEntryInIndex(game, true);
|
manageDeveloperEntryInIndex(game, true);
|
||||||
managePublisherEntryInIndex(game, true);
|
managePublisherEntryInIndex(game, true);
|
||||||
manageRatingsEntryInIndex(game, true);
|
manageGenreEntryInIndex(game, true);
|
||||||
manageKidGameEntryInIndex(game, true);
|
managePlayerEntryInIndex(game, true);
|
||||||
|
manageFavoritesEntryInIndex(game, true);
|
||||||
manageCompletedEntryInIndex(game, true);
|
manageCompletedEntryInIndex(game, true);
|
||||||
manageBrokenEntryInIndex(game, true);
|
manageKidGameEntryInIndex(game, true);
|
||||||
manageHiddenEntryInIndex(game, true);
|
manageHiddenEntryInIndex(game, true);
|
||||||
|
manageBrokenEntryInIndex(game, true);
|
||||||
manageAltemulatorEntryInIndex(game, true);
|
manageAltemulatorEntryInIndex(game, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,36 +335,36 @@ void FileFilterIndex::setKidModeFilters()
|
||||||
void FileFilterIndex::debugPrintIndexes()
|
void FileFilterIndex::debugPrintIndexes()
|
||||||
{
|
{
|
||||||
LOG(LogInfo) << "Printing Indexes...";
|
LOG(LogInfo) << "Printing Indexes...";
|
||||||
for (auto x : mFavoritesIndexAllKeys) {
|
for (auto x : mRatingsIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Favorites Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
||||||
|
}
|
||||||
|
for (auto x : mDeveloperIndexAllKeys) {
|
||||||
|
LOG(LogInfo) << "Developer Index: " << x.first << ": " << x.second;
|
||||||
|
}
|
||||||
|
for (auto x : mPublisherIndexAllKeys) {
|
||||||
|
LOG(LogInfo) << "Publisher Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x : mGenreIndexAllKeys) {
|
for (auto x : mGenreIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Genre Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x : mPlayersIndexAllKeys) {
|
for (auto x : mPlayersIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Multiplayer Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Players Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x : mDeveloperIndexAllKeys) {
|
for (auto x : mFavoritesIndexAllKeys) {
|
||||||
LOG(LogInfo) << "PubDev Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Favorites Index: " << x.first << ": " << x.second;
|
||||||
}
|
|
||||||
for (auto x : mPublisherIndexAllKeys) {
|
|
||||||
LOG(LogInfo) << "PubDev Index: " << x.first << ": " << x.second;
|
|
||||||
}
|
|
||||||
for (auto x : mRatingsIndexAllKeys) {
|
|
||||||
LOG(LogInfo) << "Ratings Index: " << x.first << ": " << x.second;
|
|
||||||
}
|
|
||||||
for (auto x : mKidGameIndexAllKeys) {
|
|
||||||
LOG(LogInfo) << "KidGames Index: " << x.first << ": " << x.second;
|
|
||||||
}
|
}
|
||||||
for (auto x : mCompletedIndexAllKeys) {
|
for (auto x : mCompletedIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Completed Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Completed Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x : mBrokenIndexAllKeys) {
|
for (auto x : mKidGameIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Broken Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "KidGames Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
for (auto x : mHiddenIndexAllKeys) {
|
for (auto x : mHiddenIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Hidden Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Hidden Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
|
for (auto x : mBrokenIndexAllKeys) {
|
||||||
|
LOG(LogInfo) << "Broken Index: " << x.first << ": " << x.second;
|
||||||
|
}
|
||||||
for (auto x : mAltemulatorIndexAllKeys) {
|
for (auto x : mAltemulatorIndexAllKeys) {
|
||||||
LOG(LogInfo) << "Altemulator Index: " << x.first << ": " << x.second;
|
LOG(LogInfo) << "Altemulator Index: " << x.first << ": " << x.second;
|
||||||
}
|
}
|
||||||
|
@ -442,28 +442,28 @@ bool FileFilterIndex::showFile(FileData* game)
|
||||||
bool FileFilterIndex::isFiltered()
|
bool FileFilterIndex::isFiltered()
|
||||||
{
|
{
|
||||||
if (UIModeController::getInstance()->isUIModeKid()) {
|
if (UIModeController::getInstance()->isUIModeKid()) {
|
||||||
return (mFilterByText || mFilterByFavorites || mFilterByGenre || mFilterByPlayers ||
|
return (mFilterByText || mFilterByRatings || mFilterByDeveloper || mFilterByPublisher ||
|
||||||
mFilterByDeveloper || mFilterByPublisher || mFilterByRatings ||
|
mFilterByGenre || mFilterByPlayers || mFilterByFavorites || mFilterByCompleted ||
|
||||||
mFilterByCompleted || mFilterByBroken || mFilterByHidden || mFilterByAltemulator);
|
mFilterByHidden || mFilterByBroken || mFilterByAltemulator);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return (mFilterByText || mFilterByFavorites || mFilterByGenre || mFilterByPlayers ||
|
return (mFilterByText || mFilterByRatings || mFilterByDeveloper || mFilterByPublisher ||
|
||||||
mFilterByDeveloper || mFilterByPublisher || mFilterByRatings || mFilterByKidGame ||
|
mFilterByGenre || mFilterByPlayers || mFilterByFavorites || mFilterByCompleted ||
|
||||||
mFilterByCompleted || mFilterByBroken || mFilterByHidden | mFilterByAltemulator);
|
mFilterByKidGame || mFilterByHidden || mFilterByBroken || mFilterByAltemulator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type)
|
bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type)
|
||||||
{
|
{
|
||||||
const FilterIndexType filterTypes[11] = {FAVORITES_FILTER, GENRE_FILTER, PLAYER_FILTER,
|
const FilterIndexType filterTypes[11] = {RATINGS_FILTER, DEVELOPER_FILTER, PUBLISHER_FILTER,
|
||||||
DEVELOPER_FILTER, PUBLISHER_FILTER, RATINGS_FILTER,
|
GENRE_FILTER, PLAYER_FILTER, FAVORITES_FILTER,
|
||||||
KIDGAME_FILTER, COMPLETED_FILTER, BROKEN_FILTER,
|
COMPLETED_FILTER, KIDGAME_FILTER, HIDDEN_FILTER,
|
||||||
HIDDEN_FILTER, ALTEMULATOR_FILTER};
|
BROKEN_FILTER, ALTEMULATOR_FILTER};
|
||||||
std::vector<std::string> filterKeysList[11] = {
|
std::vector<std::string> filterKeysList[11] = {
|
||||||
mFavoritesIndexFilteredKeys, mGenreIndexFilteredKeys, mPlayersIndexFilteredKeys,
|
mRatingsIndexFilteredKeys, mDeveloperIndexFilteredKeys, mPublisherIndexFilteredKeys,
|
||||||
mDeveloperIndexFilteredKeys, mPublisherIndexFilteredKeys, mRatingsIndexFilteredKeys,
|
mGenreIndexFilteredKeys, mPlayersIndexFilteredKeys, mFavoritesIndexFilteredKeys,
|
||||||
mKidGameIndexFilteredKeys, mCompletedIndexFilteredKeys, mBrokenIndexFilteredKeys,
|
mCompletedIndexFilteredKeys, mKidGameIndexFilteredKeys, mHiddenIndexFilteredKeys,
|
||||||
mHiddenIndexFilteredKeys, mAltemulatorIndexFilteredKeys};
|
mBrokenIndexFilteredKeys, mAltemulatorIndexFilteredKeys};
|
||||||
|
|
||||||
for (int i = 0; i < 11; i++) {
|
for (int i = 0; i < 11; i++) {
|
||||||
if (filterTypes[i] == type) {
|
if (filterTypes[i] == type) {
|
||||||
|
@ -478,41 +478,18 @@ bool FileFilterIndex::isKeyBeingFilteredBy(std::string key, FilterIndexType type
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageFavoritesEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageRatingsEntryInIndex(FileData* game, bool remove)
|
||||||
{
|
{
|
||||||
|
std::string key = getIndexableKey(game, RATINGS_FILTER, false);
|
||||||
|
|
||||||
|
// Flag for including unknowns.
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
std::string key = getIndexableKey(game, FAVORITES_FILTER, false);
|
|
||||||
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
|
// No valid rating info found.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
manageIndexEntry(&mFavoritesIndexAllKeys, key, remove);
|
manageIndexEntry(&mRatingsIndexAllKeys, key, remove);
|
||||||
}
|
|
||||||
|
|
||||||
void FileFilterIndex::manageGenreEntryInIndex(FileData* game, bool remove)
|
|
||||||
{
|
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
|
||||||
std::string key = getIndexableKey(game, GENRE_FILTER, false);
|
|
||||||
|
|
||||||
if (!includeUnknown && (key == UNKNOWN_LABEL || key == "BIOS"))
|
|
||||||
return;
|
|
||||||
|
|
||||||
manageIndexEntry(&mGenreIndexAllKeys, key, remove);
|
|
||||||
|
|
||||||
key = getIndexableKey(game, GENRE_FILTER, true);
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
|
||||||
manageIndexEntry(&mGenreIndexAllKeys, key, remove);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FileFilterIndex::managePlayerEntryInIndex(FileData* game, bool remove)
|
|
||||||
{
|
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
|
||||||
std::string key = getIndexableKey(game, PLAYER_FILTER, false);
|
|
||||||
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
manageIndexEntry(&mPlayersIndexAllKeys, key, remove);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageDeveloperEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageDeveloperEntryInIndex(FileData* game, bool remove)
|
||||||
|
@ -545,31 +522,41 @@ void FileFilterIndex::managePublisherEntryInIndex(FileData* game, bool remove)
|
||||||
manageIndexEntry(&mPublisherIndexAllKeys, key, remove);
|
manageIndexEntry(&mPublisherIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageRatingsEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageGenreEntryInIndex(FileData* game, bool remove)
|
||||||
{
|
{
|
||||||
std::string key = getIndexableKey(game, RATINGS_FILTER, false);
|
|
||||||
|
|
||||||
// Flag for including unknowns.
|
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
|
std::string key = getIndexableKey(game, GENRE_FILTER, false);
|
||||||
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
if (!includeUnknown && (key == UNKNOWN_LABEL || key == "BIOS"))
|
||||||
// No valid rating info found.
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
manageIndexEntry(&mRatingsIndexAllKeys, key, remove);
|
manageIndexEntry(&mGenreIndexAllKeys, key, remove);
|
||||||
|
|
||||||
|
key = getIndexableKey(game, GENRE_FILTER, true);
|
||||||
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
|
manageIndexEntry(&mGenreIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageKidGameEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::managePlayerEntryInIndex(FileData* game, bool remove)
|
||||||
{
|
{
|
||||||
// Flag for including unknowns.
|
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
std::string key = getIndexableKey(game, KIDGAME_FILTER, false);
|
std::string key = getIndexableKey(game, PLAYER_FILTER, false);
|
||||||
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
// No valid kidgame info found.
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
manageIndexEntry(&mKidGameIndexAllKeys, key, remove);
|
manageIndexEntry(&mPlayersIndexAllKeys, key, remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileFilterIndex::manageFavoritesEntryInIndex(FileData* game, bool remove)
|
||||||
|
{
|
||||||
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
|
std::string key = getIndexableKey(game, FAVORITES_FILTER, false);
|
||||||
|
|
||||||
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
manageIndexEntry(&mFavoritesIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageCompletedEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageCompletedEntryInIndex(FileData* game, bool remove)
|
||||||
|
@ -585,17 +572,17 @@ void FileFilterIndex::manageCompletedEntryInIndex(FileData* game, bool remove)
|
||||||
manageIndexEntry(&mCompletedIndexAllKeys, key, remove);
|
manageIndexEntry(&mCompletedIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageBrokenEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageKidGameEntryInIndex(FileData* game, bool remove)
|
||||||
{
|
{
|
||||||
// Flag for including unknowns.
|
// Flag for including unknowns.
|
||||||
bool includeUnknown = INCLUDE_UNKNOWN;
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
std::string key = getIndexableKey(game, BROKEN_FILTER, false);
|
std::string key = getIndexableKey(game, KIDGAME_FILTER, false);
|
||||||
|
|
||||||
if (!includeUnknown && key == UNKNOWN_LABEL)
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
// No valid broken info found.
|
// No valid kidgame info found.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
manageIndexEntry(&mBrokenIndexAllKeys, key, remove);
|
manageIndexEntry(&mKidGameIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageHiddenEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageHiddenEntryInIndex(FileData* game, bool remove)
|
||||||
|
@ -611,6 +598,19 @@ void FileFilterIndex::manageHiddenEntryInIndex(FileData* game, bool remove)
|
||||||
manageIndexEntry(&mHiddenIndexAllKeys, key, remove);
|
manageIndexEntry(&mHiddenIndexAllKeys, key, remove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileFilterIndex::manageBrokenEntryInIndex(FileData* game, bool remove)
|
||||||
|
{
|
||||||
|
// Flag for including unknowns.
|
||||||
|
bool includeUnknown = INCLUDE_UNKNOWN;
|
||||||
|
std::string key = getIndexableKey(game, BROKEN_FILTER, false);
|
||||||
|
|
||||||
|
if (!includeUnknown && key == UNKNOWN_LABEL)
|
||||||
|
// No valid broken info found.
|
||||||
|
return;
|
||||||
|
|
||||||
|
manageIndexEntry(&mBrokenIndexAllKeys, key, remove);
|
||||||
|
}
|
||||||
|
|
||||||
void FileFilterIndex::manageAltemulatorEntryInIndex(FileData* game, bool remove)
|
void FileFilterIndex::manageAltemulatorEntryInIndex(FileData* game, bool remove)
|
||||||
{
|
{
|
||||||
std::string key = getIndexableKey(game, ALTEMULATOR_FILTER, false);
|
std::string key = getIndexableKey(game, ALTEMULATOR_FILTER, false);
|
||||||
|
|
|
@ -21,16 +21,16 @@ class FileData;
|
||||||
|
|
||||||
enum FilterIndexType {
|
enum FilterIndexType {
|
||||||
NONE,
|
NONE,
|
||||||
FAVORITES_FILTER,
|
RATINGS_FILTER,
|
||||||
GENRE_FILTER,
|
|
||||||
PLAYER_FILTER,
|
|
||||||
DEVELOPER_FILTER,
|
DEVELOPER_FILTER,
|
||||||
PUBLISHER_FILTER,
|
PUBLISHER_FILTER,
|
||||||
RATINGS_FILTER,
|
GENRE_FILTER,
|
||||||
KIDGAME_FILTER,
|
PLAYER_FILTER,
|
||||||
|
FAVORITES_FILTER,
|
||||||
COMPLETED_FILTER,
|
COMPLETED_FILTER,
|
||||||
BROKEN_FILTER,
|
KIDGAME_FILTER,
|
||||||
HIDDEN_FILTER,
|
HIDDEN_FILTER,
|
||||||
|
BROKEN_FILTER,
|
||||||
ALTEMULATOR_FILTER
|
ALTEMULATOR_FILTER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -72,16 +72,16 @@ private:
|
||||||
std::vector<FilterDataDecl> filterDataDecl;
|
std::vector<FilterDataDecl> filterDataDecl;
|
||||||
std::string getIndexableKey(FileData* game, FilterIndexType type, bool getSecondary);
|
std::string getIndexableKey(FileData* game, FilterIndexType type, bool getSecondary);
|
||||||
|
|
||||||
void manageFavoritesEntryInIndex(FileData* game, bool remove = false);
|
void manageRatingsEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageGenreEntryInIndex(FileData* game, bool remove = false);
|
|
||||||
void managePlayerEntryInIndex(FileData* game, bool remove = false);
|
|
||||||
void manageDeveloperEntryInIndex(FileData* game, bool remove = false);
|
void manageDeveloperEntryInIndex(FileData* game, bool remove = false);
|
||||||
void managePublisherEntryInIndex(FileData* game, bool remove = false);
|
void managePublisherEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageRatingsEntryInIndex(FileData* game, bool remove = false);
|
void manageGenreEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageKidGameEntryInIndex(FileData* game, bool remove = false);
|
void managePlayerEntryInIndex(FileData* game, bool remove = false);
|
||||||
|
void manageFavoritesEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageCompletedEntryInIndex(FileData* game, bool remove = false);
|
void manageCompletedEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageBrokenEntryInIndex(FileData* game, bool remove = false);
|
void manageKidGameEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageHiddenEntryInIndex(FileData* game, bool remove = false);
|
void manageHiddenEntryInIndex(FileData* game, bool remove = false);
|
||||||
|
void manageBrokenEntryInIndex(FileData* game, bool remove = false);
|
||||||
void manageAltemulatorEntryInIndex(FileData* game, bool remove = false);
|
void manageAltemulatorEntryInIndex(FileData* game, bool remove = false);
|
||||||
|
|
||||||
void manageIndexEntry(std::map<std::string, int>* index, std::string key, bool remove);
|
void manageIndexEntry(std::map<std::string, int>* index, std::string key, bool remove);
|
||||||
|
@ -92,40 +92,40 @@ private:
|
||||||
bool mFilterByText;
|
bool mFilterByText;
|
||||||
bool mTextRemoveSystem;
|
bool mTextRemoveSystem;
|
||||||
|
|
||||||
bool mFilterByFavorites;
|
bool mFilterByRatings;
|
||||||
bool mFilterByGenre;
|
|
||||||
bool mFilterByPlayers;
|
|
||||||
bool mFilterByDeveloper;
|
bool mFilterByDeveloper;
|
||||||
bool mFilterByPublisher;
|
bool mFilterByPublisher;
|
||||||
bool mFilterByRatings;
|
bool mFilterByGenre;
|
||||||
bool mFilterByKidGame;
|
bool mFilterByPlayers;
|
||||||
|
bool mFilterByFavorites;
|
||||||
bool mFilterByCompleted;
|
bool mFilterByCompleted;
|
||||||
bool mFilterByBroken;
|
bool mFilterByKidGame;
|
||||||
bool mFilterByHidden;
|
bool mFilterByHidden;
|
||||||
|
bool mFilterByBroken;
|
||||||
bool mFilterByAltemulator;
|
bool mFilterByAltemulator;
|
||||||
|
|
||||||
std::map<std::string, int> mFavoritesIndexAllKeys;
|
std::map<std::string, int> mRatingsIndexAllKeys;
|
||||||
std::map<std::string, int> mGenreIndexAllKeys;
|
|
||||||
std::map<std::string, int> mPlayersIndexAllKeys;
|
|
||||||
std::map<std::string, int> mDeveloperIndexAllKeys;
|
std::map<std::string, int> mDeveloperIndexAllKeys;
|
||||||
std::map<std::string, int> mPublisherIndexAllKeys;
|
std::map<std::string, int> mPublisherIndexAllKeys;
|
||||||
std::map<std::string, int> mRatingsIndexAllKeys;
|
std::map<std::string, int> mGenreIndexAllKeys;
|
||||||
std::map<std::string, int> mKidGameIndexAllKeys;
|
std::map<std::string, int> mPlayersIndexAllKeys;
|
||||||
|
std::map<std::string, int> mFavoritesIndexAllKeys;
|
||||||
std::map<std::string, int> mCompletedIndexAllKeys;
|
std::map<std::string, int> mCompletedIndexAllKeys;
|
||||||
std::map<std::string, int> mBrokenIndexAllKeys;
|
std::map<std::string, int> mKidGameIndexAllKeys;
|
||||||
std::map<std::string, int> mHiddenIndexAllKeys;
|
std::map<std::string, int> mHiddenIndexAllKeys;
|
||||||
|
std::map<std::string, int> mBrokenIndexAllKeys;
|
||||||
std::map<std::string, int> mAltemulatorIndexAllKeys;
|
std::map<std::string, int> mAltemulatorIndexAllKeys;
|
||||||
|
|
||||||
std::vector<std::string> mFavoritesIndexFilteredKeys;
|
std::vector<std::string> mRatingsIndexFilteredKeys;
|
||||||
std::vector<std::string> mGenreIndexFilteredKeys;
|
|
||||||
std::vector<std::string> mPlayersIndexFilteredKeys;
|
|
||||||
std::vector<std::string> mDeveloperIndexFilteredKeys;
|
std::vector<std::string> mDeveloperIndexFilteredKeys;
|
||||||
std::vector<std::string> mPublisherIndexFilteredKeys;
|
std::vector<std::string> mPublisherIndexFilteredKeys;
|
||||||
std::vector<std::string> mRatingsIndexFilteredKeys;
|
std::vector<std::string> mGenreIndexFilteredKeys;
|
||||||
std::vector<std::string> mKidGameIndexFilteredKeys;
|
std::vector<std::string> mPlayersIndexFilteredKeys;
|
||||||
|
std::vector<std::string> mFavoritesIndexFilteredKeys;
|
||||||
std::vector<std::string> mCompletedIndexFilteredKeys;
|
std::vector<std::string> mCompletedIndexFilteredKeys;
|
||||||
std::vector<std::string> mBrokenIndexFilteredKeys;
|
std::vector<std::string> mKidGameIndexFilteredKeys;
|
||||||
std::vector<std::string> mHiddenIndexFilteredKeys;
|
std::vector<std::string> mHiddenIndexFilteredKeys;
|
||||||
|
std::vector<std::string> mBrokenIndexFilteredKeys;
|
||||||
std::vector<std::string> mAltemulatorIndexFilteredKeys;
|
std::vector<std::string> mAltemulatorIndexFilteredKeys;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue