From c80d30493b038e8876842c6621e85fe3d8746eba Mon Sep 17 00:00:00 2001 From: pjft Date: Fri, 1 Dec 2017 19:28:45 +0000 Subject: [PATCH] Fix empty collections not showing up in Carousel for Full mode Also fixed empty favorites collection in Kiosk mode not initializing as intended after adding the first game, if empty at start. --- es-app/src/SystemData.cpp | 12 ++++++++++-- es-app/src/SystemData.h | 4 +++- es-app/src/views/SystemView.cpp | 2 +- es-app/src/views/ViewController.cpp | 2 ++ es-app/src/views/gamelist/BasicGameListView.cpp | 4 ++-- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 1ecc274b7..937c1f43a 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -9,6 +9,7 @@ #include "platform.h" #include "Settings.h" #include "ThemeData.h" +#include "views/UIModeController.h" #include #include #ifdef WIN32 @@ -340,6 +341,13 @@ std::string SystemData::getConfigPath(bool forWrite) return "/etc/emulationstation/es_systems.cfg"; } +bool SystemData::isVisible() +{ + return (getDisplayedGameCount() > 0 || + (UIModeController::getInstance()->isUIModeFull() && mIsCollectionSystem) || + (mIsCollectionSystem && mName == "favorites")); +} + SystemData* SystemData::getNext() const { std::vector::const_iterator it = getIterator(); @@ -348,7 +356,7 @@ SystemData* SystemData::getNext() const it++; if (it == sSystemVector.cend()) it = sSystemVector.cbegin(); - } while ((*it)->getDisplayedGameCount() == 0); + } while (!(*it)->isVisible()); // as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle. return *it; @@ -362,7 +370,7 @@ SystemData* SystemData::getPrev() const it++; if (it == sSystemVector.crend()) it = sSystemVector.crbegin(); - } while ((*it)->getDisplayedGameCount() == 0); + } while (!(*it)->isVisible()); // as we are starting in a valid gamelistview, this will always succeed, even if we have to come full circle. return *it; diff --git a/es-app/src/SystemData.h b/es-app/src/SystemData.h index 24597cd54..ad0456b3c 100644 --- a/es-app/src/SystemData.h +++ b/es-app/src/SystemData.h @@ -55,7 +55,9 @@ public: inline std::vector::const_iterator getIterator() const { return std::find(sSystemVector.cbegin(), sSystemVector.cend(), this); }; inline std::vector::const_reverse_iterator getRevIterator() const { return std::find(sSystemVector.crbegin(), sSystemVector.crend(), this); }; inline bool isCollection() { return mIsCollectionSystem; }; - inline bool isGameSystem() { return mIsGameSystem; } + inline bool isGameSystem() { return mIsGameSystem; }; + + bool isVisible(); SystemData* getNext() const; SystemData* getPrev() const; diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index dd5fdfcd6..fe850d566 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -37,7 +37,7 @@ void SystemView::populate() if(mViewNeedsReload) getViewElements(theme); - if((*it)->getDisplayedGameCount() > 0) + if((*it)->isVisible()) { Entry e; e.name = (*it)->getName(); diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 0647f9193..c002b6e30 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -270,6 +270,7 @@ std::shared_ptr ViewController::getGameListView(SystemData* syste if(exists != mGameListViews.cend()) return exists->second; + system->getIndex()->setUIModeFilters(); //if we didn't, make it, remember it, and return it std::shared_ptr view; @@ -442,6 +443,7 @@ void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme) if(reloadTheme) system->loadTheme(); + system->getIndex()->setUIModeFilters(); std::shared_ptr newView = getGameListView(system); // to counter having come from a placeholder diff --git a/es-app/src/views/gamelist/BasicGameListView.cpp b/es-app/src/views/gamelist/BasicGameListView.cpp index 4e479f317..9d2a96b57 100644 --- a/es-app/src/views/gamelist/BasicGameListView.cpp +++ b/es-app/src/views/gamelist/BasicGameListView.cpp @@ -111,13 +111,13 @@ void BasicGameListView::remove(FileData *game, bool deleteFile) { std::vector siblings = parent->getChildrenListToDisplay(); auto gameIter = std::find(siblings.cbegin(), siblings.cend(), game); - int gamePos = (int)std::distance(siblings.cbegin(), gameIter); + unsigned int gamePos = (int)std::distance(siblings.cbegin(), gameIter); if (gameIter != siblings.cend()) { if ((gamePos + 1) < siblings.size()) { setCursor(siblings.at(gamePos + 1)); - } else if ((gamePos - 1) > 0) { + } else if (gamePos > 1) { setCursor(siblings.at(gamePos - 1)); } }