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);
|
||||
});
|
||||
|
||||
|
|
|
@ -231,33 +231,51 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
|||
bool themeHasVideoView = system->getTheme()->hasView("video");
|
||||
|
||||
//decide type
|
||||
bool detailed = false;
|
||||
bool video = false;
|
||||
GameListViewType selectedViewType = AUTOMATIC;
|
||||
|
||||
std::string viewPreference = Settings::getInstance()->getString("GamelistViewStyle");
|
||||
if (viewPreference.compare("basic") == 0)
|
||||
selectedViewType = BASIC;
|
||||
if (viewPreference.compare("detailed") == 0)
|
||||
selectedViewType = DETAILED;
|
||||
if (viewPreference.compare("video") == 0)
|
||||
selectedViewType = VIDEO;
|
||||
|
||||
if (selectedViewType == AUTOMATIC)
|
||||
{
|
||||
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
||||
for (auto it = files.begin(); it != files.end(); it++)
|
||||
{
|
||||
if (themeHasVideoView && !(*it)->getVideoPath().empty())
|
||||
{
|
||||
video = true;
|
||||
selectedViewType = VIDEO;
|
||||
break;
|
||||
}
|
||||
else if (!(*it)->getThumbnailPath().empty())
|
||||
{
|
||||
detailed = true;
|
||||
selectedViewType = DETAILED;
|
||||
// Don't break out in case any subsequent files have video
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (video)
|
||||
// Create the view
|
||||
switch (selectedViewType)
|
||||
{
|
||||
case VIDEO:
|
||||
view = std::shared_ptr<IGameListView>(new VideoGameListView(mWindow, system->getRootFolder()));
|
||||
else if(detailed)
|
||||
break;
|
||||
case DETAILED:
|
||||
view = std::shared_ptr<IGameListView>(new DetailedGameListView(mWindow, system->getRootFolder()));
|
||||
else
|
||||
view = std::shared_ptr<IGameListView>(new BasicGameListView(mWindow, system->getRootFolder()));
|
||||
|
||||
// uncomment for experimental "image grid" view
|
||||
break;
|
||||
// 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());
|
||||
|
||||
|
|
|
@ -49,6 +49,15 @@ public:
|
|||
GAME_LIST
|
||||
};
|
||||
|
||||
enum GameListViewType
|
||||
{
|
||||
AUTOMATIC,
|
||||
BASIC,
|
||||
DETAILED,
|
||||
VIDEO
|
||||
// GRID TODO!
|
||||
};
|
||||
|
||||
struct State
|
||||
{
|
||||
ViewMode viewing;
|
||||
|
|
|
@ -75,6 +75,7 @@ void Settings::setDefaults()
|
|||
mStringMap["ThemeSet"] = "";
|
||||
mStringMap["ScreenSaverBehavior"] = "dim";
|
||||
mStringMap["Scraper"] = "TheGamesDB";
|
||||
mStringMap["GamelistViewStyle"] = "automatic";
|
||||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
|
|
Loading…
Reference in a new issue