mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Simplified the detection of folders in gamelists.
This commit is contained in:
parent
893dee2bab
commit
a2d05d0bd1
|
@ -152,17 +152,6 @@ const std::vector<FileData*> FileData::getChildrenRecursive() const
|
|||
return childrenRecursive;
|
||||
}
|
||||
|
||||
bool FileData::viewHasOnlyFolders()
|
||||
{
|
||||
bool onlyFolders = true;
|
||||
std::vector<FileData*> entrySiblings = this->getParent()->getChildren();
|
||||
for (auto it = entrySiblings.cbegin(); it != entrySiblings.cend(); it++) {
|
||||
if ((*it)->getType() != FOLDER)
|
||||
onlyFolders = false;
|
||||
}
|
||||
return onlyFolders;
|
||||
}
|
||||
|
||||
const std::string FileData::getROMDirectory()
|
||||
{
|
||||
std::string romDirSetting = Settings::getInstance()->getString("ROMDirectory");
|
||||
|
@ -440,6 +429,7 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
|||
std::pair<unsigned int, unsigned int>& gameCount)
|
||||
{
|
||||
mOnlyFolders = true;
|
||||
mHasFolders = false;
|
||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||
std::vector<FileData*> mChildrenFolders;
|
||||
std::vector<FileData*> mChildrenOthers;
|
||||
|
@ -517,6 +507,8 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
|||
|
||||
if ((*it)->getType() != FOLDER)
|
||||
mOnlyFolders = false;
|
||||
else
|
||||
mHasFolders = true;
|
||||
|
||||
// Iterate through any child folders.
|
||||
if ((*it)->getChildren().size() > 0)
|
||||
|
@ -531,6 +523,7 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
|||
std::pair<unsigned int, unsigned int>& gameCount)
|
||||
{
|
||||
mOnlyFolders = true;
|
||||
mHasFolders = false;
|
||||
std::vector<FileData*> mChildrenFolders;
|
||||
std::vector<FileData*> mChildrenFavoritesFolders;
|
||||
std::vector<FileData*> mChildrenFavorites;
|
||||
|
@ -579,6 +572,8 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
|||
|
||||
if (mChildren[i]->getType() != FOLDER)
|
||||
mOnlyFolders = false;
|
||||
else
|
||||
mHasFolders = true;
|
||||
}
|
||||
|
||||
if (mSystem->isGroupedCustomCollection())
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
inline SystemData* getSystem() const { return mSystem; }
|
||||
inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
|
||||
const bool getOnlyFoldersFlag() { return mOnlyFolders; }
|
||||
bool viewHasOnlyFolders();
|
||||
const bool getHasFoldersFlag() { return mHasFolders; }
|
||||
static const std::string getROMDirectory();
|
||||
static const std::string getMediaDirectory();
|
||||
const std::string getMediafilePath(std::string subdirectory, std::string mediatype) const;
|
||||
|
@ -149,6 +149,7 @@ private:
|
|||
// The pair includes non-favorite games, and favorite games.
|
||||
std::pair<unsigned int, unsigned int> mGameCount;
|
||||
bool mOnlyFolders;
|
||||
bool mHasFolders;
|
||||
// Used for flagging a game for deletion from its gamelist.xml file.
|
||||
bool mDeletionFlag;
|
||||
|
||||
|
|
|
@ -198,7 +198,7 @@ bool ISimpleGameListView::input(InputConfig* config, Input input)
|
|||
// are not sorted on top, this way the logic should work exactly as for mixed
|
||||
// lists or files-only lists.
|
||||
if (getCursor()->getType() == FOLDER && foldersOnTop == true)
|
||||
foldersOnTop = !getCursor()->viewHasOnlyFolders();
|
||||
foldersOnTop = !getCursor()->getParent()->getOnlyFoldersFlag();
|
||||
|
||||
if (mRoot->getSystem()->isCustomCollection())
|
||||
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||
|
|
Loading…
Reference in a new issue