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.
This commit is contained in:
Leon Styhre 2022-06-03 19:56:30 +02:00
parent 846b0a07ef
commit 94a8ef8791
6 changed files with 35 additions and 43 deletions

View file

@ -318,12 +318,6 @@ const std::string FileData::getTitleScreenPath() const
return getMediafilePath("titlescreens"); 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::string FileData::getVideoPath() const
{ {
const std::vector<std::string> extList {".avi", ".mkv", ".mov", ".mp4", ".wmv"}; const std::vector<std::string> extList {".avi", ".mkv", ".mov", ".mp4", ".wmv"};

View file

@ -80,7 +80,6 @@ public:
const std::string getMiximagePath() const; const std::string getMiximagePath() const;
const std::string getScreenshotPath() const; const std::string getScreenshotPath() const;
const std::string getTitleScreenPath() const; const std::string getTitleScreenPath() const;
const std::string getThumbnailPath() const;
const std::string getVideoPath() const; const std::string getVideoPath() const;
const bool getDeletionFlag() const { return mDeletionFlag; } const bool getDeletionFlag() const { return mDeletionFlag; }

View file

@ -910,11 +910,4 @@ void GamelistBase::removeMedia(FileData* game)
Utils::FileSystem::removeFile(path); Utils::FileSystem::removeFile(path);
removeEmptyDirFunc(systemMediaDir, mediaType, path); removeEmptyDirFunc(systemMediaDir, mediaType, path);
} }
while (Utils::FileSystem::exists(game->getThumbnailPath())) {
mediaType = "thumbnails";
path = game->getThumbnailPath();
Utils::FileSystem::removeFile(path);
removeEmptyDirFunc(systemMediaDir, mediaType, path);
}
} }

View file

