mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Fixed multiple issues with hidden games.
This commit is contained in:
parent
56ae90cc67
commit
3aa10177cf
|
@ -431,12 +431,30 @@ void FileData::sort(ComparisonFunction& comparator, bool ascending,
|
||||||
mOnlyFolders = true;
|
mOnlyFolders = true;
|
||||||
mHasFolders = false;
|
mHasFolders = false;
|
||||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||||
|
bool showHiddenGames = Settings::getInstance()->getBool("ShowHiddenGames");
|
||||||
std::vector<FileData*> mChildrenFolders;
|
std::vector<FileData*> mChildrenFolders;
|
||||||
std::vector<FileData*> mChildrenOthers;
|
std::vector<FileData*> mChildrenOthers;
|
||||||
|
|
||||||
if (mSystem->isGroupedCustomCollection())
|
if (mSystem->isGroupedCustomCollection())
|
||||||
gameCount = {};
|
gameCount = {};
|
||||||
|
|
||||||
|
if (!showHiddenGames) {
|
||||||
|
for (auto it = mChildren.begin(); it != mChildren.end();) {
|
||||||
|
// If the option to hide hidden games has been set and the game is hidden,
|
||||||
|
// then skip it. Normally games are hidden during loading of the gamelists in
|
||||||
|
// Gamelist::parseGamelist() and this code should only run when a user has marked
|
||||||
|
// an entry manually as hidden. So upon the next application startup, this game
|
||||||
|
// should be filtered already at that earlier point.
|
||||||
|
if ((*it)->getHidden())
|
||||||
|
it = mChildren.erase(it);
|
||||||
|
// Also hide folders where all its entries have been hidden.
|
||||||
|
else if ((*it)->getType() == FOLDER && (*it)->getChildren().size() == 0)
|
||||||
|
it = mChildren.erase(it);
|
||||||
|
else
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The main custom collections view is sorted during startup in CollectionSystemManager.
|
// The main custom collections view is sorted during startup in CollectionSystemManager.
|
||||||
// The individual collections are however sorted as any normal systems/folders.
|
// The individual collections are however sorted as any normal systems/folders.
|
||||||
if (mSystem->isCollection() && mSystem->getFullName() == "collections") {
|
if (mSystem->isCollection() && mSystem->getFullName() == "collections") {
|
||||||
|
@ -524,11 +542,12 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
||||||
{
|
{
|
||||||
mOnlyFolders = true;
|
mOnlyFolders = true;
|
||||||
mHasFolders = false;
|
mHasFolders = false;
|
||||||
|
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
||||||
|
bool showHiddenGames = Settings::getInstance()->getBool("ShowHiddenGames");
|
||||||
std::vector<FileData*> mChildrenFolders;
|
std::vector<FileData*> mChildrenFolders;
|
||||||
std::vector<FileData*> mChildrenFavoritesFolders;
|
std::vector<FileData*> mChildrenFavoritesFolders;
|
||||||
std::vector<FileData*> mChildrenFavorites;
|
std::vector<FileData*> mChildrenFavorites;
|
||||||
std::vector<FileData*> mChildrenOthers;
|
std::vector<FileData*> mChildrenOthers;
|
||||||
bool foldersOnTop = Settings::getInstance()->getBool("FoldersOnTop");
|
|
||||||
|
|
||||||
if (mSystem->isGroupedCustomCollection())
|
if (mSystem->isGroupedCustomCollection())
|
||||||
gameCount = {};
|
gameCount = {};
|
||||||
|
@ -549,6 +568,17 @@ void FileData::sortFavoritesOnTop(ComparisonFunction& comparator, bool ascending
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mChildren.size(); i++) {
|
for (unsigned int i = 0; i < mChildren.size(); i++) {
|
||||||
|
// If the option to hide hidden games has been set and the game is hidden,
|
||||||
|
// then skip it. Normally games are hidden during loading of the gamelists in
|
||||||
|
// Gamelist::parseGamelist() and this code should only run when a user has marked
|
||||||
|
// an entry manually as hidden. So upon the next application startup, this game
|
||||||
|
// should be filtered already at that earlier point.
|
||||||
|
if (!showHiddenGames && mChildren[i]->getHidden())
|
||||||
|
continue;
|
||||||
|
// Also hide folders where all its entries have been hidden.
|
||||||
|
else if (mChildren[i]->getType() == FOLDER && mChildren[i]->getChildren().size() == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Game count, which will be displayed in the system view.
|
// Game count, which will be displayed in the system view.
|
||||||
if (mChildren[i]->getType() == GAME && mChildren[i]->getCountAsGame()) {
|
if (mChildren[i]->getType() == GAME && mChildren[i]->getCountAsGame()) {
|
||||||
if (!mChildren[i]->getFavorite())
|
if (!mChildren[i]->getFavorite())
|
||||||
|
|
|
@ -164,11 +164,17 @@ void parseGamelist(SystemData* system)
|
||||||
// games, then delete the entry. This leaves no trace of the entry at all in ES
|
// games, then delete the entry. This leaves no trace of the entry at all in ES
|
||||||
// but that is fine as the option to show hidden files is defined as requiring an
|
// but that is fine as the option to show hidden files is defined as requiring an
|
||||||
// application restart.
|
// application restart.
|
||||||
if (!Settings::getInstance()->getBool("ShowHiddenGames") && file->getHidden()) {
|
if (!Settings::getInstance()->getBool("ShowHiddenGames")) {
|
||||||
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden " <<
|
if (file->getHidden()) {
|
||||||
(type == GAME ? "file" : "folder") << " entry \"" <<
|
LOG(LogDebug) << "Gamelist::parseGamelist(): Skipping hidden " <<
|
||||||
file->getName() << "\"" << " (\"" << file->getPath() << "\")";
|
(type == GAME ? "file" : "folder") << " entry \"" <<
|
||||||
delete file;
|
file->getName() << "\"" << " (\"" << file->getPath() << "\")";
|
||||||
|
delete file;
|
||||||
|
}
|
||||||
|
// Also delete any folders which are empty, i.e. all their entries are hidden.
|
||||||
|
else if (file->getType() == FOLDER && file->getChildren().size() == 0) {
|
||||||
|
delete file;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,7 +352,7 @@ void GuiMetaDataEd::save()
|
||||||
mMetaData->set(mMetaDataDecl.at(i).key, mEditors.at(i)->getValue());
|
mMetaData->set(mMetaDataDecl.at(i).key, mEditors.at(i)->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If hidden games are not shown and the hide flag was set for the game, then write the
|
// If hidden games are not shown and the hide flag was set for the entry, then write the
|
||||||
// metadata immediately regardless of the SaveGamelistsMode setting. Otherwise the file
|
// metadata immediately regardless of the SaveGamelistsMode setting. Otherwise the file
|
||||||
// will never be written as the game will be filtered from the gamelist. This solution is not
|
// will never be written as the game will be filtered from the gamelist. This solution is not
|
||||||
// really good as the gamelist will be written twice, but it's a very special and hopefully
|
// really good as the gamelist will be written twice, but it's a very special and hopefully
|
||||||
|
@ -376,6 +376,12 @@ void GuiMetaDataEd::save()
|
||||||
|
|
||||||
mScraperParams.system->onMetaDataSavePoint();
|
mScraperParams.system->onMetaDataSavePoint();
|
||||||
|
|
||||||
|
// If hidden games are not shown and the hide flag was set for the entry, we also need
|
||||||
|
// to re-sort the gamelist as we may need to remove the parent folder if all the entries
|
||||||
|
// within this folder are now hidden.
|
||||||
|
if (hideGameWhileHidden)
|
||||||
|
mScraperParams.system->sortSystem(true);
|
||||||
|
|
||||||
// Make sure that the cached background is updated to reflect any possible visible
|
// Make sure that the cached background is updated to reflect any possible visible
|
||||||
// changes to the gamelist (e.g. the game name).
|
// changes to the gamelist (e.g. the game name).
|
||||||
mWindow->invalidateCachedBackground();
|
mWindow->invalidateCachedBackground();
|
||||||
|
|
Loading…
Reference in a new issue