From d01be2ecba8e76147fa4fa3dfc33679184ce8246 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 25 Oct 2020 19:42:25 +0100 Subject: [PATCH] Small refactoring of CollectionSystemManager. --- es-app/src/CollectionSystemManager.cpp | 13 +++---------- es-app/src/CollectionSystemManager.h | 8 +++----- es-app/src/FileData.cpp | 5 ++--- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/es-app/src/CollectionSystemManager.cpp b/es-app/src/CollectionSystemManager.cpp index 326401de0..661d1c090 100644 --- a/es-app/src/CollectionSystemManager.cpp +++ b/es-app/src/CollectionSystemManager.cpp @@ -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(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) { diff --git a/es-app/src/CollectionSystemManager.h b/es-app/src/CollectionSystemManager.h index dbb90021a..2b690f766 100644 --- a/es-app/src/CollectionSystemManager.h +++ b/es-app/src/CollectionSystemManager.h @@ -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 diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index d6276cbd1..15e1e4a69 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -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::getChildrenListToDisplay() { - FileFilterIndex* idx = mSystem->getIndex(); if (idx->isFiltered()) { mFilteredChildren.clear();