mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-26 08:05: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;
|
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()
|
const std::string FileData::getROMDirectory()
|
||||||
{
|
{
|
||||||
std::string romDirSetting = Settings::getInstance()->getString("ROMDirectory");
|
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)
|
std::pair<unsigned int, unsigned int>& gameCount)
|
||||||
{
|
{
|
||||||
mOnlyFolders = true;
|
mOnlyFolders = true;
|
||||||
|
mHasFolders = false;
|
||||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||||
std::vector<FileData*> mChildrenFolders;
|
std::vector<FileData*> mChildrenFolders;
|
||||||
std::vector<FileData*> mChildrenOthers;
|
std::vector<FileData*> mChildrenOthers;
|
||||||
|
@ -517,6 +507,8 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
||||||
|
|
||||||
if ((*it)->getType() != FOLDER)
|
if ((*it)->getType() != FOLDER)
|
||||||
mOnlyFolders = false;
|
mOnlyFolders = false;
|
||||||
|
else
|
||||||
|
mHasFolders = true;
|
||||||
|
|
||||||
// Iterate through any child folders.
|
// Iterate through any child folders.
|
||||||
if ((*it)->getChildren().size() > 0)
|
if ((*it)->getChildren().size() > 0)
|
||||||
|
@ -531,6 +523,7 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
||||||
std::pair<unsigned int, unsigned int>& gameCount)
|
std::pair<unsigned int, unsigned int>& gameCount)
|
||||||
{
|
{
|
||||||
mOnlyFolders = true;
|
mOnlyFolders = true;
|
||||||
|
mHasFolders = false;
|
||||||
std::vector<FileData*> mChildrenFolders;
|
std::vector<FileData*> mChildrenFolders;
|
||||||
std::vector<FileData*> mChildrenFavoritesFolders;
|
std::vector<FileData*> mChildrenFavoritesFolders;
|
||||||
std::vector<FileData*> mChildrenFavorites;
|
std::vector<FileData*> mChildrenFavorites;
|
||||||
|
@ -579,6 +572,8 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
||||||
|
|
||||||
if (mChildren[i]->getType() != FOLDER)
|
if (mChildren[i]->getType() != FOLDER)
|
||||||
mOnlyFolders = false;
|
mOnlyFolders = false;
|
||||||
|
else
|
||||||
|
mHasFolders = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSystem->isGroupedCustomCollection())
|
if (mSystem->isGroupedCustomCollection())
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
inline SystemData* getSystem() const { return mSystem; }
|
inline SystemData* getSystem() const { return mSystem; }
|
||||||
inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
|
inline SystemEnvironmentData* getSystemEnvData() const { return mEnvData; }
|
||||||
const bool getOnlyFoldersFlag() { return mOnlyFolders; }
|
const bool getOnlyFoldersFlag() { return mOnlyFolders; }
|
||||||
bool viewHasOnlyFolders();
|
const bool getHasFoldersFlag() { return mHasFolders; }
|
||||||
static const std::string getROMDirectory();
|
static const std::string getROMDirectory();
|
||||||
static const std::string getMediaDirectory();
|
static const std::string getMediaDirectory();
|
||||||
const std::string getMediafilePath(std::string subdirectory, std::string mediatype) const;
|
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.
|
// The pair includes non-favorite games, and favorite games.
|
||||||
std::pair<unsigned int, unsigned int> mGameCount;
|
std::pair<unsigned int, unsigned int> mGameCount;
|
||||||
bool mOnlyFolders;
|
bool mOnlyFolders;
|
||||||
|
bool mHasFolders;
|
||||||
// Used for flagging a game for deletion from its gamelist.xml file.
|
// Used for flagging a game for deletion from its gamelist.xml file.
|
||||||
bool mDeletionFlag;
|
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
|
// are not sorted on top, this way the logic should work exactly as for mixed
|
||||||
// lists or files-only lists.
|
// lists or files-only lists.
|
||||||
if (getCursor()->getType() == FOLDER && foldersOnTop == true)
|
if (getCursor()->getType() == FOLDER && foldersOnTop == true)
|
||||||
foldersOnTop = !getCursor()->viewHasOnlyFolders();
|
foldersOnTop = !getCursor()->getParent()->getOnlyFoldersFlag();
|
||||||
|
|
||||||
if (mRoot->getSystem()->isCustomCollection())
|
if (mRoot->getSystem()->isCustomCollection())
|
||||||
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||||
|
|
Loading…
Reference in a new issue