mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Fixed a filter reset issue for grouped custom collections.
This commit is contained in:
parent
7bea146745
commit
910b9e0125
es-app/src/guis
|
@ -31,26 +31,30 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
: GuiComponent(window),
|
: GuiComponent(window),
|
||||||
mSystem(system),
|
mSystem(system),
|
||||||
mMenu(window, "OPTIONS"),
|
mMenu(window, "OPTIONS"),
|
||||||
fromPlaceholder(false),
|
|
||||||
mFiltersChanged(false),
|
mFiltersChanged(false),
|
||||||
mCancelled(false),
|
mCancelled(false),
|
||||||
isCustomCollection(false),
|
mIsCustomCollection(false),
|
||||||
isCustomCollectionGroup(false)
|
mIsCustomCollectionGroup(false),
|
||||||
|
mCustomCollectionSystem(nullptr)
|
||||||
{
|
{
|
||||||
addChild(&mMenu);
|
addChild(&mMenu);
|
||||||
|
|
||||||
// Check that it's not a placeholder folder - if it is, only show "Filter Options".
|
|
||||||
FileData* file = getGamelist()->getCursor();
|
FileData* file = getGamelist()->getCursor();
|
||||||
fromPlaceholder = file->isPlaceHolder();
|
// Check if it's a placeholder, which would limit the menu entries presented.
|
||||||
|
file->isPlaceHolder();
|
||||||
|
mFromPlaceholder = file->isPlaceHolder();
|
||||||
ComponentListRow row;
|
ComponentListRow row;
|
||||||
|
|
||||||
// There is some special logic required for custom collections.
|
// There is some special logic required for custom collections.
|
||||||
if (file->getSystem()->isCustomCollection() &&
|
if (file->getSystem()->isCustomCollection() &&
|
||||||
file->getPath() != file->getSystem()->getName())
|
file->getPath() != file->getSystem()->getName())
|
||||||
isCustomCollection = true;
|
mIsCustomCollection = true;
|
||||||
else if (file->getSystem()->isCustomCollection() &&
|
else if (file->getSystem()->isCustomCollection() &&
|
||||||
file->getPath() == file->getSystem()->getName())
|
file->getPath() == file->getSystem()->getName())
|
||||||
isCustomCollectionGroup = true;
|
mIsCustomCollectionGroup = true;
|
||||||
|
|
||||||
|
if (mFromPlaceholder && file->getSystem()->isGroupedCustomCollection())
|
||||||
|
mCustomCollectionSystem = file->getSystem();
|
||||||
|
|
||||||
// Read the setting for whether folders are sorted on top of the gamelists.
|
// Read the setting for whether folders are sorted on top of the gamelists.
|
||||||
// Also check if the gamelist only contains folders, as generated by the FileData sorting.
|
// Also check if the gamelist only contains folders, as generated by the FileData sorting.
|
||||||
|
@ -60,12 +64,12 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
|
|
||||||
// Read the applicable favorite sorting setting depending on whether the
|
// Read the applicable favorite sorting setting depending on whether the
|
||||||
// system is a custom collection or not.
|
// system is a custom collection or not.
|
||||||
if (isCustomCollection)
|
if (mIsCustomCollection)
|
||||||
mFavoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
mFavoritesSorting = Settings::getInstance()->getBool("FavFirstCustom");
|
||||||
else
|
else
|
||||||
mFavoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
mFavoritesSorting = Settings::getInstance()->getBool("FavoritesFirst");
|
||||||
|
|
||||||
if (!fromPlaceholder) {
|
if (!mFromPlaceholder) {
|
||||||
// Jump to letter quick selector.
|
// Jump to letter quick selector.
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
|
|
||||||
|
@ -108,11 +112,11 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
mMenu.addWithLabel("JUMP TO..", mJumpToLetterList);
|
mMenu.addWithLabel("JUMP TO..", mJumpToLetterList);
|
||||||
|
|
||||||
// Add the sorting entry, unless this is the grouped custom collections list.
|
// Add the sorting entry, unless this is the grouped custom collections list.
|
||||||
if (!isCustomCollectionGroup) {
|
if (!mIsCustomCollectionGroup) {
|
||||||
// Sort list by selected sort type (persistent throughout the program session).
|
// Sort list by selected sort type (persistent throughout the program session).
|
||||||
mListSort = std::make_shared<SortList>(mWindow, getHelpStyle(), "SORT GAMES BY", false);
|
mListSort = std::make_shared<SortList>(mWindow, getHelpStyle(), "SORT GAMES BY", false);
|
||||||
FileData* root;
|
FileData* root;
|
||||||
if (isCustomCollection)
|
if (mIsCustomCollection)
|
||||||
root = getGamelist()->getCursor()->getSystem()->getRootFolder();
|
root = getGamelist()->getCursor()->getSystem()->getRootFolder();
|
||||||
else
|
else
|
||||||
root = mSystem->getRootFolder();
|
root = mSystem->getRootFolder();
|
||||||
|
@ -133,7 +137,7 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the filters entry, unless this is the grouped custom collections list.
|
// Add the filters entry, unless this is the grouped custom collections list.
|
||||||
if (!isCustomCollectionGroup) {
|
if (!mIsCustomCollectionGroup) {
|
||||||
if (system->getName() != "recent" && Settings::getInstance()->getBool("GamelistFilters")) {
|
if (system->getName() != "recent" && Settings::getInstance()->getBool("GamelistFilters")) {
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
row.addElement(std::make_shared<TextComponent>
|
row.addElement(std::make_shared<TextComponent>
|
||||||
|
@ -151,7 +155,7 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
customSystem = system->getName();
|
customSystem = system->getName();
|
||||||
|
|
||||||
if (UIModeController::getInstance()->isUIModeFull() &&
|
if (UIModeController::getInstance()->isUIModeFull() &&
|
||||||
(isCustomCollection || isCustomCollectionGroup)) {
|
(mIsCustomCollection || mIsCustomCollectionGroup)) {
|
||||||
if (CollectionSystemsManager::get()->getEditingCollection() != customSystem) {
|
if (CollectionSystemsManager::get()->getEditingCollection() != customSystem) {
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
row.addElement(std::make_shared<TextComponent>(
|
row.addElement(std::make_shared<TextComponent>(
|
||||||
|
@ -174,7 +178,7 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file->getType() == FOLDER) {
|
if (file->getType() == FOLDER) {
|
||||||
if (UIModeController::getInstance()->isUIModeFull() && !fromPlaceholder &&
|
if (UIModeController::getInstance()->isUIModeFull() && !mFromPlaceholder &&
|
||||||
!(mSystem->isCollection() && file->getType() == FOLDER)) {
|
!(mSystem->isCollection() && file->getType() == FOLDER)) {
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
row.addElement(std::make_shared<TextComponent>(mWindow,
|
row.addElement(std::make_shared<TextComponent>(mWindow,
|
||||||
|
@ -185,7 +189,7 @@ GuiGamelistOptions::GuiGamelistOptions(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (UIModeController::getInstance()->isUIModeFull() && !fromPlaceholder &&
|
if (UIModeController::getInstance()->isUIModeFull() && !mFromPlaceholder &&
|
||||||
!(mSystem->isCollection() && file->getType() == FOLDER)) {
|
!(mSystem->isCollection() && file->getType() == FOLDER)) {
|
||||||
row.elements.clear();
|
row.elements.clear();
|
||||||
row.addElement(std::make_shared<TextComponent>(mWindow,
|
row.addElement(std::make_shared<TextComponent>(mWindow,
|
||||||
|
@ -214,18 +218,35 @@ GuiGamelistOptions::~GuiGamelistOptions()
|
||||||
// the menu has been closed.
|
// the menu has been closed.
|
||||||
ViewController::get()->stopScrolling();
|
ViewController::get()->stopScrolling();
|
||||||
|
|
||||||
|
if (mFiltersChanged) {
|
||||||
|
if (!mCustomCollectionSystem) {
|
||||||
|
ViewController::get()->reloadGameListView(mSystem);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!mFromPlaceholder) {
|
||||||
|
ViewController::get()->reloadGameListView(mSystem);
|
||||||
|
}
|
||||||
|
else if (!mCustomCollectionSystem->getRootFolder()->
|
||||||
|
getChildrenListToDisplay().empty()) {
|
||||||
|
ViewController::get()->reloadGameListView(mSystem);
|
||||||
|
getGamelist()->setCursor(mCustomCollectionSystem->
|
||||||
|
getRootFolder()->getChildrenListToDisplay().front());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mCancelled)
|
if (mCancelled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!fromPlaceholder) {
|
if (!mFromPlaceholder) {
|
||||||
FileData* root;
|
FileData* root;
|
||||||
if (isCustomCollection)
|
if (mIsCustomCollection)
|
||||||
root = getGamelist()->getCursor()->getSystem()->getRootFolder();
|
root = getGamelist()->getCursor()->getSystem()->getRootFolder();
|
||||||
else
|
else
|
||||||
root = mSystem->getRootFolder();
|
root = mSystem->getRootFolder();
|
||||||
|
|
||||||
// If a new sorting type was selected, then sort and update mSortTypeString for the system.
|
// If a new sorting type was selected, then sort and update mSortTypeString for the system.
|
||||||
if (!isCustomCollectionGroup &&
|
if (!mIsCustomCollectionGroup &&
|
||||||
(*mListSort->getSelected()).description != root->getSortTypeString()) {
|
(*mListSort->getSelected()).description != root->getSortTypeString()) {
|
||||||
// This will also recursively sort children.
|
// This will also recursively sort children.
|
||||||
root->sort(*mListSort->getSelected(), mFavoritesSorting);
|
root->sort(*mListSort->getSelected(), mFavoritesSorting);
|
||||||
|
@ -245,12 +266,6 @@ GuiGamelistOptions::~GuiGamelistOptions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mFiltersChanged) {
|
|
||||||
// Only reload full view if we came from a placeholder as we need to
|
|
||||||
// re-display the remaining elements for whatever new game is selected.
|
|
||||||
ViewController::get()->reloadGameListView(mSystem);
|
|
||||||
}
|
|
||||||
|
|
||||||
NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND);
|
NavigationSounds::getInstance()->playThemeNavigationSound(SCROLLSOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +274,7 @@ void GuiGamelistOptions::openGamelistFilter()
|
||||||
GuiGamelistFilter* ggf;
|
GuiGamelistFilter* ggf;
|
||||||
mFiltersChanged = true;
|
mFiltersChanged = true;
|
||||||
|
|
||||||
if (isCustomCollection)
|
if (mIsCustomCollection)
|
||||||
ggf = new GuiGamelistFilter(mWindow, getGamelist()->getCursor()->getSystem());
|
ggf = new GuiGamelistFilter(mWindow, getGamelist()->getCursor()->getSystem());
|
||||||
else
|
else
|
||||||
ggf = new GuiGamelistFilter(mWindow, mSystem);
|
ggf = new GuiGamelistFilter(mWindow, mSystem);
|
||||||
|
|
|
@ -54,11 +54,12 @@ private:
|
||||||
bool mFoldersOnTop;
|
bool mFoldersOnTop;
|
||||||
bool mFavoritesSorting;
|
bool mFavoritesSorting;
|
||||||
bool mOnlyHasFolders;
|
bool mOnlyHasFolders;
|
||||||
bool fromPlaceholder;
|
bool mFromPlaceholder;
|
||||||
bool mFiltersChanged;
|
bool mFiltersChanged;
|
||||||
bool mCancelled;
|
bool mCancelled;
|
||||||
bool isCustomCollection;
|
bool mIsCustomCollection;
|
||||||
bool isCustomCollectionGroup;
|
bool mIsCustomCollectionGroup;
|
||||||
|
SystemData* mCustomCollectionSystem;
|
||||||
std::vector<std::string> mFirstLetterIndex;
|
std::vector<std::string> mFirstLetterIndex;
|
||||||
std::string mCurrentFirstCharacter;
|
std::string mCurrentFirstCharacter;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue