skip game lists without games when quick selecting, handle empty game lists

This commit is contained in:
taalas 2015-06-09 15:13:29 +02:00
parent d2d448ee1c
commit 6f602a22c9
3 changed files with 37 additions and 6 deletions

View file

@ -161,6 +161,12 @@ void SystemData::launchGame(Window* window, FileData* game)
void SystemData::populateFolder(FileData* folder)
{
if (mDirectLaunch)
{
LOG(LogInfo) << "System " << mName << " is a direct launch item, not building game lists.";
return;
}
const fs::path& folderPath = folder->getPath();
if(!fs::is_directory(folderPath))
{
@ -330,12 +336,15 @@ bool SystemData::loadConfig()
continue;
}
if (!directLaunch)
{
//convert path to generic directory seperators
boost::filesystem::path genericPath(path);
path = genericPath.generic_string();
}
SystemData* newSys = new SystemData(name, fullname, path, extensions, cmd, platformIds, themeFolder, directLaunch);
if(newSys->getRootFolder()->getChildren().size() == 0)
if(newSys->getRootFolder()->getChildren().size() == 0 && !directLaunch)
{
LOG(LogWarning) << "System \"" << name << "\" has no games! Ignoring it.";
delete newSys;

View file

@ -72,7 +72,15 @@ void ViewController::goToNextGameList()
assert(mState.viewing == GAME_LIST);
SystemData* system = getState().getSystem();
assert(system);
goToGameList(system->getNext());
// skip systems that don't have a game list, this will always end since it is called
// from a system with a game list and the iterator is cyclic
do
{
system = system->getNext();
} while ( system->getDirectLaunch() );
goToGameList(system);
}
void ViewController::goToPrevGameList()
@ -80,7 +88,15 @@ void ViewController::goToPrevGameList()
assert(mState.viewing == GAME_LIST);
SystemData* system = getState().getSystem();
assert(system);
goToGameList(system->getPrev());
// skip systems that don't have a game list, this will always end since it is called
// from a system with a game list and the iterator is cyclic
do
{
system = system->getPrev();
} while ( system->getDirectLaunch() );
goToGameList(system);
}
void ViewController::goToGameList(SystemData* system)

View file

@ -39,6 +39,12 @@ void BasicGameListView::populateList(const std::vector<FileData*>& files)
{
mList.clear();
// file list can be empty if direct launch item
if (files.size()==0)
{
return;
}
mHeaderText.setText(files.at(0)->getSystem()->getFullName());
for(auto it = files.begin(); it != files.end(); it++)