Reorganized the UI Settings and Other Settings menus a bit.

This commit is contained in:
Leon Styhre 2021-08-22 14:29:43 +02:00
parent 5580de74b1
commit a0c2c21a99
2 changed files with 76 additions and 71 deletions

View file

@ -86,7 +86,11 @@ GuiMenu::~GuiMenu()
ViewController::get()->stopScrolling();
}
void GuiMenu::openScraperOptions() { mWindow->pushGui(new GuiScraperMenu(mWindow, "SCRAPER")); }
void GuiMenu::openScraperOptions()
{
// Open the scraper menu.
mWindow->pushGui(new GuiScraperMenu(mWindow, "SCRAPER"));
}
void GuiMenu::openUIOptions()
{
@ -372,6 +376,28 @@ void GuiMenu::openUIOptions()
}
});
// Media viewer.
ComponentListRow media_viewer_row;
media_viewer_row.elements.clear();
media_viewer_row.addElement(std::make_shared<TextComponent>(mWindow, "MEDIA VIEWER SETTINGS",
Font::get(FONT_SIZE_MEDIUM),
0x777777FF),
true);
media_viewer_row.addElement(makeArrow(mWindow), false);
media_viewer_row.makeAcceptInputHandler(std::bind(&GuiMenu::openMediaViewerOptions, this));
s->addRow(media_viewer_row);
// Screensaver.
ComponentListRow screensaver_row;
screensaver_row.elements.clear();
screensaver_row.addElement(std::make_shared<TextComponent>(mWindow, "SCREENSAVER SETTINGS",
Font::get(FONT_SIZE_MEDIUM),
0x777777FF),
true);
screensaver_row.addElement(makeArrow(mWindow), false);
screensaver_row.makeAcceptInputHandler(std::bind(&GuiMenu::openScreensaverOptions, this));
s->addRow(screensaver_row);
#if defined(USE_OPENGL_21)
// Blur background when the menu is open.
auto menu_blur_background = std::make_shared<SwitchComponent>(mWindow);
@ -554,28 +580,6 @@ void GuiMenu::openUIOptions()
}
});
// Media viewer.
ComponentListRow media_viewer_row;
media_viewer_row.elements.clear();
media_viewer_row.addElement(std::make_shared<TextComponent>(mWindow, "MEDIA VIEWER SETTINGS",
Font::get(FONT_SIZE_MEDIUM),
0x777777FF),
true);
media_viewer_row.addElement(makeArrow(mWindow), false);
media_viewer_row.makeAcceptInputHandler(std::bind(&GuiMenu::openMediaViewerOptions, this));
s->addRow(media_viewer_row);
// Screensaver.
ComponentListRow screensaver_row;
screensaver_row.elements.clear();
screensaver_row.addElement(std::make_shared<TextComponent>(mWindow, "SCREENSAVER SETTINGS",
Font::get(FONT_SIZE_MEDIUM),
0x777777FF),
true);
screensaver_row.addElement(makeArrow(mWindow), false);
screensaver_row.makeAcceptInputHandler(std::bind(&GuiMenu::openScreensaverOptions, this));
s->addRow(screensaver_row);
mWindow->pushGui(s);
}
@ -768,6 +772,37 @@ void GuiMenu::openOtherOptions()
{
auto s = new GuiSettings(mWindow, "OTHER SETTINGS");
// Game media directory.
ComponentListRow rowMediaDir;
auto media_directory = std::make_shared<TextComponent>(mWindow, "GAME MEDIA DIRECTORY",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketMediaDirectory = std::make_shared<ImageComponent>(mWindow);
bracketMediaDirectory->setImage(":/graphics/arrow.svg");
bracketMediaDirectory->setResize(
glm::vec2{0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
rowMediaDir.addElement(media_directory, true);
rowMediaDir.addElement(bracketMediaDirectory, false);
std::string titleMediaDir = "ENTER GAME MEDIA DIRECTORY";
std::string mediaDirectoryStaticText = "Default directory:";
std::string defaultDirectoryText = "~/.emulationstation/downloaded_media/";
std::string initValueMediaDir = Settings::getInstance()->getString("MediaDirectory");
bool multiLineMediaDir = false;
auto updateValMediaDir = [this](const std::string& newVal) {
Settings::getInstance()->setString("MediaDirectory", newVal);
Settings::getInstance()->saveFile();
ViewController::get()->reloadAll();
mWindow->invalidateCachedBackground();
};
rowMediaDir.makeAcceptInputHandler([this, titleMediaDir, mediaDirectoryStaticText,
defaultDirectoryText, initValueMediaDir, updateValMediaDir,
multiLineMediaDir] {
mWindow->pushGui(new GuiComplexTextEditPopup(
mWindow, getHelpStyle(), titleMediaDir, mediaDirectoryStaticText, defaultDirectoryText,
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
multiLineMediaDir, "SAVE", "SAVE CHANGES?"));
});
s->addRow(rowMediaDir);
// Maximum VRAM.
auto max_vram = std::make_shared<SliderComponent>(mWindow, 80.f, 1024.f, 8.f, "MiB");
max_vram->setValue(static_cast<float>(Settings::getInstance()->getInt("MaxVRAM")));
@ -891,37 +926,6 @@ void GuiMenu::openOtherOptions()
}
});
// Game media directory.
ComponentListRow rowMediaDir;
auto media_directory = std::make_shared<TextComponent>(mWindow, "GAME MEDIA DIRECTORY",
Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
auto bracketMediaDirectory = std::make_shared<ImageComponent>(mWindow);
bracketMediaDirectory->setImage(":/graphics/arrow.svg");
bracketMediaDirectory->setResize(
glm::vec2{0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()});
rowMediaDir.addElement(media_directory, true);
rowMediaDir.addElement(bracketMediaDirectory, false);
std::string titleMediaDir = "ENTER GAME MEDIA DIRECTORY";
std::string mediaDirectoryStaticText = "Default directory:";
std::string defaultDirectoryText = "~/.emulationstation/downloaded_media/";
std::string initValueMediaDir = Settings::getInstance()->getString("MediaDirectory");
bool multiLineMediaDir = false;
auto updateValMediaDir = [this](const std::string& newVal) {
Settings::getInstance()->setString("MediaDirectory", newVal);
Settings::getInstance()->saveFile();
ViewController::get()->reloadAll();
mWindow->invalidateCachedBackground();
};
rowMediaDir.makeAcceptInputHandler([this, titleMediaDir, mediaDirectoryStaticText,
defaultDirectoryText, initValueMediaDir, updateValMediaDir,
multiLineMediaDir] {
mWindow->pushGui(new GuiComplexTextEditPopup(
mWindow, getHelpStyle(), titleMediaDir, mediaDirectoryStaticText, defaultDirectoryText,
Settings::getInstance()->getString("MediaDirectory"), updateValMediaDir,
multiLineMediaDir, "SAVE", "SAVE CHANGES?"));
});
s->addRow(rowMediaDir);
#if defined(_WIN64)
// Hide taskbar during the ES program session.
auto hide_taskbar = std::make_shared<SwitchComponent>(mWindow);

View file

@ -142,21 +142,6 @@ void Settings::setDefaults()
mStringMap["DefaultSortOrder"] = {"filename, ascending", "filename, ascending"};
mStringMap["MenuOpeningEffect"] = {"scale-up", "scale-up"};
mStringMap["LaunchScreenDuration"] = {"normal", "normal"};
mBoolMap["MenuBlurBackground"] = {true, true};
mBoolMap["GamelistVideoPillarbox"] = {true, true};
mBoolMap["GamelistVideoScanlines"] = {false, false};
mBoolMap["FoldersOnTop"] = {true, true};
mBoolMap["FavoritesFirst"] = {true, true};
mBoolMap["FavoritesStar"] = {true, true};
mBoolMap["SpecialCharsASCII"] = {false, false};
mBoolMap["ListScrollOverlay"] = {false, false};
mBoolMap["FavoritesAddButton"] = {true, true};
mBoolMap["RandomAddButton"] = {false, false};
mBoolMap["GamelistFilters"] = {true, true};
mBoolMap["QuickSystemSelect"] = {true, true};
mBoolMap["ShowHelpPrompts"] = {true, true};
mBoolMap["PlayVideosImmediately"] = {false, false};
mBoolMap["EnableMenuKidMode"] = {false, false};
// UI settings -> media viewer settings.
mBoolMap["MediaViewerKeepVideoRunning"] = {true, true};
@ -187,6 +172,22 @@ void Settings::setDefaults()
mBoolMap["ScreensaverVideoScanlines"] = {true, true};
mBoolMap["ScreensaverVideoBlur"] = {false, false};
mBoolMap["MenuBlurBackground"] = {true, true};
mBoolMap["GamelistVideoPillarbox"] = {true, true};
mBoolMap["GamelistVideoScanlines"] = {false, false};
mBoolMap["FoldersOnTop"] = {true, true};
mBoolMap["FavoritesFirst"] = {true, true};
mBoolMap["FavoritesStar"] = {true, true};
mBoolMap["SpecialCharsASCII"] = {false, false};
mBoolMap["ListScrollOverlay"] = {false, false};
mBoolMap["FavoritesAddButton"] = {true, true};
mBoolMap["RandomAddButton"] = {false, false};
mBoolMap["GamelistFilters"] = {true, true};
mBoolMap["QuickSystemSelect"] = {true, true};
mBoolMap["ShowHelpPrompts"] = {true, true};
mBoolMap["PlayVideosImmediately"] = {false, false};
mBoolMap["EnableMenuKidMode"] = {false, false};
// Sound settings.
mIntMap["SoundVolumeNavigation"] = {80, 80};
mIntMap["SoundVolumeVideos"] = {100, 100};
@ -207,7 +208,8 @@ void Settings::setDefaults()
mBoolMap["UseCustomCollectionsSystem"] = {true, true};
mBoolMap["CollectionShowSystemInfo"] = {true, true};
// Other settings.
// Other settings.
mStringMap["MediaDirectory"] = {"", ""};
#if defined(_RPI_)
mIntMap["MaxVRAM"] = {80, 80};
#else
@ -234,7 +236,6 @@ void Settings::setDefaults()
#if defined(_WIN64)
mBoolMap["LaunchWorkaround"] = {true, true};
#endif
mStringMap["MediaDirectory"] = {"", ""};
#if !defined(_RPI_)
mBoolMap["VideoHardwareDecoding"] = {false, false};
#endif