mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
Removed the entry counter from the media viewer and added an option for whether to display the media types
This commit is contained in:
parent
cfdfe8c565
commit
1c7a18830e
|
@ -15,6 +15,7 @@
|
|||
MediaViewer::MediaViewer()
|
||||
: mRenderer {Renderer::getInstance()}
|
||||
, mGame {nullptr}
|
||||
, mShowMediaTypes {false}
|
||||
, mFrameHeight {0.0f}
|
||||
, mHelpInfoPosition {HelpInfoPosition::TOP}
|
||||
{
|
||||
|
@ -29,6 +30,8 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
mScreenshotIndex = -1;
|
||||
mTitleScreenIndex = -1;
|
||||
|
||||
mShowMediaTypes = Settings::getInstance()->getBool("MediaViewerShowTypes");
|
||||
|
||||
if (Settings::getInstance()->getString("MediaViewerHelpPrompts") == "disabled")
|
||||
mHelpInfoPosition = HelpInfoPosition::DISABLED;
|
||||
else if (Settings::getInstance()->getString("MediaViewerHelpPrompts") == "bottom")
|
||||
|
@ -57,17 +60,17 @@ bool MediaViewer::startMediaViewer(FileData* game)
|
|||
|
||||
mEntryCount = std::to_string(mImages.size() + (mVideo == nullptr ? 0 : 1));
|
||||
|
||||
mEntryNumText = std::make_unique<TextComponent>(
|
||||
"1/" + mEntryCount + (mHasVideo ? " VIDEO" : mImageFiles[0].second),
|
||||
mMediaType =
|
||||
std::make_unique<TextComponent>((mHasVideo ? "VIDEO" : mImageFiles[0].second),
|
||||
Font::get(FONT_SIZE_MINI, FONT_PATH_REGULAR), 0xAAAAAAFF);
|
||||
mEntryNumText->setOrigin(0.0f, 0.5f);
|
||||
mMediaType->setOrigin(0.0f, 0.5f);
|
||||
|
||||
if (mHelpInfoPosition == HelpInfoPosition::TOP) {
|
||||
mEntryNumText->setPosition(mRenderer->getScreenWidth() * 0.01f, mFrameHeight / 2.0f);
|
||||
mMediaType->setPosition(mRenderer->getScreenWidth() * 0.01f, mFrameHeight / 2.0f);
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f, mFrameHeight / 2.0f};
|
||||
}
|
||||
else if (mHelpInfoPosition == HelpInfoPosition::BOTTOM) {
|
||||
mEntryNumText->setPosition(mRenderer->getScreenWidth() * 0.01f,
|
||||
mMediaType->setPosition(mRenderer->getScreenWidth() * 0.01f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f));
|
||||
style.position = glm::vec2 {mRenderer->getScreenWidth() / 2.0f,
|
||||
mRenderer->getScreenHeight() - (mFrameHeight / 2.0f)};
|
||||
|
@ -171,7 +174,8 @@ void MediaViewer::render(const glm::mat4& /*parentTrans*/)
|
|||
Renderer::getScreenHeight() - mFrameHeight),
|
||||
Renderer::getScreenWidth(), mFrameHeight, 0x222222FF, 0x222222FF);
|
||||
mHelp->render(trans);
|
||||
mEntryNumText->render(trans);
|
||||
if (mShowMediaTypes)
|
||||
mMediaType->render(trans);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,8 +326,7 @@ void MediaViewer::showNext()
|
|||
++mCurrentImageIndex;
|
||||
|
||||
mDisplayingImage = true;
|
||||
mEntryNumText->setText(std::to_string(mCurrentImageIndex + 1 + (mHasVideo ? 1 : 0)) + "/" +
|
||||
mEntryCount + mImageFiles[mCurrentImageIndex].second);
|
||||
mMediaType->setText(mImageFiles[mCurrentImageIndex].second);
|
||||
}
|
||||
|
||||
void MediaViewer::showPrevious()
|
||||
|
@ -336,13 +339,12 @@ void MediaViewer::showPrevious()
|
|||
}
|
||||
else if (mCurrentImageIndex == 0 && mHasVideo) {
|
||||
mDisplayingImage = false;
|
||||
mEntryNumText->setText("1/" + mEntryCount + " VIDEO");
|
||||
mMediaType->setText("VIDEO");
|
||||
playVideo();
|
||||
return;
|
||||
}
|
||||
|
||||
mEntryNumText->setText(std::to_string(mCurrentImageIndex + (mHasVideo ? 1 : 0)) + "/" +
|
||||
mEntryCount + mImageFiles[mCurrentImageIndex - 1].second);
|
||||
mMediaType->setText(mImageFiles[mCurrentImageIndex - 1].second);
|
||||
--mCurrentImageIndex;
|
||||
}
|
||||
|
||||
|
@ -356,8 +358,7 @@ void MediaViewer::showFirst()
|
|||
return;
|
||||
|
||||
mCurrentImageIndex = 0;
|
||||
mEntryNumText->setText("1/" + mEntryCount +
|
||||
(mHasVideo ? " VIDEO" : mImageFiles[mCurrentImageIndex].second));
|
||||
mMediaType->setText((mHasVideo ? "VIDEO" : mImageFiles[mCurrentImageIndex].second));
|
||||
|
||||
if (mHasVideo) {
|
||||
mDisplayingImage = false;
|
||||
|
@ -375,8 +376,7 @@ void MediaViewer::showLast()
|
|||
return;
|
||||
|
||||
mCurrentImageIndex = static_cast<int>(mImages.size()) - 1;
|
||||
mEntryNumText->setText(mEntryCount + "/" + mEntryCount +
|
||||
mImageFiles[mCurrentImageIndex].second);
|
||||
mMediaType->setText(mImageFiles[mCurrentImageIndex].second);
|
||||
mDisplayingImage = true;
|
||||
|
||||
if (mVideo && !Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"))
|
||||
|
|
|
@ -54,6 +54,7 @@ private:
|
|||
bool mHasImages;
|
||||
bool mDisplayingImage;
|
||||
bool mHasManual;
|
||||
bool mShowMediaTypes;
|
||||
|
||||
float mFrameHeight;
|
||||
int mCurrentImageIndex;
|
||||
|
@ -66,7 +67,7 @@ private:
|
|||
std::vector<std::unique_ptr<ImageComponent>> mImages;
|
||||
|
||||
std::unique_ptr<HelpComponent> mHelp;
|
||||
std::unique_ptr<TextComponent> mEntryNumText;
|
||||
std::unique_ptr<TextComponent> mMediaType;
|
||||
std::string mEntryCount;
|
||||
HelpInfoPosition mHelpInfoPosition;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,19 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
|
|||
}
|
||||
});
|
||||
|
||||
// Display media types.
|
||||
auto mediaViewerShowTypes = std::make_shared<SwitchComponent>();
|
||||
mediaViewerShowTypes->setState(Settings::getInstance()->getBool("MediaViewerShowTypes"));
|
||||
addWithLabel("DISPLAY MEDIA TYPES", mediaViewerShowTypes);
|
||||
addSaveFunc([mediaViewerShowTypes, this] {
|
||||
if (mediaViewerShowTypes->getState() !=
|
||||
Settings::getInstance()->getBool("MediaViewerShowTypes")) {
|
||||
Settings::getInstance()->setBool("MediaViewerShowTypes",
|
||||
mediaViewerShowTypes->getState());
|
||||
setNeedsSaving();
|
||||
}
|
||||
});
|
||||
|
||||
// Keep videos running when viewing images.
|
||||
auto keepVideoRunning = std::make_shared<SwitchComponent>();
|
||||
keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"));
|
||||
|
|
|
@ -173,6 +173,7 @@ void Settings::setDefaults()
|
|||
|
||||
// UI settings -> media viewer settings.
|
||||
mStringMap["MediaViewerHelpPrompts"] = {"top", "top"};
|
||||
mBoolMap["MediaViewerShowTypes"] = {false, false};
|
||||
mBoolMap["MediaViewerKeepVideoRunning"] = {true, true};
|
||||
mBoolMap["MediaViewerStretchVideos"] = {false, false};
|
||||
#if defined(RASPBERRY_PI)
|
||||
|
|
Loading…
Reference in a new issue