From c114ef05ac2a992d1b6071789df7efbdf9a1747d Mon Sep 17 00:00:00 2001 From: John Rassa Date: Fri, 28 Feb 2020 21:19:52 -0500 Subject: [PATCH] Grid View Fixes Fix for metadata disappearing when selecting system for the first time. Fix for video not resuming after launching game. --- es-app/src/views/ViewController.cpp | 6 ++++++ .../src/views/gamelist/GridGameListView.cpp | 20 +++++++++++++++++++ es-app/src/views/gamelist/GridGameListView.h | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/es-app/src/views/ViewController.cpp b/es-app/src/views/ViewController.cpp index 3489628f6..fd195adac 100644 --- a/es-app/src/views/ViewController.cpp +++ b/es-app/src/views/ViewController.cpp @@ -235,6 +235,8 @@ void ViewController::launch(FileData* game, Vector3f center) game->launchGame(mWindow); setAnimation(new LambdaAnimation(fadeFunc, 800), 0, [this] { mLockInput = false; }, true); this->onFileChanged(game, FILE_METADATA_CHANGED); + if (mCurrentView) + mCurrentView->onShow(); }); } else if (transition_style == "slide"){ // move camera to zoom in on center + fade out, launch game, come back in @@ -244,6 +246,8 @@ void ViewController::launch(FileData* game, Vector3f center) mCamera = origCamera; setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 600), 0, [this] { mLockInput = false; }, true); this->onFileChanged(game, FILE_METADATA_CHANGED); + if (mCurrentView) + mCurrentView->onShow(); }); } else { // instant setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, [this, origCamera, center, game] @@ -252,6 +256,8 @@ void ViewController::launch(FileData* game, Vector3f center) mCamera = origCamera; setAnimation(new LaunchAnimation(mCamera, mFadeOpacity, center, 10), 0, [this] { mLockInput = false; }, true); this->onFileChanged(game, FILE_METADATA_CHANGED); + if (mCurrentView) + mCurrentView->onShow(); }); } } diff --git a/es-app/src/views/gamelist/GridGameListView.cpp b/es-app/src/views/gamelist/GridGameListView.cpp index fa9d63228..a95033d89 100644 --- a/es-app/src/views/gamelist/GridGameListView.cpp +++ b/es-app/src/views/gamelist/GridGameListView.cpp @@ -115,6 +115,11 @@ GridGameListView::GridGameListView(Window* window, FileData* root) : updateInfoPanel(); } +GridGameListView::~GridGameListView() +{ + delete mVideo; +} + FileData* GridGameListView::getCursor() { return mGrid.getSelected(); @@ -219,7 +224,10 @@ void GridGameListView::onThemeChanged(const std::shared_ptr& theme) mDescription.setSize(mDescContainer.getSize().x(), 0); mDescription.applyTheme(theme, getName(), "md_description", ALL ^ (POSITION | ThemeFlags::SIZE | ThemeFlags::ORIGIN | TEXT | ROTATION)); + // Repopulate list in case new theme is displaying a different image. Preserve selection. + FileData* file = mGrid.getSelected(); populateList(mRoot->getChildrenListToDisplay()); + mGrid.setCursor(file); sortChildren(); } @@ -474,3 +482,15 @@ std::vector GridGameListView::getHelpPrompts() } return prompts; } + +void GridGameListView::update(int deltaTime) +{ + ISimpleGameListView::update(deltaTime); + mVideo->update(deltaTime); +} + +void GridGameListView::onShow() +{ + GuiComponent::onShow(); + updateInfoPanel(); +} diff --git a/es-app/src/views/gamelist/GridGameListView.h b/es-app/src/views/gamelist/GridGameListView.h index f6367a11d..6f5798fef 100644 --- a/es-app/src/views/gamelist/GridGameListView.h +++ b/es-app/src/views/gamelist/GridGameListView.h @@ -13,6 +13,9 @@ class GridGameListView : public ISimpleGameListView { public: GridGameListView(Window* window, FileData* root); + virtual ~GridGameListView(); + + virtual void onShow() override; virtual void onThemeChanged(const std::shared_ptr& theme) override; @@ -27,6 +30,7 @@ public: virtual void launch(FileData* game) override; protected: + virtual void update(int deltaTime) override; virtual std::string getQuickSystemSelectRightButton() override; virtual std::string getQuickSystemSelectLeftButton() override; virtual void populateList(const std::vector& files) override;