Small refactoring of CollectionSystemManager.

This commit is contained in:
Leon Styhre 2020-10-25 19:42:25 +01:00
parent 546f6304ef
commit d01be2ecba
3 changed files with 8 additions and 18 deletions

View file

@ -449,7 +449,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit)
{
SystemData* curSys = rootFolder->getSystem();
while ((int)rootFolder->getChildrenListToDisplay().size() > limit) {
while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) {
CollectionFileData* gameToRemove =
(CollectionFileData*)rootFolder->getChildrenListToDisplay().back();
ViewController::get()->getGameListView(curSys).get()->remove(gameToRemove, false);
@ -1191,24 +1191,17 @@ bool CollectionSystemManager::includeFileInAutoCollections(FileData* file)
return file->getName() != "kodi" && file->getSystem()->isGameSystem();
}
std::string getCustomCollectionConfigPath(std::string collectionName)
std::string CollectionSystemManager::getCustomCollectionConfigPath(std::string collectionName)
{
return getCollectionsFolder() + "/custom-" + collectionName + ".cfg";
}
std::string getCollectionsFolder()
std::string CollectionSystemManager::getCollectionsFolder()
{
return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() +
"/.emulationstation/collections");
}
bool systemSort(SystemData* sys1, SystemData* sys2)
{
std::string name1 = Utils::String::toUpper(sys1->getName());
std::string name2 = Utils::String::toUpper(sys2->getName());
return name1.compare(name2) < 0;
}
// Return whether the system is a custom collection.
bool CollectionSystemManager::getIsCustomCollection(SystemData* system)
{

View file

@ -115,6 +115,7 @@ private:
bool mHasEnabledCustomCollection;
std::string mEditingCollection;
CollectionSystemData* mEditingCollectionSystemData;
SystemData* mCustomCollectionsBundle;
void initAutoCollectionSystems();
void initCustomCollectionSystems();
@ -138,11 +139,8 @@ private:
bool themeFolderExists(std::string folder);
bool includeFileInAutoCollections(FileData* file);
SystemData* mCustomCollectionsBundle;
std::string getCustomCollectionConfigPath(std::string collectionName);
std::string getCollectionsFolder();
};
std::string getCustomCollectionConfigPath(std::string collectionName);
std::string getCollectionsFolder();
bool systemSort(SystemData* sys1, SystemData* sys2);
#endif // ES_APP_COLLECTION_SYSTEM_MANAGER_H

View file

@ -299,8 +299,8 @@ const std::string FileData::getVideoPath() const
if (Settings::getInstance()->getBool("LocalArt"))
{
for (int i = 0; i < 5; i++) {
std::string localMediaPath = mEnvData->mStartPath + "/videos/" + getDisplayName() +
"-video" + extList[i];
std::string localMediaPath = mEnvData->mStartPath + "/videos/" +
getDisplayName() + "-video" + extList[i];
if (Utils::FileSystem::exists(localMediaPath))
return localMediaPath;
}
@ -311,7 +311,6 @@ const std::string FileData::getVideoPath() const
const std::vector<FileData*>& FileData::getChildrenListToDisplay()
{
FileFilterIndex* idx = mSystem->getIndex();
if (idx->isFiltered()) {
mFilteredChildren.clear();