mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Limiting last played count to 50
This commit is contained in:
parent
32258e1f00
commit
d3cc0a77ef
|
@ -16,6 +16,8 @@
|
|||
|
||||
std::string myCollectionsName = "collections";
|
||||
|
||||
#define LAST_PLAYED_MAX 50
|
||||
|
||||
/* Handling the getting, initialization, deinitialization, saving and deletion of
|
||||
* a CollectionSystemManager Instance */
|
||||
CollectionSystemManager* CollectionSystemManager::sInstance = NULL;
|
||||
|
@ -277,7 +279,23 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
|
|||
}
|
||||
}
|
||||
rootFolder->sort(getSortTypeFromString(mCollectionSystemDeclsIndex[name].defaultSort));
|
||||
ViewController::get()->onFileChanged(rootFolder, FILE_SORTED);
|
||||
if (name == "recent")
|
||||
{
|
||||
trimCollectionCount(rootFolder, LAST_PLAYED_MAX);
|
||||
ViewController::get()->onFileChanged(rootFolder, FILE_METADATA_CHANGED);
|
||||
}
|
||||
else
|
||||
ViewController::get()->onFileChanged(rootFolder, FILE_SORTED);
|
||||
}
|
||||
}
|
||||
|
||||
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit)
|
||||
{
|
||||
SystemData* curSys = rootFolder->getSystem();
|
||||
while (rootFolder->getChildren().size() > limit)
|
||||
{
|
||||
CollectionFileData* gameToRemove = (CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
|
||||
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -713,6 +731,8 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
|
|||
}
|
||||
}
|
||||
rootFolder->sort(getSortTypeFromString(sysDecl.defaultSort));
|
||||
if (sysDecl.type == AUTO_LAST_PLAYED)
|
||||
trimCollectionCount(rootFolder, LAST_PLAYED_MAX);
|
||||
sysData->isPopulated = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,8 @@ private:
|
|||
std::vector<std::string> getCollectionThemeFolders(bool custom);
|
||||
std::vector<std::string> getUserCollectionThemeFolders();
|
||||
|
||||
void trimCollectionCount(FileData* rootFolder, int limit);
|
||||
|
||||
bool themeFolderExists(std::string folder);
|
||||
|
||||
bool includeFileInAutoCollections(FileData* file);
|
||||
|
|
Loading…
Reference in a new issue