mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Replaced the legacy gamelist code with rudimentary support for GamelistBase and GamelistView.
This commit is contained in:
parent
dfeddebc66
commit
51578903ff
|
@ -49,12 +49,6 @@ set(ES_HEADERS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/ScreenScraper.h
|
||||
|
||||
# Views
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/VideoGamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/GamelistBase.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/GamelistView.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.h
|
||||
|
@ -101,12 +95,6 @@ set(ES_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/scrapers/ScreenScraper.cpp
|
||||
|
||||
# Views
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/BasicGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/DetailedGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/GridGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/IGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/ISimpleGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/gamelist/VideoGamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/GamelistBase.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/GamelistView.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/views/SystemView.cpp
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "utils/TimeUtil.h"
|
||||
#include "views/GamelistView.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <pugixml.hpp>
|
||||
|
@ -449,9 +449,9 @@ void CollectionSystemsManager::updateCollectionSystem(FileData* file, Collection
|
|||
auto nTime = Utils::Time::now();
|
||||
if (nTime - Utils::Time::stringToTime(file->metadata.get("lastplayed")) < 2) {
|
||||
// Select the first row of the gamelist (the game just played).
|
||||
IGamelistView* gameList = ViewController::getInstance()
|
||||
->getGamelistView(getSystemToView(sysData.system))
|
||||
.get();
|
||||
GamelistView* gameList = ViewController::getInstance()
|
||||
->getGamelistView(getSystemToView(sysData.system))
|
||||
.get();
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
|
@ -1286,7 +1286,7 @@ void CollectionSystemsManager::addEnabledCollectionsToDisplayedSystems(
|
|||
rootFolder->getSortTypeFromString(rootFolder->getSortTypeString()),
|
||||
Settings::getInstance()->getBool("FavFirstCustom"));
|
||||
// Jump to the first row of the game list, assuming it's not empty.
|
||||
IGamelistView* gameList =
|
||||
GamelistView* gameList =
|
||||
ViewController::getInstance()->getGamelistView((it->second.system)).get();
|
||||
if (!gameList->getCursor()->isPlaceHolder()) {
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "resources/Font.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/GamelistView.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
#include <random>
|
||||
#include <time.h>
|
||||
|
@ -211,7 +211,7 @@ void Screensaver::launchGame()
|
|||
// Launching game
|
||||
ViewController::getInstance()->triggerGameLaunch(mCurrentGame);
|
||||
ViewController::getInstance()->goToGamelist(mCurrentGame->getSystem());
|
||||
IGamelistView* view =
|
||||
GamelistView* view =
|
||||
ViewController::getInstance()->getGamelistView(mCurrentGame->getSystem()).get();
|
||||
view->setCursor(mCurrentGame);
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
|
@ -223,7 +223,7 @@ void Screensaver::goToGame()
|
|||
if (mCurrentGame != nullptr) {
|
||||
// Go to the game in the gamelist view, but don't launch it.
|
||||
ViewController::getInstance()->goToGamelist(mCurrentGame->getSystem());
|
||||
IGamelistView* view =
|
||||
GamelistView* view =
|
||||
ViewController::getInstance()->getGamelistView(mCurrentGame->getSystem()).get();
|
||||
view->setCursor(mCurrentGame);
|
||||
ViewController::getInstance()->cancelViewTransitions();
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "resources/ResourceManager.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/GamelistView.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <pugixml.hpp>
|
||||
|
@ -1212,7 +1212,7 @@ void SystemData::sortSystem(bool reloadGamelist, bool jumpToFirstRow)
|
|||
ViewController::getInstance()->reloadGamelistView(this, false);
|
||||
|
||||
if (jumpToFirstRow) {
|
||||
IGamelistView* gameList = ViewController::getInstance()->getGamelistView(this).get();
|
||||
GamelistView* gameList {ViewController::getInstance()->getGamelistView(this).get()};
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "guis/GuiGamelistFilter.h"
|
||||
#include "scrapers/Scraper.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
|
||||
: GuiComponent {window}
|
||||
|
@ -454,7 +453,7 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
if (file->getType() == FOLDER) {
|
||||
mWindow->pushGui(new GuiMetaDataEd(
|
||||
mWindow, &file->metadata, file->metadata.getMDD(FOLDER_METADATA), p,
|
||||
std::bind(&IGamelistView::onFileChanged,
|
||||
std::bind(&GamelistView::onFileChanged,
|
||||
ViewController::getInstance()->getGamelistView(file->getSystem()).get(), file,
|
||||
true),
|
||||
clearGameBtnFunc, deleteGameBtnFunc));
|
||||
|
@ -462,7 +461,7 @@ void GuiGamelistOptions::openMetaDataEd()
|
|||
else {
|
||||
mWindow->pushGui(new GuiMetaDataEd(
|
||||
mWindow, &file->metadata, file->metadata.getMDD(GAME_METADATA), p,
|
||||
std::bind(&IGamelistView::onFileChanged,
|
||||
std::bind(&GamelistView::onFileChanged,
|
||||
ViewController::getInstance()->getGamelistView(file->getSystem()).get(), file,
|
||||
true),
|
||||
clearGameBtnFunc, deleteGameBtnFunc));
|
||||
|
@ -566,7 +565,7 @@ std::vector<HelpPrompt> GuiGamelistOptions::getHelpPrompts()
|
|||
return prompts;
|
||||
}
|
||||
|
||||
IGamelistView* GuiGamelistOptions::getGamelist()
|
||||
GamelistView* GuiGamelistOptions::getGamelist()
|
||||
{
|
||||
return ViewController::getInstance()->getGamelistView(mSystem).get();
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#include "components/MenuComponent.h"
|
||||
#include "components/OptionListComponent.h"
|
||||
#include "utils/StringUtil.h"
|
||||
#include "views/GamelistView.h"
|
||||
|
||||
class IGamelistView;
|
||||
class SystemData;
|
||||
|
||||
class GuiGamelistOptions : public GuiComponent
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
std::shared_ptr<SortList> mListSort;
|
||||
|
||||
SystemData* mSystem;
|
||||
IGamelistView* getGamelist();
|
||||
GamelistView* getGamelist();
|
||||
bool mFoldersOnTop;
|
||||
bool mFavoritesSorting;
|
||||
bool mOnlyHasFolders;
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "utils/PlatformUtil.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
#include <SDL2/SDL_events.h>
|
||||
#include <algorithm>
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
#include "components/HelpComponent.h"
|
||||
#include "guis/GuiTextEditKeyboardPopup.h"
|
||||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "views/GamelistView.h"
|
||||
#include "views/ViewController.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
|
||||
GuiSettings::GuiSettings(Window* window, std::string title)
|
||||
: GuiComponent(window)
|
||||
|
@ -77,7 +77,7 @@ void GuiSettings::save()
|
|||
(*it)->sortSystem(true);
|
||||
|
||||
// Jump to the first row of the gamelist.
|
||||
IGamelistView* gameList = ViewController::getInstance()->getGamelistView((*it)).get();
|
||||
GamelistView* gameList = ViewController::getInstance()->getGamelistView((*it)).get();
|
||||
gameList->setCursor(gameList->getFirstEntry());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,15 @@ GamelistBase::GamelistBase(Window* window, FileData* root)
|
|||
, mRandomGame {nullptr}
|
||||
, mLastUpdated(nullptr)
|
||||
{
|
||||
setSize(static_cast<float>(Renderer::getScreenWidth()),
|
||||
static_cast<float>(Renderer::getScreenHeight()));
|
||||
|
||||
mList.setSize(mSize.x, mSize.y * 0.8f);
|
||||
mList.setPosition(0.0f, mSize.y * 0.2f);
|
||||
mList.setDefaultZIndex(20.0f);
|
||||
addChild(&mList);
|
||||
|
||||
populateList(root->getChildrenListToDisplay(), root);
|
||||
}
|
||||
|
||||
GamelistBase::~GamelistBase()
|
||||
|
@ -381,12 +390,11 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
// was unmarked. We couldn't do this earlier as we didn't have the list
|
||||
// sorted yet.
|
||||
if (removedLastFavorite) {
|
||||
// TEMPORARY
|
||||
// ViewController::getInstance()
|
||||
// ->getGamelistView(entryToUpdate->getSystem())
|
||||
// ->setCursor(ViewController::getInstance()
|
||||
// ->getGamelistView(entryToUpdate->getSystem())
|
||||
// ->getFirstEntry());
|
||||
ViewController::getInstance()
|
||||
->getGamelistView(entryToUpdate->getSystem())
|
||||
->setCursor(ViewController::getInstance()
|
||||
->getGamelistView(entryToUpdate->getSystem())
|
||||
->getFirstEntry());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -400,27 +408,25 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
// As the toggling of the game destroyed this object, we need to get the view
|
||||
// from ViewController instead of using the reference that existed before the
|
||||
// destruction. Otherwise we get random crashes.
|
||||
// TEMPORARY
|
||||
// IGamelistView* view =
|
||||
// ViewController::getInstance()->getGamelistView(system).get();
|
||||
GamelistView* view =
|
||||
ViewController::getInstance()->getGamelistView(system).get();
|
||||
// Jump to the first entry in the gamelist if the last favorite was unmarked.
|
||||
if (foldersOnTop && removedLastFavorite &&
|
||||
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||
// TEMPORARY
|
||||
// ViewController::getInstance()
|
||||
// ->getGamelistView(entryToUpdate->getSystem())
|
||||
// ->setCursor(ViewController::getInstance()
|
||||
// ->getGamelistView(entryToUpdate->getSystem())
|
||||
// ->getFirstGameEntry());
|
||||
ViewController::getInstance()
|
||||
->getGamelistView(entryToUpdate->getSystem())
|
||||
->setCursor(ViewController::getInstance()
|
||||
->getGamelistView(entryToUpdate->getSystem())
|
||||
->getFirstGameEntry());
|
||||
}
|
||||
else if (removedLastFavorite &&
|
||||
!entryToUpdate->getSystem()->isCustomCollection()) {
|
||||
setCursor(getFirstEntry());
|
||||
// view->setCursor(view->getFirstEntry());
|
||||
view->setCursor(view->getFirstEntry());
|
||||
}
|
||||
else if (selectLastEntry) {
|
||||
setCursor(getLastEntry());
|
||||
// view->setCursor(view->getLastEntry());
|
||||
view->setCursor(view->getLastEntry());
|
||||
}
|
||||
// Display the indication icons which show what games are part of the
|
||||
// custom collection currently being edited. This is done cheaply using
|
||||
|
@ -428,10 +434,9 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
if (isEditing) {
|
||||
for (auto it = SystemData::sSystemVector.begin();
|
||||
it != SystemData::sSystemVector.end(); ++it) {
|
||||
// TEMPORARY
|
||||
// ViewController::getInstance()->getGamelistView((*it))->onFileChanged(
|
||||
// ViewController::getInstance()->getGamelistView((*it))->getCursor(),
|
||||
// false);
|
||||
ViewController::getInstance()->getGamelistView((*it))->onFileChanged(
|
||||
ViewController::getInstance()->getGamelistView((*it))->getCursor(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -443,7 +448,6 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
}
|
||||
}
|
||||
|
||||
// return IGamelistView::input(config, input);
|
||||
// Select button opens GuiGamelistOptions.
|
||||
if (!UIModeController::getInstance()->isUIModeKid() && // Line break.
|
||||
config->isMappedTo("back", input) && input.value) {
|
||||
|
@ -458,9 +462,8 @@ bool GamelistBase::input(InputConfig* config, Input input)
|
|||
config->getDeviceId() == DEVICE_KEYBOARD &&
|
||||
(SDL_GetModState() & (KMOD_LCTRL | KMOD_RCTRL)) && input.id == SDLK_r &&
|
||||
input.value != 0) {
|
||||
LOG(LogDebug) << "IGamelistView::input(): Reloading view";
|
||||
// TEMPORARY
|
||||
// ViewController::getInstance()->reloadGamelistView(this, true);
|
||||
LOG(LogDebug) << "GamelistView::input(): Reloading view";
|
||||
ViewController::getInstance()->reloadGamelistView(this->mRoot->getSystem(), true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,31 +37,6 @@ public:
|
|||
FileData* getLastEntry() { return mList.getLast(); }
|
||||
FileData* getFirstGameEntry() { return mFirstGameEntry; }
|
||||
|
||||
protected:
|
||||
GamelistBase(Window* window, FileData* root);
|
||||
~GamelistBase();
|
||||
|
||||
// Called when a FileData* is added, has its metadata changed, or is removed.
|
||||
virtual void onFileChanged(FileData* file, bool reloadGamelist) = 0;
|
||||
|
||||
void populateList(const std::vector<FileData*>& files, FileData* firstEntry);
|
||||
void addPlaceholder(FileData*);
|
||||
|
||||
void generateFirstLetterIndex(const std::vector<FileData*>& files);
|
||||
void generateGamelistInfo(FileData* cursor, FileData* firstEntry);
|
||||
|
||||
void remove(FileData* game, bool deleteFile);
|
||||
void removeMedia(FileData* game);
|
||||
|
||||
virtual void launch(FileData* game) = 0;
|
||||
|
||||
bool isListScrolling() override { return mList.isScrolling(); }
|
||||
void stopListScrolling() override { mList.stopScrolling(); }
|
||||
|
||||
const std::vector<std::string>& getFirstLetterIndex() { return mFirstLetterIndex; }
|
||||
std::string getQuickSystemSelectRightButton() { return "right"; }
|
||||
std::string getQuickSystemSelectLeftButton() { return "left"; }
|
||||
|
||||
// These functions are used to retain the folder cursor history, for instance
|
||||
// during a view reload. The calling function stores the history temporarily.
|
||||
void copyCursorHistory(std::vector<FileData*>& cursorHistory)
|
||||
|
@ -73,6 +48,33 @@ protected:
|
|||
mCursorStackHistory = cursorHistory;
|
||||
}
|
||||
|
||||
void addPlaceholder(FileData*);
|
||||
|
||||
void remove(FileData* game, bool deleteFile);
|
||||
void removeMedia(FileData* game);
|
||||
|
||||
const std::vector<std::string>& getFirstLetterIndex() { return mFirstLetterIndex; }
|
||||
|
||||
protected:
|
||||
GamelistBase(Window* window, FileData* root);
|
||||
~GamelistBase();
|
||||
|
||||
// Called when a FileData* is added, has its metadata changed, or is removed.
|
||||
virtual void onFileChanged(FileData* file, bool reloadGamelist) = 0;
|
||||
|
||||
void populateList(const std::vector<FileData*>& files, FileData* firstEntry);
|
||||
|
||||
void generateFirstLetterIndex(const std::vector<FileData*>& files);
|
||||
void generateGamelistInfo(FileData* cursor, FileData* firstEntry);
|
||||
|
||||
virtual void launch(FileData* game) = 0;
|
||||
|
||||
bool isListScrolling() override { return mList.isScrolling(); }
|
||||
void stopListScrolling() override { mList.stopScrolling(); }
|
||||
|
||||
std::string getQuickSystemSelectRightButton() { return "right"; }
|
||||
std::string getQuickSystemSelectLeftButton() { return "left"; }
|
||||
|
||||
FileData* mRoot;
|
||||
TextListComponent<FileData*> mList;
|
||||
|
||||
|
|
|
@ -45,20 +45,41 @@ GamelistView::GamelistView(Window* window, FileData* root)
|
|||
, mDescription {window}
|
||||
, mGamelistInfo {window}
|
||||
{
|
||||
mHeaderText.setText("Logo Text", false);
|
||||
mHeaderText.setSize(mSize.x, 0.0f);
|
||||
mHeaderText.setPosition(0.0f, 0.0f);
|
||||
mHeaderText.setHorizontalAlignment(ALIGN_CENTER);
|
||||
mHeaderText.setDefaultZIndex(50.0f);
|
||||
|
||||
mHeaderText.setText(mRoot->getSystem()->getFullName());
|
||||
|
||||
mHeaderImage.setResize(0.0f, mSize.y * 0.185f);
|
||||
mHeaderImage.setOrigin(0.5f, 0.0f);
|
||||
mHeaderImage.setPosition(mSize.x / 2.0f, 0.0f);
|
||||
mHeaderImage.setDefaultZIndex(50.0f);
|
||||
|
||||
mBackground.setResize(mSize.x, mSize.y);
|
||||
mBackground.setDefaultZIndex(0.0f);
|
||||
|
||||
addChild(&mHeaderText);
|
||||
addChild(&mBackground);
|
||||
}
|
||||
|
||||
GamelistView::~GamelistView()
|
||||
{
|
||||
//
|
||||
// Remove theme extras.
|
||||
for (auto extra : mThemeExtras) {
|
||||
removeChild(extra);
|
||||
delete extra;
|
||||
}
|
||||
mThemeExtras.clear();
|
||||
}
|
||||
|
||||
void GamelistView::onFileChanged(FileData* file, bool reloadGamelist)
|
||||
{
|
||||
if (reloadGamelist) {
|
||||
// Might switch to a detailed view.
|
||||
// TEMPORARY.
|
||||
// ViewController::getInstance()->reloadGamelistView(this);
|
||||
ViewController::getInstance()->reloadGamelistView(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
#include "guis/GuiMenu.h"
|
||||
#include "guis/GuiTextEditKeyboardPopup.h"
|
||||
#include "guis/GuiTextEditPopup.h"
|
||||
#include "views/GamelistView.h"
|
||||
#include "views/SystemView.h"
|
||||
#include "views/gamelist/DetailedGamelistView.h"
|
||||
#include "views/gamelist/GridGamelistView.h"
|
||||
#include "views/gamelist/IGamelistView.h"
|
||||
#include "views/gamelist/VideoGamelistView.h"
|
||||
|
||||
ViewController* ViewController::getInstance()
|
||||
{
|
||||
|
@ -718,7 +715,7 @@ void ViewController::removeGamelistView(SystemData* system)
|
|||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<IGamelistView> ViewController::getGamelistView(SystemData* system)
|
||||
std::shared_ptr<GamelistView> ViewController::getGamelistView(SystemData* system)
|
||||
{
|
||||
// If we have already created an entry for this system, then return that one.
|
||||
auto exists = mGamelistViews.find(system);
|
||||
|
@ -727,14 +724,14 @@ std::shared_ptr<IGamelistView> ViewController::getGamelistView(SystemData* syste
|
|||
|
||||
system->getIndex()->setKidModeFilters();
|
||||
// If there's no entry, then create it and return it.
|
||||
std::shared_ptr<IGamelistView> view;
|
||||
std::shared_ptr<GamelistView> view;
|
||||
|
||||
bool themeHasVideoView = system->getTheme()->hasView("video");
|
||||
bool themeHasVideoView {system->getTheme()->hasView("video")};
|
||||
|
||||
// Decide which view style to use.
|
||||
GamelistViewStyle selectedViewStyle = AUTOMATIC;
|
||||
|
||||
std::string viewPreference = Settings::getInstance()->getString("GamelistViewStyle");
|
||||
std::string viewPreference {Settings::getInstance()->getString("GamelistViewStyle")};
|
||||
if (viewPreference.compare("basic") == 0)
|
||||
selectedViewStyle = BASIC;
|
||||
if (viewPreference.compare("detailed") == 0)
|
||||
|
@ -745,7 +742,7 @@ std::shared_ptr<IGamelistView> ViewController::getGamelistView(SystemData* syste
|
|||
selectedViewStyle = VIDEO;
|
||||
|
||||
if (selectedViewStyle == AUTOMATIC) {
|
||||
std::vector<FileData*> files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER);
|
||||
std::vector<FileData*> files {system->getRootFolder()->getFilesRecursive(GAME | FOLDER)};
|
||||
for (auto it = files.cbegin(); it != files.cend(); ++it) {
|
||||
if (themeHasVideoView && !(*it)->getVideoPath().empty()) {
|
||||
selectedViewStyle = VIDEO;
|
||||
|
@ -759,39 +756,42 @@ std::shared_ptr<IGamelistView> ViewController::getGamelistView(SystemData* syste
|
|||
}
|
||||
|
||||
// Create the view.
|
||||
switch (selectedViewStyle) {
|
||||
case VIDEO: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new VideoGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = VIDEO;
|
||||
break;
|
||||
/*
|
||||
switch (selectedViewStyle) {
|
||||
case VIDEO: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new VideoGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = VIDEO;
|
||||
break;
|
||||
}
|
||||
case DETAILED: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new DetailedGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = DETAILED;
|
||||
break;
|
||||
}
|
||||
case GRID: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new GridGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = GRID;
|
||||
break;
|
||||
}
|
||||
case BASIC: {
|
||||
}
|
||||
default: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new BasicGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = BASIC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case DETAILED: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new DetailedGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = DETAILED;
|
||||
break;
|
||||
}
|
||||
case GRID: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new GridGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = GRID;
|
||||
break;
|
||||
}
|
||||
case BASIC: {
|
||||
}
|
||||
default: {
|
||||
view = std::shared_ptr<IGamelistView>(
|
||||
new BasicGamelistView(mWindow, system->getRootFolder()));
|
||||
mState.viewstyle = BASIC;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
view = std::shared_ptr<GamelistView>(new GamelistView(mWindow, system->getRootFolder()));
|
||||
|
||||
view->setTheme(system->getTheme());
|
||||
|
||||
std::vector<SystemData*>& sysVec = SystemData::sSystemVector;
|
||||
int id = static_cast<int>(std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin());
|
||||
int id {static_cast<int>(std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin())};
|
||||
view->setPosition(id * static_cast<float>(Renderer::getScreenWidth()),
|
||||
static_cast<float>(Renderer::getScreenHeight() * 2));
|
||||
|
||||
|
@ -967,13 +967,13 @@ void ViewController::preload()
|
|||
NavigationSounds::getInstance().loadThemeNavigationSounds(nullptr);
|
||||
}
|
||||
|
||||
void ViewController::reloadGamelistView(IGamelistView* view, bool reloadTheme)
|
||||
void ViewController::reloadGamelistView(GamelistView* view, bool reloadTheme)
|
||||
{
|
||||
for (auto it = mGamelistViews.cbegin(); it != mGamelistViews.cend(); ++it) {
|
||||
if (it->second.get() == view) {
|
||||
bool isCurrent = (mCurrentView == it->second);
|
||||
SystemData* system = it->first;
|
||||
FileData* cursor = view->getCursor();
|
||||
bool isCurrent {(mCurrentView == it->second)};
|
||||
SystemData* system {it->first};
|
||||
FileData* cursor {view->getCursor()};
|
||||
|
||||
// Retain the cursor history for the view.
|
||||
std::vector<FileData*> cursorHistoryTemp;
|
||||
|
@ -987,7 +987,7 @@ void ViewController::reloadGamelistView(IGamelistView* view, bool reloadTheme)
|
|||
if (reloadTheme)
|
||||
system->loadTheme();
|
||||
system->getIndex()->setKidModeFilters();
|
||||
std::shared_ptr<IGamelistView> newView = getGamelistView(system);
|
||||
std::shared_ptr<GamelistView> newView = getGamelistView(system);
|
||||
|
||||
// To counter having come from a placeholder.
|
||||
if (!cursor->isPlaceHolder()) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
class IGamelistView;
|
||||
class GamelistView;
|
||||
class SystemData;
|
||||
class SystemView;
|
||||
|
||||
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
// If a basic view detected a metadata change, it can request to recreate
|
||||
// the current gamelist view (as it may change to be detailed).
|
||||
void reloadGamelistView(IGamelistView* gamelist, bool reloadTheme = false);
|
||||
void reloadGamelistView(GamelistView* gamelist, bool reloadTheme = false);
|
||||
void reloadGamelistView(SystemData* system, bool reloadTheme = false)
|
||||
{
|
||||
reloadGamelistView(getGamelistView(system).get(), reloadTheme);
|
||||
|
@ -110,10 +110,10 @@ public:
|
|||
|
||||
const State& getState() const { return mState; }
|
||||
|
||||
virtual std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
virtual HelpStyle getHelpStyle() override;
|
||||
std::vector<HelpPrompt> getHelpPrompts() override;
|
||||
HelpStyle getHelpStyle() override;
|
||||
|
||||
std::shared_ptr<IGamelistView> getGamelistView(SystemData* system);
|
||||
std::shared_ptr<GamelistView> getGamelistView(SystemData* system);
|
||||
std::shared_ptr<SystemView> getSystemListView();
|
||||
void removeGamelistView(SystemData* system);
|
||||
|
||||
|
@ -158,7 +158,7 @@ private:
|
|||
std::shared_ptr<GuiComponent> mCurrentView;
|
||||
std::shared_ptr<GuiComponent> mPreviousView;
|
||||
std::shared_ptr<GuiComponent> mSkipView;
|
||||
std::map<SystemData*, std::shared_ptr<IGamelistView>> mGamelistViews;
|
||||
std::map<SystemData*, std::shared_ptr<GamelistView>> mGamelistViews;
|
||||
std::shared_ptr<SystemView> mSystemListView;
|
||||
|
||||
FileData* mGameToLaunch;
|
||||
|
|
Loading…
Reference in a new issue