Fixed two issues with grouped custom collections.

A crash was caused by the grouped custom collection flag not being set to false when changing from grouped to ungrouped via the settings menu, and the favorite game counter was not updated for custom collections as the actual system was sorted instead of the parent system.
This commit is contained in:
Leon Styhre 2020-10-30 10:34:37 +01:00
parent 07efcd19d0
commit 9bfee8edff

View file

@ -414,9 +414,18 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
// collection, then skip the sorting. // collection, then skip the sorting.
else if (sysData.decl.isCustom && else if (sysData.decl.isCustom &&
children.find(file->getFullPath()) != children.cend()) { children.find(file->getFullPath()) != children.cend()) {
// For custom collections, update either the actual system or its parent depending
// on whether the collection is grouped or not.
if (rootFolder->getSystem()->isGroupedCustomCollection()) {
rootFolder->getParent()->sort(rootFolder->getParent()->
getSortTypeFromString(rootFolder->getParent()->
getSortTypeString()), mFavoritesSorting);
}
else {
rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()), rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
mFavoritesSorting); mFavoritesSorting);
} }
}
else if (!sysData.decl.isCustom) { else if (!sysData.decl.isCustom) {
rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()), rootFolder->sort(rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
mFavoritesSorting); mFavoritesSorting);
@ -1051,6 +1060,7 @@ void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems(
if (!gameList->getCursor()->isPlaceHolder()) { if (!gameList->getCursor()->isPlaceHolder()) {
gameList->setCursor(gameList->getFirstEntry()); gameList->setCursor(gameList->getFirstEntry());
} }
it->second.system->setIsGroupedCustomCollection(false);
} }
} }
else { else {