mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Enable the grid view for developers
- Add the remove function to GridGameListView - Enable the grid view in ViewController - The grid view will not be available in the menu yet, but can be enable by tweaking es_settings.cfg
This commit is contained in:
parent
99cc97680d
commit
b4feb69980
|
@ -273,6 +273,11 @@ void GuiMenu::openUISettings()
|
|||
styles.push_back("basic");
|
||||
styles.push_back("detailed");
|
||||
styles.push_back("video");
|
||||
|
||||
// Temporary "hack" so ES don't crash when leaving this menu after he enabled the grid by tweaking config file
|
||||
if (Settings::getInstance()->getString("GamelistViewStyle") == "grid")
|
||||
styles.push_back("grid");
|
||||
|
||||
for (auto it = styles.cbegin(); it != styles.cend(); it++)
|
||||
gamelist_style->add(*it, *it, Settings::getInstance()->getString("GamelistViewStyle") == *it);
|
||||
s->addWithLabel("GAMELIST VIEW STYLE", gamelist_style);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "guis/GuiMenu.h"
|
||||
#include "views/gamelist/DetailedGameListView.h"
|
||||
#include "views/gamelist/IGameListView.h"
|
||||
#include "views/gamelist/GridGameListView.h"
|
||||
#include "views/gamelist/VideoGameListView.h"
|
||||
#include "views/SystemView.h"
|
||||
#include "views/UIModeController.h"
|
||||
|
@ -283,6 +284,8 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
|||
selectedViewType = BASIC;
|
||||
if (viewPreference.compare("detailed") == 0)
|
||||
selectedViewType = DETAILED;
|
||||
if (viewPreference.compare("grid") == 0)
|
||||
selectedViewType = GRID;
|
||||
if (viewPreference.compare("video") == 0)
|
||||
selectedViewType = VIDEO;
|
||||
|
||||
|
@ -313,9 +316,9 @@ std::shared_ptr<IGameListView> ViewController::getGameListView(SystemData* syste
|
|||
case DETAILED:
|
||||
view = std::shared_ptr<IGameListView>(new DetailedGameListView(mWindow, system->getRootFolder()));
|
||||
break;
|
||||
// case GRID placeholder for future implementation.
|
||||
// view = std::shared_ptr<IGameListView>(new GridGameListView(mWindow, system->getRootFolder()));
|
||||
// break;
|
||||
case GRID:
|
||||
view = std::shared_ptr<IGameListView>(new GridGameListView(mWindow, system->getRootFolder()));
|
||||
break;
|
||||
case BASIC:
|
||||
default:
|
||||
view = std::shared_ptr<IGameListView>(new BasicGameListView(mWindow, system->getRootFolder()));
|
||||
|
|
|
@ -61,8 +61,8 @@ public:
|
|||
AUTOMATIC,
|
||||
BASIC,
|
||||
DETAILED,
|
||||
GRID,
|
||||
VIDEO
|
||||
// GRID TODO!
|
||||
};
|
||||
|
||||
struct State
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "views/gamelist/GridGameListView.h"
|
||||
|
||||
#include "views/ViewController.h"
|
||||
#include "SystemData.h"
|
||||
|
||||
GridGameListView::GridGameListView(Window* window, FileData* root) : ISimpleGameListView(window, root),
|
||||
mGrid(window)
|
||||
|
@ -43,11 +44,47 @@ void GridGameListView::populateList(const std::vector<FileData*>& files)
|
|||
}
|
||||
}
|
||||
|
||||
void GridGameListView::addPlaceholder()
|
||||
{
|
||||
// empty grid - add a placeholder
|
||||
FileData* placeholder = new FileData(PLACEHOLDER, "<No Entries Found>", this->mRoot->getSystem()->getSystemEnvData(), this->mRoot->getSystem());
|
||||
mGrid.add(placeholder->getName(), "", placeholder);
|
||||
}
|
||||
|
||||
void GridGameListView::launch(FileData* game)
|
||||
{
|
||||
ViewController::get()->launch(game);
|
||||
}
|
||||
|
||||
void GridGameListView::remove(FileData *game, bool deleteFile)
|
||||
{
|
||||
if (deleteFile)
|
||||
Utils::FileSystem::removeFile(game->getPath()); // actually delete the file on the filesystem
|
||||
FileData* parent = game->getParent();
|
||||
if (getCursor() == game) // Select next element in list, or prev if none
|
||||
{
|
||||
std::vector<FileData*> siblings = parent->getChildrenListToDisplay();
|
||||
auto gameIter = std::find(siblings.cbegin(), siblings.cend(), game);
|
||||
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) {
|
||||
setCursor(siblings.at(gamePos - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
mGrid.remove(game);
|
||||
if(mGrid.size() == 0)
|
||||
{
|
||||
addPlaceholder();
|
||||
}
|
||||
delete game; // remove before repopulating (removes from parent)
|
||||
onFileChanged(parent, FILE_REMOVED); // update the view, with game removed
|
||||
}
|
||||
|
||||
std::vector<HelpPrompt> GridGameListView::getHelpPrompts()
|
||||
{
|
||||
std::vector<HelpPrompt> prompts;
|
||||
|
|
|
@ -24,6 +24,8 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void populateList(const std::vector<FileData*>& files) override;
|
||||
virtual void remove(FileData* game, bool deleteFile) override;
|
||||
virtual void addPlaceholder();
|
||||
|
||||
ImageGridComponent<FileData*> mGrid;
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <pugixml/src/pugixml.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
std::vector<std::string> ThemeData::sSupportedViews { { "system" }, { "basic" }, { "detailed" }, { "video" } };
|
||||
std::vector<std::string> ThemeData::sSupportedViews { { "system" }, { "basic" }, { "detailed" }, { "grid" }, { "video" } };
|
||||
std::vector<std::string> ThemeData::sSupportedFeatures { { "video" }, { "carousel" }, { "z-index" } };
|
||||
|
||||
std::map<std::string, std::map<std::string, ThemeData::ElementPropertyType>> ThemeData::sElementMap {
|
||||
|
|
Loading…
Reference in a new issue