Merge pull request #325 from pjft/favorites-syntax

Fix empty collections not showing in carousel in Full Mode.
This commit is contained in:
Jools Wills 2018-04-12 15:29:29 +01:00 committed by GitHub
commit 757dd43dd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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
@ -338,6 +339,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();
@ -346,7 +354,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;
@ -360,7 +368,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

@ -271,6 +271,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;
@ -445,6 +446,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

@ -121,13 +121,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));
}
}