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.
This commit is contained in:
pjft 2017-12-01 19:28:45 +00:00
parent 566804e682
commit c80d30493b
5 changed files with 18 additions and 6 deletions

View file

@ -9,6 +9,7 @@
#include "platform.h"
#include "Settings.h"
#include "ThemeData.h"
#include "views/UIModeController.h"
#include <pugixml/src/pugixml.hpp>
#include <fstream>
#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<SystemData*>::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;

View file

@ -55,7 +55,9 @@ public:
inline std::vector<SystemData*>::const_iterator getIterator() const { return std::find(sSystemVector.cbegin(), sSystemVector.cend(), this); };
inline std::vector<SystemData*>::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;

View file

@ -37,7 +37,7 @@ void SystemView::populate()
if(mViewNeedsReload)
getViewElements(theme);
if((*it)->getDisplayedGameCount() > 0)
if((*it)->isVisible())
{
Entry e;
e.name = (*it)->getName();

View file

@ -270,6 +270,7 @@ std::shared_ptr<IGameListView> 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<IGameListView> view;
@ -442,6 +443,7 @@ void ViewController::reloadGameListView(IGameListView* view, bool reloadTheme)
if(reloadTheme)
system->loadTheme();
system->getIndex()->setUIModeFilters();
std::shared_ptr<IGameListView> newView = getGameListView(system);
// to counter having come from a placeholder

View file

@ -111,13 +111,13 @@ void BasicGameListView::remove(FileData *game, bool deleteFile)
{
std::vector<FileData*> 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));
}
}