Added media type information to the media viewer help prompts

This commit is contained in:
Leon Styhre 2023-06-30 21:56:23 +02:00
parent 51241c8b94
commit 61b6fe2b33
2 changed files with 18 additions and 15 deletions

View file

@ -57,7 +57,8 @@ bool MediaViewer::startMediaViewer(FileData* game)
mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1)); mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1));
mEntryNumText = std::make_unique<TextComponent>( mEntryNumText = std::make_unique<TextComponent>(
"1/" + mEntryCount, Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF); "1/" + mEntryCount + (mHasVideo ? " VIDEO" : mImageFiles[0].second),
Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
mEntryNumText->setOrigin(0.0f, 0.5f); mEntryNumText->setOrigin(0.0f, 0.5f);
if (mHelpInfoPosition == HelpInfoPosition::TOP) { if (mHelpInfoPosition == HelpInfoPosition::TOP) {
@ -210,31 +211,31 @@ void MediaViewer::findMedia()
} }
if (!mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") { if (!mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " SCREENSHOT"));
mScreenshotIndex = 0; mScreenshotIndex = 0;
} }
if ((mediaFile = mGame->getCoverPath()) != "") if ((mediaFile = mGame->getCoverPath()) != "")
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " BOX COVER"));
if ((mediaFile = mGame->getBackCoverPath()) != "") if ((mediaFile = mGame->getBackCoverPath()) != "")
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " BOX BACK COVER"));
if ((mediaFile = mGame->getTitleScreenPath()) != "") { if ((mediaFile = mGame->getTitleScreenPath()) != "") {
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " TITLE SCREEN"));
mTitleScreenIndex = static_cast<int>(mImageFiles.size() - 1); mTitleScreenIndex = static_cast<int>(mImageFiles.size() - 1);
} }
if (mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") { if (mHasVideo && (mediaFile = mGame->getScreenshotPath()) != "") {
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " SCREENSHOT"));
mScreenshotIndex = static_cast<int>(mImageFiles.size() - 1); mScreenshotIndex = static_cast<int>(mImageFiles.size() - 1);
} }
if ((mediaFile = mGame->getFanArtPath()) != "") if ((mediaFile = mGame->getFanArtPath()) != "")
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " FAN ART"));
if ((mediaFile = mGame->getMiximagePath()) != "") if ((mediaFile = mGame->getMiximagePath()) != "")
mImageFiles.push_back(mediaFile); mImageFiles.push_back(std::make_pair(mediaFile, " MIXIMAGE"));
if (!mImageFiles.empty()) if (!mImageFiles.empty())
mHasImages = true; mHasImages = true;
@ -261,7 +262,7 @@ void MediaViewer::loadImages()
} }
mImages.back()->setMaxSize(Renderer::getScreenWidth(), mImages.back()->setMaxSize(Renderer::getScreenWidth(),
Renderer::getScreenHeight() - mFrameHeight); Renderer::getScreenHeight() - mFrameHeight);
mImages.back()->setImage(file); mImages.back()->setImage(file.first);
} }
} }
@ -321,7 +322,7 @@ void MediaViewer::showNext()
mDisplayingImage = true; mDisplayingImage = true;
mEntryNumText->setText(std::to_string(mCurrentImageIndex + 1 + (mHasVideo ? 1 : 0)) + "/" + mEntryNumText->setText(std::to_string(mCurrentImageIndex + 1 + (mHasVideo ? 1 : 0)) + "/" +
mEntryCount); mEntryCount + mImageFiles[mCurrentImageIndex].second);
} }
void MediaViewer::showPrevious() void MediaViewer::showPrevious()
@ -334,13 +335,13 @@ void MediaViewer::showPrevious()
} }
else if (mCurrentImageIndex == 0 && mHasVideo) { else if (mCurrentImageIndex == 0 && mHasVideo) {
mDisplayingImage = false; mDisplayingImage = false;
mEntryNumText->setText("1/" + mEntryCount); mEntryNumText->setText("1/" + mEntryCount + " VIDEO");
playVideo(); playVideo();
return; return;
} }
mEntryNumText->setText(std::to_string(mCurrentImageIndex + (mHasVideo ? 1 : 0)) + "/" + mEntryNumText->setText(std::to_string(mCurrentImageIndex + (mHasVideo ? 1 : 0)) + "/" +
mEntryCount); mEntryCount + mImageFiles[mCurrentImageIndex - 1].second);
--mCurrentImageIndex; --mCurrentImageIndex;
} }
@ -354,7 +355,8 @@ void MediaViewer::showFirst()
return; return;
mCurrentImageIndex = 0; mCurrentImageIndex = 0;
mEntryNumText->setText("1/" + mEntryCount); mEntryNumText->setText("1/" + mEntryCount +
(mHasVideo ? " VIDEO" : mImageFiles[mCurrentImageIndex].second));
if (mHasVideo) { if (mHasVideo) {
mDisplayingImage = false; mDisplayingImage = false;
@ -372,7 +374,8 @@ void MediaViewer::showLast()
return; return;
mCurrentImageIndex = static_cast<int>(mImages.size()) - 1; mCurrentImageIndex = static_cast<int>(mImages.size()) - 1;
mEntryNumText->setText(mEntryCount + "/" + mEntryCount); mEntryNumText->setText(mEntryCount + "/" + mEntryCount +
mImageFiles[mCurrentImageIndex].second);
mDisplayingImage = true; mDisplayingImage = true;
if (mVideo && !Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) if (mVideo && !Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"))

View file

@ -62,7 +62,7 @@ private:
std::string mVideoFile; std::string mVideoFile;
std::unique_ptr<VideoComponent> mVideo; std::unique_ptr<VideoComponent> mVideo;
std::vector<std::string> mImageFiles; std::vector<std::pair<std::string, std::string>> mImageFiles;
std::vector<std::unique_ptr<ImageComponent>> mImages; std::vector<std::unique_ptr<ImageComponent>> mImages;
std::unique_ptr<HelpComponent> mHelp; std::unique_ptr<HelpComponent> mHelp;