Merge pull request #94 from jrassa/gamelist-view-check

don't enable video view if current theme doesn't support it
This commit is contained in:
Jools Wills 2017-03-07 20:13:37 +00:00 committed by GitHub
commit 0bb7134b5d
3 changed files with 10 additions and 1 deletions

View file

@ -228,13 +228,15 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
//if we didn't, make it, remember it, and return it
std::shared_ptr<IGameListView> view;
bool themeHasVideoView = system->getTheme()->hasView("video");
//decide type
bool detailed = false;
bool video = false;
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
for(auto it = files.begin(); it != files.end(); it++)
{
if(!(*it)->getVideoPath().empty())
if(themeHasVideoView && !(*it)->getVideoPath().empty())
{
video = true;
break;

View file

@ -343,6 +343,11 @@ void ThemeData::parseElement(const pugi::xml_node& root, const std::map<std::str
}
}
bool ThemeData::hasView(const std::string& view)
{
auto viewIt = mViews.find(view);
return (viewIt != mViews.end());
}
const ThemeData::ThemeElement* ThemeData::getElement(const std::string& view, const std::string& element, const std::string& expectedType) const
{

View file

@ -135,6 +135,8 @@ public:
BOOLEAN
};
bool hasView(const std::string& view);
// If expectedType is an empty string, will do no type checking.
const ThemeElement* getElement(const std::string& view, const std::string& element, const std::string& expectedType) const;