Games marked not to be counted are now also excluded from the 'Recent' and 'Favorites' collections.

Also fixed a crash when opening the game options menu when a placeholder was selected.
This commit is contained in:
Leon Styhre 2020-08-06 22:11:55 +02:00
parent 22ed97c6d8
commit 3a59c77d3e
2 changed files with 9 additions and 8 deletions

View file

@ -281,8 +281,7 @@ void CollectionSystemManager::refreshCollectionSystems(FileData* file)
void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionSystemData sysData) void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionSystemData sysData)
{ {
if (sysData.isPopulated) if (sysData.isPopulated) {
{
// Collection files use the full path as key, to avoid clashes. // Collection files use the full path as key, to avoid clashes.
std::string key = file->getFullPath(); std::string key = file->getFullPath();
@ -316,7 +315,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
ViewController::get()-> ViewController::get()->
getGameListView(curSys).get()->remove(collectionEntry, false); getGameListView(curSys).get()->remove(collectionEntry, false);
} }
else if (name == "all" && !file->getCountAsGame()) { else if (curSys->isCollection() && !file->getCountAsGame()) {
// If the countasgame flag has been set to false, then remove the game. // If the countasgame flag has been set to false, then remove the game.
ViewController::get()-> ViewController::get()->
getGameListView(curSys).get()->remove(collectionEntry, false); getGameListView(curSys).get()->remove(collectionEntry, false);
@ -331,9 +330,10 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
else { else {
bool addGame = false; bool addGame = false;
// We didn't find it here - we need to check if we should add it. // We didn't find it here - we need to check if we should add it.
if (name == "recent" && file->metadata.get("playcount") > "0" && if ((name == "recent" && file->metadata.get("playcount") > "0" &&
includeFileInAutoCollections(file) || name == "favorites" && file->getCountAsGame() && includeFileInAutoCollections(file)) ||
file->metadata.get("favorite") == "true") (name == "favorites" && file->metadata.get("favorite") == "true" &&
file->getCountAsGame()))
addGame = true; addGame = true;
else if (name == "all" && file->getCountAsGame()) else if (name == "all" && file->getCountAsGame())
addGame = true; addGame = true;
@ -839,7 +839,7 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
if (include) { if (include) {
// Exclude files that are set not to be counted as games. // Exclude files that are set not to be counted as games.
if (rootFolder->getName() == "all" && !(*gameIt)->getCountAsGame()) if (!(*gameIt)->getCountAsGame())
continue; continue;
CollectionFileData* newGame = new CollectionFileData(*gameIt, newSys); CollectionFileData* newGame = new CollectionFileData(*gameIt, newSys);

View file

@ -42,6 +42,7 @@ GuiGamelistOptions::GuiGamelistOptions(
// Read the setting for whether folders are sorted on top of the gamelists. // Read the setting for whether folders are sorted on top of the gamelists.
// Also check if the gamelist only contains folders, as generated by the FileData sorting. // Also check if the gamelist only contains folders, as generated by the FileData sorting.
mFoldersOnTop = Settings::getInstance()->getBool("FoldersOnTop"); mFoldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
if (file->getType() != PLACEHOLDER)
mOnlyHasFolders = file->getParent()->getOnlyFoldersFlag(); mOnlyHasFolders = file->getParent()->getOnlyFoldersFlag();
// Read the applicable favorite sorting setting depending on whether the // Read the applicable favorite sorting setting depending on whether the