ES-DE/es-app/src/guis/GuiMediaViewerOptions.cpp

117 lines
5.3 KiB
C++
Raw Normal View History

2021-05-16 11:12:31 +00:00
// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// GuiMediaViewerOptions.cpp
//
// User interface for the media viewer options.
// Submenu to the GuiMenu main menu.
//
#include "guis/GuiMediaViewerOptions.h"
#include "Settings.h"
#include "components/OptionListComponent.h"
#include "components/SwitchComponent.h"
2021-05-16 11:12:31 +00:00
GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title)
: GuiSettings {title}
2021-05-16 11:12:31 +00:00
{
// Help prompts.
auto mediaViewerHelpPrompts =
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "HELP PROMPTS", false);
std::string selectedHelpPrompts {Settings::getInstance()->getString("MediaViewerHelpPrompts")};
mediaViewerHelpPrompts->add("TOP", "top", selectedHelpPrompts == "top");
mediaViewerHelpPrompts->add("BOTTOM", "bottom", selectedHelpPrompts == "bottom");
mediaViewerHelpPrompts->add("DISABLED", "disabled", selectedHelpPrompts == "disabled");
// If there are no objects returned, then there must be a manually modified entry in the
// configuration file. Simply set the help prompts to "top" in this case.
if (mediaViewerHelpPrompts->getSelectedObjects().size() == 0)
mediaViewerHelpPrompts->selectEntry(0);
addWithLabel("HELP PROMPTS", mediaViewerHelpPrompts);
addSaveFunc([mediaViewerHelpPrompts, this] {
if (mediaViewerHelpPrompts->getSelected() !=
Settings::getInstance()->getString("MediaViewerHelpPrompts")) {
Settings::getInstance()->setString("MediaViewerHelpPrompts",
mediaViewerHelpPrompts->getSelected());
setNeedsSaving();
}
});
// 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();
}
});
2021-05-16 11:12:31 +00:00
// Keep videos running when viewing images.
2022-09-03 10:44:49 +00:00
auto keepVideoRunning = std::make_shared<SwitchComponent>();
keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"));
addWithLabel("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES", keepVideoRunning);
addSaveFunc([keepVideoRunning, this] {
if (keepVideoRunning->getState() !=
Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) {
2021-05-16 11:12:31 +00:00
Settings::getInstance()->setBool("MediaViewerKeepVideoRunning",
2022-09-03 10:44:49 +00:00
keepVideoRunning->getState());
2021-05-16 11:12:31 +00:00
setNeedsSaving();
}
});
// Stretch videos to screen resolution.
2022-09-03 10:44:49 +00:00
auto stretchVideos = std::make_shared<SwitchComponent>();
stretchVideos->setState(Settings::getInstance()->getBool("MediaViewerStretchVideos"));
addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", stretchVideos);
addSaveFunc([stretchVideos, this] {
if (stretchVideos->getState() !=
Settings::getInstance()->getBool("MediaViewerStretchVideos")) {
2022-09-03 10:44:49 +00:00
Settings::getInstance()->setBool("MediaViewerStretchVideos", stretchVideos->getState());
2021-05-16 11:12:31 +00:00
setNeedsSaving();
}
});
// Render scanlines for videos using a shader.
2022-09-03 10:44:49 +00:00
auto videoScanlines = std::make_shared<SwitchComponent>();
videoScanlines->setState(Settings::getInstance()->getBool("MediaViewerVideoScanlines"));
addWithLabel("RENDER SCANLINES FOR VIDEOS", videoScanlines);
addSaveFunc([videoScanlines, this] {
if (videoScanlines->getState() !=
Settings::getInstance()->getBool("MediaViewerVideoScanlines")) {
2021-05-16 11:12:31 +00:00
Settings::getInstance()->setBool("MediaViewerVideoScanlines",
2022-09-03 10:44:49 +00:00
videoScanlines->getState());
2021-05-16 11:12:31 +00:00
setNeedsSaving();
}
});
// Render blur for videos using a shader.
2022-09-03 10:44:49 +00:00
auto videoBlur = std::make_shared<SwitchComponent>();
videoBlur->setState(Settings::getInstance()->getBool("MediaViewerVideoBlur"));
addWithLabel("RENDER BLUR FOR VIDEOS", videoBlur);
addSaveFunc([videoBlur, this] {
if (videoBlur->getState() != Settings::getInstance()->getBool("MediaViewerVideoBlur")) {
Settings::getInstance()->setBool("MediaViewerVideoBlur", videoBlur->getState());
2021-05-16 11:12:31 +00:00
setNeedsSaving();
}
});
// Render scanlines for screenshots and title screens using a shader.
2022-09-03 10:44:49 +00:00
auto screenshotScanlines = std::make_shared<SwitchComponent>();
screenshotScanlines->setState(
Settings::getInstance()->getBool("MediaViewerScreenshotScanlines"));
2022-09-03 10:44:49 +00:00
addWithLabel("RENDER SCANLINES FOR SCREENSHOTS AND TITLES", screenshotScanlines);
addSaveFunc([screenshotScanlines, this] {
if (screenshotScanlines->getState() !=
Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")) {
2021-05-16 11:12:31 +00:00
Settings::getInstance()->setBool("MediaViewerScreenshotScanlines",
2022-09-03 10:44:49 +00:00
screenshotScanlines->getState());
2021-05-16 11:12:31 +00:00
setNeedsSaving();
}
});
}