From 94a8ef879134e7dcccca7d23e05254243f73c85f Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 3 Jun 2022 19:56:30 +0200 Subject: [PATCH] Fixed two issues were thumbnails and game images were not displayed for the Detailed and Video view styles respectively. Also removed support for the thumbnail game media type and fixed an issue where the logo and logotext were displayed at the same time in the gamelist view. --- es-app/src/FileData.cpp | 6 ----- es-app/src/FileData.h | 1 - es-app/src/views/GamelistBase.cpp | 7 ----- es-app/src/views/GamelistLegacy.h | 43 +++++++++++++++++++++++++------ es-app/src/views/GamelistView.cpp | 7 ----- es-app/src/views/SystemView.cpp | 14 ---------- 6 files changed, 35 insertions(+), 43 deletions(-) diff --git a/es-app/src/FileData.cpp b/es-app/src/FileData.cpp index fe091b29b..60ac7affb 100644 --- a/es-app/src/FileData.cpp +++ b/es-app/src/FileData.cpp @@ -318,12 +318,6 @@ const std::string FileData::getTitleScreenPath() const return getMediafilePath("titlescreens"); } -const std::string FileData::getThumbnailPath() const -{ - // Return path to the thumbnail image. - return getMediafilePath("thumbnails"); -} - const std::string FileData::getVideoPath() const { const std::vector extList {".avi", ".mkv", ".mov", ".mp4", ".wmv"}; diff --git a/es-app/src/FileData.h b/es-app/src/FileData.h index b04e3fa9e..85ca7903a 100644 --- a/es-app/src/FileData.h +++ b/es-app/src/FileData.h @@ -80,7 +80,6 @@ public: const std::string getMiximagePath() const; const std::string getScreenshotPath() const; const std::string getTitleScreenPath() const; - const std::string getThumbnailPath() const; const std::string getVideoPath() const; const bool getDeletionFlag() const { return mDeletionFlag; } diff --git a/es-app/src/views/GamelistBase.cpp b/es-app/src/views/GamelistBase.cpp index 4335f3074..b25ca6cd9 100644 --- a/es-app/src/views/GamelistBase.cpp +++ b/es-app/src/views/GamelistBase.cpp @@ -910,11 +910,4 @@ void GamelistBase::removeMedia(FileData* game) Utils::FileSystem::removeFile(path); removeEmptyDirFunc(systemMediaDir, mediaType, path); } - - while (Utils::FileSystem::exists(game->getThumbnailPath())) { - mediaType = "thumbnails"; - path = game->getThumbnailPath(); - Utils::FileSystem::removeFile(path); - removeEmptyDirFunc(systemMediaDir, mediaType, path); - } } diff --git a/es-app/src/views/GamelistLegacy.h b/es-app/src/views/GamelistLegacy.h index edf6b2e48..a948f7366 100644 --- a/es-app/src/views/GamelistLegacy.h +++ b/es-app/src/views/GamelistLegacy.h @@ -36,6 +36,7 @@ void GamelistView::legacyPopulateFields() mImageComponents.back()->setOrigin(0.5f, 0.0f); mImageComponents.back()->setPosition(mSize.x / 2.0f, 0.0f); mImageComponents.back()->setDefaultZIndex(50.0f); + mImageComponents.back()->setVisible(false); addChild(mImageComponents.back().get()); // Background. @@ -50,6 +51,8 @@ void GamelistView::legacyPopulateFields() mImageComponents.back()->setOrigin(0.5f, 0.5f); mImageComponents.back()->setMaxSize(mSize.x * (0.25f - 2.0f * padding), mSize.y * 0.10f); mImageComponents.back()->setDefaultZIndex(25.0f); + mImageComponents.back()->setScrollFadeIn(true); + mImageComponents.back()->setVisible(false); addChild(mImageComponents.back().get()); // Marquee. @@ -57,9 +60,9 @@ void GamelistView::legacyPopulateFields() mImageComponents.back()->setThemeMetadata("image_md_marquee"); mImageComponents.back()->setLinearInterpolation(true); mImageComponents.back()->setOrigin(0.5f, 0.5f); - mImageComponents.back()->setVisible(false); mImageComponents.back()->setMaxSize(mSize.x * (0.5f - 2.0f * padding), mSize.y * 0.18f); mImageComponents.back()->setDefaultZIndex(35.0f); + mImageComponents.back()->setVisible(false); addChild(mImageComponents.back().get()); // Image. @@ -224,6 +227,10 @@ void GamelistView::legacyOnThemeChanged(const std::shared_ptr& theme) mImageComponents[LOGO]->applyTheme(theme, getName(), "image_logo", ALL); mImageComponents[BACKGROUND]->applyTheme(theme, getName(), "image_background", ALL); + // Make sure we don't display both the logo and logo text. + if (mImageComponents[LOGO]->getTexture() != nullptr) + mTextComponents[LOGOTEXT]->setVisible(false); + // Remove old theme extras. for (auto extra : mThemeExtras) { removeChild(extra); @@ -257,6 +264,10 @@ void GamelistView::legacyOnThemeChanged(const std::shared_ptr& theme) mVideoComponents.front()->applyTheme( theme, getName(), mVideoComponents.front()->getThemeMetadata(), POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION | VISIBLE); + mImageComponents[LegacyImage::MD_IMAGE]->setVisible(false); + mImageComponents[LegacyImage::MD_IMAGE]->applyTheme( + theme, getName(), mImageComponents[LegacyImage::MD_IMAGE]->getThemeMetadata(), + POSITION | ThemeFlags::SIZE | Z_INDEX | ROTATION | VISIBLE); } legacyInitMDLabels(); @@ -401,8 +412,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state) mRandomGame = CollectionSystemsManager::getInstance()->updateCollectionFolderMetadata( file->getSystem()); if (mRandomGame) { - mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage( - mRandomGame->getThumbnailPath()); + mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(mRandomGame->getImagePath()); mImageComponents[LegacyImage::MD_MARQUEE]->setImage(mRandomGame->getMarqueePath()); if (mViewStyle == ViewController::VIDEO) { mVideoComponents.front()->setImage(mRandomGame->getImagePath()); @@ -412,6 +422,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state) mVideoComponents.front()->setDefaultVideo(); mVideoComponents.front()->startVideoPlayer(); + mImageComponents[LegacyImage::MD_IMAGE]->setImage(mRandomGame->getImagePath()); } else { mImageComponents[LegacyImage::MD_IMAGE]->setImage(mRandomGame->getImagePath()); @@ -429,7 +440,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state) } } else { - mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(file->getThumbnailPath()); + mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(file->getImagePath()); mImageComponents[LegacyImage::MD_MARQUEE]->setImage(file->getMarqueePath()); if (mViewStyle == ViewController::VIDEO) { mVideoComponents.front()->setImage(file->getImagePath()); @@ -439,6 +450,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state) mVideoComponents.front()->setDefaultVideo(); mVideoComponents.front()->startVideoPlayer(); + mImageComponents[LegacyImage::MD_IMAGE]->setImage(file->getImagePath()); } else { mImageComponents[LegacyImage::MD_IMAGE]->setImage(file->getImagePath()); @@ -486,20 +498,35 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state) if (mViewStyle == ViewController::DETAILED) { // Fade in the game image. - auto func = [this](float t) { + auto funcImage = [this](float t) { mImageComponents[LegacyImage::MD_IMAGE]->setOpacity( glm::mix(FADE_IN_START_OPACITY, 1.0f, t)); }; mImageComponents[LegacyImage::MD_IMAGE]->setAnimation( - new LambdaAnimation(func, FADE_IN_TIME), 0, nullptr, false); + new LambdaAnimation(funcImage, FADE_IN_TIME), 0, nullptr, false); + + // Fade in the thumbnail. + auto funcThumbnail = [this](float t) { + mImageComponents[LegacyImage::MD_THUMBNAIL]->setOpacity( + glm::mix(FADE_IN_START_OPACITY, 1.0f, t)); + }; + mImageComponents[LegacyImage::MD_THUMBNAIL]->setAnimation( + new LambdaAnimation(funcThumbnail, FADE_IN_TIME), 0, nullptr, false); } else if (mViewStyle == ViewController::VIDEO) { // Fade in the static image. - auto func = [this](float t) { + auto funcVideo = [this](float t) { mVideoComponents.front()->setOpacity(glm::mix(FADE_IN_START_OPACITY, 1.0f, t)); }; - mVideoComponents.front()->setAnimation(new LambdaAnimation(func, FADE_IN_TIME), 0, + mVideoComponents.front()->setAnimation(new LambdaAnimation(funcVideo, FADE_IN_TIME), 0, nullptr, false); + // Fade in the game image. + auto funcImage = [this](float t) { + mImageComponents[LegacyImage::MD_IMAGE]->setOpacity( + glm::mix(FADE_IN_START_OPACITY, 1.0f, t)); + }; + mImageComponents[LegacyImage::MD_IMAGE]->setAnimation( + new LambdaAnimation(funcImage, FADE_IN_TIME), 0, nullptr, false); } mTextComponents[LegacyText::MD_DESCRIPTION]->setText(file->metadata.get("desc")); diff --git a/es-app/src/views/GamelistView.cpp b/es-app/src/views/GamelistView.cpp index d3ea5bf3a..6134e6f48 100644 --- a/es-app/src/views/GamelistView.cpp +++ b/es-app/src/views/GamelistView.cpp @@ -860,13 +860,6 @@ void GamelistView::setGameImage(FileData* file, GuiComponent* comp) break; } } - else if (imageType == "thumbnail") { - path = file->getThumbnailPath(); - if (path != "") { - comp->setImage(path); - break; - } - } } // This is needed so the default image is set if no game media was found. if (path == "" && comp->getThemeImageTypes().size() > 0) diff --git a/es-app/src/views/SystemView.cpp b/es-app/src/views/SystemView.cpp index e4b2c1e70..c2a3db8a4 100644 --- a/es-app/src/views/SystemView.cpp +++ b/es-app/src/views/SystemView.cpp @@ -807,13 +807,6 @@ void SystemView::updateGameSelectors() break; } } - else if (imageType == "thumbnail") { - path = games.front()->getThumbnailPath(); - if (path != "") { - image->setImage(path); - break; - } - } } // This is needed so the default image is set if no game media was found. if (path == "" && image->getThemeImageTypes().size() > 0) @@ -961,13 +954,6 @@ void SystemView::updateGameSelectors() break; } } - else if (imageType == "thumbnail") { - path = games.front()->getThumbnailPath(); - if (path != "") { - video->setImage(path); - break; - } - } } // This is needed so the default image is set if no game media was found. if (path == "" && video->getThemeImageTypes().size() > 0)