mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-19 05:15:41 +00:00
Add Explicit Gamelist Type selection to GUI menu.
Currently supports Basic, Detailed, Video, and Automatic types. The Automatic type checks for the availability of first video's, then screenshots, defaulting to Basic view if none are present.
This commit is contained in:
parent
bf1c0b841b
commit
003d9edbf9
|
@ -160,6 +160,24 @@ GuiMenu::GuiMenu(Window* window) : GuiComponent(window), mMenu(window, "MAIN MEN
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GameList view style
|
||||||
|
auto gamelist_style = std::make_shared< OptionListComponent<std::string> >(mWindow, "GAMELIST VIEW STYLE", false);
|
||||||
|
std::vector<std::string> styles;
|
||||||
|
styles.push_back("automatic");
|
||||||
|
styles.push_back("basic");
|
||||||
|
styles.push_back("detailed");
|
||||||
|
styles.push_back("video");
|
||||||
|
for (auto it = styles.begin(); it != styles.end(); it++)
|
||||||
|
gamelist_style->add(*it, *it, Settings::getInstance()->getString("GamelistViewStyle") == *it);
|
||||||
|
s->addWithLabel("GAMELIST VIEW STYLE", gamelist_style);
|
||||||
|
s->addSaveFunc([gamelist_style] {
|
||||||
|
bool needReload = false;
|
||||||
|
if (Settings::getInstance()->getString("GamelistViewStyle") != gamelist_style->getSelected())
|
||||||
|
needReload = true;
|
||||||
|
Settings::getInstance()->setString("GamelistViewStyle", gamelist_style->getSelected());
|
||||||
|
if (needReload)
|
||||||
|
ViewController::get()->reloadAll();
|
||||||
|
});
|
||||||
mWindow->pushGui(s);
|
mWindow->pushGui(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -231,33 +231,51 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
||||||
bool themeHasVideoView = system->getTheme()->hasView("video");
|
bool themeHasVideoView = system->getTheme()->hasView("video");
|
||||||
|
|
||||||
//decide type
|
//decide type
|
||||||
bool detailed = false;
|
GameListViewType selectedViewType = AUTOMATIC;
|
||||||
bool video = false;
|
|
||||||
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
std::string viewPreference = Settings::getInstance()->getString("GamelistViewStyle");
|
||||||
for(auto it = files.begin(); it != files.end(); it++)
|
if (viewPreference.compare("basic") == 0)
|
||||||
|
selectedViewType = BASIC;
|
||||||
|
if (viewPreference.compare("detailed") == 0)
|
||||||
|
selectedViewType = DETAILED;
|
||||||
|
if (viewPreference.compare("video") == 0)
|
||||||
|
selectedViewType = VIDEO;
|
||||||
|
|
||||||
|
if (selectedViewType == AUTOMATIC)
|
||||||
{
|
{
|
||||||
if(themeHasVideoView && !(*it)->getVideoPath().empty())
|
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
||||||
|
for (auto it = files.begin(); it != files.end(); it++)
|
||||||
{
|
{
|
||||||
video = true;
|
if (themeHasVideoView && !(*it)->getVideoPath().empty())
|
||||||
break;
|
{
|
||||||
}
|
selectedViewType = VIDEO;
|
||||||
else if(!(*it)->getThumbnailPath().empty())
|
break;
|
||||||
{
|
}
|
||||||
detailed = true;
|
else if (!(*it)->getThumbnailPath().empty())
|
||||||
// Don't break out in case any subsequent files have video
|
{
|
||||||
|
selectedViewType = DETAILED;
|
||||||
|
// Don't break out in case any subsequent files have video
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video)
|
// Create the view
|
||||||
// Create the view
|
switch (selectedViewType)
|
||||||
view = std::shared_ptr<IGameListView>(new VideoGameListView(mWindow, system->getRootFolder()));
|
{
|
||||||
else if(detailed)
|
case VIDEO:
|
||||||
view = std::shared_ptr<IGameListView>(new DetailedGameListView(mWindow, system->getRootFolder()));
|
view = std::shared_ptr<IGameListView>(new VideoGameListView(mWindow, system->getRootFolder()));
|
||||||
else
|
break;
|
||||||
view = std::shared_ptr<IGameListView>(new BasicGameListView(mWindow, system->getRootFolder()));
|
case DETAILED:
|
||||||
|
view = std::shared_ptr<IGameListView>(new DetailedGameListView(mWindow, system->getRootFolder()));
|
||||||
// uncomment for experimental "image grid" view
|
break;
|
||||||
//view = std::shared_ptr<IGameListView>(new GridGameListView(mWindow, system->getRootFolder()));
|
// case GRID placeholder for future implementation.
|
||||||
|
// view = std::shared_ptr<IGameListView>(new GridGameListView(mWindow, system->getRootFolder()));
|
||||||
|
// break;
|
||||||
|
case BASIC:
|
||||||
|
default:
|
||||||
|
view = std::shared_ptr<IGameListView>(new BasicGameListView(mWindow, system->getRootFolder()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
view->setTheme(system->getTheme());
|
view->setTheme(system->getTheme());
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,15 @@ public:
|
||||||
GAME_LIST
|
GAME_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum GameListViewType
|
||||||
|
{
|
||||||
|
AUTOMATIC,
|
||||||
|
BASIC,
|
||||||
|
DETAILED,
|
||||||
|
VIDEO
|
||||||
|
// GRID TODO!
|
||||||
|
};
|
||||||
|
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
ViewMode viewing;
|
ViewMode viewing;
|
||||||
|
|
|
@ -75,6 +75,7 @@ void Settings::setDefaults()
|
||||||
mStringMap["ThemeSet"] = "";
|
mStringMap["ThemeSet"] = "";
|
||||||
mStringMap["ScreenSaverBehavior"] = "dim";
|
mStringMap["ScreenSaverBehavior"] = "dim";
|
||||||
mStringMap["Scraper"] = "TheGamesDB";
|
mStringMap["Scraper"] = "TheGamesDB";
|
||||||
|
mStringMap["GamelistViewStyle"] = "automatic";
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename K, typename V>
|
template <typename K, typename V>
|
||||||
|
|
Loading…
Reference in a new issue