mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 07:05:39 +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";
|
std::string myCollectionsName = "collections";
|
||||||
|
|
||||||
|
#define LAST_PLAYED_MAX 50
|
||||||
|
|
||||||
/* Handling the getting, initialization, deinitialization, saving and deletion of
|
/* Handling the getting, initialization, deinitialization, saving and deletion of
|
||||||
* a CollectionSystemManager Instance */
|
* a CollectionSystemManager Instance */
|
||||||
CollectionSystemManager* CollectionSystemManager::sInstance = NULL;
|
CollectionSystemManager* CollectionSystemManager::sInstance = NULL;
|
||||||
|
@ -277,10 +279,26 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootFolder->sort(getSortTypeFromString(mCollectionSystemDeclsIndex[name].defaultSort));
|
rootFolder->sort(getSortTypeFromString(mCollectionSystemDeclsIndex[name].defaultSort));
|
||||||
|
if (name == "recent")
|
||||||
|
{
|
||||||
|
trimCollectionCount(rootFolder, LAST_PLAYED_MAX);
|
||||||
|
ViewController::get()->onFileChanged(rootFolder, FILE_METADATA_CHANGED);
|
||||||
|
}
|
||||||
|
else
|
||||||
ViewController::get()->onFileChanged(rootFolder, FILE_SORTED);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// deletes all collection files from collection systems related to the source file
|
// deletes all collection files from collection systems related to the source file
|
||||||
void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
void CollectionSystemManager::deleteCollectionFiles(FileData* file)
|
||||||
{
|
{
|
||||||
|
@ -713,6 +731,8 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rootFolder->sort(getSortTypeFromString(sysDecl.defaultSort));
|
rootFolder->sort(getSortTypeFromString(sysDecl.defaultSort));
|
||||||
|
if (sysDecl.type == AUTO_LAST_PLAYED)
|
||||||
|
trimCollectionCount(rootFolder, LAST_PLAYED_MAX);
|
||||||
sysData->isPopulated = true;
|
sysData->isPopulated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,8 @@ private:
|
||||||
std::vector<std::string> getCollectionThemeFolders(bool custom);
|
std::vector<std::string> getCollectionThemeFolders(bool custom);
|
||||||
std::vector<std::string> getUserCollectionThemeFolders();
|
std::vector<std::string> getUserCollectionThemeFolders();
|
||||||
|
|
||||||
|
void trimCollectionCount(FileData* rootFolder, int limit);
|
||||||
|
|
||||||
bool themeFolderExists(std::string folder);
|
bool themeFolderExists(std::string folder);
|
||||||
|
|
||||||
bool includeFileInAutoCollections(FileData* file);
|
bool includeFileInAutoCollections(FileData* file);
|
||||||
|
|
Loading…
Reference in a new issue