From 51578903ffc0e8e27caf42f82553f15ecd73e826 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 18 Jan 2022 20:42:50 +0100 Subject: [PATCH] Replaced the legacy gamelist code with rudimentary support for GamelistBase and GamelistView. --- es-app/CMakeLists.txt | 12 --- es-app/src/CollectionSystemsManager.cpp | 10 +-- es-app/src/Screensaver.cpp | 6 +- es-app/src/SystemData.cpp | 4 +- es-app/src/guis/GuiGamelistOptions.cpp | 7 +- es-app/src/guis/GuiGamelistOptions.h | 4 +- es-app/src/guis/GuiMenu.cpp | 1 - es-app/src/guis/GuiSettings.cpp | 4 +- es-app/src/views/GamelistBase.cpp | 53 ++++++------ es-app/src/views/GamelistBase.h | 52 ++++++------ es-app/src/views/GamelistView.cpp | 27 +++++- es-app/src/views/ViewController.cpp | 84 +++++++++---------- es-app/src/views/ViewController.h | 12 +-- .../BasicGamelistView.cpp | 0 .../BasicGamelistView.h | 0 .../DetailedGamelistView.cpp | 0 .../DetailedGamelistView.h | 0 .../GridGamelistView.cpp | 0 .../GridGamelistView.h | 0 .../IGamelistView.cpp | 0 .../IGamelistView.h | 0 .../ISimpleGamelistView.cpp | 0 .../ISimpleGamelistView.h | 0 .../VideoGamelistView.cpp | 0 .../VideoGamelistView.h | 0 25 files changed, 144 insertions(+), 132 deletions(-) rename es-app/src/views/{gamelist => legacygamelists}/BasicGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/BasicGamelistView.h (100%) rename es-app/src/views/{gamelist => legacygamelists}/DetailedGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/DetailedGamelistView.h (100%) rename es-app/src/views/{gamelist => legacygamelists}/GridGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/GridGamelistView.h (100%) rename es-app/src/views/{gamelist => legacygamelists}/IGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/IGamelistView.h (100%) rename es-app/src/views/{gamelist => legacygamelists}/ISimpleGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/ISimpleGamelistView.h (100%) rename es-app/src/views/{gamelist => legacygamelists}/VideoGamelistView.cpp (100%) rename es-app/src/views/{gamelist => legacygamelists}/VideoGamelistView.h (100%) diff --git a/es-app/CMakeLists.txt b/es-app/CMakeLists.txt index a976736d6..9510737e6 100644 --- a/es-app/CMakeLists.txt +++ b/es-app/CMakeLists.txt @@ -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 diff --git a/es-app/src/CollectionSystemsManager.cpp b/es-app/src/CollectionSystemsManager.cpp index 9452f30a1..bf5c71960 100644 --- a/es-app/src/CollectionSystemsManager.cpp +++ b/es-app/src/CollectionSystemsManager.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 #include @@ -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()); diff --git a/es-app/src/Screensaver.cpp b/es-app/src/Screensaver.cpp index 5d444f6eb..2115346f9 100644 --- a/es-app/src/Screensaver.cpp +++ b/es-app/src/Screensaver.cpp @@ -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 #include @@ -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(); diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index 6c4ba35fc..fca19a5b1 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -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 #include @@ -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()); } } diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index 9a1036311..5fb4eb2eb 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -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 GuiGamelistOptions::getHelpPrompts() return prompts; } -IGamelistView* GuiGamelistOptions::getGamelist() +GamelistView* GuiGamelistOptions::getGamelist() { return ViewController::getInstance()->getGamelistView(mSystem).get(); } diff --git a/es-app/src/guis/GuiGamelistOptions.h b/es-app/src/guis/GuiGamelistOptions.h index b08422845..3fb6b167a 100644 --- a/es-app/src/guis/GuiGamelistOptions.h +++ b/es-app/src/guis/GuiGamelistOptions.h @@ -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 mListSort; SystemData* mSystem; - IGamelistView* getGamelist(); + GamelistView* getGamelist(); bool mFoldersOnTop; bool mFavoritesSorting; bool mOnlyHasFolders; diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index b8f8088d4..0884cbd4a 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -35,7 +35,6 @@ #include "guis/GuiTextEditPopup.h" #include "utils/PlatformUtil.h" #include "views/ViewController.h" -#include "views/gamelist/IGamelistView.h" #include #include diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index c689adb16..0a1d3bcd7 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -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()); } } diff --git a/es-app/src/views/GamelistBase.cpp b/es-app/src/views/GamelistBase.cpp index 07ac1a555..59a120b32 100644 --- a/es-app/src/views/GamelistBase.cpp +++ b/es-app/src/views/GamelistBase.cpp @@ -21,6 +21,15 @@ GamelistBase::GamelistBase(Window* window, FileData* root) , mRandomGame {nullptr} , mLastUpdated(nullptr) { + setSize(static_cast(Renderer::getScreenWidth()), + static_cast(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; } diff --git a/es-app/src/views/GamelistBase.h b/es-app/src/views/GamelistBase.h index c48098415..7f0f18981 100644 --- a/es-app/src/views/GamelistBase.h +++ b/es-app/src/views/GamelistBase.h @@ -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& files, FileData* firstEntry); - void addPlaceholder(FileData*); - - void generateFirstLetterIndex(const std::vector& 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& 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& cursorHistory) @@ -73,6 +48,33 @@ protected: mCursorStackHistory = cursorHistory; } + void addPlaceholder(FileData*); + + void remove(FileData* game, bool deleteFile); + void removeMedia(FileData* game); + + const std::vector& 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& files, FileData* firstEntry); + + void generateFirstLetterIndex(const std::vector& 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 mList; diff --git a/es-app/src/views/GamelistView.cpp b/es-app/src/views/GamelistView.cpp index 9b329c173..de7e65d9d 100644 --- a/es-app/src/views/GamelistView.cpp +++ b/es-app/src/views/GamelistView.cpp @@ -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; } diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 92dba451e..47ddabcbc 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -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 ViewController::getGamelistView(SystemData* system) +std::shared_ptr 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 ViewController::getGamelistView(SystemData* syste system->getIndex()->setKidModeFilters(); // If there's no entry, then create it and return it. - std::shared_ptr view; + std::shared_ptr 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 ViewController::getGamelistView(SystemData* syste selectedViewStyle = VIDEO; if (selectedViewStyle == AUTOMATIC) { - std::vector files = system->getRootFolder()->getFilesRecursive(GAME | FOLDER); + std::vector 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 ViewController::getGamelistView(SystemData* syste } // Create the view. - switch (selectedViewStyle) { - case VIDEO: { - view = std::shared_ptr( - new VideoGamelistView(mWindow, system->getRootFolder())); - mState.viewstyle = VIDEO; - break; + /* + switch (selectedViewStyle) { + case VIDEO: { + view = std::shared_ptr( + new VideoGamelistView(mWindow, system->getRootFolder())); + mState.viewstyle = VIDEO; + break; + } + case DETAILED: { + view = std::shared_ptr( + new DetailedGamelistView(mWindow, system->getRootFolder())); + mState.viewstyle = DETAILED; + break; + } + case GRID: { + view = std::shared_ptr( + new GridGamelistView(mWindow, system->getRootFolder())); + mState.viewstyle = GRID; + break; + } + case BASIC: { + } + default: { + view = std::shared_ptr( + new BasicGamelistView(mWindow, system->getRootFolder())); + mState.viewstyle = BASIC; + break; + } } - case DETAILED: { - view = std::shared_ptr( - new DetailedGamelistView(mWindow, system->getRootFolder())); - mState.viewstyle = DETAILED; - break; - } - case GRID: { - view = std::shared_ptr( - new GridGamelistView(mWindow, system->getRootFolder())); - mState.viewstyle = GRID; - break; - } - case BASIC: { - } - default: { - view = std::shared_ptr( - new BasicGamelistView(mWindow, system->getRootFolder())); - mState.viewstyle = BASIC; - break; - } - } + */ + view = std::shared_ptr(new GamelistView(mWindow, system->getRootFolder())); view->setTheme(system->getTheme()); std::vector& sysVec = SystemData::sSystemVector; - int id = static_cast(std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin()); + int id {static_cast(std::find(sysVec.cbegin(), sysVec.cend(), system) - sysVec.cbegin())}; view->setPosition(id * static_cast(Renderer::getScreenWidth()), static_cast(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 cursorHistoryTemp; @@ -987,7 +987,7 @@ void ViewController::reloadGamelistView(IGamelistView* view, bool reloadTheme) if (reloadTheme) system->loadTheme(); system->getIndex()->setKidModeFilters(); - std::shared_ptr newView = getGamelistView(system); + std::shared_ptr newView = getGamelistView(system); // To counter having come from a placeholder. if (!cursor->isPlaceHolder()) { diff --git a/es-app/src/views/ViewController.h b/es-app/src/views/ViewController.h index 63dd9ce8b..c91b8235e 100644 --- a/es-app/src/views/ViewController.h +++ b/es-app/src/views/ViewController.h @@ -21,7 +21,7 @@ #include -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 getHelpPrompts() override; - virtual HelpStyle getHelpStyle() override; + std::vector getHelpPrompts() override; + HelpStyle getHelpStyle() override; - std::shared_ptr getGamelistView(SystemData* system); + std::shared_ptr getGamelistView(SystemData* system); std::shared_ptr getSystemListView(); void removeGamelistView(SystemData* system); @@ -158,7 +158,7 @@ private: std::shared_ptr mCurrentView; std::shared_ptr mPreviousView; std::shared_ptr mSkipView; - std::map> mGamelistViews; + std::map> mGamelistViews; std::shared_ptr mSystemListView; FileData* mGameToLaunch; diff --git a/es-app/src/views/gamelist/BasicGamelistView.cpp b/es-app/src/views/legacygamelists/BasicGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/BasicGamelistView.cpp rename to es-app/src/views/legacygamelists/BasicGamelistView.cpp diff --git a/es-app/src/views/gamelist/BasicGamelistView.h b/es-app/src/views/legacygamelists/BasicGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/BasicGamelistView.h rename to es-app/src/views/legacygamelists/BasicGamelistView.h diff --git a/es-app/src/views/gamelist/DetailedGamelistView.cpp b/es-app/src/views/legacygamelists/DetailedGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/DetailedGamelistView.cpp rename to es-app/src/views/legacygamelists/DetailedGamelistView.cpp diff --git a/es-app/src/views/gamelist/DetailedGamelistView.h b/es-app/src/views/legacygamelists/DetailedGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/DetailedGamelistView.h rename to es-app/src/views/legacygamelists/DetailedGamelistView.h diff --git a/es-app/src/views/gamelist/GridGamelistView.cpp b/es-app/src/views/legacygamelists/GridGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/GridGamelistView.cpp rename to es-app/src/views/legacygamelists/GridGamelistView.cpp diff --git a/es-app/src/views/gamelist/GridGamelistView.h b/es-app/src/views/legacygamelists/GridGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/GridGamelistView.h rename to es-app/src/views/legacygamelists/GridGamelistView.h diff --git a/es-app/src/views/gamelist/IGamelistView.cpp b/es-app/src/views/legacygamelists/IGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/IGamelistView.cpp rename to es-app/src/views/legacygamelists/IGamelistView.cpp diff --git a/es-app/src/views/gamelist/IGamelistView.h b/es-app/src/views/legacygamelists/IGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/IGamelistView.h rename to es-app/src/views/legacygamelists/IGamelistView.h diff --git a/es-app/src/views/gamelist/ISimpleGamelistView.cpp b/es-app/src/views/legacygamelists/ISimpleGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/ISimpleGamelistView.cpp rename to es-app/src/views/legacygamelists/ISimpleGamelistView.cpp diff --git a/es-app/src/views/gamelist/ISimpleGamelistView.h b/es-app/src/views/legacygamelists/ISimpleGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/ISimpleGamelistView.h rename to es-app/src/views/legacygamelists/ISimpleGamelistView.h diff --git a/es-app/src/views/gamelist/VideoGamelistView.cpp b/es-app/src/views/legacygamelists/VideoGamelistView.cpp similarity index 100% rename from es-app/src/views/gamelist/VideoGamelistView.cpp rename to es-app/src/views/legacygamelists/VideoGamelistView.cpp diff --git a/es-app/src/views/gamelist/VideoGamelistView.h b/es-app/src/views/legacygamelists/VideoGamelistView.h similarity index 100% rename from es-app/src/views/gamelist/VideoGamelistView.h rename to es-app/src/views/legacygamelists/VideoGamelistView.h