mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 09:35:39 +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/FileSystemUtil.h"
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
#include "views/UIModeController.h"
|
#include "views/UIModeController.h"
|
||||||
|
#include "views/ViewController.h"
|
||||||
#include "CollectionSystemManager.h"
|
#include "CollectionSystemManager.h"
|
||||||
#include "FileFilterIndex.h"
|
#include "FileFilterIndex.h"
|
||||||
#include "FileSorts.h"
|
#include "FileSorts.h"
|
||||||
|
@ -613,6 +614,28 @@ FileData* SystemData::getRandomGame(const FileData* currentGame)
|
||||||
return gameList.at(target);
|
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
|
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
|
// 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);
|
static FileData* getRandomCollectionFolder(const FileData* currentFolder);
|
||||||
FileData* getRandomGame(const FileData* currentGame = nullptr);
|
FileData* getRandomGame(const FileData* currentGame = nullptr);
|
||||||
|
|
||||||
|
void sortSystem(bool reloadGamelist = true);
|
||||||
|
|
||||||
// Load or re-load theme.
|
// Load or re-load theme.
|
||||||
void loadTheme();
|
void loadTheme();
|
||||||
|
|
||||||
|
|
|
@ -372,22 +372,7 @@ void GuiMenu::openUISettings()
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
for (auto it = SystemData::sSystemVector.cbegin(); it !=
|
||||||
SystemData::sSystemVector.cend(); it++) {
|
SystemData::sSystemVector.cend(); it++) {
|
||||||
|
|
||||||
bool favoritesSorting;
|
(*it)->sortSystem();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// Jump to the first row of the gamelist.
|
// Jump to the first row of the gamelist.
|
||||||
IGameListView* gameList = ViewController::get()->getGameListView((*it)).get();
|
IGameListView* gameList = ViewController::get()->getGameListView((*it)).get();
|
||||||
|
|
Loading…
Reference in a new issue