Renamed CollectionSystemManager to CollectionSystemsManager.

This commit is contained in:
Leon Styhre 2020-12-23 18:06:30 +01:00
parent a27c961987
commit 327676d7d7
17 changed files with 126 additions and 126 deletions

View file

@ -11,7 +11,7 @@ set(ES_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.h
${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.h ${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.h
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.h ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.h
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.h ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.h
# Guis # Guis
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.h
@ -59,7 +59,7 @@ set(ES_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/Gamelist.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/FileFilterIndex.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/SystemScreensaver.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/CollectionSystemsManager.cpp
# Guis # Guis
${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/guis/GuiMetaDataEd.cpp

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// EmulationStation Desktop Edition // EmulationStation Desktop Edition
// CollectionSystemManager.cpp // CollectionSystemsManager.cpp
// //
// Manages collections of the following two types: // Manages collections of the following two types:
// 1) Automatically populated (All games, Favorites and Recent/Last Played) // 1) Automatically populated (All games, Favorites and Recent/Last Played)
@ -9,17 +9,17 @@
// //
// The automatic collections are basically virtual systems that have no // The automatic collections are basically virtual systems that have no
// gamelist.xml files and that only exist in memory during the program session. // gamelist.xml files and that only exist in memory during the program session.
// SystemData sets up the basic data structures and CollectionSystemManager // SystemData sets up the basic data structures and CollectionSystemsManager
// populates and manages the collections. // populates and manages the collections.
// //
// The custom collections have simple data files which are just lists of ROM files. // The custom collections have simple data files which are just lists of ROM files.
// //
// In addition to this, CollectionSystemManager also handles some logic for // In addition to this, CollectionSystemsManager also handles some logic for
// normal systems such as adding and removing favorite games, including triggering // normal systems such as adding and removing favorite games, including triggering
// the required re-sort and refresh of the gamelists. // the required re-sort and refresh of the gamelists.
// //
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "guis/GuiInfoPopup.h" #include "guis/GuiInfoPopup.h"
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
@ -43,10 +43,10 @@ std::string myCollectionsName = "collections";
#define LAST_PLAYED_MAX 50 #define LAST_PLAYED_MAX 50
// Handles the getting, initialization, deinitialization, // Handles the getting, initialization, deinitialization,
// saving and deletion of a CollectionSystemManager instance. // saving and deletion of a CollectionSystemsManager instance.
CollectionSystemManager* CollectionSystemManager::sInstance = nullptr; CollectionSystemsManager* CollectionSystemsManager::sInstance = nullptr;
CollectionSystemManager::CollectionSystemManager(Window* window) : mWindow(window) CollectionSystemsManager::CollectionSystemsManager(Window* window) : mWindow(window)
{ {
CollectionSystemDecl systemDecls[] = { CollectionSystemDecl systemDecls[] = {
// Type Name Long name Theme folder isCustom // Type Name Long name Theme folder isCustom
@ -84,7 +84,7 @@ CollectionSystemManager::CollectionSystemManager(Window* window) : mWindow(windo
mCustomCollectionsBundle = nullptr; mCustomCollectionsBundle = nullptr;
} }
CollectionSystemManager::~CollectionSystemManager() CollectionSystemsManager::~CollectionSystemsManager()
{ {
assert(sInstance == this); assert(sInstance == this);
@ -112,25 +112,25 @@ CollectionSystemManager::~CollectionSystemManager()
sInstance = nullptr; sInstance = nullptr;
} }
CollectionSystemManager* CollectionSystemManager::get() CollectionSystemsManager* CollectionSystemsManager::get()
{ {
assert(sInstance); assert(sInstance);
return sInstance; return sInstance;
} }
void CollectionSystemManager::init(Window* window) void CollectionSystemsManager::init(Window* window)
{ {
assert(!sInstance); assert(!sInstance);
sInstance = new CollectionSystemManager(window); sInstance = new CollectionSystemsManager(window);
} }
void CollectionSystemManager::deinit() void CollectionSystemsManager::deinit()
{ {
if (sInstance) if (sInstance)
delete sInstance; delete sInstance;
} }
void CollectionSystemManager::saveCustomCollection(SystemData* sys) void CollectionSystemsManager::saveCustomCollection(SystemData* sys)
{ {
const std::string rompath = FileData::getROMDirectory(); const std::string rompath = FileData::getROMDirectory();
std::string name = sys->getName(); std::string name = sys->getName();
@ -204,7 +204,7 @@ void CollectionSystemManager::saveCustomCollection(SystemData* sys)
} }
} }
void CollectionSystemManager::loadCollectionSystems() void CollectionSystemsManager::loadCollectionSystems()
{ {
initAutoCollectionSystems(); initAutoCollectionSystems();
CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName]; CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName];
@ -222,7 +222,7 @@ void CollectionSystemManager::loadCollectionSystems()
} }
} }
void CollectionSystemManager::loadEnabledListFromSettings() void CollectionSystemsManager::loadEnabledListFromSettings()
{ {
// We parse the auto collection settings list. // We parse the auto collection settings list.
std::vector<std::string> autoSelected = Utils::String::commaStringToVector( std::vector<std::string> autoSelected = Utils::String::commaStringToVector(
@ -255,7 +255,7 @@ void CollectionSystemManager::loadEnabledListFromSettings()
} }
} }
void CollectionSystemManager::updateSystemsList() void CollectionSystemsManager::updateSystemsList()
{ {
// Remove all collection systems. // Remove all collection systems.
removeCollectionsFromDisplayedSystems(); removeCollectionsFromDisplayedSystems();
@ -289,7 +289,7 @@ void CollectionSystemManager::updateSystemsList()
} }
} }
void CollectionSystemManager::refreshCollectionSystems(FileData* file) void CollectionSystemsManager::refreshCollectionSystems(FileData* file)
{ {
if (!file->getSystem()->isGameSystem() || file->getType() != GAME) if (!file->getSystem()->isGameSystem() || file->getType() != GAME)
return; return;
@ -321,7 +321,7 @@ void CollectionSystemManager::refreshCollectionSystems(FileData* file)
} }
} }
void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionSystemData sysData) void CollectionSystemsManager::updateCollectionSystem(FileData* file, CollectionSystemData sysData)
{ {
if (sysData.isPopulated) { if (sysData.isPopulated) {
// Skip all custom collections where the game does not exist. // Skip all custom collections where the game does not exist.
@ -455,7 +455,7 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
} }
} }
void CollectionSystemManager::deleteCollectionFiles(FileData* file) void CollectionSystemsManager::deleteCollectionFiles(FileData* file)
{ {
// Collection files use the full path as key, to avoid clashes. // Collection files use the full path as key, to avoid clashes.
std::string key = file->getFullPath(); std::string key = file->getFullPath();
@ -485,7 +485,7 @@ void CollectionSystemManager::deleteCollectionFiles(FileData* file)
} }
} }
bool CollectionSystemManager::isThemeGenericCollectionCompatible(bool genericCustomCollections) bool CollectionSystemsManager::isThemeGenericCollectionCompatible(bool genericCustomCollections)
{ {
std::vector<std::string> cfgSys = getCollectionThemeFolders(genericCustomCollections); std::vector<std::string> cfgSys = getCollectionThemeFolders(genericCustomCollections);
for (auto sysIt = cfgSys.cbegin(); sysIt != cfgSys.cend(); sysIt++) { for (auto sysIt = cfgSys.cbegin(); sysIt != cfgSys.cend(); sysIt++) {
@ -495,7 +495,7 @@ bool CollectionSystemManager::isThemeGenericCollectionCompatible(bool genericCus
return true; return true;
} }
bool CollectionSystemManager::isThemeCustomCollectionCompatible( bool CollectionSystemsManager::isThemeCustomCollectionCompatible(
std::vector<std::string> stringVector) std::vector<std::string> stringVector)
{ {
if (isThemeGenericCollectionCompatible(true)) if (isThemeGenericCollectionCompatible(true))
@ -517,7 +517,7 @@ bool CollectionSystemManager::isThemeCustomCollectionCompatible(
return true; return true;
} }
std::string CollectionSystemManager::getValidNewCollectionName(std::string inName, int index) std::string CollectionSystemsManager::getValidNewCollectionName(std::string inName, int index)
{ {
std::string name = inName; std::string name = inName;
@ -570,7 +570,7 @@ std::string CollectionSystemManager::getValidNewCollectionName(std::string inNam
return name; return name;
} }
void CollectionSystemManager::setEditMode(std::string collectionName) void CollectionSystemsManager::setEditMode(std::string collectionName)
{ {
if (mCustomCollectionSystemsData.find(collectionName) == mCustomCollectionSystemsData.cend()) { if (mCustomCollectionSystemsData.find(collectionName) == mCustomCollectionSystemsData.cend()) {
LOG(LogError) << "Tried to edit a non-existing collection: " << collectionName; LOG(LogError) << "Tried to edit a non-existing collection: " << collectionName;
@ -593,7 +593,7 @@ void CollectionSystemManager::setEditMode(std::string collectionName)
mWindow->setInfoPopup(s); mWindow->setInfoPopup(s);
} }
void CollectionSystemManager::exitEditMode() void CollectionSystemsManager::exitEditMode()
{ {
GuiInfoPopup* s = new GuiInfoPopup(mWindow, "FINISHED EDITING THE '" + GuiInfoPopup* s = new GuiInfoPopup(mWindow, "FINISHED EDITING THE '" +
Utils::String::toUpper(mEditingCollection) + "' COLLECTION", 4000); Utils::String::toUpper(mEditingCollection) + "' COLLECTION", 4000);
@ -605,7 +605,7 @@ void CollectionSystemManager::exitEditMode()
mEditingCollectionSystemData->system->onMetaDataSavePoint(); mEditingCollectionSystemData->system->onMetaDataSavePoint();
} }
bool CollectionSystemManager::inCustomCollection( bool CollectionSystemsManager::inCustomCollection(
const std::string& collectionName, FileData* gameFile) const std::string& collectionName, FileData* gameFile)
{ {
auto collectionEntry = mCustomCollectionSystemsData.find(collectionName); auto collectionEntry = mCustomCollectionSystemsData.find(collectionName);
@ -619,7 +619,7 @@ bool CollectionSystemManager::inCustomCollection(
return false; return false;
} }
bool CollectionSystemManager::toggleGameInCollection(FileData* file) bool CollectionSystemsManager::toggleGameInCollection(FileData* file)
{ {
if (file->getType() == GAME) { if (file->getType() == GAME) {
GuiInfoPopup* s; GuiInfoPopup* s;
@ -704,7 +704,7 @@ bool CollectionSystemManager::toggleGameInCollection(FileData* file)
return false; return false;
} }
SystemData* CollectionSystemManager::getSystemToView(SystemData* sys) SystemData* CollectionSystemsManager::getSystemToView(SystemData* sys)
{ {
SystemData* systemToView = sys; SystemData* systemToView = sys;
FileData* rootFolder = sys->getRootFolder(); FileData* rootFolder = sys->getRootFolder();
@ -721,7 +721,7 @@ SystemData* CollectionSystemManager::getSystemToView(SystemData* sys)
return systemToView; return systemToView;
} }
FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sys) FileData* CollectionSystemsManager::updateCollectionFolderMetadata(SystemData* sys)
{ {
FileData* rootFolder = sys->getRootFolder(); FileData* rootFolder = sys->getRootFolder();
std::string desc = "This collection is empty."; std::string desc = "This collection is empty.";
@ -808,7 +808,7 @@ FileData* CollectionSystemManager::updateCollectionFolderMetadata(SystemData* sy
return nullptr; return nullptr;
} }
std::vector<std::string> CollectionSystemManager::getUnusedSystemsFromTheme() std::vector<std::string> CollectionSystemsManager::getUnusedSystemsFromTheme()
{ {
// Get used systems in es_systems.cfg. // Get used systems in es_systems.cfg.
std::vector<std::string> systemsInUse = getSystemsFromConfig(); std::vector<std::string> systemsInUse = getSystemsFromConfig();
@ -834,7 +834,7 @@ std::vector<std::string> CollectionSystemManager::getUnusedSystemsFromTheme()
return themeSys; return themeSys;
} }
SystemData* CollectionSystemManager::addNewCustomCollection(std::string name) SystemData* CollectionSystemsManager::addNewCustomCollection(std::string name)
{ {
CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName]; CollectionSystemDecl decl = mCollectionSystemDeclsIndex[myCollectionsName];
decl.themeFolder = name; decl.themeFolder = name;
@ -844,7 +844,7 @@ SystemData* CollectionSystemManager::addNewCustomCollection(std::string name)
return createNewCollectionEntry(name, decl, true, true); return createNewCollectionEntry(name, decl, true, true);
} }
void CollectionSystemManager::deleteCustomCollection(std::string collectionName) void CollectionSystemsManager::deleteCustomCollection(std::string collectionName)
{ {
auto collectionEntry = mCustomCollectionSystemsData.find(collectionName); auto collectionEntry = mCustomCollectionSystemsData.find(collectionName);
@ -855,8 +855,8 @@ void CollectionSystemManager::deleteCustomCollection(std::string collectionName)
delete mWindow->peekGui(); delete mWindow->peekGui();
if (collectionEntry != mCustomCollectionSystemsData.end()) { if (collectionEntry != mCustomCollectionSystemsData.end()) {
CollectionSystemManager::get()->loadEnabledListFromSettings(); CollectionSystemsManager::get()->loadEnabledListFromSettings();
CollectionSystemManager::get()->updateSystemsList(); CollectionSystemsManager::get()->updateSystemsList();
ViewController::get()->removeGameListView(collectionEntry->second.system); ViewController::get()->removeGameListView(collectionEntry->second.system);
ViewController::get()->reloadAll(); ViewController::get()->reloadAll();
@ -867,7 +867,7 @@ void CollectionSystemManager::deleteCustomCollection(std::string collectionName)
// Remove the collection configuration file. // Remove the collection configuration file.
std::string configFile = getCustomCollectionConfigPath(collectionName); std::string configFile = getCustomCollectionConfigPath(collectionName);
Utils::FileSystem::removeFile(configFile); Utils::FileSystem::removeFile(configFile);
LOG(LogDebug) << "CollectionSystemManager::deleteCustomCollection(): Deleted the " LOG(LogDebug) << "CollectionSystemsManager::deleteCustomCollection(): Deleted the "
"configuration file '" << configFile << "'."; "configuration file '" << configFile << "'.";
GuiInfoPopup* s = new GuiInfoPopup(mWindow, "DELETED THE COLLECTION '" + GuiInfoPopup* s = new GuiInfoPopup(mWindow, "DELETED THE COLLECTION '" +
@ -880,7 +880,7 @@ void CollectionSystemManager::deleteCustomCollection(std::string collectionName)
} }
} }
void CollectionSystemManager::initAutoCollectionSystems() void CollectionSystemsManager::initAutoCollectionSystems()
{ {
for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator
it = mCollectionSystemDeclsIndex.cbegin(); it = mCollectionSystemDeclsIndex.cbegin();
@ -892,7 +892,7 @@ void CollectionSystemManager::initAutoCollectionSystems()
} }
} }
void CollectionSystemManager::initCustomCollectionSystems() void CollectionSystemsManager::initCustomCollectionSystems()
{ {
std::vector<std::string> systems = getCollectionsFromConfigFolder(); std::vector<std::string> systems = getCollectionsFromConfigFolder();
for (auto nameIt = systems.cbegin(); nameIt != systems.cend(); nameIt++) { for (auto nameIt = systems.cbegin(); nameIt != systems.cend(); nameIt++) {
@ -900,7 +900,7 @@ void CollectionSystemManager::initCustomCollectionSystems()
} }
} }
SystemData* CollectionSystemManager::getAllGamesCollection() SystemData* CollectionSystemsManager::getAllGamesCollection()
{ {
CollectionSystemData* allSysData = &mAutoCollectionSystemsData["all"]; CollectionSystemData* allSysData = &mAutoCollectionSystemsData["all"];
if (!allSysData->isPopulated) if (!allSysData->isPopulated)
@ -909,7 +909,7 @@ SystemData* CollectionSystemManager::getAllGamesCollection()
return allSysData->system; return allSysData->system;
} }
SystemData* CollectionSystemManager::createNewCollectionEntry( SystemData* CollectionSystemsManager::createNewCollectionEntry(
std::string name, CollectionSystemDecl sysDecl, bool index, bool custom) std::string name, CollectionSystemDecl sysDecl, bool index, bool custom)
{ {
SystemData* newSys = new SystemData(name, sysDecl.longName, SystemData* newSys = new SystemData(name, sysDecl.longName,
@ -931,7 +931,7 @@ SystemData* CollectionSystemManager::createNewCollectionEntry(
return newSys; return newSys;
} }
void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysData) void CollectionSystemsManager::populateAutoCollection(CollectionSystemData* sysData)
{ {
SystemData* newSys = sysData->system; SystemData* newSys = sysData->system;
CollectionSystemDecl sysDecl = sysData->decl; CollectionSystemDecl sysDecl = sysData->decl;
@ -990,7 +990,7 @@ void CollectionSystemManager::populateAutoCollection(CollectionSystemData* sysDa
sysData->isPopulated = true; sysData->isPopulated = true;
} }
void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sysData) void CollectionSystemsManager::populateCustomCollection(CollectionSystemData* sysData)
{ {
SystemData* newSys = sysData->system; SystemData* newSys = sysData->system;
sysData->isPopulated = true; sysData->isPopulated = true;
@ -1044,7 +1044,7 @@ void CollectionSystemManager::populateCustomCollection(CollectionSystemData* sys
} }
} }
void CollectionSystemManager::removeCollectionsFromDisplayedSystems() void CollectionSystemsManager::removeCollectionsFromDisplayedSystems()
{ {
// Remove all collection Systems. // Remove all collection Systems.
for (auto sysIt = SystemData::sSystemVector.cbegin(); for (auto sysIt = SystemData::sSystemVector.cbegin();
@ -1068,7 +1068,7 @@ void CollectionSystemManager::removeCollectionsFromDisplayedSystems()
ViewController::get()->removeGameListView(mCustomCollectionsBundle); ViewController::get()->removeGameListView(mCustomCollectionsBundle);
} }
void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems( void CollectionSystemsManager::addEnabledCollectionsToDisplayedSystems(
std::map<std::string, CollectionSystemData, stringComparator>* colSystemData) std::map<std::string, CollectionSystemData, stringComparator>* colSystemData)
{ {
// Add auto enabled collections. // Add auto enabled collections.
@ -1113,7 +1113,7 @@ void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems(
} }
} }
std::vector<std::string> CollectionSystemManager::getSystemsFromConfig() std::vector<std::string> CollectionSystemsManager::getSystemsFromConfig()
{ {
std::vector<std::string> systems; std::vector<std::string> systems;
std::string path = SystemData::getConfigPath(false); std::string path = SystemData::getConfigPath(false);
@ -1148,7 +1148,7 @@ std::vector<std::string> CollectionSystemManager::getSystemsFromConfig()
} }
// Get all folders from the current theme path. // Get all folders from the current theme path.
std::vector<std::string> CollectionSystemManager::getSystemsFromTheme() std::vector<std::string> CollectionSystemsManager::getSystemsFromTheme()
{ {
std::vector<std::string> systems; std::vector<std::string> systems;
@ -1185,7 +1185,7 @@ std::vector<std::string> CollectionSystemManager::getSystemsFromTheme()
return systems; return systems;
} }
std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder() std::vector<std::string> CollectionSystemsManager::getCollectionsFromConfigFolder()
{ {
std::vector<std::string> systems; std::vector<std::string> systems;
std::string configPath = getCollectionsFolder(); std::string configPath = getCollectionsFolder();
@ -1215,7 +1215,7 @@ std::vector<std::string> CollectionSystemManager::getCollectionsFromConfigFolder
return systems; return systems;
} }
std::vector<std::string> CollectionSystemManager::getCollectionThemeFolders(bool custom) std::vector<std::string> CollectionSystemsManager::getCollectionThemeFolders(bool custom)
{ {
std::vector<std::string> systems; std::vector<std::string> systems;
for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator for (std::map<std::string, CollectionSystemDecl, stringComparator>::const_iterator
@ -1228,7 +1228,7 @@ std::vector<std::string> CollectionSystemManager::getCollectionThemeFolders(bool
return systems; return systems;
} }
std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders() std::vector<std::string> CollectionSystemsManager::getUserCollectionThemeFolders()
{ {
std::vector<std::string> systems; std::vector<std::string> systems;
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator
@ -1238,7 +1238,7 @@ std::vector<std::string> CollectionSystemManager::getUserCollectionThemeFolders(
return systems; return systems;
} }
void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limit) void CollectionSystemsManager::trimCollectionCount(FileData* rootFolder, int limit)
{ {
SystemData* curSys = rootFolder->getSystem(); SystemData* curSys = rootFolder->getSystem();
while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) { while (static_cast<int>(rootFolder->getChildrenListToDisplay().size()) > limit) {
@ -1248,13 +1248,13 @@ void CollectionSystemManager::trimCollectionCount(FileData* rootFolder, int limi
} }
} }
bool CollectionSystemManager::themeFolderExists(std::string folder) bool CollectionSystemsManager::themeFolderExists(std::string folder)
{ {
std::vector<std::string> themeSys = getSystemsFromTheme(); std::vector<std::string> themeSys = getSystemsFromTheme();
return std::find(themeSys.cbegin(), themeSys.cend(), folder) != themeSys.cend(); return std::find(themeSys.cbegin(), themeSys.cend(), folder) != themeSys.cend();
} }
bool CollectionSystemManager::includeFileInAutoCollections(FileData* file) bool CollectionSystemsManager::includeFileInAutoCollections(FileData* file)
{ {
// We exclude non-game files from collections (i.e. "kodi", entries from non-game systems). // We exclude non-game files from collections (i.e. "kodi", entries from non-game systems).
// If/when there are more in the future, maybe this can be a more complex method, with a // If/when there are more in the future, maybe this can be a more complex method, with a
@ -1262,12 +1262,12 @@ bool CollectionSystemManager::includeFileInAutoCollections(FileData* file)
return file->getName() != "kodi" && file->getSystem()->isGameSystem(); return file->getName() != "kodi" && file->getSystem()->isGameSystem();
} }
std::string CollectionSystemManager::getCustomCollectionConfigPath(std::string collectionName) std::string CollectionSystemsManager::getCustomCollectionConfigPath(std::string collectionName)
{ {
return getCollectionsFolder() + "/custom-" + collectionName + ".cfg"; return getCollectionsFolder() + "/custom-" + collectionName + ".cfg";
} }
std::string CollectionSystemManager::getCollectionsFolder() std::string CollectionSystemsManager::getCollectionsFolder()
{ {
return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() + return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() +
"/.emulationstation/collections"); "/.emulationstation/collections");

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// //
// EmulationStation Desktop Edition // EmulationStation Desktop Edition
// CollectionSystemManager.h // CollectionSystemsManager.h
// //
// Manages collections of the following two types: // Manages collections of the following two types:
// 1) Automatically populated (All games, Favorites and Recent/Last Played) // 1) Automatically populated (All games, Favorites and Recent/Last Played)
@ -9,12 +9,12 @@
// //
// The automatic collections are basically virtual systems that have no // The automatic collections are basically virtual systems that have no
// gamelist.xml files and that only exist in memory during the program session. // gamelist.xml files and that only exist in memory during the program session.
// SystemData sets up the basic data structures and CollectionSystemManager // SystemData sets up the basic data structures and CollectionSystemsManager
// populates and manages the collections. // populates and manages the collections.
// //
// The custom collections have simple data files which are just lists of ROM files. // The custom collections have simple data files which are just lists of ROM files.
// //
// In addition to this, CollectionSystemManager also handles some logic for // In addition to this, CollectionSystemsManager also handles some logic for
// normal systems such as adding and removing favorite games, including triggering // normal systems such as adding and removing favorite games, including triggering
// the required re-sort and refresh of the gamelists. // the required re-sort and refresh of the gamelists.
// //
@ -62,13 +62,13 @@ struct stringComparator {
} }
}; };
class CollectionSystemManager class CollectionSystemsManager
{ {
public: public:
CollectionSystemManager(Window* window); CollectionSystemsManager(Window* window);
~CollectionSystemManager(); ~CollectionSystemsManager();
static CollectionSystemManager* get(); static CollectionSystemsManager* get();
static void init(Window* window); static void init(Window* window);
static void deinit(); static void deinit();
void saveCustomCollection(SystemData* sys); void saveCustomCollection(SystemData* sys);
@ -118,7 +118,7 @@ public:
inline std::string getEditingCollection() { return mEditingCollection; }; inline std::string getEditingCollection() { return mEditingCollection; };
private: private:
static CollectionSystemManager* sInstance; static CollectionSystemsManager* sInstance;
SystemEnvironmentData* mCollectionEnvData; SystemEnvironmentData* mCollectionEnvData;
std::map<std::string, CollectionSystemDecl, stringComparator> mCollectionSystemDeclsIndex; std::map<std::string, CollectionSystemDecl, stringComparator> mCollectionSystemDeclsIndex;
std::map<std::string, CollectionSystemData, stringComparator> mAutoCollectionSystemsData; std::map<std::string, CollectionSystemData, stringComparator> mAutoCollectionSystemsData;

View file

@ -15,7 +15,7 @@
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "utils/TimeUtil.h" #include "utils/TimeUtil.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "FileSorts.h" #include "FileSorts.h"
#include "Log.h" #include "Log.h"
@ -464,7 +464,7 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
} }
} }
// The main custom collections view is sorted during startup in CollectionSystemManager. // The main custom collections view is sorted during startup in CollectionSystemsManager.
// The individual collections are however sorted as any normal systems/folders. // The individual collections are however sorted as any normal systems/folders.
if (mSystem->isCollection() && mSystem->getFullName() == "collections") { if (mSystem->isCollection() && mSystem->getFullName() == "collections") {
std::pair<unsigned int, unsigned int> tempGameCount = {}; std::pair<unsigned int, unsigned int> tempGameCount = {};
@ -560,7 +560,7 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
if (mSystem->isGroupedCustomCollection()) if (mSystem->isGroupedCustomCollection())
gameCount = {}; gameCount = {};
// The main custom collections view is sorted during startup in CollectionSystemManager. // The main custom collections view is sorted during startup in CollectionSystemsManager.
// The individual collections are however sorted as any normal systems/folders. // The individual collections are however sorted as any normal systems/folders.
if (mSystem->isCollection() && mSystem->getFullName() == "collections") { if (mSystem->isCollection() && mSystem->getFullName() == "collections") {
std::pair<unsigned int, unsigned int> tempGameCount = {}; std::pair<unsigned int, unsigned int> tempGameCount = {};
@ -964,7 +964,7 @@ void FileData::launchGame(Window* window)
gameToUpdate->metadata.get("lastplayed")); gameToUpdate->metadata.get("lastplayed"));
} }
CollectionSystemManager::get()->refreshCollectionSystems(gameToUpdate); CollectionSystemsManager::get()->refreshCollectionSystems(gameToUpdate);
gameToUpdate->mSystem->onMetaDataSavePoint(); gameToUpdate->mSystem->onMetaDataSavePoint();
} }

View file

@ -17,7 +17,7 @@
#include "views/gamelist/IGameListView.h" #include "views/gamelist/IGameListView.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "FileSorts.h" #include "FileSorts.h"
#include "Gamelist.h" #include "Gamelist.h"
@ -74,7 +74,7 @@ SystemData::SystemData(
indexAllGameFilters(mRootFolder); indexAllGameFilters(mRootFolder);
} }
else { else {
// Virtual systems are updated afterwards by CollectionSystemManager. // Virtual systems are updated afterwards by CollectionSystemsManager.
// We're just creating the data structure here. // We're just creating the data structure here.
mRootFolder = new FileData(FOLDER, "" + name, mEnvData, this); mRootFolder = new FileData(FOLDER, "" + name, mEnvData, this);
setupSystemSortType(mRootFolder); setupSystemSortType(mRootFolder);
@ -372,7 +372,7 @@ bool SystemData::loadConfig()
// Don't load any collections if there are no systems available. // Don't load any collections if there are no systems available.
if (sSystemVector.size() > 0) if (sSystemVector.size() > 0)
CollectionSystemManager::get()->loadCollectionSystems(); CollectionSystemsManager::get()->loadCollectionSystems();
return true; return true;
} }

View file

@ -15,7 +15,7 @@
#include "guis/GuiSettings.h" #include "guis/GuiSettings.h"
#include "guis/GuiTextEditPopup.h" #include "guis/GuiTextEditPopup.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
GuiCollectionSystemsOptions::GuiCollectionSystemsOptions( GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
Window* window, Window* window,
@ -25,13 +25,13 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
mDeletedCustomCollection(false) mDeletedCustomCollection(false)
{ {
// Finish editing custom collection. // Finish editing custom collection.
if (CollectionSystemManager::get()->isEditing()) { if (CollectionSystemsManager::get()->isEditing()) {
ComponentListRow row; ComponentListRow row;
row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" + row.addElement(std::make_shared<TextComponent>(mWindow, "FINISH EDITING '" +
Utils::String::toUpper(CollectionSystemManager::get()->getEditingCollection()) + Utils::String::toUpper(CollectionSystemsManager::get()->getEditingCollection()) +
"' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); "' COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.makeAcceptInputHandler([this] { row.makeAcceptInputHandler([this] {
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
delete this; delete this;
}); });
addRow(row); addRow(row);
@ -41,7 +41,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
collection_systems_auto = std::make_shared<OptionListComponent<std::string>> collection_systems_auto = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "SELECT COLLECTIONS", true); (mWindow, getHelpStyle(), "SELECT COLLECTIONS", true);
std::map<std::string, CollectionSystemData, stringComparator> autoSystems = std::map<std::string, CollectionSystemData, stringComparator> autoSystems =
CollectionSystemManager::get()->getAutoCollectionSystems(); CollectionSystemsManager::get()->getAutoCollectionSystems();
// Add automatic systems. // Add automatic systems.
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator
it = autoSystems.cbegin(); it != autoSystems.cend() ; it++) it = autoSystems.cbegin(); it != autoSystems.cend() ; it++)
@ -53,8 +53,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
Utils::String::vectorToCommaString(collection_systems_auto->getSelectedObjects(), true); Utils::String::vectorToCommaString(collection_systems_auto->getSelectedObjects(), true);
std::string autoSystemsConfig = Settings::getInstance()->getString("CollectionSystemsAuto"); std::string autoSystemsConfig = Settings::getInstance()->getString("CollectionSystemsAuto");
if (autoSystemsSelected != autoSystemsConfig) { if (autoSystemsSelected != autoSystemsConfig) {
if (CollectionSystemManager::get()->isEditing()) if (CollectionSystemsManager::get()->isEditing())
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
Settings::getInstance()->setString("CollectionSystemsAuto", autoSystemsSelected); Settings::getInstance()->setString("CollectionSystemsAuto", autoSystemsSelected);
setNeedsSaving(); setNeedsSaving();
setNeedsReloading(); setNeedsReloading();
@ -68,7 +68,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
collection_systems_custom = std::make_shared<OptionListComponent<std::string>> collection_systems_custom = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "SELECT COLLECTIONS", true); (mWindow, getHelpStyle(), "SELECT COLLECTIONS", true);
std::map<std::string, CollectionSystemData, stringComparator> customSystems = std::map<std::string, CollectionSystemData, stringComparator> customSystems =
CollectionSystemManager::get()->getCustomCollectionSystems(); CollectionSystemsManager::get()->getCustomCollectionSystems();
// Add custom systems. // Add custom systems.
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator
it = customSystems.cbegin(); it != customSystems.cend() ; it++) it = customSystems.cbegin(); it != customSystems.cend() ; it++)
@ -82,8 +82,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
std::string customSystemsConfig = Settings::getInstance()-> std::string customSystemsConfig = Settings::getInstance()->
getString("CollectionSystemsCustom"); getString("CollectionSystemsCustom");
if (customSystemsSelected != customSystemsConfig) { if (customSystemsSelected != customSystemsConfig) {
if (CollectionSystemManager::get()->isEditing()) if (CollectionSystemsManager::get()->isEditing())
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
Settings::getInstance()->setString("CollectionSystemsCustom", Settings::getInstance()->setString("CollectionSystemsCustom",
customSystemsSelected); customSystemsSelected);
setNeedsSaving(); setNeedsSaving();
@ -97,7 +97,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
// Create custom collection from theme. // Create custom collection from theme.
std::vector<std::string> unusedFolders = std::vector<std::string> unusedFolders =
CollectionSystemManager::get()->getUnusedSystemsFromTheme(); CollectionSystemsManager::get()->getUnusedSystemsFromTheme();
if (unusedFolders.size() > 0) { if (unusedFolders.size() > 0) {
ComponentListRow row; ComponentListRow row;
auto themeCollection = std::make_shared<TextComponent>(mWindow, auto themeCollection = std::make_shared<TextComponent>(mWindow,
@ -186,8 +186,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
Utils::String::toUpper(name) + "'\n" Utils::String::toUpper(name) + "'\n"
"ARE YOU SURE?", "ARE YOU SURE?",
"YES", [this, name] { "YES", [this, name] {
if (CollectionSystemManager::get()->isEditing()) if (CollectionSystemsManager::get()->isEditing())
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
mDeletedCustomCollection = true; mDeletedCustomCollection = true;
std::vector<std::string> selectedCustomCollections = std::vector<std::string> selectedCustomCollections =
collection_systems_custom->getSelectedObjects(); collection_systems_custom->getSelectedObjects();
@ -212,7 +212,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
setNeedsSaving(); setNeedsSaving();
setNeedsGoToSystemView(SystemData::sSystemVector.front()); setNeedsGoToSystemView(SystemData::sSystemVector.front());
} }
CollectionSystemManager::get()->deleteCustomCollection(name); CollectionSystemsManager::get()->deleteCustomCollection(name);
return true; return true;
}, },
"NO", [this] { "NO", [this] {
@ -295,15 +295,15 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(
void GuiCollectionSystemsOptions::createCustomCollection(std::string inName) void GuiCollectionSystemsOptions::createCustomCollection(std::string inName)
{ {
if (CollectionSystemManager::get()->isEditing()) if (CollectionSystemsManager::get()->isEditing())
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
std::string collectionName = CollectionSystemManager::get()-> std::string collectionName = CollectionSystemsManager::get()->
getValidNewCollectionName(inName); getValidNewCollectionName(inName);
SystemData* newCollection = CollectionSystemManager::get()-> SystemData* newCollection = CollectionSystemsManager::get()->
addNewCustomCollection(collectionName); addNewCustomCollection(collectionName);
CollectionSystemManager::get()->saveCustomCollection(newCollection); CollectionSystemsManager::get()->saveCustomCollection(newCollection);
collection_systems_custom->add(collectionName, collectionName, true); collection_systems_custom->add(collectionName, collectionName, true);
mAddedCustomCollection = true; mAddedCustomCollection = true;
@ -312,5 +312,5 @@ void GuiCollectionSystemsOptions::createCustomCollection(std::string inName)
Window* window = mWindow; Window* window = mWindow;
while (window->peekGui() && window->peekGui() != ViewController::get()) while (window->peekGui() && window->peekGui() != ViewController::get())
delete window->peekGui(); delete window->peekGui();
CollectionSystemManager::get()->setEditMode(collectionName); CollectionSystemsManager::get()->setEditMode(collectionName);
} }

View file

@ -17,7 +17,7 @@
#include "views/gamelist/IGameListView.h" #include "views/gamelist/IGameListView.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "FileSorts.h" #include "FileSorts.h"
#include "GuiMetaDataEd.h" #include "GuiMetaDataEd.h"
@ -152,7 +152,7 @@ GuiGamelistOptions::GuiGamelistOptions(
if (UIModeController::getInstance()->isUIModeFull() && if (UIModeController::getInstance()->isUIModeFull() &&
(isCustomCollection || isCustomCollectionGroup)) { (isCustomCollection || isCustomCollectionGroup)) {
if (CollectionSystemManager::get()->getEditingCollection() != customSystem) { if (CollectionSystemsManager::get()->getEditingCollection() != customSystem) {
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>( row.addElement(std::make_shared<TextComponent>(
mWindow, "ADD/REMOVE GAMES TO THIS GAME COLLECTION", mWindow, "ADD/REMOVE GAMES TO THIS GAME COLLECTION",
@ -163,11 +163,11 @@ GuiGamelistOptions::GuiGamelistOptions(
} }
if (UIModeController::getInstance()->isUIModeFull() && if (UIModeController::getInstance()->isUIModeFull() &&
CollectionSystemManager::get()->isEditing()) { CollectionSystemsManager::get()->isEditing()) {
row.elements.clear(); row.elements.clear();
row.addElement(std::make_shared<TextComponent>( row.addElement(std::make_shared<TextComponent>(
mWindow, "FINISH EDITING '" + Utils::String::toUpper( mWindow, "FINISH EDITING '" + Utils::String::toUpper(
CollectionSystemManager::get()->getEditingCollection()) + CollectionSystemsManager::get()->getEditingCollection()) +
"' COLLECTION",Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); "' COLLECTION",Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true);
row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::exitEditMode, this)); row.makeAcceptInputHandler(std::bind(&GuiGamelistOptions::exitEditMode, this));
mMenu.addRow(row); mMenu.addRow(row);
@ -272,7 +272,7 @@ void GuiGamelistOptions::startEditMode()
std::string editingSystem = mSystem->getName(); std::string editingSystem = mSystem->getName();
// Need to check if we're editing the collections bundle, // Need to check if we're editing the collections bundle,
// as we will want to edit the selected collection within. // as we will want to edit the selected collection within.
if (editingSystem == CollectionSystemManager::get()->getCustomCollectionsBundle()->getName()) { if (editingSystem == CollectionSystemsManager::get()->getCustomCollectionsBundle()->getName()) {
FileData* file = getGamelist()->getCursor(); FileData* file = getGamelist()->getCursor();
// Do we have the cursor on a specific collection?. // Do we have the cursor on a specific collection?.
if (file->getType() == FOLDER) if (file->getType() == FOLDER)
@ -281,7 +281,7 @@ void GuiGamelistOptions::startEditMode()
// We are inside a specific collection. We want to edit that one. // We are inside a specific collection. We want to edit that one.
editingSystem = file->getSystem()->getName(); editingSystem = file->getSystem()->getName();
} }
CollectionSystemManager::get()->setEditMode(editingSystem); CollectionSystemsManager::get()->setEditMode(editingSystem);
// Display the indication icons which show what games are part of the custom collection // Display the indication icons which show what games are part of the custom collection
// currently being edited. This is done cheaply using onFileChanged() which will trigger // currently being edited. This is done cheaply using onFileChanged() which will trigger
@ -297,7 +297,7 @@ void GuiGamelistOptions::startEditMode()
void GuiGamelistOptions::exitEditMode() void GuiGamelistOptions::exitEditMode()
{ {
CollectionSystemManager::get()->exitEditMode(); CollectionSystemsManager::get()->exitEditMode();
for (auto it = SystemData::sSystemVector.begin(); for (auto it = SystemData::sSystemVector.begin();
it != SystemData::sSystemVector.end(); it++) { it != SystemData::sSystemVector.end(); it++) {
@ -360,7 +360,7 @@ void GuiGamelistOptions::openMetaDataEd()
deleteGameBtnFunc = [this, file] { deleteGameBtnFunc = [this, file] {
LOG(LogInfo) << "Deleting the game file \"" << file->getFullPath() << LOG(LogInfo) << "Deleting the game file \"" << file->getFullPath() <<
"\", all its media files and its gamelist.xml entry."; "\", all its media files and its gamelist.xml entry.";
CollectionSystemManager::get()->deleteCollectionFiles(file); CollectionSystemsManager::get()->deleteCollectionFiles(file);
ViewController::get()->getGameListView( ViewController::get()->getGameListView(
file->getSystem()).get()->removeMedia(file); file->getSystem()).get()->removeMedia(file);
ViewController::get()->getGameListView( ViewController::get()->getGameListView(

View file

@ -22,7 +22,7 @@
#include "views/gamelist/IGameListView.h" #include "views/gamelist/IGameListView.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "EmulationStation.h" #include "EmulationStation.h"
#include "FileSorts.h" #include "FileSorts.h"
#include "Platform.h" #include "Platform.h"
@ -165,7 +165,7 @@ void GuiMenu::openUISettings()
if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) { if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) {
Scripting::fireEvent("theme-changed", theme_set->getSelected(), Scripting::fireEvent("theme-changed", theme_set->getSelected(),
Settings::getInstance()->getString("ThemeSet")); Settings::getInstance()->getString("ThemeSet"));
CollectionSystemManager::get()->updateSystemsList(); CollectionSystemsManager::get()->updateSystemsList();
Settings::getInstance()->setString("ThemeSet", theme_set->getSelected()); Settings::getInstance()->setString("ThemeSet", theme_set->getSelected());
s->setNeedsSaving(); s->setNeedsSaving();
s->setNeedsReloading(); s->setNeedsReloading();

View file

@ -25,7 +25,7 @@
#include "resources/Font.h" #include "resources/Font.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileData.h" #include "FileData.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "Gamelist.h" #include "Gamelist.h"
@ -378,7 +378,7 @@ void GuiMetaDataEd::save()
mScraperParams.system->getIndex()->addToIndex(mScraperParams.game); mScraperParams.system->getIndex()->addToIndex(mScraperParams.game);
// If it's a folder that has been updated, we need to manually sort the gamelist // If it's a folder that has been updated, we need to manually sort the gamelist
// as CollectionSystemManager ignores folders. // as CollectionSystemsManager ignores folders.
if (mScraperParams.game->getType() == FOLDER) if (mScraperParams.game->getType() == FOLDER)
mScraperParams.system->sortSystem(false); mScraperParams.system->sortSystem(false);
@ -386,7 +386,7 @@ void GuiMetaDataEd::save()
mSavedCallback(); mSavedCallback();
// Update respective Collection Entries. // Update respective Collection Entries.
CollectionSystemManager::get()->refreshCollectionSystems(mScraperParams.game); CollectionSystemsManager::get()->refreshCollectionSystems(mScraperParams.game);
mScraperParams.system->onMetaDataSavePoint(); mScraperParams.system->onMetaDataSavePoint();

View file

@ -26,7 +26,7 @@
#include "resources/Font.h" #include "resources/Font.h"
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileData.h" #include "FileData.h"
#include "Log.h" #include "Log.h"
#include "MameNames.h" #include "MameNames.h"

View file

@ -13,7 +13,7 @@
#include "guis/GuiTextEditPopup.h" #include "guis/GuiTextEditPopup.h"
#include "views/gamelist/IGameListView.h" #include "views/gamelist/IGameListView.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
#include "Window.h" #include "Window.h"
@ -57,8 +57,8 @@ void GuiSettings::save()
Settings::getInstance()->saveFile(); Settings::getInstance()->saveFile();
if (mNeedsCollectionsUpdate) { if (mNeedsCollectionsUpdate) {
CollectionSystemManager::get()->loadEnabledListFromSettings(); CollectionSystemsManager::get()->loadEnabledListFromSettings();
CollectionSystemManager::get()->updateSystemsList(); CollectionSystemsManager::get()->updateSystemsList();
} }
if (mNeedsReloading) if (mNeedsReloading)

View file

@ -25,7 +25,7 @@
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "AudioManager.h" #include "AudioManager.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "EmulationStation.h" #include "EmulationStation.h"
#include "InputManager.h" #include "InputManager.h"
#include "Log.h" #include "Log.h"
@ -451,7 +451,7 @@ int main(int argc, char* argv[])
Window window; Window window;
SystemScreensaver screensaver(&window); SystemScreensaver screensaver(&window);
ViewController::init(&window); ViewController::init(&window);
CollectionSystemManager::init(&window); CollectionSystemsManager::init(&window);
window.pushGui(ViewController::get()); window.pushGui(ViewController::get());
bool splashScreen = Settings::getInstance()->getBool("SplashScreen"); bool splashScreen = Settings::getInstance()->getBool("SplashScreen");
@ -642,7 +642,7 @@ int main(int argc, char* argv[])
window.deinit(); window.deinit();
MameNames::deinit(); MameNames::deinit();
CollectionSystemManager::deinit(); CollectionSystemsManager::deinit();
SystemData::deleteSystems(); SystemData::deleteSystems();
// Call this ONLY when linking with FreeImage as a static library. // Call this ONLY when linking with FreeImage as a static library.

View file

@ -11,7 +11,7 @@
#include "utils/FileSystemUtil.h" #include "utils/FileSystemUtil.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "Settings.h" #include "Settings.h"
#include "SystemData.h" #include "SystemData.h"
@ -54,8 +54,8 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files, FileDa
std::string editingCollection; std::string editingCollection;
std::string inCollectionPrefix; std::string inCollectionPrefix;
if (CollectionSystemManager::get()->isEditing()) { if (CollectionSystemsManager::get()->isEditing()) {
editingCollection = CollectionSystemManager::get()->getEditingCollection(); editingCollection = CollectionSystemsManager::get()->getEditingCollection();
isEditing = true; isEditing = true;
} }
@ -77,7 +77,7 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files, FileDa
// Add a leading tick mark icon to the game name if it's part of the custom collection // Add a leading tick mark icon to the game name if it's part of the custom collection
// currently being edited. // currently being edited.
if (isEditing && (*it)->getType() == GAME) { if (isEditing && (*it)->getType() == GAME) {
if (CollectionSystemManager::get()->inCustomCollection(editingCollection, (*it))) if (CollectionSystemsManager::get()->inCustomCollection(editingCollection, (*it)))
inCollectionPrefix = "\uF14A "; inCollectionPrefix = "\uF14A ";
else else
inCollectionPrefix = ""; inCollectionPrefix = "";
@ -269,8 +269,8 @@ std::vector<HelpPrompt> BasicGameListView::getHelpPrompts()
if (mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid() && if (mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid() &&
!UIModeController::getInstance()->isUIModeKiosk() && !UIModeController::getInstance()->isUIModeKiosk() &&
(Settings::getInstance()->getBool("FavoritesAddButton") || (Settings::getInstance()->getBool("FavoritesAddButton") ||
CollectionSystemManager::get()->isEditing())) { CollectionSystemsManager::get()->isEditing())) {
std::string prompt = CollectionSystemManager::get()->getEditingCollection(); std::string prompt = CollectionSystemsManager::get()->getEditingCollection();
prompts.push_back(HelpPrompt("y", prompt)); prompts.push_back(HelpPrompt("y", prompt));
} }
return prompts; return prompts;

View file

@ -10,7 +10,7 @@
#include "animations/LambdaAnimation.h" #include "animations/LambdaAnimation.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "SystemData.h" #include "SystemData.h"
#define FADE_IN_START_OPACITY 0.5f #define FADE_IN_START_OPACITY 0.5f
@ -329,7 +329,7 @@ void DetailedGameListView::updateInfoPanel()
// the first of these so that we can display its game media. // the first of these so that we can display its game media.
if (file->getSystem()->isCustomCollection() && if (file->getSystem()->isCustomCollection() &&
file->getPath() == file->getSystem()->getName()) { file->getPath() == file->getSystem()->getName()) {
FileData* randomGame = CollectionSystemManager::get()-> FileData* randomGame = CollectionSystemsManager::get()->
updateCollectionFolderMetadata(file->getSystem()); updateCollectionFolderMetadata(file->getSystem());
if (randomGame) { if (randomGame) {
mThumbnail.setImage(randomGame->getThumbnailPath()); mThumbnail.setImage(randomGame->getThumbnailPath());

View file

@ -11,7 +11,7 @@
#include "animations/LambdaAnimation.h" #include "animations/LambdaAnimation.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "Settings.h" #include "Settings.h"
#include "Sound.h" #include "Sound.h"
#include "SystemData.h" #include "SystemData.h"
@ -637,7 +637,7 @@ std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
if (mRoot->getSystem()->isGameSystem()) if (mRoot->getSystem()->isGameSystem())
prompts.push_back(HelpPrompt("x", "random")); prompts.push_back(HelpPrompt("x", "random"));
if (mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid()) { if (mRoot->getSystem()->isGameSystem() && !UIModeController::getInstance()->isUIModeKid()) {
std::string prompt = CollectionSystemManager::get()->getEditingCollection(); std::string prompt = CollectionSystemsManager::get()->getEditingCollection();
prompts.push_back(HelpPrompt("y", prompt)); prompts.push_back(HelpPrompt("y", prompt));
} }
return prompts; return prompts;

View file

@ -12,7 +12,7 @@
#include "utils/StringUtil.h" #include "utils/StringUtil.h"
#include "views/UIModeController.h" #include "views/UIModeController.h"
#include "views/ViewController.h" #include "views/ViewController.h"
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "FileFilterIndex.h" #include "FileFilterIndex.h"
#include "Settings.h" #include "Settings.h"
#include "Sound.h" #include "Sound.h"
@ -201,7 +201,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
} }
else if (config->isMappedTo("y", input) && else if (config->isMappedTo("y", input) &&
!Settings::getInstance()->getBool("FavoritesAddButton") && !Settings::getInstance()->getBool("FavoritesAddButton") &&
!CollectionSystemManager::get()->isEditing()) { !CollectionSystemsManager::get()->isEditing()) {
return true; return true;
} }
else if (config->isMappedTo("y", input) && else if (config->isMappedTo("y", input) &&
@ -217,7 +217,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
FileData* entryToUpdate = getCursor(); FileData* entryToUpdate = getCursor();
bool favoritesSorting; bool favoritesSorting;
bool removedLastFavorite = false; bool removedLastFavorite = false;
bool isEditing = CollectionSystemManager::get()->isEditing(); bool isEditing = CollectionSystemsManager::get()->isEditing();
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop"); bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
// If the current list only contains folders, then treat it as if the folders // If the current list only contains folders, then treat it as if the folders
// are not sorted on top, this way the logic should work exactly as for mixed // are not sorted on top, this way the logic should work exactly as for mixed
@ -292,7 +292,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
// Marking folders as favorites don't make them part of any collections, // Marking folders as favorites don't make them part of any collections,
// so it makes more sense to handle it here than to add the function to // so it makes more sense to handle it here than to add the function to
// CollectionSystemManager. // CollectionSystemsManager.
if (entryToUpdate->getType() == FOLDER) { if (entryToUpdate->getType() == FOLDER) {
GuiInfoPopup* s; GuiInfoPopup* s;
if (isEditing) { if (isEditing) {
@ -340,7 +340,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
"AS GAMES TO CUSTOM COLLECTIONS", 4000); "AS GAMES TO CUSTOM COLLECTIONS", 4000);
mWindow->setInfoPopup(s); mWindow->setInfoPopup(s);
} }
else if (CollectionSystemManager::get()->toggleGameInCollection(entryToUpdate)) { else if (CollectionSystemsManager::get()->toggleGameInCollection(entryToUpdate)) {
// Jump to the first entry in the gamelist if the last favorite was unmarked. // Jump to the first entry in the gamelist if the last favorite was unmarked.
if (foldersOnTop && removedLastFavorite && if (foldersOnTop && removedLastFavorite &&
!entryToUpdate->getSystem()->isCustomCollection()) !entryToUpdate->getSystem()->isCustomCollection())

View file

@ -18,7 +18,7 @@
#if defined(_RPI_) #if defined(_RPI_)
#include "Settings.h" #include "Settings.h"
#endif #endif
#include "CollectionSystemManager.h" #include "CollectionSystemsManager.h"
#include "SystemData.h" #include "SystemData.h"
#define FADE_IN_START_OPACITY 0.5f #define FADE_IN_START_OPACITY 0.5f
@ -355,7 +355,7 @@ void VideoGameListView::updateInfoPanel()
// the first of these so that we can display its game media. // the first of these so that we can display its game media.
if (file->getSystem()->isCustomCollection() && if (file->getSystem()->isCustomCollection() &&
file->getPath() == file->getSystem()->getName()) { file->getPath() == file->getSystem()->getName()) {
FileData* randomGame = CollectionSystemManager::get()-> FileData* randomGame = CollectionSystemsManager::get()->
updateCollectionFolderMetadata(file->getSystem()); updateCollectionFolderMetadata(file->getSystem());
if (randomGame) { if (randomGame) {
mThumbnail.setImage(randomGame->getThumbnailPath()); mThumbnail.setImage(randomGame->getThumbnailPath());