mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Simplified the detection of grouped custom collections.
This commit is contained in:
parent
b9301f08da
commit
07efcd19d0
|
@ -442,19 +442,13 @@ void CollectionSystemManager::updateCollectionSystem(FileData* file, CollectionS
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ViewController::get()->onFileChanged(rootFolder, false);
|
ViewController::get()->onFileChanged(rootFolder, false);
|
||||||
// If it's a custom collection and the setting to group the collections is
|
// For custom collections, update either the actual system or its parent depending
|
||||||
// enabled, we may have to update the parent instead.
|
// on whether the collection is grouped or not.
|
||||||
// However it may not necessarily be so if some collections are themed and
|
if (sysData.decl.isCustom) {
|
||||||
// some are not, so we always need to check whether a parent exists.
|
if (rootFolder->getSystem()->isGroupedCustomCollection())
|
||||||
if (sysData.decl.isCustom &&
|
|
||||||
Settings::getInstance()->getBool("UseCustomCollectionsSystem")) {
|
|
||||||
// In case of a returned null pointer, we know there is no parent.
|
|
||||||
if (rootFolder->getParent() == nullptr) {
|
|
||||||
ViewController::get()->onFileChanged(rootFolder, false);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ViewController::get()->onFileChanged(rootFolder->getParent(), false);
|
ViewController::get()->onFileChanged(rootFolder->getParent(), false);
|
||||||
}
|
else
|
||||||
|
ViewController::get()->onFileChanged(rootFolder, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1063,6 +1057,7 @@ void CollectionSystemManager::addEnabledCollectionsToDisplayedSystems(
|
||||||
FileData* newSysRootFolder = it->second.system->getRootFolder();
|
FileData* newSysRootFolder = it->second.system->getRootFolder();
|
||||||
mCustomCollectionsBundle->getRootFolder()->addChild(newSysRootFolder);
|
mCustomCollectionsBundle->getRootFolder()->addChild(newSysRootFolder);
|
||||||
mCustomCollectionsBundle->getIndex()->importIndex(it->second.system->getIndex());
|
mCustomCollectionsBundle->getIndex()->importIndex(it->second.system->getIndex());
|
||||||
|
it->second.system->setIsGroupedCustomCollection(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,17 +1246,3 @@ std::string CollectionSystemManager::getCollectionsFolder()
|
||||||
return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() +
|
return Utils::FileSystem::getGenericPath(Utils::FileSystem::getHomePath() +
|
||||||
"/.emulationstation/collections");
|
"/.emulationstation/collections");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return whether the system is a custom collection.
|
|
||||||
bool CollectionSystemManager::getIsCustomCollection(SystemData* system)
|
|
||||||
{
|
|
||||||
// Iterate the map.
|
|
||||||
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator
|
|
||||||
it = mCustomCollectionSystemsData.cbegin();
|
|
||||||
it != mCustomCollectionSystemsData.cend() ; it++) {
|
|
||||||
if (it->second.system == system)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
|
@ -103,8 +103,6 @@ public:
|
||||||
SystemData* getSystemToView(SystemData* sys);
|
SystemData* getSystemToView(SystemData* sys);
|
||||||
FileData* updateCollectionFolderMetadata(SystemData* sys);
|
FileData* updateCollectionFolderMetadata(SystemData* sys);
|
||||||
|
|
||||||
bool getIsCustomCollection(SystemData* system);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static CollectionSystemManager* sInstance;
|
static CollectionSystemManager* sInstance;
|
||||||
SystemEnvironmentData* mCollectionEnvData;
|
SystemEnvironmentData* mCollectionEnvData;
|
||||||
|
|
|
@ -44,6 +44,7 @@ SystemData::SystemData(
|
||||||
mThemeFolder(themeFolder),
|
mThemeFolder(themeFolder),
|
||||||
mIsCollectionSystem(CollectionSystem),
|
mIsCollectionSystem(CollectionSystem),
|
||||||
mIsCustomCollectionSystem(CustomCollectionSystem),
|
mIsCustomCollectionSystem(CustomCollectionSystem),
|
||||||
|
mIsGroupedCustomCollectionSystem(false),
|
||||||
mIsGameSystem(true),
|
mIsGameSystem(true),
|
||||||
mScrapeFlag(false)
|
mScrapeFlag(false)
|
||||||
{
|
{
|
||||||
|
@ -629,7 +630,7 @@ void SystemData::sortSystem(bool reloadGamelist)
|
||||||
|
|
||||||
bool favoritesSorting;
|
bool favoritesSorting;
|
||||||
|
|
||||||
if (CollectionSystemManager::get()->getIsCustomCollection(this))
|
if (this->isCustomCollection())
|
||||||
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||||
else
|
else
|
||||||
favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
||||||
|
|
|
@ -83,6 +83,9 @@ public:
|
||||||
{ return std::find(sSystemVector.crbegin(), sSystemVector.crend(), this); };
|
{ return std::find(sSystemVector.crbegin(), sSystemVector.crend(), this); };
|
||||||
inline bool isCollection() { return mIsCollectionSystem; };
|
inline bool isCollection() { return mIsCollectionSystem; };
|
||||||
inline bool isCustomCollection() { return mIsCustomCollectionSystem; };
|
inline bool isCustomCollection() { return mIsCustomCollectionSystem; };
|
||||||
|
inline bool isGroupedCustomCollection() { return mIsGroupedCustomCollectionSystem; };
|
||||||
|
void setIsGroupedCustomCollection(bool isGroupedCustom)
|
||||||
|
{ mIsGroupedCustomCollectionSystem = isGroupedCustom; };
|
||||||
inline bool isGameSystem() { return mIsGameSystem; };
|
inline bool isGameSystem() { return mIsGameSystem; };
|
||||||
|
|
||||||
bool isVisible();
|
bool isVisible();
|
||||||
|
@ -106,6 +109,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool mIsCollectionSystem;
|
bool mIsCollectionSystem;
|
||||||
bool mIsCustomCollectionSystem;
|
bool mIsCustomCollectionSystem;
|
||||||
|
bool mIsGroupedCustomCollectionSystem;
|
||||||
bool mIsGameSystem;
|
bool mIsGameSystem;
|
||||||
bool mScrapeFlag; // Only used by scraper GUI to remember which systems to scrape.
|
bool mScrapeFlag; // Only used by scraper GUI to remember which systems to scrape.
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
|
@ -468,7 +468,7 @@ void GuiMenu::openUISettings()
|
||||||
continue;
|
continue;
|
||||||
// Don't re-sort custom collections as they have their own option
|
// Don't re-sort custom collections as they have their own option
|
||||||
// for whether to sort favorites on top or not (FavFirstCustom).
|
// for whether to sort favorites on top or not (FavFirstCustom).
|
||||||
if (CollectionSystemManager::get()->getIsCustomCollection((*it)))
|
if ((*it)->isCustomCollection())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FileData* rootFolder = (*it)->getRootFolder();
|
FileData* rootFolder = (*it)->getRootFolder();
|
||||||
|
|
Loading…
Reference in a new issue