From 162d893ea03dcf2789ece06debd5316dd3eafa67 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 8 Nov 2020 19:04:43 +0100 Subject: [PATCH] Filtered non-games are now included in the GamelistInfo field. --- USERGUIDE.md | 2 +- es-app/src/views/gamelist/DetailedGameListView.cpp | 9 +++++++-- es-app/src/views/gamelist/GridGameListView.cpp | 9 +++++++-- es-app/src/views/gamelist/ISimpleGameListView.cpp | 5 +++++ es-app/src/views/gamelist/ISimpleGameListView.h | 1 + es-app/src/views/gamelist/VideoGameListView.cpp | 9 +++++++-- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/USERGUIDE.md b/USERGUIDE.md index f4deda50c..c4944649b 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -70,7 +70,7 @@ It's possible to manually set a specific gamelist view style in the UI settings In additions to the styles just described, there is a **Grid** view style as well, but as of version 1.0.0 this is very limited and not recommended. Future versions of EmulationStation may update this style to a more useful state. -If the theme supports it, there's a gamelist information field displayed in the gamelist view, showing the number of games for the system (total and favorites) as well as a folder icon if a folder has been entered. When applying any filters to the gamelist, the game counter is replaced with the amount of games filtered (as in 'filtered / total games'). This functionality is specific to EmulationStation Desktop Edition so older themes will not support this. +If the theme supports it, there's a gamelist information field displayed in the gamelist view, showing the number of games for the system (total and favorites) as well as a folder icon if a folder has been entered. When applying any filters to the gamelist, the game counter is replaced with the amount of games filtered, as in 'filtered / total games', e.g. '19 / 77'. If there are game entries in the filter result that are marked not to be counted as games, the number of such files will be indicated like 'filtered + filtered non-games / total games', for example '23 + 4 / 77' indicating 23 normal games, 4 non-games out of a total of 77. Due to this approach it's theoretically possible that the combined filtered game amount exceeds the number of counted games in the collection, for instance '69 + 11 / 77'. This is not considered a bug and is so by design. This gamelist information field functionality is specific to EmulationStation Desktop Edition so older themes will not support this. ## Help system diff --git a/es-app/src/views/gamelist/DetailedGameListView.cpp b/es-app/src/views/gamelist/DetailedGameListView.cpp index 3e5e3b54c..ab01fa202 100644 --- a/es-app/src/views/gamelist/DetailedGameListView.cpp +++ b/es-app/src/views/gamelist/DetailedGameListView.cpp @@ -358,8 +358,13 @@ void DetailedGameListView::updateInfoPanel() gamelistInfoString = "\uF07C "; if (mIsFiltered) { - gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + - std::to_string(mGameCount); + if (mFilteredGameCountAll == mFilteredGameCount) + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + + std::to_string(mGameCount); + else + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " + + std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " + + std::to_string(mGameCount); } else { gamelistInfoString += "\uF11b " + std::to_string(mGameCount); diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp index d3acf87f4..8c542d8c4 100644 --- a/es-app/src/views/gamelist/GridGameListView.cpp +++ b/es-app/src/views/gamelist/GridGameListView.cpp @@ -446,8 +446,13 @@ void GridGameListView::updateInfoPanel() std::string gamelistInfoString; if (mIsFiltered) { - gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + - std::to_string(mGameCount); + if (mFilteredGameCountAll == mFilteredGameCount) + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + + std::to_string(mGameCount); + else + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " + + std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " + + std::to_string(mGameCount); } else { gamelistInfoString += "\uF11b " + std::to_string(mGameCount); diff --git a/es-app/src/views/gamelist/ISimpleGameListView.cpp b/es-app/src/views/gamelist/ISimpleGameListView.cpp index e0eb5b7e1..36df31b93 100644 --- a/es-app/src/views/gamelist/ISimpleGameListView.cpp +++ b/es-app/src/views/gamelist/ISimpleGameListView.cpp @@ -370,10 +370,15 @@ void ISimpleGameListView::generateGamelistInfo(const std::vector& fil mGameCount = gameCount.first + gameCount.second; mFavoritesGameCount = gameCount.second; mFilteredGameCount = 0; + mFilteredGameCountAll = 0; if (idx->isFiltered()) { mIsFiltered = true; mFilteredGameCount = mRoot->getFilesRecursive(GAME, true, false).size(); + // Also count the games that are set to not be counted as games, as the filter may + // apply to such entries as well and this will be indicated with a separate '+ XX' + // in the GamelistInfo field. + mFilteredGameCountAll = mRoot->getFilesRecursive(GAME, true, true).size(); } if (files.size() > 0 && files.front()->getParent() != mRoot) diff --git a/es-app/src/views/gamelist/ISimpleGameListView.h b/es-app/src/views/gamelist/ISimpleGameListView.h index 1c72738fb..74253fee6 100644 --- a/es-app/src/views/gamelist/ISimpleGameListView.h +++ b/es-app/src/views/gamelist/ISimpleGameListView.h @@ -55,6 +55,7 @@ protected: unsigned int mGameCount; unsigned int mFavoritesGameCount; unsigned int mFilteredGameCount; + unsigned int mFilteredGameCountAll; bool mIsFiltered; bool mIsFolder; }; diff --git a/es-app/src/views/gamelist/VideoGameListView.cpp b/es-app/src/views/gamelist/VideoGameListView.cpp index 044731898..8e8cb8f9f 100644 --- a/es-app/src/views/gamelist/VideoGameListView.cpp +++ b/es-app/src/views/gamelist/VideoGameListView.cpp @@ -401,8 +401,13 @@ void VideoGameListView::updateInfoPanel() gamelistInfoString = "\uF07C "; if (mIsFiltered) { - gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + - std::to_string(mGameCount); + if (mFilteredGameCountAll == mFilteredGameCount) + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " / " + + std::to_string(mGameCount); + else + gamelistInfoString += "\uF0b0 " + std::to_string(mFilteredGameCount) + " + " + + std::to_string(mFilteredGameCountAll - mFilteredGameCount) + " / " + + std::to_string(mGameCount); } else { gamelistInfoString += "\uF11b " + std::to_string(mGameCount);