mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added a system sorting function to SystemData.
This commit is contained in:
parent
8db04c5fcb
commit
707850b339
|
@ -15,6 +15,7 @@
|
|||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/UIModeController.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "CollectionSystemManager.h"
|
||||
#include "FileFilterIndex.h"
|
||||
#include "FileSorts.h"
|
||||
|
@ -613,6 +614,28 @@ FileData* SystemData::getRandomGame(const FileData* currentGame)
|
|||
return gameList.at(target);
|
||||
}
|
||||
|
||||
void SystemData::sortSystem(bool reloadGamelist)
|
||||
{
|
||||
if (getName() == "recent")
|
||||
return;
|
||||
|
||||
bool favoritesSorting;
|
||||
|
||||
if (CollectionSystemManager::get()->getIsCustomCollection(this))
|
||||
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||
else
|
||||
favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
||||
|
||||
FileData* rootFolder = getRootFolder();
|
||||
setupSystemSortType(rootFolder);
|
||||
|
||||
rootFolder->sort(rootFolder->getSortTypeFromString(
|
||||
rootFolder->getSortTypeString()), favoritesSorting);
|
||||
|
||||
if (reloadGamelist)
|
||||
ViewController::get()->reloadGameListView(this, false);
|
||||
}
|
||||
|
||||
std::pair<unsigned int, unsigned int> SystemData::getDisplayedGameCount() const
|
||||
{
|
||||
// Return all games for the system which are marked as 'countasgame'. As this flag is set
|
||||
|
|
|
@ -93,6 +93,8 @@ public:
|
|||
static FileData* getRandomCollectionFolder(const FileData* currentFolder);
|
||||
FileData* getRandomGame(const FileData* currentGame = nullptr);
|
||||
|
||||
void sortSystem(bool reloadGamelist = true);
|
||||
|
||||
// Load or re-load theme.
|
||||
void loadTheme();
|
||||
|
||||
|
|
|
@ -372,22 +372,7 @@ void GuiMenu::openUISettings()
|
|||
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
||||
SystemData::sSystemVector.cend(); it++) {
|
||||
|
||||
bool favoritesSorting;
|
||||
|
||||
if ((*it)->getName() == "recent")
|
||||
continue;
|
||||
|
||||
if (CollectionSystemManager::get()->getIsCustomCollection(*it))
|
||||
favoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||
else
|
||||
favoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
||||
|
||||
FileData* rootFolder = (*it)->getRootFolder();
|
||||
rootFolder->getSystem()->setupSystemSortType(rootFolder);
|
||||
|
||||
rootFolder->sort(rootFolder->getSortTypeFromString(
|
||||
rootFolder->getSortTypeString()), favoritesSorting);
|
||||
ViewController::get()->reloadGameListView(*it);
|
||||
(*it)->sortSystem();
|
||||
|
||||
// Jump to the first row of the gamelist.
|
||||
IGameListView* gameList = ViewController::get()->getGameListView((*it)).get();
|
||||
|
|
Loading…
Reference in a new issue