@ -36,6 +36,7 @@ void GamelistView::legacyPopulateFields()
mImageComponents.back()->setOrigin(0.5f, 0.0f); mImageComponents.back()->setOrigin(0.5f, 0.0f);
mImageComponents.back()->setPosition(mSize.x / 2.0f, 0.0f); mImageComponents.back()->setPosition(mSize.x / 2.0f, 0.0f);
mImageComponents.back()->setDefaultZIndex(50.0f); mImageComponents.back()->setDefaultZIndex(50.0f);
mImageComponents.back()->setVisible(false);
addChild(mImageComponents.back().get()); addChild(mImageComponents.back().get());
// Background. // Background.
@ -50,6 +51,8 @@ void GamelistView::legacyPopulateFields()
mImageComponents.back()->setOrigin(0.5f, 0.5f); mImageComponents.back()->setOrigin(0.5f, 0.5f);
mImageComponents.back()->setMaxSize(mSize.x * (0.25f - 2.0f * padding), mSize.y * 0.10f); mImageComponents.back()->setMaxSize(mSize.x * (0.25f - 2.0f * padding), mSize.y * 0.10f);
mImageComponents.back()->setDefaultZIndex(25.0f); mImageComponents.back()->setDefaultZIndex(25.0f);
mImageComponents.back()->setScrollFadeIn(true);
mImageComponents.back()->setVisible(false);
addChild(mImageComponents.back().get()); addChild(mImageComponents.back().get());
// Marquee. // Marquee.
@ -57,9 +60,9 @@ void GamelistView::legacyPopulateFields()
mImageComponents.back()->setThemeMetadata("image_md_marquee"); mImageComponents.back()->setThemeMetadata("image_md_marquee");
mImageComponents.back()->setLinearInterpolation(true); mImageComponents.back()->setLinearInterpolation(true);
mImageComponents.back()->setOrigin(0.5f, 0.5f); 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()->setMaxSize(mSize.x * (0.5f - 2.0f * padding), mSize.y * 0.18f);
mImageComponents.back()->setDefaultZIndex(35.0f); mImageComponents.back()->setDefaultZIndex(35.0f);
mImageComponents.back()->setVisible(false);
addChild(mImageComponents.back().get()); addChild(mImageComponents.back().get());
// Image. // Image.
@ -224,6 +227,10 @@ void GamelistView::legacyOnThemeChanged(const std::shared_ptr<ThemeData>& theme)
mImageComponents[LOGO]->applyTheme(theme, getName(), "image_logo", ALL); mImageComponents[LOGO]->applyTheme(theme, getName(), "image_logo", ALL);
mImageComponents[BACKGROUND]->applyTheme(theme, getName(), "image_background", 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. // Remove old theme extras.
for (auto extra : mThemeExtras) { for (auto extra : mThemeExtras) {
removeChild(extra); removeChild(extra);
@ -257,6 +264,10 @@ void GamelistView::legacyOnThemeChanged(const std::shared_ptr<ThemeData>& theme)
mVideoComponents.front()->applyTheme( mVideoComponents.front()->applyTheme(
theme, getName(), mVideoComponents.front()->getThemeMetadata(), theme, getName(), mVideoComponents.front()->getThemeMetadata(),
POSITION | ThemeFlags::SIZE | ThemeFlags::DELAY | Z_INDEX | ROTATION | VISIBLE); 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(); legacyInitMDLabels();
@ -401,8 +412,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
mRandomGame = CollectionSystemsManager::getInstance()->updateCollectionFolderMetadata( mRandomGame = CollectionSystemsManager::getInstance()->updateCollectionFolderMetadata(
file->getSystem()); file->getSystem());
if (mRandomGame) { if (mRandomGame) {
mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage( mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(mRandomGame->getImagePath());
mRandomGame->getThumbnailPath());
mImageComponents[LegacyImage::MD_MARQUEE]->setImage(mRandomGame->getMarqueePath()); mImageComponents[LegacyImage::MD_MARQUEE]->setImage(mRandomGame->getMarqueePath());
if (mViewStyle == ViewController::VIDEO) { if (mViewStyle == ViewController::VIDEO) {
mVideoComponents.front()->setImage(mRandomGame->getImagePath()); mVideoComponents.front()->setImage(mRandomGame->getImagePath());
@ -412,6 +422,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
mVideoComponents.front()->setDefaultVideo(); mVideoComponents.front()->setDefaultVideo();
mVideoComponents.front()->startVideoPlayer(); mVideoComponents.front()->startVideoPlayer();
mImageComponents[LegacyImage::MD_IMAGE]->setImage(mRandomGame->getImagePath());
} }
else { else {
mImageComponents[LegacyImage::MD_IMAGE]->setImage(mRandomGame->getImagePath()); mImageComponents[LegacyImage::MD_IMAGE]->setImage(mRandomGame->getImagePath());
@ -429,7 +440,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
} }
} }
else { else {
mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(file->getThumbnailPath()); mImageComponents[LegacyImage::MD_THUMBNAIL]->setImage(file->getImagePath());
mImageComponents[LegacyImage::MD_MARQUEE]->setImage(file->getMarqueePath()); mImageComponents[LegacyImage::MD_MARQUEE]->setImage(file->getMarqueePath());
if (mViewStyle == ViewController::VIDEO) { if (mViewStyle == ViewController::VIDEO) {
mVideoComponents.front()->setImage(file->getImagePath()); mVideoComponents.front()->setImage(file->getImagePath());
@ -439,6 +450,7 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
mVideoComponents.front()->setDefaultVideo(); mVideoComponents.front()->setDefaultVideo();
mVideoComponents.front()->startVideoPlayer(); mVideoComponents.front()->startVideoPlayer();
mImageComponents[LegacyImage::MD_IMAGE]->setImage(file->getImagePath());
} }
else { else {
mImageComponents[LegacyImage::MD_IMAGE]->setImage(file->getImagePath()); mImageComponents[LegacyImage::MD_IMAGE]->setImage(file->getImagePath());
@ -486,20 +498,35 @@ void GamelistView::legacyUpdateInfoPanel(const CursorState& state)
if (mViewStyle == ViewController::DETAILED) { if (mViewStyle == ViewController::DETAILED) {
// Fade in the game image. // Fade in the game image.
auto func = [this](float t) { auto funcImage = [this](float t) {
mImageComponents[LegacyImage::MD_IMAGE]->setOpacity( mImageComponents[LegacyImage::MD_IMAGE]->setOpacity(
glm::mix(FADE_IN_START_OPACITY, 1.0f, t)); glm::mix(FADE_IN_START_OPACITY, 1.0f, t));
}; };
mImageComponents[LegacyImage::MD_IMAGE]->setAnimation( 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) { else if (mViewStyle == ViewController::VIDEO) {
// Fade in the static image. // 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()->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); 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")); mTextComponents[LegacyText::MD_DESCRIPTION]->setText(file->metadata.get("desc"));

View file

@ -860,13 +860,6 @@ void GamelistView::setGameImage(FileData* file, GuiComponent* comp)
break; 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. // This is needed so the default image is set if no game media was found.
if (path == "" && comp->getThemeImageTypes().size() > 0) if (path == "" && comp->getThemeImageTypes().size() > 0)

View file

@ -807,13 +807,6 @@ void SystemView::updateGameSelectors()
break; 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. // This is needed so the default image is set if no game media was found.
if (path == "" && image->getThemeImageTypes().size() > 0) if (path == "" && image->getThemeImageTypes().size() > 0)
@ -961,13 +954,6 @@ void SystemView::updateGameSelectors()
break; 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. // This is needed so the default image is set if no game media was found.
if (path == "" && video->getThemeImageTypes().size() > 0) if (path == "" && video->getThemeImageTypes().size() > 0)