From 2a83f616e6591542893f7d83958c7bbc72af3248 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 3 Sep 2022 12:44:49 +0200 Subject: [PATCH] Code cleanup of various GUIs. --- es-app/src/guis/GuiAlternativeEmulators.cpp | 8 +- .../src/guis/GuiCollectionSystemsOptions.cpp | 34 +- es-app/src/guis/GuiCollectionSystemsOptions.h | 4 +- es-app/src/guis/GuiGamelistFilter.cpp | 30 +- es-app/src/guis/GuiGamelistOptions.cpp | 12 +- es-app/src/guis/GuiLaunchScreen.cpp | 6 +- es-app/src/guis/GuiMediaViewerOptions.cpp | 61 +- es-app/src/guis/GuiMenu.cpp | 675 +++++++++--------- es-app/src/guis/GuiMetaDataEd.cpp | 12 +- es-app/src/guis/GuiOfflineGenerator.cpp | 4 +- es-app/src/guis/GuiScraperMenu.cpp | 615 ++++++++-------- es-app/src/guis/GuiScraperMulti.cpp | 14 +- es-app/src/guis/GuiScraperSearch.cpp | 34 +- es-app/src/guis/GuiScraperSingle.cpp | 4 +- es-app/src/guis/GuiScreensaverOptions.cpp | 184 +++-- es-app/src/guis/GuiSettings.cpp | 6 +- 16 files changed, 849 insertions(+), 854 deletions(-) diff --git a/es-app/src/guis/GuiAlternativeEmulators.cpp b/es-app/src/guis/GuiAlternativeEmulators.cpp index b0678b623..dc128bfd6 100644 --- a/es-app/src/guis/GuiAlternativeEmulators.cpp +++ b/es-app/src/guis/GuiAlternativeEmulators.cpp @@ -109,9 +109,9 @@ GuiAlternativeEmulators::GuiAlternativeEmulators() // es_systems.xml. if (!mHasSystems) { ComponentListRow row; - std::shared_ptr systemText = std::make_shared( + std::shared_ptr systemText {std::make_shared( ViewController::EXCLAMATION_CHAR + " NO ALTERNATIVE EMULATORS DEFINED", - Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER); + Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_CENTER)}; row.addElement(systemText, true); mMenu.addRow(row); } @@ -142,7 +142,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system) { auto s = new GuiSettings(system->getFullName()); - std::string selectedLabel = system->getAlternativeEmulator(); + std::string selectedLabel {system->getAlternativeEmulator()}; std::string label; for (auto entry : system->getSystemEnvData()->mLaunchCommands) { @@ -253,7 +253,7 @@ bool GuiAlternativeEmulators::input(InputConfig* config, Input input) std::vector GuiAlternativeEmulators::getHelpPrompts() { - std::vector prompts = mMenu.getHelpPrompts(); + std::vector prompts {mMenu.getHelpPrompts()}; prompts.push_back(HelpPrompt("b", "back")); if (mHasSystems) prompts.push_back(HelpPrompt("a", "select")); diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp index eb3c99436..c2ba1a285 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp +++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp @@ -44,7 +44,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) } // Automatic collections. - collection_systems_auto = std::make_shared>( + mCollectionSystemsAuto = std::make_shared>( getHelpStyle(), "SELECT COLLECTIONS", true); std::map autoSystems { CollectionSystemsManager::getInstance()->getAutoCollectionSystems()}; @@ -52,13 +52,13 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) for (std::map::const_iterator it = autoSystems.cbegin(); it != autoSystems.cend(); ++it) - collection_systems_auto->add(it->second.decl.fullName, it->second.decl.name, - it->second.isEnabled); - addWithLabel("AUTOMATIC GAME COLLECTIONS", collection_systems_auto); + mCollectionSystemsAuto->add(it->second.decl.fullName, it->second.decl.name, + it->second.isEnabled); + addWithLabel("AUTOMATIC GAME COLLECTIONS", mCollectionSystemsAuto); addSaveFunc([this, autoSystems] { std::string autoSystemsSelected {Utils::String::vectorToDelimitedString( - collection_systems_auto->getSelectedObjects(), ",", true)}; - std::string autoSystemsConfig = Settings::getInstance()->getString("CollectionSystemsAuto"); + mCollectionSystemsAuto->getSelectedObjects(), ",", true)}; + std::string autoSystemsConfig {Settings::getInstance()->getString("CollectionSystemsAuto")}; if (autoSystemsSelected != autoSystemsConfig) { if (CollectionSystemsManager::getInstance()->isEditing()) CollectionSystemsManager::getInstance()->exitEditMode(); @@ -93,7 +93,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) }); // Custom collections. - collection_systems_custom = std::make_shared>( + mCollectionSystemsCustom = std::make_shared>( getHelpStyle(), "SELECT COLLECTIONS", true); std::map customSystems { CollectionSystemsManager::getInstance()->getCustomCollectionSystems()}; @@ -101,14 +101,14 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) for (std::map::const_iterator it = customSystems.cbegin(); it != customSystems.cend(); ++it) - collection_systems_custom->add(it->second.decl.fullName, it->second.decl.name, - it->second.isEnabled); + mCollectionSystemsCustom->add(it->second.decl.fullName, it->second.decl.name, + it->second.isEnabled); - addWithLabel("CUSTOM GAME COLLECTIONS", collection_systems_custom); + addWithLabel("CUSTOM GAME COLLECTIONS", mCollectionSystemsCustom); addSaveFunc([this, customSystems] { if (!mDeletedCustomCollection) { std::string customSystemsSelected {Utils::String::vectorToDelimitedString( - collection_systems_custom->getSelectedObjects(), ",", true)}; + mCollectionSystemsCustom->getSelectedObjects(), ",", true)}; std::string customSystemsConfig { Settings::getInstance()->getString("CollectionSystemsCustom")}; if (customSystemsSelected != customSystemsConfig) { @@ -150,10 +150,10 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) // If there are no custom collections, then gray out this menu entry. if (customSystems.empty()) { - collection_systems_custom->setEnabled(false); - collection_systems_custom->setOpacity(DISABLED_OPACITY); - collection_systems_custom->getParent() - ->getChild(collection_systems_custom->getChildIndex() - 1) + mCollectionSystemsCustom->setEnabled(false); + mCollectionSystemsCustom->setOpacity(DISABLED_OPACITY); + mCollectionSystemsCustom->getParent() + ->getChild(mCollectionSystemsCustom->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } @@ -261,7 +261,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) CollectionSystemsManager::getInstance()->exitEditMode(); mDeletedCustomCollection = true; std::vector selectedCustomCollections { - collection_systems_custom->getSelectedObjects()}; + mCollectionSystemsCustom->getSelectedObjects()}; std::string collectionsConfigEntry; // Create the configuration file entry. If the collection to be // deleted was activated, then exclude it. @@ -387,7 +387,7 @@ void GuiCollectionSystemsOptions::createCustomCollection(std::string inName) CollectionSystemsManager::getInstance()->addNewCustomCollection(collectionName)}; CollectionSystemsManager::getInstance()->saveCustomCollection(newCollection); - collection_systems_custom->add(collectionName, collectionName, true); + mCollectionSystemsCustom->add(collectionName, collectionName, true); mAddedCustomCollection = true; setNeedsGoToStart(); diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.h b/es-app/src/guis/GuiCollectionSystemsOptions.h index 61f43ac81..788ef4f13 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.h +++ b/es-app/src/guis/GuiCollectionSystemsOptions.h @@ -22,8 +22,8 @@ public: private: void createCustomCollection(std::string inName); - std::shared_ptr> collection_systems_auto; - std::shared_ptr> collection_systems_custom; + std::shared_ptr> mCollectionSystemsAuto; + std::shared_ptr> mCollectionSystemsCustom; bool mAddedCustomCollection; bool mDeletedCustomCollection; diff --git a/es-app/src/guis/GuiGamelistFilter.cpp b/es-app/src/guis/GuiGamelistFilter.cpp index e492b276c..eaa12edf9 100644 --- a/es-app/src/guis/GuiGamelistFilter.cpp +++ b/es-app/src/guis/GuiGamelistFilter.cpp @@ -69,8 +69,8 @@ void GuiGamelistFilter::initializeMenu() std::shared_ptr>>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it) { - std::shared_ptr> optionList = it->second; - std::vector filters = optionList->getSelectedObjects(); + std::shared_ptr> optionList {it->second}; + std::vector filters {optionList->getSelectedObjects()}; mInitialFilters.push_back(filters); } } @@ -82,7 +82,7 @@ void GuiGamelistFilter::resetAllFilters() std::shared_ptr>>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it) { - std::shared_ptr> optionList = it->second; + std::shared_ptr> optionList {it->second}; optionList->selectNone(); } @@ -142,20 +142,20 @@ void GuiGamelistFilter::addFiltersToMenu() mMenu.addRow(row); - std::vector decls = mFilterIndex->getFilterDataDecls(); + std::vector decls {mFilterIndex->getFilterDataDecls()}; for (std::vector::const_iterator it = decls.cbegin(); // Line break. it != decls.cend(); ++it) { - FilterIndexType type = (*it).type; // Type of filter. + FilterIndexType type {(*it).type}; // Type of filter. // Don't include the alternative emulators if the corresponding setting has been disabled. if (type == ALTEMULATOR_FILTER && !Settings::getInstance()->getBool("AlternativeEmulatorPerGame")) continue; - std::map* allKeys = (*it).allIndexKeys; + std::map* allKeys {(*it).allIndexKeys}; - bool exclusiveSelect = false; + bool exclusiveSelect {false}; if (type == FAVORITES_FILTER || type == KIDGAME_FILTER || type == COMPLETED_FILTER || type == BROKEN_FILTER) @@ -169,7 +169,7 @@ void GuiGamelistFilter::addFiltersToMenu() continue; } - std::string menuLabel = (*it).menuLabel; // Text to show in menu. + std::string menuLabel {(*it).menuLabel}; // Text to show in menu. std::shared_ptr> optionList; // For bool values, make the selection exclusive so that both True and False can't be @@ -191,8 +191,8 @@ void GuiGamelistFilter::addFiltersToMenu() if (type == CONTROLLER_FILTER) { for (auto it : *allKeys) { - std::string displayName = - BadgeComponent::getDisplayName(Utils::String::toLower(it.first)); + std::string displayName { + BadgeComponent::getDisplayName(Utils::String::toLower(it.first))}; if (displayName == "unknown") displayName = it.first; optionList->add(displayName, it.first, @@ -219,13 +219,13 @@ void GuiGamelistFilter::applyFilters() if (mInitialTextFilter != mTextFilterField->getValue()) mFiltersChanged = true; - std::vector decls = mFilterIndex->getFilterDataDecls(); + std::vector decls {mFilterIndex->getFilterDataDecls()}; for (std::map>>::const_iterator it = mFilterOptions.cbegin(); it != mFilterOptions.cend(); ++it) { - std::shared_ptr> optionList = it->second; - std::vector filters = optionList->getSelectedObjects(); + std::shared_ptr> optionList {it->second}; + std::vector filters {optionList->getSelectedObjects()}; auto iteratorDistance = std::distance(mFilterOptions.cbegin(), it); if (mInitialFilters[iteratorDistance] != filters) mFiltersChanged = true; @@ -238,7 +238,7 @@ void GuiGamelistFilter::applyFilters() bool GuiGamelistFilter::input(InputConfig* config, Input input) { - bool consumed = GuiComponent::input(config, input); + bool consumed {GuiComponent::input(config, input)}; if (consumed) return true; @@ -250,7 +250,7 @@ bool GuiGamelistFilter::input(InputConfig* config, Input input) std::vector GuiGamelistFilter::getHelpPrompts() { - std::vector prompts = mMenu.getHelpPrompts(); + std::vector prompts {mMenu.getHelpPrompts()}; prompts.push_back(HelpPrompt("b", "back")); prompts.push_back(HelpPrompt("a", "select")); return prompts; diff --git a/es-app/src/guis/GuiGamelistOptions.cpp b/es-app/src/guis/GuiGamelistOptions.cpp index e9a320bf5..c4332749b 100644 --- a/es-app/src/guis/GuiGamelistOptions.cpp +++ b/es-app/src/guis/GuiGamelistOptions.cpp @@ -86,7 +86,7 @@ GuiGamelistOptions::GuiGamelistOptions(SystemData* system) } else { // Check if the currently selected game is a favorite. - bool isFavorite = false; + bool isFavorite {false}; if (mFirstLetterIndex.size() == 1 && mFirstLetterIndex.front() == ViewController::FAVORITE_CHAR) isFavorite = true; @@ -128,14 +128,14 @@ GuiGamelistOptions::GuiGamelistOptions(SystemData* system) else root = mSystem->getRootFolder(); - std::string sortType = root->getSortTypeString(); + std::string sortType {root->getSortTypeString()}; unsigned int numSortTypes = static_cast(FileSorts::SortTypes.size()); // If it's not a collection, then hide the System sort options. if (!root->getSystem()->isCollection()) numSortTypes -= 2; for (unsigned int i = 0; i < numSortTypes; ++i) { - const FileData::SortType& sort = FileSorts::SortTypes.at(i); + const FileData::SortType& sort {FileSorts::SortTypes.at(i)}; if (sort.description == sortType) mListSort->add(sort.description, &sort, true); else @@ -391,7 +391,7 @@ void GuiGamelistOptions::openMetaDataEd() { // Open metadata editor. // Get the FileData that holds the original metadata. - FileData* file = getGamelist()->getCursor()->getSourceFileData(); + FileData* file {getGamelist()->getCursor()->getSourceFileData()}; ScraperSearchParams p; p.game = file; p.system = file->getSystem(); @@ -541,8 +541,8 @@ void GuiGamelistOptions::jumpToFirstRow() { if (mFoldersOnTop && mJumpToLetterList->getSelected() == ViewController::FAVORITE_CHAR) { // Get the gamelist. - const std::vector& files = - getGamelist()->getCursor()->getParent()->getChildrenListToDisplay(); + const std::vector& files { + getGamelist()->getCursor()->getParent()->getChildrenListToDisplay()}; // Select the first game that is not a folder, unless it's a folder-only list in // which case the first line overall is selected. for (auto it = files.cbegin(); it != files.cend(); ++it) { diff --git a/es-app/src/guis/GuiLaunchScreen.cpp b/es-app/src/guis/GuiLaunchScreen.cpp index 8703a637c..af5955a56 100644 --- a/es-app/src/guis/GuiLaunchScreen.cpp +++ b/es-app/src/guis/GuiLaunchScreen.cpp @@ -45,8 +45,8 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game) } mScaleUp = 0.5f; - const float titleFontSize = 0.060f; - const float gameNameFontSize = 0.073f; + const float titleFontSize {0.060f}; + const float gameNameFontSize {0.073f}; // Spacer row. mGrid->setEntry(std::make_shared(), glm::ivec2 {1, 0}, false, false, @@ -145,7 +145,7 @@ void GuiLaunchScreen::displayLaunchScreen(FileData* game) mGrid->setSize(mSize); - float totalRowHeight = 0.0f; + float totalRowHeight {0.0f}; // Hack to adjust the window height to the row boundary. for (int i = 0; i < 7; ++i) diff --git a/es-app/src/guis/GuiMediaViewerOptions.cpp b/es-app/src/guis/GuiMediaViewerOptions.cpp index 0d8f06a6e..2ff54c383 100644 --- a/es-app/src/guis/GuiMediaViewerOptions.cpp +++ b/es-app/src/guis/GuiMediaViewerOptions.cpp @@ -16,65 +16,64 @@ GuiMediaViewerOptions::GuiMediaViewerOptions(const std::string& title) : GuiSettings {title} { // Keep videos running when viewing images. - auto keep_video_running = std::make_shared(); - keep_video_running->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")); - addWithLabel("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES", keep_video_running); - addSaveFunc([keep_video_running, this] { - if (keep_video_running->getState() != + auto keepVideoRunning = std::make_shared(); + keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")); + addWithLabel("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES", keepVideoRunning); + addSaveFunc([keepVideoRunning, this] { + if (keepVideoRunning->getState() != Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) { Settings::getInstance()->setBool("MediaViewerKeepVideoRunning", - keep_video_running->getState()); + keepVideoRunning->getState()); setNeedsSaving(); } }); // Stretch videos to screen resolution. - auto stretch_videos = std::make_shared(); - stretch_videos->setState(Settings::getInstance()->getBool("MediaViewerStretchVideos")); - addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", stretch_videos); - addSaveFunc([stretch_videos, this] { - if (stretch_videos->getState() != + auto stretchVideos = std::make_shared(); + stretchVideos->setState(Settings::getInstance()->getBool("MediaViewerStretchVideos")); + addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", stretchVideos); + addSaveFunc([stretchVideos, this] { + if (stretchVideos->getState() != Settings::getInstance()->getBool("MediaViewerStretchVideos")) { - Settings::getInstance()->setBool("MediaViewerStretchVideos", - stretch_videos->getState()); + Settings::getInstance()->setBool("MediaViewerStretchVideos", stretchVideos->getState()); setNeedsSaving(); } }); // Render scanlines for videos using a shader. - auto video_scanlines = std::make_shared(); - video_scanlines->setState(Settings::getInstance()->getBool("MediaViewerVideoScanlines")); - addWithLabel("RENDER SCANLINES FOR VIDEOS", video_scanlines); - addSaveFunc([video_scanlines, this] { - if (video_scanlines->getState() != + auto videoScanlines = std::make_shared(); + videoScanlines->setState(Settings::getInstance()->getBool("MediaViewerVideoScanlines")); + addWithLabel("RENDER SCANLINES FOR VIDEOS", videoScanlines); + addSaveFunc([videoScanlines, this] { + if (videoScanlines->getState() != Settings::getInstance()->getBool("MediaViewerVideoScanlines")) { Settings::getInstance()->setBool("MediaViewerVideoScanlines", - video_scanlines->getState()); + videoScanlines->getState()); setNeedsSaving(); } }); // Render blur for videos using a shader. - auto video_blur = std::make_shared(); - video_blur->setState(Settings::getInstance()->getBool("MediaViewerVideoBlur")); - addWithLabel("RENDER BLUR FOR VIDEOS", video_blur); - addSaveFunc([video_blur, this] { - if (video_blur->getState() != Settings::getInstance()->getBool("MediaViewerVideoBlur")) { - Settings::getInstance()->setBool("MediaViewerVideoBlur", video_blur->getState()); + auto videoBlur = std::make_shared(); + 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()); setNeedsSaving(); } }); // Render scanlines for screenshots and title screens using a shader. - auto screenshot_scanlines = std::make_shared(); - screenshot_scanlines->setState( + auto screenshotScanlines = std::make_shared(); + screenshotScanlines->setState( Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")); - addWithLabel("RENDER SCANLINES FOR SCREENSHOTS AND TITLES", screenshot_scanlines); - addSaveFunc([screenshot_scanlines, this] { - if (screenshot_scanlines->getState() != + addWithLabel("RENDER SCANLINES FOR SCREENSHOTS AND TITLES", screenshotScanlines); + addSaveFunc([screenshotScanlines, this] { + if (screenshotScanlines->getState() != Settings::getInstance()->getBool("MediaViewerScreenshotScanlines")) { Settings::getInstance()->setBool("MediaViewerScreenshotScanlines", - screenshot_scanlines->getState()); + screenshotScanlines->getState()); setNeedsSaving(); } }); diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 7b22be950..97037ed9b 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -108,7 +108,7 @@ void GuiMenu::openUIOptions() std::map::const_iterator selectedSet; - auto theme_set = + auto themeSet = std::make_shared>(getHelpStyle(), "THEME SET", false); // Theme selection. @@ -120,14 +120,14 @@ void GuiMenu::openUIOptions() for (auto it = themeSets.cbegin(); it != themeSets.cend(); ++it) { // If required, abbreviate the theme set name so it doesn't overlap the setting name. float maxNameLength = mSize.x * 0.62f; - theme_set->add(it->first, it->first, it == selectedSet, maxNameLength); + themeSet->add(it->first, it->first, it == selectedSet, maxNameLength); } - s->addWithLabel("THEME SET", theme_set); - s->addSaveFunc([this, theme_set, s] { - if (theme_set->getSelected() != Settings::getInstance()->getString("ThemeSet")) { - Scripting::fireEvent("theme-changed", theme_set->getSelected(), + s->addWithLabel("THEME SET", themeSet); + s->addSaveFunc([this, themeSet, s] { + if (themeSet->getSelected() != Settings::getInstance()->getString("ThemeSet")) { + Scripting::fireEvent("theme-changed", themeSet->getSelected(), Settings::getInstance()->getString("ThemeSet")); - Settings::getInstance()->setString("ThemeSet", theme_set->getSelected()); + Settings::getInstance()->setString("ThemeSet", themeSet->getSelected()); mWindow->setChangedThemeSet(); // This is required so that the custom collection system does not disappear // if the user is editing a custom collection when switching theme sets. @@ -246,23 +246,23 @@ void GuiMenu::openUIOptions() Settings::getInstance()->getString("ThemeAspectRatio")); // Legacy gamelist view style. - auto gamelist_view_style = std::make_shared>( + auto gamelistViewStyle = std::make_shared>( getHelpStyle(), "LEGACY GAMELIST VIEW STYLE", false); - std::string selectedViewStyle = Settings::getInstance()->getString("GamelistViewStyle"); - gamelist_view_style->add("automatic", "automatic", selectedViewStyle == "automatic"); - gamelist_view_style->add("basic", "basic", selectedViewStyle == "basic"); - gamelist_view_style->add("detailed", "detailed", selectedViewStyle == "detailed"); - gamelist_view_style->add("video", "video", selectedViewStyle == "video"); + std::string selectedViewStyle {Settings::getInstance()->getString("GamelistViewStyle")}; + gamelistViewStyle->add("automatic", "automatic", selectedViewStyle == "automatic"); + gamelistViewStyle->add("basic", "basic", selectedViewStyle == "basic"); + gamelistViewStyle->add("detailed", "detailed", selectedViewStyle == "detailed"); + gamelistViewStyle->add("video", "video", selectedViewStyle == "video"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the view style to Automatic in this case. - if (gamelist_view_style->getSelectedObjects().size() == 0) - gamelist_view_style->selectEntry(0); - s->addWithLabel("LEGACY GAMELIST VIEW STYLE", gamelist_view_style); - s->addSaveFunc([gamelist_view_style, s] { - if (gamelist_view_style->getSelected() != + if (gamelistViewStyle->getSelectedObjects().size() == 0) + gamelistViewStyle->selectEntry(0); + s->addWithLabel("LEGACY GAMELIST VIEW STYLE", gamelistViewStyle); + s->addSaveFunc([gamelistViewStyle, s] { + if (gamelistViewStyle->getSelected() != Settings::getInstance()->getString("GamelistViewStyle")) { Settings::getInstance()->setString("GamelistViewStyle", - gamelist_view_style->getSelected()); + gamelistViewStyle->getSelected()); s->setNeedsSaving(); s->setNeedsReloading(); s->setInvalidateCachedBackground(); @@ -270,20 +270,20 @@ void GuiMenu::openUIOptions() }); // Legacy ransition style. - auto transition_style = std::make_shared>( + auto transitionStyle = std::make_shared>( getHelpStyle(), "LEGACY TRANSITION STYLE", false); std::vector transitions; transitions.push_back("slide"); transitions.push_back("fade"); transitions.push_back("instant"); for (auto it = transitions.cbegin(); it != transitions.cend(); ++it) - transition_style->add(*it, *it, - Settings::getInstance()->getString("TransitionStyle") == *it); - s->addWithLabel("LEGACY TRANSITION STYLE", transition_style); - s->addSaveFunc([transition_style, s] { - if (transition_style->getSelected() != + transitionStyle->add(*it, *it, + Settings::getInstance()->getString("TransitionStyle") == *it); + s->addWithLabel("LEGACY TRANSITION STYLE", transitionStyle); + s->addSaveFunc([transitionStyle, s] { + if (transitionStyle->getSelected() != Settings::getInstance()->getString("TransitionStyle")) { - Settings::getInstance()->setString("TransitionStyle", transition_style->getSelected()); + Settings::getInstance()->setString("TransitionStyle", transitionStyle->getSelected()); s->setNeedsSaving(); } }); @@ -296,7 +296,7 @@ void GuiMenu::openUIOptions() it != SystemData::sSystemVector.cend(); ++it) { if ((*it)->getName() != "retropie") { // If required, abbreviate the system name so it doesn't overlap the setting name. - float maxNameLength = mSize.x * 0.48f; + float maxNameLength {mSize.x * 0.48f}; startupSystem->add((*it)->getFullName(), (*it)->getName(), Settings::getInstance()->getString("StartupSystem") == (*it)->getName(), @@ -317,10 +317,10 @@ void GuiMenu::openUIOptions() // Default gamelist sort order. std::string sortOrder; - auto default_sort_order = std::make_shared>( + auto defaultSortOrder = std::make_shared>( getHelpStyle(), "DEFAULT SORT ORDER", false); // Exclude the System sort options. - unsigned int numSortTypes = static_cast(FileSorts::SortTypes.size() - 2); + unsigned int numSortTypes {static_cast(FileSorts::SortTypes.size() - 2)}; for (unsigned int i = 0; i < numSortTypes; ++i) { if (FileSorts::SortTypes[i].description == Settings::getInstance()->getString("DefaultSortOrder")) { @@ -333,15 +333,15 @@ void GuiMenu::openUIOptions() if (sortOrder == "") sortOrder = Settings::getInstance()->getDefaultString("DefaultSortOrder"); for (unsigned int i = 0; i < numSortTypes; ++i) { - const FileData::SortType& sort = FileSorts::SortTypes[i]; + const FileData::SortType& sort {FileSorts::SortTypes[i]}; if (sort.description == sortOrder) - default_sort_order->add(sort.description, &sort, true); + defaultSortOrder->add(sort.description, &sort, true); else - default_sort_order->add(sort.description, &sort, false); + defaultSortOrder->add(sort.description, &sort, false); } - s->addWithLabel("DEFAULT SORT ORDER", default_sort_order); - s->addSaveFunc([default_sort_order, sortOrder, s] { - std::string selectedSortOrder = default_sort_order.get()->getSelected()->description; + s->addWithLabel("DEFAULT SORT ORDER", defaultSortOrder); + s->addSaveFunc([defaultSortOrder, sortOrder, s] { + std::string selectedSortOrder {defaultSortOrder.get()->getSelected()->description}; if (selectedSortOrder != sortOrder) { Settings::getInstance()->setString("DefaultSortOrder", selectedSortOrder); s->setNeedsSaving(); @@ -352,49 +352,49 @@ void GuiMenu::openUIOptions() }); // Open menu effect. - auto menu_opening_effect = std::make_shared>( + auto menuOpeningEffect = std::make_shared>( getHelpStyle(), "MENU OPENING EFFECT", false); - std::string selectedMenuEffect = Settings::getInstance()->getString("MenuOpeningEffect"); - menu_opening_effect->add("SCALE-UP", "scale-up", selectedMenuEffect == "scale-up"); - menu_opening_effect->add("NONE", "none", selectedMenuEffect == "none"); + std::string selectedMenuEffect {Settings::getInstance()->getString("MenuOpeningEffect")}; + menuOpeningEffect->add("SCALE-UP", "scale-up", selectedMenuEffect == "scale-up"); + menuOpeningEffect->add("NONE", "none", selectedMenuEffect == "none"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the opening effect to "scale-up" in this case. - if (menu_opening_effect->getSelectedObjects().size() == 0) - menu_opening_effect->selectEntry(0); - s->addWithLabel("MENU OPENING EFFECT", menu_opening_effect); - s->addSaveFunc([menu_opening_effect, s] { - if (menu_opening_effect->getSelected() != + if (menuOpeningEffect->getSelectedObjects().size() == 0) + menuOpeningEffect->selectEntry(0); + s->addWithLabel("MENU OPENING EFFECT", menuOpeningEffect); + s->addSaveFunc([menuOpeningEffect, s] { + if (menuOpeningEffect->getSelected() != Settings::getInstance()->getString("MenuOpeningEffect")) { Settings::getInstance()->setString("MenuOpeningEffect", - menu_opening_effect->getSelected()); + menuOpeningEffect->getSelected()); s->setNeedsSaving(); } }); // Launch screen duration. - auto launch_screen_duration = std::make_shared>( + auto launchScreenDuration = std::make_shared>( getHelpStyle(), "LAUNCH SCREEN DURATION", false); - std::string selectedDuration = Settings::getInstance()->getString("LaunchScreenDuration"); - launch_screen_duration->add("NORMAL", "normal", selectedDuration == "normal"); - launch_screen_duration->add("BRIEF", "brief", selectedDuration == "brief"); - launch_screen_duration->add("LONG", "long", selectedDuration == "long"); - launch_screen_duration->add("DISABLED", "disabled", selectedDuration == "disabled"); + std::string selectedDuration {Settings::getInstance()->getString("LaunchScreenDuration")}; + launchScreenDuration->add("NORMAL", "normal", selectedDuration == "normal"); + launchScreenDuration->add("BRIEF", "brief", selectedDuration == "brief"); + launchScreenDuration->add("LONG", "long", selectedDuration == "long"); + launchScreenDuration->add("DISABLED", "disabled", selectedDuration == "disabled"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the duration to "normal" in this case. - if (launch_screen_duration->getSelectedObjects().size() == 0) - launch_screen_duration->selectEntry(0); - s->addWithLabel("LAUNCH SCREEN DURATION", launch_screen_duration); - s->addSaveFunc([launch_screen_duration, s] { - if (launch_screen_duration->getSelected() != + if (launchScreenDuration->getSelectedObjects().size() == 0) + launchScreenDuration->selectEntry(0); + s->addWithLabel("LAUNCH SCREEN DURATION", launchScreenDuration); + s->addSaveFunc([launchScreenDuration, s] { + if (launchScreenDuration->getSelected() != Settings::getInstance()->getString("LaunchScreenDuration")) { Settings::getInstance()->setString("LaunchScreenDuration", - launch_screen_duration->getSelected()); + launchScreenDuration->getSelected()); s->setNeedsSaving(); } }); // UI mode. - auto ui_mode = + auto uiMode = std::make_shared>(getHelpStyle(), "UI MODE", false); std::vector uiModes; uiModes.push_back("full"); @@ -408,10 +408,10 @@ void GuiMenu::openUIOptions() else setMode = Settings::getInstance()->getString("UIMode"); for (auto it = uiModes.cbegin(); it != uiModes.cend(); ++it) - ui_mode->add(*it, *it, setMode == *it); - s->addWithLabel("UI MODE", ui_mode); - s->addSaveFunc([ui_mode, this, s] { - std::string selectedMode = ui_mode->getSelected(); + uiMode->add(*it, *it, setMode == *it); + s->addWithLabel("UI MODE", uiMode); + s->addSaveFunc([uiMode, this, s] { + std::string selectedMode {uiMode->getSelected()}; // If any of the force flags are set, then always apply and save the setting. if (selectedMode == Settings::getInstance()->getString("UIMode") && !Settings::getInstance()->getBool("ForceFull") && @@ -420,19 +420,19 @@ void GuiMenu::openUIOptions() return; } else if (selectedMode != "full") { - std::string msg = "YOU ARE CHANGING THE UI TO THE RESTRICTED MODE\n'" + - Utils::String::toUpper(selectedMode) + "'\n"; + std::string msg {"YOU ARE CHANGING THE UI TO THE RESTRICTED MODE\n'" + + Utils::String::toUpper(selectedMode) + "'\n"}; if (selectedMode == "kiosk") { - msg += "THIS WILL HIDE MOST MENU OPTIONS TO PREVENT\n"; - msg += "CHANGES TO THE SYSTEM\n"; + msg.append("THIS WILL HIDE MOST MENU OPTIONS TO PREVENT\n"); + msg.append("CHANGES TO THE SYSTEM\n"); } else { - msg += "THIS WILL LIMIT THE AVAILABLE GAMES TO THE ONES\n"; - msg += "FLAGGED SUITABLE FOR CHILDREN\n"; + msg.append("THIS WILL LIMIT THE AVAILABLE GAMES TO THE ONES\n"); + msg.append("FLAGGED SUITABLE FOR CHILDREN\n"); } - msg += "TO UNLOCK AND RETURN TO THE FULL UI, ENTER THIS CODE: \n"; - msg += UIModeController::getInstance()->getFormattedPassKeyStr() + "\n\n"; - msg += "DO YOU WANT TO PROCEED?"; + msg.append("TO UNLOCK AND RETURN TO THE FULL UI, ENTER THIS CODE: \n"); + msg.append(UIModeController::getInstance()->getFormattedPassKeyStr() + "\n\n"); + msg.append("DO YOU WANT TO PROCEED?"); mWindow->pushGui(new GuiMsgBox( this->getHelpStyle(), msg, "YES", [this, selectedMode] { @@ -464,7 +464,7 @@ void GuiMenu::openUIOptions() else { LOG(LogDebug) << "GuiMenu::openUISettings(): Setting UI mode to '" << selectedMode << "'."; - Settings::getInstance()->setString("UIMode", ui_mode->getSelected()); + Settings::getInstance()->setString("UIMode", uiMode->getSelected()); Settings::getInstance()->setBool("ForceFull", false); Settings::getInstance()->setBool("ForceKiosk", false); Settings::getInstance()->setBool("ForceKid", false); @@ -480,35 +480,33 @@ void GuiMenu::openUIOptions() }); // Media viewer. - ComponentListRow media_viewer_row; - media_viewer_row.elements.clear(); - media_viewer_row.addElement(std::make_shared("MEDIA VIEWER SETTINGS", - Font::get(FONT_SIZE_MEDIUM), - 0x777777FF), - true); - media_viewer_row.addElement(makeArrow(), false); - media_viewer_row.makeAcceptInputHandler(std::bind(&GuiMenu::openMediaViewerOptions, this)); - s->addRow(media_viewer_row); + ComponentListRow mediaViewerRow; + mediaViewerRow.elements.clear(); + mediaViewerRow.addElement(std::make_shared( + "MEDIA VIEWER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), + true); + mediaViewerRow.addElement(makeArrow(), false); + mediaViewerRow.makeAcceptInputHandler(std::bind(&GuiMenu::openMediaViewerOptions, this)); + s->addRow(mediaViewerRow); // Screensaver. - ComponentListRow screensaver_row; - screensaver_row.elements.clear(); - screensaver_row.addElement(std::make_shared( - "SCREENSAVER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), - true); - screensaver_row.addElement(makeArrow(), false); - screensaver_row.makeAcceptInputHandler(std::bind(&GuiMenu::openScreensaverOptions, this)); - s->addRow(screensaver_row); + ComponentListRow screensaverRow; + screensaverRow.elements.clear(); + screensaverRow.addElement(std::make_shared( + "SCREENSAVER SETTINGS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), + true); + screensaverRow.addElement(makeArrow(), false); + screensaverRow.makeAcceptInputHandler(std::bind(&GuiMenu::openScreensaverOptions, this)); + s->addRow(screensaverRow); // Blur background when the menu is open. - auto menu_blur_background = std::make_shared(); - menu_blur_background->setState(Settings::getInstance()->getBool("MenuBlurBackground")); - s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menu_blur_background); - s->addSaveFunc([menu_blur_background, s] { - if (menu_blur_background->getState() != + auto menuBlurBackground = std::make_shared(); + menuBlurBackground->setState(Settings::getInstance()->getBool("MenuBlurBackground")); + s->addWithLabel("BLUR BACKGROUND WHEN MENU IS OPEN", menuBlurBackground); + s->addSaveFunc([menuBlurBackground, s] { + if (menuBlurBackground->getState() != Settings::getInstance()->getBool("MenuBlurBackground")) { - Settings::getInstance()->setBool("MenuBlurBackground", - menu_blur_background->getState()); + Settings::getInstance()->setBool("MenuBlurBackground", menuBlurBackground->getState()); s->setNeedsSaving(); s->setInvalidateCachedBackground(); } @@ -541,12 +539,12 @@ void GuiMenu::openUIOptions() }); // Sort folders on top of the gamelists. - auto folders_on_top = std::make_shared(); - folders_on_top->setState(Settings::getInstance()->getBool("FoldersOnTop")); - s->addWithLabel("SORT FOLDERS ON TOP OF GAMELISTS", folders_on_top); - s->addSaveFunc([folders_on_top, s] { - if (folders_on_top->getState() != Settings::getInstance()->getBool("FoldersOnTop")) { - Settings::getInstance()->setBool("FoldersOnTop", folders_on_top->getState()); + auto foldersOnTop = std::make_shared(); + foldersOnTop->setState(Settings::getInstance()->getBool("FoldersOnTop")); + s->addWithLabel("SORT FOLDERS ON TOP OF GAMELISTS", foldersOnTop); + s->addSaveFunc([foldersOnTop, s] { + if (foldersOnTop->getState() != Settings::getInstance()->getBool("FoldersOnTop")) { + Settings::getInstance()->setBool("FoldersOnTop", foldersOnTop->getState()); s->setNeedsSaving(); s->setNeedsSorting(); s->setInvalidateCachedBackground(); @@ -554,12 +552,12 @@ void GuiMenu::openUIOptions() }); // Sort favorites on top of non-favorites in the gamelists. - auto favorites_first = std::make_shared(); - favorites_first->setState(Settings::getInstance()->getBool("FavoritesFirst")); - s->addWithLabel("SORT FAVORITE GAMES ABOVE NON-FAVORITES", favorites_first); - s->addSaveFunc([favorites_first, s] { - if (favorites_first->getState() != Settings::getInstance()->getBool("FavoritesFirst")) { - Settings::getInstance()->setBool("FavoritesFirst", favorites_first->getState()); + auto favoritesFirst = std::make_shared(); + favoritesFirst->setState(Settings::getInstance()->getBool("FavoritesFirst")); + s->addWithLabel("SORT FAVORITE GAMES ABOVE NON-FAVORITES", favoritesFirst); + s->addSaveFunc([favoritesFirst, s] { + if (favoritesFirst->getState() != Settings::getInstance()->getBool("FavoritesFirst")) { + Settings::getInstance()->setBool("FavoritesFirst", favoritesFirst->getState()); s->setNeedsSaving(); s->setNeedsSorting(); s->setNeedsSortingCollections(); @@ -568,12 +566,12 @@ void GuiMenu::openUIOptions() }); // Enable gamelist star markings for favorite games. - auto favorites_star = std::make_shared(); - favorites_star->setState(Settings::getInstance()->getBool("FavoritesStar")); - s->addWithLabel("ADD STAR MARKINGS TO FAVORITE GAMES", favorites_star); - s->addSaveFunc([favorites_star, s] { - if (favorites_star->getState() != Settings::getInstance()->getBool("FavoritesStar")) { - Settings::getInstance()->setBool("FavoritesStar", favorites_star->getState()); + auto favoritesStar = std::make_shared(); + favoritesStar->setState(Settings::getInstance()->getBool("FavoritesStar")); + s->addWithLabel("ADD STAR MARKINGS TO FAVORITE GAMES", favoritesStar); + s->addSaveFunc([favoritesStar, s] { + if (favoritesStar->getState() != Settings::getInstance()->getBool("FavoritesStar")) { + Settings::getInstance()->setBool("FavoritesStar", favoritesStar->getState()); s->setNeedsSaving(); s->setNeedsReloading(); s->setInvalidateCachedBackground(); @@ -581,84 +579,83 @@ void GuiMenu::openUIOptions() }); // Enable quick list scrolling overlay. - auto list_scroll_overlay = std::make_shared(); - list_scroll_overlay->setState(Settings::getInstance()->getBool("ListScrollOverlay")); - s->addWithLabel("ENABLE QUICK LIST SCROLLING OVERLAY", list_scroll_overlay); - s->addSaveFunc([list_scroll_overlay, s] { - if (list_scroll_overlay->getState() != + auto listScrollOverlay = std::make_shared(); + listScrollOverlay->setState(Settings::getInstance()->getBool("ListScrollOverlay")); + s->addWithLabel("ENABLE QUICK LIST SCROLLING OVERLAY", listScrollOverlay); + s->addSaveFunc([listScrollOverlay, s] { + if (listScrollOverlay->getState() != Settings::getInstance()->getBool("ListScrollOverlay")) { - Settings::getInstance()->setBool("ListScrollOverlay", list_scroll_overlay->getState()); + Settings::getInstance()->setBool("ListScrollOverlay", listScrollOverlay->getState()); s->setNeedsSaving(); } }); // Enable virtual (on-screen) keyboard. - auto virtual_keyboard = std::make_shared(); - virtual_keyboard->setState(Settings::getInstance()->getBool("VirtualKeyboard")); - s->addWithLabel("ENABLE VIRTUAL KEYBOARD", virtual_keyboard); - s->addSaveFunc([virtual_keyboard, s] { - if (virtual_keyboard->getState() != Settings::getInstance()->getBool("VirtualKeyboard")) { - Settings::getInstance()->setBool("VirtualKeyboard", virtual_keyboard->getState()); + auto virtualKeyboard = std::make_shared(); + virtualKeyboard->setState(Settings::getInstance()->getBool("VirtualKeyboard")); + s->addWithLabel("ENABLE VIRTUAL KEYBOARD", virtualKeyboard); + s->addSaveFunc([virtualKeyboard, s] { + if (virtualKeyboard->getState() != Settings::getInstance()->getBool("VirtualKeyboard")) { + Settings::getInstance()->setBool("VirtualKeyboard", virtualKeyboard->getState()); s->setNeedsSaving(); s->setInvalidateCachedBackground(); } }); // Enable the 'Y' button for tagging games as favorites. - auto favorites_add_button = std::make_shared(); - favorites_add_button->setState(Settings::getInstance()->getBool("FavoritesAddButton")); - s->addWithLabel("ENABLE TOGGLE FAVORITES BUTTON", favorites_add_button); - s->addSaveFunc([favorites_add_button, s] { + auto favoritesAddButton = std::make_shared(); + favoritesAddButton->setState(Settings::getInstance()->getBool("FavoritesAddButton")); + s->addWithLabel("ENABLE TOGGLE FAVORITES BUTTON", favoritesAddButton); + s->addSaveFunc([favoritesAddButton, s] { if (Settings::getInstance()->getBool("FavoritesAddButton") != - favorites_add_button->getState()) { - Settings::getInstance()->setBool("FavoritesAddButton", - favorites_add_button->getState()); + favoritesAddButton->getState()) { + Settings::getInstance()->setBool("FavoritesAddButton", favoritesAddButton->getState()); s->setNeedsSaving(); } }); // Enable the thumbstick click buttons for jumping to a random system or game. - auto random_add_button = std::make_shared(); - random_add_button->setState(Settings::getInstance()->getBool("RandomAddButton")); - s->addWithLabel("ENABLE RANDOM SYSTEM OR GAME BUTTON", random_add_button); - s->addSaveFunc([random_add_button, s] { - if (Settings::getInstance()->getBool("RandomAddButton") != random_add_button->getState()) { - Settings::getInstance()->setBool("RandomAddButton", random_add_button->getState()); + auto randomAddButton = std::make_shared(); + randomAddButton->setState(Settings::getInstance()->getBool("RandomAddButton")); + s->addWithLabel("ENABLE RANDOM SYSTEM OR GAME BUTTON", randomAddButton); + s->addSaveFunc([randomAddButton, s] { + if (Settings::getInstance()->getBool("RandomAddButton") != randomAddButton->getState()) { + Settings::getInstance()->setBool("RandomAddButton", randomAddButton->getState()); s->setNeedsSaving(); } }); // Gamelist filters. - auto gamelist_filters = std::make_shared(); - gamelist_filters->setState(Settings::getInstance()->getBool("GamelistFilters")); - s->addWithLabel("ENABLE GAMELIST FILTERS", gamelist_filters); - s->addSaveFunc([gamelist_filters, s] { - if (Settings::getInstance()->getBool("GamelistFilters") != gamelist_filters->getState()) { - Settings::getInstance()->setBool("GamelistFilters", gamelist_filters->getState()); + auto gamelistFilters = std::make_shared(); + gamelistFilters->setState(Settings::getInstance()->getBool("GamelistFilters")); + s->addWithLabel("ENABLE GAMELIST FILTERS", gamelistFilters); + s->addSaveFunc([gamelistFilters, s] { + if (Settings::getInstance()->getBool("GamelistFilters") != gamelistFilters->getState()) { + Settings::getInstance()->setBool("GamelistFilters", gamelistFilters->getState()); s->setNeedsSaving(); s->setNeedsReloading(); } }); // Quick system select (navigate left/right in gamelist view). - auto quick_system_select = std::make_shared(); - quick_system_select->setState(Settings::getInstance()->getBool("QuickSystemSelect")); - s->addWithLabel("ENABLE QUICK SYSTEM SELECT", quick_system_select); - s->addSaveFunc([quick_system_select, s] { + auto quickSystemSelect = std::make_shared(); + quickSystemSelect->setState(Settings::getInstance()->getBool("QuickSystemSelect")); + s->addWithLabel("ENABLE QUICK SYSTEM SELECT", quickSystemSelect); + s->addSaveFunc([quickSystemSelect, s] { if (Settings::getInstance()->getBool("QuickSystemSelect") != - quick_system_select->getState()) { - Settings::getInstance()->setBool("QuickSystemSelect", quick_system_select->getState()); + quickSystemSelect->getState()) { + Settings::getInstance()->setBool("QuickSystemSelect", quickSystemSelect->getState()); s->setNeedsSaving(); } }); // On-screen help prompts. - auto show_help_prompts = std::make_shared(); - show_help_prompts->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); - s->addWithLabel("DISPLAY ON-SCREEN HELP", show_help_prompts); - s->addSaveFunc([show_help_prompts, s] { - if (Settings::getInstance()->getBool("ShowHelpPrompts") != show_help_prompts->getState()) { - Settings::getInstance()->setBool("ShowHelpPrompts", show_help_prompts->getState()); + auto showHelpPrompts = std::make_shared(); + showHelpPrompts->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); + s->addWithLabel("DISPLAY ON-SCREEN HELP", showHelpPrompts); + s->addSaveFunc([showHelpPrompts, s] { + if (Settings::getInstance()->getBool("ShowHelpPrompts") != showHelpPrompts->getState()) { + Settings::getInstance()->setBool("ShowHelpPrompts", showHelpPrompts->getState()); s->setNeedsSaving(); } }); @@ -708,16 +705,16 @@ void GuiMenu::openUIOptions() ->setOpacity(DISABLED_OPACITY); } if (!selectedSet->second.capabilities.legacyTheme) { - gamelist_view_style->setEnabled(false); - gamelist_view_style->setOpacity(DISABLED_OPACITY); - gamelist_view_style->getParent() - ->getChild(gamelist_view_style->getChildIndex() - 1) + gamelistViewStyle->setEnabled(false); + gamelistViewStyle->setOpacity(DISABLED_OPACITY); + gamelistViewStyle->getParent() + ->getChild(gamelistViewStyle->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); // TEMPORARY - // transition_style->setEnabled(false); - transition_style->setOpacity(DISABLED_OPACITY); - transition_style->getParent() - ->getChild(transition_style->getChildIndex() - 1) + // transitionStyle->setEnabled(false); + transitionStyle->setOpacity(DISABLED_OPACITY); + transitionStyle->getParent() + ->getChild(transitionStyle->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); // Pillarboxes are theme-controlled for newer themes. @@ -735,16 +732,16 @@ void GuiMenu::openUIOptions() ->setOpacity(DISABLED_OPACITY); } else { - gamelist_view_style->setEnabled(true); - gamelist_view_style->setOpacity(1.0f); - gamelist_view_style->getParent() - ->getChild(gamelist_view_style->getChildIndex() - 1) + gamelistViewStyle->setEnabled(true); + gamelistViewStyle->setOpacity(1.0f); + gamelistViewStyle->getParent() + ->getChild(gamelistViewStyle->getChildIndex() - 1) ->setOpacity(1.0f); - transition_style->setEnabled(true); - transition_style->setOpacity(1.0f); - transition_style->getParent() - ->getChild(transition_style->getChildIndex() - 1) + transitionStyle->setEnabled(true); + transitionStyle->setOpacity(1.0f); + transitionStyle->getParent() + ->getChild(transitionStyle->getChildIndex() - 1) ->setOpacity(1.0f); gamelistVideoPillarbox->setEnabled(true); @@ -762,7 +759,7 @@ void GuiMenu::openUIOptions() }; scrollThemeSetFunc(selectedSet->first, true); - theme_set->setCallback(scrollThemeSetFunc); + themeSet->setCallback(scrollThemeSetFunc); s->setSize(mSize); mWindow->pushGui(s); @@ -781,7 +778,7 @@ void GuiMenu::openSoundOptions() // audio volume done by the operating system. And we don't really need this object laying // around anyway as it's only used here. VolumeControl volumeControl; - int currentVolume = volumeControl.getVolume(); + int currentVolume {volumeControl.getVolume()}; auto systemVolume = std::make_shared(0.f, 100.f, 1.f, "%"); systemVolume->setValue(static_cast(currentVolume)); @@ -796,29 +793,29 @@ void GuiMenu::openSoundOptions() #endif // Volume for navigation sounds. - auto sound_volume_navigation = std::make_shared(0.f, 100.f, 1.f, "%"); - sound_volume_navigation->setValue( + auto soundVolumeNavigation = std::make_shared(0.f, 100.f, 1.f, "%"); + soundVolumeNavigation->setValue( static_cast(Settings::getInstance()->getInt("SoundVolumeNavigation"))); - s->addWithLabel("NAVIGATION SOUNDS VOLUME", sound_volume_navigation); - s->addSaveFunc([sound_volume_navigation, s] { - if (sound_volume_navigation->getValue() != + s->addWithLabel("NAVIGATION SOUNDS VOLUME", soundVolumeNavigation); + s->addSaveFunc([soundVolumeNavigation, s] { + if (soundVolumeNavigation->getValue() != static_cast(Settings::getInstance()->getInt("SoundVolumeNavigation"))) { Settings::getInstance()->setInt("SoundVolumeNavigation", - static_cast(sound_volume_navigation->getValue())); + static_cast(soundVolumeNavigation->getValue())); s->setNeedsSaving(); } }); // Volume for videos. - auto sound_volume_videos = std::make_shared(0.f, 100.f, 1.f, "%"); - sound_volume_videos->setValue( + auto soundVolumeVideos = std::make_shared(0.f, 100.f, 1.f, "%"); + soundVolumeVideos->setValue( static_cast(Settings::getInstance()->getInt("SoundVolumeVideos"))); - s->addWithLabel("VIDEO PLAYER VOLUME", sound_volume_videos); - s->addSaveFunc([sound_volume_videos, s] { - if (sound_volume_videos->getValue() != + s->addWithLabel("VIDEO PLAYER VOLUME", soundVolumeVideos); + s->addSaveFunc([soundVolumeVideos, s] { + if (soundVolumeVideos->getValue() != static_cast(Settings::getInstance()->getInt("SoundVolumeVideos"))) { Settings::getInstance()->setInt("SoundVolumeVideos", - static_cast(sound_volume_videos->getValue())); + static_cast(soundVolumeVideos->getValue())); s->setNeedsSaving(); } }); @@ -837,41 +834,39 @@ void GuiMenu::openSoundOptions() }); // Play audio for media viewer videos. - auto media_viewer_video_audio = std::make_shared(); - media_viewer_video_audio->setState( - Settings::getInstance()->getBool("MediaViewerVideoAudio")); - s->addWithLabel("PLAY AUDIO FOR MEDIA VIEWER VIDEOS", media_viewer_video_audio); - s->addSaveFunc([media_viewer_video_audio, s] { - if (media_viewer_video_audio->getState() != + auto mediaViewerVideoAudio = std::make_shared(); + mediaViewerVideoAudio->setState(Settings::getInstance()->getBool("MediaViewerVideoAudio")); + s->addWithLabel("PLAY AUDIO FOR MEDIA VIEWER VIDEOS", mediaViewerVideoAudio); + s->addSaveFunc([mediaViewerVideoAudio, s] { + if (mediaViewerVideoAudio->getState() != Settings::getInstance()->getBool("MediaViewerVideoAudio")) { Settings::getInstance()->setBool("MediaViewerVideoAudio", - media_viewer_video_audio->getState()); + mediaViewerVideoAudio->getState()); s->setNeedsSaving(); } }); // Play audio for screensaver videos. - auto screensaver_video_audio = std::make_shared(); - screensaver_video_audio->setState( - Settings::getInstance()->getBool("ScreensaverVideoAudio")); - s->addWithLabel("PLAY AUDIO FOR SCREENSAVER VIDEOS", screensaver_video_audio); - s->addSaveFunc([screensaver_video_audio, s] { - if (screensaver_video_audio->getState() != + auto screensaverVideoAudio = std::make_shared(); + screensaverVideoAudio->setState(Settings::getInstance()->getBool("ScreensaverVideoAudio")); + s->addWithLabel("PLAY AUDIO FOR SCREENSAVER VIDEOS", screensaverVideoAudio); + s->addSaveFunc([screensaverVideoAudio, s] { + if (screensaverVideoAudio->getState() != Settings::getInstance()->getBool("ScreensaverVideoAudio")) { Settings::getInstance()->setBool("ScreensaverVideoAudio", - screensaver_video_audio->getState()); + screensaverVideoAudio->getState()); s->setNeedsSaving(); } }); // Navigation sounds. - auto navigation_sounds = std::make_shared(); - navigation_sounds->setState(Settings::getInstance()->getBool("NavigationSounds")); - s->addWithLabel("ENABLE NAVIGATION SOUNDS", navigation_sounds); - s->addSaveFunc([navigation_sounds, s] { - if (navigation_sounds->getState() != + auto navigationSounds = std::make_shared(); + navigationSounds->setState(Settings::getInstance()->getBool("NavigationSounds")); + s->addWithLabel("ENABLE NAVIGATION SOUNDS", navigationSounds); + s->addSaveFunc([navigationSounds, s] { + if (navigationSounds->getState() != Settings::getInstance()->getBool("NavigationSounds")) { - Settings::getInstance()->setBool("NavigationSounds", navigation_sounds->getState()); + Settings::getInstance()->setBool("NavigationSounds", navigationSounds->getState()); s->setNeedsSaving(); } }); @@ -886,53 +881,53 @@ void GuiMenu::openInputDeviceOptions() auto s = new GuiSettings("INPUT DEVICE SETTINGS"); // Controller type. - auto input_controller_type = std::make_shared>( + auto inputControllerType = std::make_shared>( getHelpStyle(), "CONTROLLER TYPE", false); - std::string selectedPlayer = Settings::getInstance()->getString("InputControllerType"); - input_controller_type->add("XBOX", "xbox", selectedPlayer == "xbox"); - input_controller_type->add("XBOX 360", "xbox360", selectedPlayer == "xbox360"); - input_controller_type->add("PLAYSTATION 4", "ps4", selectedPlayer == "ps4"); - input_controller_type->add("PLAYSTATION 5", "ps5", selectedPlayer == "ps5"); - input_controller_type->add("SNES", "snes", selectedPlayer == "snes"); + std::string selectedPlayer {Settings::getInstance()->getString("InputControllerType")}; + inputControllerType->add("XBOX", "xbox", selectedPlayer == "xbox"); + inputControllerType->add("XBOX 360", "xbox360", selectedPlayer == "xbox360"); + inputControllerType->add("PLAYSTATION 4", "ps4", selectedPlayer == "ps4"); + inputControllerType->add("PLAYSTATION 5", "ps5", selectedPlayer == "ps5"); + inputControllerType->add("SNES", "snes", selectedPlayer == "snes"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the controller type to "xbox" in this case. - if (input_controller_type->getSelectedObjects().size() == 0) - input_controller_type->selectEntry(0); - s->addWithLabel("CONTROLLER TYPE", input_controller_type); - s->addSaveFunc([input_controller_type, s] { - if (input_controller_type->getSelected() != + if (inputControllerType->getSelectedObjects().size() == 0) + inputControllerType->selectEntry(0); + s->addWithLabel("CONTROLLER TYPE", inputControllerType); + s->addSaveFunc([inputControllerType, s] { + if (inputControllerType->getSelected() != Settings::getInstance()->getString("InputControllerType")) { Settings::getInstance()->setString("InputControllerType", - input_controller_type->getSelected()); + inputControllerType->getSelected()); s->setNeedsReloadHelpPrompts(); s->setNeedsSaving(); } }); // Whether to only accept input from the first controller. - auto input_only_first_controller = std::make_shared(); - input_only_first_controller->setState( + auto inputOnlyFirstController = std::make_shared(); + inputOnlyFirstController->setState( Settings::getInstance()->getBool("InputOnlyFirstController")); - s->addWithLabel("ONLY ACCEPT INPUT FROM FIRST CONTROLLER", input_only_first_controller); - s->addSaveFunc([input_only_first_controller, s] { + s->addWithLabel("ONLY ACCEPT INPUT FROM FIRST CONTROLLER", inputOnlyFirstController); + s->addSaveFunc([inputOnlyFirstController, s] { if (Settings::getInstance()->getBool("InputOnlyFirstController") != - input_only_first_controller->getState()) { + inputOnlyFirstController->getState()) { Settings::getInstance()->setBool("InputOnlyFirstController", - input_only_first_controller->getState()); + inputOnlyFirstController->getState()); s->setNeedsSaving(); } }); // Configure keyboard and controllers. - ComponentListRow configure_input_row; - configure_input_row.elements.clear(); - configure_input_row.addElement( + ComponentListRow configureInputRow; + configureInputRow.elements.clear(); + configureInputRow.addElement( std::make_shared("CONFIGURE KEYBOARD AND CONTROLLERS", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); - configure_input_row.addElement(makeArrow(), false); - configure_input_row.makeAcceptInputHandler(std::bind(&GuiMenu::openConfigInput, this, s)); - s->addRow(configure_input_row); + configureInputRow.addElement(makeArrow(), false); + configureInputRow.makeAcceptInputHandler(std::bind(&GuiMenu::openConfigInput, this, s)); + s->addRow(configureInputRow); s->setSize(mSize); mWindow->pushGui(s); @@ -947,11 +942,11 @@ void GuiMenu::openConfigInput(GuiSettings* settings) // the input device settings menu later on. settings->setNeedsSaving(false); - std::string message = "THE KEYBOARD AND CONTROLLERS ARE AUTOMATICALLY\n" - "CONFIGURED, BUT USING THIS CONFIGURATION TOOL\n" - "YOU CAN OVERRIDE THE DEFAULT BUTTON MAPPINGS\n" - "(THIS WILL NOT AFFECT THE HELP PROMPTS)\n" - "CONTINUE?"; + std::string message {"THE KEYBOARD AND CONTROLLERS ARE AUTOMATICALLY\n" + "CONFIGURED, BUT USING THIS CONFIGURATION TOOL\n" + "YOU CAN OVERRIDE THE DEFAULT BUTTON MAPPINGS\n" + "(THIS WILL NOT AFFECT THE HELP PROMPTS)\n" + "CONTINUE?"}; Window* window {mWindow}; window->pushGui(new GuiMsgBox( @@ -977,19 +972,19 @@ void GuiMenu::openOtherOptions() // Game media directory. ComponentListRow rowMediaDir; - auto media_directory = std::make_shared("GAME MEDIA DIRECTORY", - Font::get(FONT_SIZE_MEDIUM), 0x777777FF); + auto mediaDirectory = std::make_shared("GAME MEDIA DIRECTORY", + Font::get(FONT_SIZE_MEDIUM), 0x777777FF); auto bracketMediaDirectory = std::make_shared(); bracketMediaDirectory->setResize( glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); bracketMediaDirectory->setImage(":/graphics/arrow.svg"); - rowMediaDir.addElement(media_directory, true); + rowMediaDir.addElement(mediaDirectory, 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; + 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(); @@ -1015,34 +1010,34 @@ void GuiMenu::openOtherOptions() s->addRow(rowMediaDir); // Maximum VRAM. - auto max_vram = std::make_shared(80.f, 1024.f, 8.f, "MiB"); - max_vram->setValue(static_cast(Settings::getInstance()->getInt("MaxVRAM"))); - s->addWithLabel("VRAM LIMIT", max_vram); - s->addSaveFunc([max_vram, s] { - if (max_vram->getValue() != Settings::getInstance()->getInt("MaxVRAM")) { + auto maxVram = std::make_shared(80.f, 1024.f, 8.f, "MiB"); + maxVram->setValue(static_cast(Settings::getInstance()->getInt("MaxVRAM"))); + s->addWithLabel("VRAM LIMIT", maxVram); + s->addSaveFunc([maxVram, s] { + if (maxVram->getValue() != Settings::getInstance()->getInt("MaxVRAM")) { Settings::getInstance()->setInt("MaxVRAM", - static_cast(std::round(max_vram->getValue()))); + static_cast(std::round(maxVram->getValue()))); s->setNeedsSaving(); } }); // Display/monitor. - auto display_index = std::make_shared>( + auto displayIndex = std::make_shared>( getHelpStyle(), "DISPLAY/MONITOR INDEX", false); - std::vector displayIndex; - displayIndex.push_back("1"); - displayIndex.push_back("2"); - displayIndex.push_back("3"); - displayIndex.push_back("4"); - for (auto it = displayIndex.cbegin(); it != displayIndex.cend(); ++it) - display_index->add(*it, *it, - Settings::getInstance()->getInt("DisplayIndex") == atoi((*it).c_str())); - s->addWithLabel("DISPLAY/MONITOR INDEX (REQUIRES RESTART)", display_index); - s->addSaveFunc([display_index, s] { - if (atoi(display_index->getSelected().c_str()) != + std::vector displayIndexEntry; + displayIndexEntry.push_back("1"); + displayIndexEntry.push_back("2"); + displayIndexEntry.push_back("3"); + displayIndexEntry.push_back("4"); + for (auto it = displayIndexEntry.cbegin(); it != displayIndexEntry.cend(); ++it) + displayIndex->add(*it, *it, + Settings::getInstance()->getInt("DisplayIndex") == atoi((*it).c_str())); + s->addWithLabel("DISPLAY/MONITOR INDEX (REQUIRES RESTART)", displayIndex); + s->addSaveFunc([displayIndex, s] { + if (atoi(displayIndex->getSelected().c_str()) != Settings::getInstance()->getInt("DisplayIndex")) { Settings::getInstance()->setInt("DisplayIndex", - atoi(display_index->getSelected().c_str())); + atoi(displayIndex->getSelected().c_str())); s->setNeedsSaving(); } }); @@ -1077,22 +1072,22 @@ void GuiMenu::openOtherOptions() }); // When to save game metadata. - auto save_gamelist_mode = std::make_shared>( + auto saveGamelistsMode = std::make_shared>( getHelpStyle(), "WHEN TO SAVE METADATA", false); std::vector saveModes; saveModes.push_back("on exit"); saveModes.push_back("always"); saveModes.push_back("never"); for (auto it = saveModes.cbegin(); it != saveModes.cend(); ++it) { - save_gamelist_mode->add(*it, *it, - Settings::getInstance()->getString("SaveGamelistsMode") == *it); + saveGamelistsMode->add(*it, *it, + Settings::getInstance()->getString("SaveGamelistsMode") == *it); } - s->addWithLabel("WHEN TO SAVE GAME METADATA", save_gamelist_mode); - s->addSaveFunc([save_gamelist_mode, s] { - if (save_gamelist_mode->getSelected() != + s->addWithLabel("WHEN TO SAVE GAME METADATA", saveGamelistsMode); + s->addSaveFunc([saveGamelistsMode, s] { + if (saveGamelistsMode->getSelected() != Settings::getInstance()->getString("SaveGamelistsMode")) { Settings::getInstance()->setString("SaveGamelistsMode", - save_gamelist_mode->getSelected()); + saveGamelistsMode->getSelected()); // Always save the gamelist.xml files if switching to "always" as there may // be changes that will otherwise be lost. if (Settings::getInstance()->getString("SaveGamelistsMode") == "always") { @@ -1118,40 +1113,40 @@ void GuiMenu::openOtherOptions() #endif // Run ES in the background when a game has been launched. - auto run_in_background = std::make_shared(); - run_in_background->setState(Settings::getInstance()->getBool("RunInBackground")); - s->addWithLabel("RUN IN BACKGROUND (WHILE GAME IS LAUNCHED)", run_in_background); - s->addSaveFunc([run_in_background, s] { - if (run_in_background->getState() != Settings::getInstance()->getBool("RunInBackground")) { - Settings::getInstance()->setBool("RunInBackground", run_in_background->getState()); + auto runInBackground = std::make_shared(); + runInBackground->setState(Settings::getInstance()->getBool("RunInBackground")); + s->addWithLabel("RUN IN BACKGROUND (WHILE GAME IS LAUNCHED)", runInBackground); + s->addSaveFunc([runInBackground, s] { + if (runInBackground->getState() != Settings::getInstance()->getBool("RunInBackground")) { + Settings::getInstance()->setBool("RunInBackground", runInBackground->getState()); s->setNeedsSaving(); } }); #if defined(VIDEO_HW_DECODING) // Whether to enable hardware decoding for the FFmpeg video player. - auto video_hardware_decoding = std::make_shared(); - video_hardware_decoding->setState(Settings::getInstance()->getBool("VideoHardwareDecoding")); - s->addWithLabel("VIDEO HARDWARE DECODING (EXPERIMENTAL)", video_hardware_decoding); - s->addSaveFunc([video_hardware_decoding, s] { - if (video_hardware_decoding->getState() != + auto videoHardwareDecoding = std::make_shared(); + videoHardwareDecoding->setState(Settings::getInstance()->getBool("VideoHardwareDecoding")); + s->addWithLabel("VIDEO HARDWARE DECODING (EXPERIMENTAL)", videoHardwareDecoding); + s->addSaveFunc([videoHardwareDecoding, s] { + if (videoHardwareDecoding->getState() != Settings::getInstance()->getBool("VideoHardwareDecoding")) { Settings::getInstance()->setBool("VideoHardwareDecoding", - video_hardware_decoding->getState()); + videoHardwareDecoding->getState()); s->setNeedsSaving(); } }); #endif // Whether to upscale the video frame rate to 60 FPS. - auto video_upscale_frame_rate = std::make_shared(); - video_upscale_frame_rate->setState(Settings::getInstance()->getBool("VideoUpscaleFrameRate")); - s->addWithLabel("UPSCALE VIDEO FRAME RATE TO 60 FPS", video_upscale_frame_rate); - s->addSaveFunc([video_upscale_frame_rate, s] { - if (video_upscale_frame_rate->getState() != + auto videoUpscaleFrameRate = std::make_shared(); + videoUpscaleFrameRate->setState(Settings::getInstance()->getBool("VideoUpscaleFrameRate")); + s->addWithLabel("UPSCALE VIDEO FRAME RATE TO 60 FPS", videoUpscaleFrameRate); + s->addSaveFunc([videoUpscaleFrameRate, s] { + if (videoUpscaleFrameRate->getState() != Settings::getInstance()->getBool("VideoUpscaleFrameRate")) { Settings::getInstance()->setBool("VideoUpscaleFrameRate", - video_upscale_frame_rate->getState()); + videoUpscaleFrameRate->getState()); s->setNeedsSaving(); } }); @@ -1174,86 +1169,86 @@ void GuiMenu::openOtherOptions() }); // Show hidden files. - auto show_hidden_files = std::make_shared(); - show_hidden_files->setState(Settings::getInstance()->getBool("ShowHiddenFiles")); - s->addWithLabel("SHOW HIDDEN FILES AND FOLDERS (REQUIRES RESTART)", show_hidden_files); - s->addSaveFunc([show_hidden_files, s] { - if (show_hidden_files->getState() != Settings::getInstance()->getBool("ShowHiddenFiles")) { - Settings::getInstance()->setBool("ShowHiddenFiles", show_hidden_files->getState()); + auto showHiddenFiles = std::make_shared(); + showHiddenFiles->setState(Settings::getInstance()->getBool("ShowHiddenFiles")); + s->addWithLabel("SHOW HIDDEN FILES AND FOLDERS (REQUIRES RESTART)", showHiddenFiles); + s->addSaveFunc([showHiddenFiles, s] { + if (showHiddenFiles->getState() != Settings::getInstance()->getBool("ShowHiddenFiles")) { + Settings::getInstance()->setBool("ShowHiddenFiles", showHiddenFiles->getState()); s->setNeedsSaving(); } }); // Show hidden games. - auto show_hidden_games = std::make_shared(); - show_hidden_games->setState(Settings::getInstance()->getBool("ShowHiddenGames")); - s->addWithLabel("SHOW HIDDEN GAMES (REQUIRES RESTART)", show_hidden_games); - s->addSaveFunc([show_hidden_games, s] { - if (show_hidden_games->getState() != Settings::getInstance()->getBool("ShowHiddenGames")) { - Settings::getInstance()->setBool("ShowHiddenGames", show_hidden_games->getState()); + auto showHiddenGames = std::make_shared(); + showHiddenGames->setState(Settings::getInstance()->getBool("ShowHiddenGames")); + s->addWithLabel("SHOW HIDDEN GAMES (REQUIRES RESTART)", showHiddenGames); + s->addSaveFunc([showHiddenGames, s] { + if (showHiddenGames->getState() != Settings::getInstance()->getBool("ShowHiddenGames")) { + Settings::getInstance()->setBool("ShowHiddenGames", showHiddenGames->getState()); s->setNeedsSaving(); } }); // Custom event scripts, fired using Scripting::fireEvent(). - auto custom_eventscripts = std::make_shared(); - custom_eventscripts->setState(Settings::getInstance()->getBool("CustomEventScripts")); - s->addWithLabel("ENABLE CUSTOM EVENT SCRIPTS", custom_eventscripts); - s->addSaveFunc([custom_eventscripts, s] { - if (custom_eventscripts->getState() != + auto customEventScripts = std::make_shared(); + customEventScripts->setState(Settings::getInstance()->getBool("CustomEventScripts")); + s->addWithLabel("ENABLE CUSTOM EVENT SCRIPTS", customEventScripts); + s->addSaveFunc([customEventScripts, s] { + if (customEventScripts->getState() != Settings::getInstance()->getBool("CustomEventScripts")) { - Settings::getInstance()->setBool("CustomEventScripts", custom_eventscripts->getState()); + Settings::getInstance()->setBool("CustomEventScripts", customEventScripts->getState()); s->setNeedsSaving(); } }); // Only show ROMs included in the gamelist.xml files. - auto parse_gamelist_only = std::make_shared(); - parse_gamelist_only->setState(Settings::getInstance()->getBool("ParseGamelistOnly")); - s->addWithLabel("ONLY SHOW ROMS FROM GAMELIST.XML FILES", parse_gamelist_only); - s->addSaveFunc([parse_gamelist_only, s] { - if (parse_gamelist_only->getState() != + auto parseGamelistOnly = std::make_shared(); + parseGamelistOnly->setState(Settings::getInstance()->getBool("ParseGamelistOnly")); + s->addWithLabel("ONLY SHOW ROMS FROM GAMELIST.XML FILES", parseGamelistOnly); + s->addSaveFunc([parseGamelistOnly, s] { + if (parseGamelistOnly->getState() != Settings::getInstance()->getBool("ParseGamelistOnly")) { - Settings::getInstance()->setBool("ParseGamelistOnly", parse_gamelist_only->getState()); + Settings::getInstance()->setBool("ParseGamelistOnly", parseGamelistOnly->getState()); s->setNeedsSaving(); } }); #if defined(__unix__) // Whether to disable desktop composition. - auto disable_composition = std::make_shared(); - disable_composition->setState(Settings::getInstance()->getBool("DisableComposition")); - s->addWithLabel("DISABLE DESKTOP COMPOSITION (REQUIRES RESTART)", disable_composition); - s->addSaveFunc([disable_composition, s] { - if (disable_composition->getState() != + auto disableComposition = std::make_shared(); + disableComposition->setState(Settings::getInstance()->getBool("DisableComposition")); + s->addWithLabel("DISABLE DESKTOP COMPOSITION (REQUIRES RESTART)", disableComposition); + s->addSaveFunc([disableComposition, s] { + if (disableComposition->getState() != Settings::getInstance()->getBool("DisableComposition")) { - Settings::getInstance()->setBool("DisableComposition", disable_composition->getState()); + Settings::getInstance()->setBool("DisableComposition", disableComposition->getState()); s->setNeedsSaving(); } }); #endif // GPU statistics overlay. - auto display_gpu_statistics = std::make_shared(); - display_gpu_statistics->setState(Settings::getInstance()->getBool("DisplayGPUStatistics")); - s->addWithLabel("DISPLAY GPU STATISTICS OVERLAY", display_gpu_statistics); - s->addSaveFunc([display_gpu_statistics, s] { - if (display_gpu_statistics->getState() != + auto displayGpuStatistics = std::make_shared(); + displayGpuStatistics->setState(Settings::getInstance()->getBool("DisplayGPUStatistics")); + s->addWithLabel("DISPLAY GPU STATISTICS OVERLAY", displayGpuStatistics); + s->addSaveFunc([displayGpuStatistics, s] { + if (displayGpuStatistics->getState() != Settings::getInstance()->getBool("DisplayGPUStatistics")) { Settings::getInstance()->setBool("DisplayGPUStatistics", - display_gpu_statistics->getState()); + displayGpuStatistics->getState()); s->setNeedsSaving(); } }); // Whether to enable the menu in Kid mode. - auto enable_menu_kid_mode = std::make_shared(); - enable_menu_kid_mode->setState(Settings::getInstance()->getBool("EnableMenuKidMode")); - s->addWithLabel("ENABLE MENU IN KID MODE", enable_menu_kid_mode); - s->addSaveFunc([enable_menu_kid_mode, s] { + auto enableMenuKidMode = std::make_shared(); + enableMenuKidMode->setState(Settings::getInstance()->getBool("EnableMenuKidMode")); + s->addWithLabel("ENABLE MENU IN KID MODE", enableMenuKidMode); + s->addSaveFunc([enableMenuKidMode, s] { if (Settings::getInstance()->getBool("EnableMenuKidMode") != - enable_menu_kid_mode->getState()) { - Settings::getInstance()->setBool("EnableMenuKidMode", enable_menu_kid_mode->getState()); + enableMenuKidMode->getState()) { + Settings::getInstance()->setBool("EnableMenuKidMode", enableMenuKidMode->getState()); s->setNeedsSaving(); } }); @@ -1262,12 +1257,12 @@ void GuiMenu::openOtherOptions() // sense to enable this setting and menu entry for that operating system. #if !defined(__APPLE__) // Whether to show the quit menu with the options to reboot and shutdown the computer. - auto show_quit_menu = std::make_shared(); - show_quit_menu->setState(Settings::getInstance()->getBool("ShowQuitMenu")); - s->addWithLabel("SHOW QUIT MENU (REBOOT AND POWER OFF ENTRIES)", show_quit_menu); - s->addSaveFunc([this, show_quit_menu, s] { - if (show_quit_menu->getState() != Settings::getInstance()->getBool("ShowQuitMenu")) { - Settings::getInstance()->setBool("ShowQuitMenu", show_quit_menu->getState()); + auto showQuitMenu = std::make_shared(); + showQuitMenu->setState(Settings::getInstance()->getBool("ShowQuitMenu")); + s->addWithLabel("SHOW QUIT MENU (REBOOT AND POWER OFF ENTRIES)", showQuitMenu); + s->addSaveFunc([this, showQuitMenu, s] { + if (showQuitMenu->getState() != Settings::getInstance()->getBool("ShowQuitMenu")) { + Settings::getInstance()->setBool("ShowQuitMenu", showQuitMenu->getState()); s->setNeedsSaving(); GuiMenu::close(false); } @@ -1300,7 +1295,7 @@ void GuiMenu::openQuitMenu() auto s = new GuiSettings("QUIT"); Window* window {mWindow}; - HelpStyle style = getHelpStyle(); + HelpStyle style {getHelpStyle()}; ComponentListRow row; @@ -1400,7 +1395,7 @@ void GuiMenu::addEntry(const std::string& name, bool add_arrow, const std::function& func) { - std::shared_ptr font = Font::get(FONT_SIZE_MEDIUM); + std::shared_ptr font {Font::get(FONT_SIZE_MEDIUM)}; // Populate the list. ComponentListRow row; @@ -1436,7 +1431,7 @@ bool GuiMenu::input(InputConfig* config, Input input) if (GuiComponent::input(config, input)) return true; - const bool isStart = config->isMappedTo("start", input); + const bool isStart {config->isMappedTo("start", input)}; if (input.value != 0 && (config->isMappedTo("b", input) || isStart)) { close(isStart); return true; diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index cc4976c18..f0cd19b3f 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -687,11 +687,11 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, mGrid.setEntry(mButtons, glm::ivec2 {0, 5}, true, false, glm::ivec2 {2, 1}); // Resize + center. - float width = std::min(Renderer::getScreenHeight() * 1.05f, Renderer::getScreenWidth() * 0.90f); + float width {std::min(Renderer::getScreenHeight() * 1.05f, Renderer::getScreenWidth() * 0.90f)}; // Set height explicitly to ten rows for the component list. - float height = mList->getRowHeight(0) * 10.0f + mTitle->getSize().y + mSubtitle->getSize().y + - mButtons->getSize().y; + float height {mList->getRowHeight(0) * 10.0f + mTitle->getSize().y + mSubtitle->getSize().y + + mButtons->getSize().y}; setSize(width, height); } @@ -848,9 +848,9 @@ void GuiMetaDataEd::save() void GuiMetaDataEd::fetch() { - GuiScraperSingle* scr = new GuiScraperSingle( + GuiScraperSingle* scr {new GuiScraperSingle( mScraperParams, std::bind(&GuiMetaDataEd::fetchDone, this, std::placeholders::_1), - mSavedMediaAndAborted); + mSavedMediaAndAborted)}; mWindow->pushGui(scr); } @@ -994,7 +994,7 @@ bool GuiMetaDataEd::input(InputConfig* config, Input input) std::vector GuiMetaDataEd::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; prompts.push_back(HelpPrompt("y", "scrape")); prompts.push_back(HelpPrompt("b", "back")); return prompts; diff --git a/es-app/src/guis/GuiOfflineGenerator.cpp b/es-app/src/guis/GuiOfflineGenerator.cpp index 026d099cf..de712f4d5 100644 --- a/es-app/src/guis/GuiOfflineGenerator.cpp +++ b/es-app/src/guis/GuiOfflineGenerator.cpp @@ -254,7 +254,7 @@ void GuiOfflineGenerator::update(int deltaTime) } } else { - std::string errorMessage = mResultMessage + " (" + mGameName + ")"; + std::string errorMessage {mResultMessage + " (" + mGameName + ")"}; mLastErrorVal->setText(errorMessage); LOG(LogInfo) << "GuiOfflineGenerator: " << errorMessage; ++mGamesFailed; @@ -323,6 +323,6 @@ void GuiOfflineGenerator::update(int deltaTime) std::vector GuiOfflineGenerator::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; return prompts; } diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index 347e13d17..2a76e9edf 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -151,7 +151,7 @@ GuiScraperMenu::~GuiScraperMenu() { // Save the scrape flags to the system settings so that they are // remembered throughout the program session. - std::vector sys = mSystems->getSelectedObjects(); + std::vector sys {mSystems->getSelectedObjects()}; for (auto it = SystemData::sSystemVector.cbegin(); // Line break. it != SystemData::sSystemVector.cend(); ++it) { (*it)->setScrapeFlag(false); @@ -167,49 +167,49 @@ void GuiScraperMenu::openAccountOptions() auto s = new GuiSettings("ACCOUNT SETTINGS"); // ScreenScraper username. - auto scraper_username_screenscraper = + auto scraperUsernameScreenScraper = std::make_shared("", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_RIGHT); - s->addEditableTextComponent("SCREENSCRAPER USERNAME", scraper_username_screenscraper, + s->addEditableTextComponent("SCREENSCRAPER USERNAME", scraperUsernameScreenScraper, Settings::getInstance()->getString("ScraperUsernameScreenScraper")); - s->addSaveFunc([scraper_username_screenscraper, s] { - if (scraper_username_screenscraper->getValue() != + s->addSaveFunc([scraperUsernameScreenScraper, s] { + if (scraperUsernameScreenScraper->getValue() != Settings::getInstance()->getString("ScraperUsernameScreenScraper")) { Settings::getInstance()->setString("ScraperUsernameScreenScraper", - scraper_username_screenscraper->getValue()); + scraperUsernameScreenScraper->getValue()); s->setNeedsSaving(); } }); // ScreenScraper password. - auto scraper_password_screenscraper = + auto scraperPasswordScreenScraper = std::make_shared("", Font::get(FONT_SIZE_MEDIUM), 0x777777FF, ALIGN_RIGHT); std::string passwordMasked; if (Settings::getInstance()->getString("ScraperPasswordScreenScraper") != "") { passwordMasked = "********"; - scraper_password_screenscraper->setHiddenValue( + scraperPasswordScreenScraper->setHiddenValue( Settings::getInstance()->getString("ScraperPasswordScreenScraper")); } - s->addEditableTextComponent("SCREENSCRAPER PASSWORD", scraper_password_screenscraper, + s->addEditableTextComponent("SCREENSCRAPER PASSWORD", scraperPasswordScreenScraper, passwordMasked, "", true); - s->addSaveFunc([scraper_password_screenscraper, s] { - if (scraper_password_screenscraper->getHiddenValue() != + s->addSaveFunc([scraperPasswordScreenScraper, s] { + if (scraperPasswordScreenScraper->getHiddenValue() != Settings::getInstance()->getString("ScraperPasswordScreenScraper")) { Settings::getInstance()->setString("ScraperPasswordScreenScraper", - scraper_password_screenscraper->getHiddenValue()); + scraperPasswordScreenScraper->getHiddenValue()); s->setNeedsSaving(); } }); // Whether to use the ScreenScraper account when scraping. - auto scraper_use_account_screenscraper = std::make_shared(); - scraper_use_account_screenscraper->setState( + auto scraperUseAccountScreenScraper = std::make_shared(); + scraperUseAccountScreenScraper->setState( Settings::getInstance()->getBool("ScraperUseAccountScreenScraper")); - s->addWithLabel("USE THIS ACCOUNT FOR SCREENSCRAPER", scraper_use_account_screenscraper); - s->addSaveFunc([scraper_use_account_screenscraper, s] { - if (scraper_use_account_screenscraper->getState() != + s->addWithLabel("USE THIS ACCOUNT FOR SCREENSCRAPER", scraperUseAccountScreenScraper); + s->addSaveFunc([scraperUseAccountScreenScraper, s] { + if (scraperUseAccountScreenScraper->getState() != Settings::getInstance()->getBool("ScraperUseAccountScreenScraper")) { Settings::getInstance()->setBool("ScraperUseAccountScreenScraper", - scraper_use_account_screenscraper->getState()); + scraperUseAccountScreenScraper->getState()); s->setNeedsSaving(); } }); @@ -222,33 +222,33 @@ void GuiScraperMenu::openContentOptions() auto s = new GuiSettings("CONTENT SETTINGS"); // Scrape game names. - auto scrape_game_names = std::make_shared(); - scrape_game_names->setState(Settings::getInstance()->getBool("ScrapeGameNames")); - s->addWithLabel("GAME NAMES", scrape_game_names); - s->addSaveFunc([scrape_game_names, s] { - if (scrape_game_names->getState() != Settings::getInstance()->getBool("ScrapeGameNames")) { - Settings::getInstance()->setBool("ScrapeGameNames", scrape_game_names->getState()); + auto scrapeGameNames = std::make_shared(); + scrapeGameNames->setState(Settings::getInstance()->getBool("ScrapeGameNames")); + s->addWithLabel("GAME NAMES", scrapeGameNames); + s->addSaveFunc([scrapeGameNames, s] { + if (scrapeGameNames->getState() != Settings::getInstance()->getBool("ScrapeGameNames")) { + Settings::getInstance()->setBool("ScrapeGameNames", scrapeGameNames->getState()); s->setNeedsSaving(); } }); // Scrape ratings. - auto scrape_ratings = std::make_shared(); - scrape_ratings->setState(Settings::getInstance()->getBool("ScrapeRatings")); - s->addWithLabel("RATINGS", scrape_ratings); - s->addSaveFunc([scrape_ratings, s] { - if (scrape_ratings->getState() != Settings::getInstance()->getBool("ScrapeRatings")) { - Settings::getInstance()->setBool("ScrapeRatings", scrape_ratings->getState()); + auto scrapeRatings = std::make_shared(); + scrapeRatings->setState(Settings::getInstance()->getBool("ScrapeRatings")); + s->addWithLabel("RATINGS", scrapeRatings); + s->addSaveFunc([scrapeRatings, s] { + if (scrapeRatings->getState() != Settings::getInstance()->getBool("ScrapeRatings")) { + Settings::getInstance()->setBool("ScrapeRatings", scrapeRatings->getState()); s->setNeedsSaving(); } }); // Ratings are not supported by TheGamesDB, so gray out the option if this scraper is selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scrape_ratings->setEnabled(false); - scrape_ratings->setOpacity(DISABLED_OPACITY); - scrape_ratings->getParent() - ->getChild(scrape_ratings->getChildIndex() - 1) + scrapeRatings->setEnabled(false); + scrapeRatings->setOpacity(DISABLED_OPACITY); + scrapeRatings->getParent() + ->getChild(scrapeRatings->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } @@ -275,44 +275,44 @@ void GuiScraperMenu::openContentOptions() } // Scrape other metadata. - auto scrape_metadata = std::make_shared(); - scrape_metadata->setState(Settings::getInstance()->getBool("ScrapeMetadata")); - s->addWithLabel("OTHER METADATA", scrape_metadata); - s->addSaveFunc([scrape_metadata, s] { - if (scrape_metadata->getState() != Settings::getInstance()->getBool("ScrapeMetadata")) { - Settings::getInstance()->setBool("ScrapeMetadata", scrape_metadata->getState()); + auto scrapeMetadata = std::make_shared(); + scrapeMetadata->setState(Settings::getInstance()->getBool("ScrapeMetadata")); + s->addWithLabel("OTHER METADATA", scrapeMetadata); + s->addSaveFunc([scrapeMetadata, s] { + if (scrapeMetadata->getState() != Settings::getInstance()->getBool("ScrapeMetadata")) { + Settings::getInstance()->setBool("ScrapeMetadata", scrapeMetadata->getState()); s->setNeedsSaving(); } }); // Scrape videos. - auto scrape_videos = std::make_shared(); - scrape_videos->setState(Settings::getInstance()->getBool("ScrapeVideos")); - s->addWithLabel("VIDEOS", scrape_videos); - s->addSaveFunc([scrape_videos, s] { - if (scrape_videos->getState() != Settings::getInstance()->getBool("ScrapeVideos")) { - Settings::getInstance()->setBool("ScrapeVideos", scrape_videos->getState()); + auto scrapeVideos = std::make_shared(); + scrapeVideos->setState(Settings::getInstance()->getBool("ScrapeVideos")); + s->addWithLabel("VIDEOS", scrapeVideos); + s->addSaveFunc([scrapeVideos, s] { + if (scrapeVideos->getState() != Settings::getInstance()->getBool("ScrapeVideos")) { + Settings::getInstance()->setBool("ScrapeVideos", scrapeVideos->getState()); s->setNeedsSaving(); } }); // Videos are not supported by TheGamesDB, so gray out the option if this scraper is selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scrape_videos->setEnabled(false); - scrape_videos->setOpacity(DISABLED_OPACITY); - scrape_videos->getParent() - ->getChild(scrape_videos->getChildIndex() - 1) + scrapeVideos->setEnabled(false); + scrapeVideos->setOpacity(DISABLED_OPACITY); + scrapeVideos->getParent() + ->getChild(scrapeVideos->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } // Scrape screenshots images. - auto scrape_screenshots = std::make_shared(); - scrape_screenshots->setState(Settings::getInstance()->getBool("ScrapeScreenshots")); - s->addWithLabel("SCREENSHOT IMAGES", scrape_screenshots); - s->addSaveFunc([scrape_screenshots, s] { - if (scrape_screenshots->getState() != + auto scrapeScreenshots = std::make_shared(); + scrapeScreenshots->setState(Settings::getInstance()->getBool("ScrapeScreenshots")); + s->addWithLabel("SCREENSHOT IMAGES", scrapeScreenshots); + s->addSaveFunc([scrapeScreenshots, s] { + if (scrapeScreenshots->getState() != Settings::getInstance()->getBool("ScrapeScreenshots")) { - Settings::getInstance()->setBool("ScrapeScreenshots", scrape_screenshots->getState()); + Settings::getInstance()->setBool("ScrapeScreenshots", scrapeScreenshots->getState()); s->setNeedsSaving(); } }); @@ -330,12 +330,12 @@ void GuiScraperMenu::openContentOptions() }); // Scrape box cover images. - auto scrape_covers = std::make_shared(); - scrape_covers->setState(Settings::getInstance()->getBool("ScrapeCovers")); - s->addWithLabel("BOX COVER IMAGES", scrape_covers); - s->addSaveFunc([scrape_covers, s] { - if (scrape_covers->getState() != Settings::getInstance()->getBool("ScrapeCovers")) { - Settings::getInstance()->setBool("ScrapeCovers", scrape_covers->getState()); + auto scrapeCovers = std::make_shared(); + scrapeCovers->setState(Settings::getInstance()->getBool("ScrapeCovers")); + s->addWithLabel("BOX COVER IMAGES", scrapeCovers); + s->addSaveFunc([scrapeCovers, s] { + if (scrapeCovers->getState() != Settings::getInstance()->getBool("ScrapeCovers")) { + Settings::getInstance()->setBool("ScrapeCovers", scrapeCovers->getState()); s->setNeedsSaving(); } }); @@ -352,23 +352,23 @@ void GuiScraperMenu::openContentOptions() }); // Scrape marquee images. - auto scrape_marquees = std::make_shared(); - scrape_marquees->setState(Settings::getInstance()->getBool("ScrapeMarquees")); - s->addWithLabel("MARQUEE (WHEEL) IMAGES", scrape_marquees); - s->addSaveFunc([scrape_marquees, s] { - if (scrape_marquees->getState() != Settings::getInstance()->getBool("ScrapeMarquees")) { - Settings::getInstance()->setBool("ScrapeMarquees", scrape_marquees->getState()); + auto scrapeMarquees = std::make_shared(); + scrapeMarquees->setState(Settings::getInstance()->getBool("ScrapeMarquees")); + s->addWithLabel("MARQUEE (WHEEL) IMAGES", scrapeMarquees); + s->addSaveFunc([scrapeMarquees, s] { + if (scrapeMarquees->getState() != Settings::getInstance()->getBool("ScrapeMarquees")) { + Settings::getInstance()->setBool("ScrapeMarquees", scrapeMarquees->getState()); s->setNeedsSaving(); } }); // Scrape 3D box images. - auto scrape_3dboxes = std::make_shared(); - scrape_3dboxes->setState(Settings::getInstance()->getBool("Scrape3DBoxes")); - s->addWithLabel("3D BOX IMAGES", scrape_3dboxes); - s->addSaveFunc([scrape_3dboxes, s] { - if (scrape_3dboxes->getState() != Settings::getInstance()->getBool("Scrape3DBoxes")) { - Settings::getInstance()->setBool("Scrape3DBoxes", scrape_3dboxes->getState()); + auto scrape3dBoxes = std::make_shared(); + scrape3dBoxes->setState(Settings::getInstance()->getBool("Scrape3DBoxes")); + s->addWithLabel("3D BOX IMAGES", scrape3dBoxes); + s->addSaveFunc([scrape3dBoxes, s] { + if (scrape3dBoxes->getState() != Settings::getInstance()->getBool("Scrape3DBoxes")) { + Settings::getInstance()->setBool("Scrape3DBoxes", scrape3dBoxes->getState()); s->setNeedsSaving(); } }); @@ -376,10 +376,10 @@ void GuiScraperMenu::openContentOptions() // 3D box images are not supported by TheGamesDB, so gray out the option if this scraper // is selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scrape_3dboxes->setEnabled(false); - scrape_3dboxes->setOpacity(DISABLED_OPACITY); - scrape_3dboxes->getParent() - ->getChild(scrape_3dboxes->getChildIndex() - 1) + scrape3dBoxes->setEnabled(false); + scrape3dBoxes->setOpacity(DISABLED_OPACITY); + scrape3dBoxes->getParent() + ->getChild(scrape3dBoxes->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } @@ -425,42 +425,42 @@ void GuiScraperMenu::openMiximageOptions() auto s = new GuiSettings("MIXIMAGE SETTINGS"); // Miximage resolution. - auto miximage_resolution = std::make_shared>( + auto miximageResolution = std::make_shared>( getHelpStyle(), "MIXIMAGE RESOLUTION", false); - std::string selectedResolution = Settings::getInstance()->getString("MiximageResolution"); - miximage_resolution->add("1280x960", "1280x960", selectedResolution == "1280x960"); - miximage_resolution->add("1920x1440", "1920x1440", selectedResolution == "1920x1440"); - miximage_resolution->add("640x480", "640x480", selectedResolution == "640x480"); + std::string selectedResolution {Settings::getInstance()->getString("MiximageResolution")}; + miximageResolution->add("1280x960", "1280x960", selectedResolution == "1280x960"); + miximageResolution->add("1920x1440", "1920x1440", selectedResolution == "1920x1440"); + miximageResolution->add("640x480", "640x480", selectedResolution == "640x480"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the resolution to "1280x960" in this case. - if (miximage_resolution->getSelectedObjects().size() == 0) - miximage_resolution->selectEntry(0); - s->addWithLabel("MIXIMAGE RESOLUTION", miximage_resolution); - s->addSaveFunc([miximage_resolution, s] { - if (miximage_resolution->getSelected() != + if (miximageResolution->getSelectedObjects().size() == 0) + miximageResolution->selectEntry(0); + s->addWithLabel("MIXIMAGE RESOLUTION", miximageResolution); + s->addSaveFunc([miximageResolution, s] { + if (miximageResolution->getSelected() != Settings::getInstance()->getString("MiximageResolution")) { Settings::getInstance()->setString("MiximageResolution", - miximage_resolution->getSelected()); + miximageResolution->getSelected()); s->setNeedsSaving(); } }); // Screenshot scaling method. - auto miximage_scaling = std::make_shared>( + auto miximageScaling = std::make_shared>( getHelpStyle(), "SCREENSHOT SCALING", false); - std::string selectedScaling = Settings::getInstance()->getString("MiximageScreenshotScaling"); - miximage_scaling->add("sharp", "sharp", selectedScaling == "sharp"); - miximage_scaling->add("smooth", "smooth", selectedScaling == "smooth"); + std::string selectedScaling {Settings::getInstance()->getString("MiximageScreenshotScaling")}; + miximageScaling->add("sharp", "sharp", selectedScaling == "sharp"); + miximageScaling->add("smooth", "smooth", selectedScaling == "smooth"); // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the scaling method to "sharp" in this case. - if (miximage_scaling->getSelectedObjects().size() == 0) - miximage_scaling->selectEntry(0); - s->addWithLabel("SCREENSHOT SCALING METHOD", miximage_scaling); - s->addSaveFunc([miximage_scaling, s] { - if (miximage_scaling->getSelected() != + if (miximageScaling->getSelectedObjects().size() == 0) + miximageScaling->selectEntry(0); + s->addWithLabel("SCREENSHOT SCALING METHOD", miximageScaling); + s->addSaveFunc([miximageScaling, s] { + if (miximageScaling->getSelected() != Settings::getInstance()->getString("MiximageScreenshotScaling")) { Settings::getInstance()->setString("MiximageScreenshotScaling", - miximage_scaling->getSelected()); + miximageScaling->getSelected()); s->setNeedsSaving(); } }); @@ -468,7 +468,7 @@ void GuiScraperMenu::openMiximageOptions() // Box/cover size. auto miximageBoxSize = std::make_shared>(getHelpStyle(), "BOX SIZE", false); - std::string selectedBoxSize = Settings::getInstance()->getString("MiximageBoxSize"); + std::string selectedBoxSize {Settings::getInstance()->getString("MiximageBoxSize")}; miximageBoxSize->add("small", "small", selectedBoxSize == "small"); miximageBoxSize->add("medium", "medium", selectedBoxSize == "medium"); miximageBoxSize->add("large", "large", selectedBoxSize == "large"); @@ -488,8 +488,8 @@ void GuiScraperMenu::openMiximageOptions() // Physical media size. auto miximagePhysicalMediaSize = std::make_shared>( getHelpStyle(), "PHYSICAL MEDIA SIZE", false); - std::string selectedPhysicalMediaSize = - Settings::getInstance()->getString("MiximagePhysicalMediaSize"); + std::string selectedPhysicalMediaSize { + Settings::getInstance()->getString("MiximagePhysicalMediaSize")}; miximagePhysicalMediaSize->add("small", "small", selectedPhysicalMediaSize == "small"); miximagePhysicalMediaSize->add("medium", "medium", selectedPhysicalMediaSize == "medium"); miximagePhysicalMediaSize->add("large", "large", selectedPhysicalMediaSize == "large"); @@ -508,50 +508,52 @@ void GuiScraperMenu::openMiximageOptions() }); // Whether to generate miximages when scraping. - auto miximage_generate = std::make_shared(); - miximage_generate->setState(Settings::getInstance()->getBool("MiximageGenerate")); - s->addWithLabel("GENERATE MIXIMAGES WHEN SCRAPING", miximage_generate); - s->addSaveFunc([miximage_generate, s] { - if (miximage_generate->getState() != Settings::getInstance()->getBool("MiximageGenerate")) { - Settings::getInstance()->setBool("MiximageGenerate", miximage_generate->getState()); + auto miximageGenerate = std::make_shared(); + miximageGenerate->setState(Settings::getInstance()->getBool("MiximageGenerate")); + s->addWithLabel("GENERATE MIXIMAGES WHEN SCRAPING", miximageGenerate); + s->addSaveFunc([miximageGenerate, s] { + if (miximageGenerate->getState() != Settings::getInstance()->getBool("MiximageGenerate")) { + Settings::getInstance()->setBool("MiximageGenerate", miximageGenerate->getState()); s->setNeedsSaving(); } }); // Whether to overwrite miximages (both for the scraper and offline generator). - auto miximage_overwrite = std::make_shared(); - miximage_overwrite->setState(Settings::getInstance()->getBool("MiximageOverwrite")); - s->addWithLabel("OVERWRITE MIXIMAGES (SCRAPER/OFFLINE GENERATOR)", miximage_overwrite); - s->addSaveFunc([miximage_overwrite, s] { - if (miximage_overwrite->getState() != + auto miximageOverwrite = std::make_shared(); + miximageOverwrite->setState(Settings::getInstance()->getBool("MiximageOverwrite")); + s->addWithLabel("OVERWRITE MIXIMAGES (SCRAPER/OFFLINE GENERATOR)", miximageOverwrite); + s->addSaveFunc([miximageOverwrite, s] { + if (miximageOverwrite->getState() != Settings::getInstance()->getBool("MiximageOverwrite")) { - Settings::getInstance()->setBool("MiximageOverwrite", miximage_overwrite->getState()); + Settings::getInstance()->setBool("MiximageOverwrite", miximageOverwrite->getState()); s->setNeedsSaving(); } }); // Whether to remove letterboxes from the screenshots. - auto remove_letterboxes = std::make_shared(); - remove_letterboxes->setState(Settings::getInstance()->getBool("MiximageRemoveLetterboxes")); - s->addWithLabel("REMOVE LETTERBOXES FROM SCREENSHOTS", remove_letterboxes); - s->addSaveFunc([remove_letterboxes, s] { - if (remove_letterboxes->getState() != + auto miximageRemoveLetterboxes = std::make_shared(); + miximageRemoveLetterboxes->setState( + Settings::getInstance()->getBool("MiximageRemoveLetterboxes")); + s->addWithLabel("REMOVE LETTERBOXES FROM SCREENSHOTS", miximageRemoveLetterboxes); + s->addSaveFunc([miximageRemoveLetterboxes, s] { + if (miximageRemoveLetterboxes->getState() != Settings::getInstance()->getBool("MiximageRemoveLetterboxes")) { Settings::getInstance()->setBool("MiximageRemoveLetterboxes", - remove_letterboxes->getState()); + miximageRemoveLetterboxes->getState()); s->setNeedsSaving(); } }); // Whether to remove pillarboxes from the screenshots. - auto remove_pillarboxes = std::make_shared(); - remove_pillarboxes->setState(Settings::getInstance()->getBool("MiximageRemovePillarboxes")); - s->addWithLabel("REMOVE PILLARBOXES FROM SCREENSHOTS", remove_pillarboxes); - s->addSaveFunc([remove_pillarboxes, s] { - if (remove_pillarboxes->getState() != + auto miximageRemovePillarboxes = std::make_shared(); + miximageRemovePillarboxes->setState( + Settings::getInstance()->getBool("MiximageRemovePillarboxes")); + s->addWithLabel("REMOVE PILLARBOXES FROM SCREENSHOTS", miximageRemovePillarboxes); + s->addSaveFunc([miximageRemovePillarboxes, s] { + if (miximageRemovePillarboxes->getState() != Settings::getInstance()->getBool("MiximageRemovePillarboxes")) { Settings::getInstance()->setBool("MiximageRemovePillarboxes", - remove_pillarboxes->getState()); + miximageRemovePillarboxes->getState()); s->setNeedsSaving(); } }); @@ -571,67 +573,68 @@ void GuiScraperMenu::openMiximageOptions() }); // Whether to include marquee images. - auto miximage_marquee = std::make_shared(); - miximage_marquee->setState(Settings::getInstance()->getBool("MiximageIncludeMarquee")); - s->addWithLabel("INCLUDE MARQUEE IMAGE", miximage_marquee); - s->addSaveFunc([miximage_marquee, s] { - if (miximage_marquee->getState() != + auto miximageIncludeMarquee = std::make_shared(); + miximageIncludeMarquee->setState(Settings::getInstance()->getBool("MiximageIncludeMarquee")); + s->addWithLabel("INCLUDE MARQUEE IMAGE", miximageIncludeMarquee); + s->addSaveFunc([miximageIncludeMarquee, s] { + if (miximageIncludeMarquee->getState() != Settings::getInstance()->getBool("MiximageIncludeMarquee")) { Settings::getInstance()->setBool("MiximageIncludeMarquee", - miximage_marquee->getState()); + miximageIncludeMarquee->getState()); s->setNeedsSaving(); } }); // Whether to include box images. - auto miximage_box = std::make_shared(); - miximage_box->setState(Settings::getInstance()->getBool("MiximageIncludeBox")); - s->addWithLabel("INCLUDE BOX IMAGE", miximage_box); - s->addSaveFunc([miximage_box, s] { - if (miximage_box->getState() != Settings::getInstance()->getBool("MiximageIncludeBox")) { - Settings::getInstance()->setBool("MiximageIncludeBox", miximage_box->getState()); + auto miximageIncludeBox = std::make_shared(); + miximageIncludeBox->setState(Settings::getInstance()->getBool("MiximageIncludeBox")); + s->addWithLabel("INCLUDE BOX IMAGE", miximageIncludeBox); + s->addSaveFunc([miximageIncludeBox, s] { + if (miximageIncludeBox->getState() != + Settings::getInstance()->getBool("MiximageIncludeBox")) { + Settings::getInstance()->setBool("MiximageIncludeBox", miximageIncludeBox->getState()); s->setNeedsSaving(); } }); // Whether to use cover image if there is no 3D box image. - auto miximage_cover_fallback = std::make_shared(); - miximage_cover_fallback->setState(Settings::getInstance()->getBool("MiximageCoverFallback")); - s->addWithLabel("USE COVER IMAGE IF 3D BOX IS MISSING", miximage_cover_fallback); - s->addSaveFunc([miximage_cover_fallback, s] { - if (miximage_cover_fallback->getState() != + auto miximageCoverFallback = std::make_shared(); + miximageCoverFallback->setState(Settings::getInstance()->getBool("MiximageCoverFallback")); + s->addWithLabel("USE COVER IMAGE IF 3D BOX IS MISSING", miximageCoverFallback); + s->addSaveFunc([miximageCoverFallback, s] { + if (miximageCoverFallback->getState() != Settings::getInstance()->getBool("MiximageCoverFallback")) { Settings::getInstance()->setBool("MiximageCoverFallback", - miximage_cover_fallback->getState()); + miximageCoverFallback->getState()); s->setNeedsSaving(); } }); // Whether to include physical media images. - auto miximagePhysicalMedia = std::make_shared(); - miximagePhysicalMedia->setState( + auto miximageIncludePhysicalMedia = std::make_shared(); + miximageIncludePhysicalMedia->setState( Settings::getInstance()->getBool("MiximageIncludePhysicalMedia")); - s->addWithLabel("INCLUDE PHYSICAL MEDIA IMAGE", miximagePhysicalMedia); - s->addSaveFunc([miximagePhysicalMedia, s] { - if (miximagePhysicalMedia->getState() != + s->addWithLabel("INCLUDE PHYSICAL MEDIA IMAGE", miximageIncludePhysicalMedia); + s->addSaveFunc([miximageIncludePhysicalMedia, s] { + if (miximageIncludePhysicalMedia->getState() != Settings::getInstance()->getBool("MiximageIncludePhysicalMedia")) { Settings::getInstance()->setBool("MiximageIncludePhysicalMedia", - miximagePhysicalMedia->getState()); + miximageIncludePhysicalMedia->getState()); s->setNeedsSaving(); } }); // Miximage offline generator. - ComponentListRow offline_generator_row; - offline_generator_row.elements.clear(); - offline_generator_row.addElement(std::make_shared("OFFLINE GENERATOR", - Font::get(FONT_SIZE_MEDIUM), - 0x777777FF), - true); - offline_generator_row.addElement(makeArrow(), false); - offline_generator_row.makeAcceptInputHandler( + ComponentListRow offlineGeneratorRow; + offlineGeneratorRow.elements.clear(); + offlineGeneratorRow.addElement(std::make_shared("OFFLINE GENERATOR", + Font::get(FONT_SIZE_MEDIUM), + 0x777777FF), + true); + offlineGeneratorRow.addElement(makeArrow(), false); + offlineGeneratorRow.makeAcceptInputHandler( std::bind(&GuiScraperMenu::openOfflineGenerator, this, s)); - s->addRow(offline_generator_row); + s->addRow(offlineGeneratorRow); mWindow->pushGui(s); } @@ -655,10 +658,10 @@ void GuiScraperMenu::openOfflineGenerator(GuiSettings* settings) // Build the queue of games to process. std::queue gameQueue; - std::vector systems = mSystems->getSelectedObjects(); + std::vector systems {mSystems->getSelectedObjects()}; for (auto sys = systems.cbegin(); sys != systems.cend(); ++sys) { - std::vector games = (*sys)->getRootFolder()->getChildrenRecursive(); + std::vector games {(*sys)->getRootFolder()->getChildrenRecursive()}; // Sort the games by "filename, ascending". std::stable_sort(games.begin(), games.end(), FileSorts::SortTypes.at(0).comparisonFunction); @@ -675,71 +678,71 @@ void GuiScraperMenu::openOtherOptions() auto s = new GuiSettings("OTHER SETTINGS"); // Scraper region. - auto scraper_region = + auto scraperRegion = std::make_shared>(getHelpStyle(), "REGION", false); - std::string selectedScraperRegion = Settings::getInstance()->getString("ScraperRegion"); + std::string selectedScraperRegion {Settings::getInstance()->getString("ScraperRegion")}; // clang-format off - scraper_region->add("Europe", "eu", selectedScraperRegion == "eu"); - scraper_region->add("Japan", "jp", selectedScraperRegion == "jp"); - scraper_region->add("USA", "us", selectedScraperRegion == "us"); - scraper_region->add("World", "wor", selectedScraperRegion == "wor"); + scraperRegion->add("Europe", "eu", selectedScraperRegion == "eu"); + scraperRegion->add("Japan", "jp", selectedScraperRegion == "jp"); + scraperRegion->add("USA", "us", selectedScraperRegion == "us"); + scraperRegion->add("World", "wor", selectedScraperRegion == "wor"); // clang-format on // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the region to "Europe" in this case. - if (scraper_region->getSelectedObjects().size() == 0) - scraper_region->selectEntry(0); - s->addWithLabel("REGION", scraper_region); - s->addSaveFunc([scraper_region, s] { - if (scraper_region->getSelected() != Settings::getInstance()->getString("ScraperRegion")) { - Settings::getInstance()->setString("ScraperRegion", scraper_region->getSelected()); + if (scraperRegion->getSelectedObjects().size() == 0) + scraperRegion->selectEntry(0); + s->addWithLabel("REGION", scraperRegion); + s->addSaveFunc([scraperRegion, s] { + if (scraperRegion->getSelected() != Settings::getInstance()->getString("ScraperRegion")) { + Settings::getInstance()->setString("ScraperRegion", scraperRegion->getSelected()); s->setNeedsSaving(); } }); // Regions are not supported by TheGamesDB, so gray out the option if this scraper is selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scraper_region->setEnabled(false); - scraper_region->setOpacity(DISABLED_OPACITY); - scraper_region->getParent() - ->getChild(scraper_region->getChildIndex() - 1) + scraperRegion->setEnabled(false); + scraperRegion->setOpacity(DISABLED_OPACITY); + scraperRegion->getParent() + ->getChild(scraperRegion->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } // Scraper language. - auto scraper_language = std::make_shared>( + auto scraperLanguage = std::make_shared>( getHelpStyle(), "PREFERRED LANGUAGE", false); - std::string selectedScraperLanguage = Settings::getInstance()->getString("ScraperLanguage"); + std::string selectedScraperLanguage {Settings::getInstance()->getString("ScraperLanguage")}; // clang-format off - scraper_language->add("English", "en", selectedScraperLanguage == "en"); - scraper_language->add("Español", "es", selectedScraperLanguage == "es"); - scraper_language->add("Português", "pt", selectedScraperLanguage == "pt"); - scraper_language->add("Français", "fr", selectedScraperLanguage == "fr"); - scraper_language->add("Deutsch", "de", selectedScraperLanguage == "de"); - scraper_language->add("Italiano", "it", selectedScraperLanguage == "it"); - scraper_language->add("Nederlands", "nl", selectedScraperLanguage == "nl"); - scraper_language->add("日本語", "ja", selectedScraperLanguage == "ja"); - scraper_language->add("简体中文", "zh", selectedScraperLanguage == "zh"); - scraper_language->add("한국어", "ko", selectedScraperLanguage == "ko"); - scraper_language->add("Русский", "ru", selectedScraperLanguage == "ru"); - scraper_language->add("Dansk", "da", selectedScraperLanguage == "da"); - scraper_language->add("Suomi", "fi", selectedScraperLanguage == "fi"); - scraper_language->add("Svenska", "sv", selectedScraperLanguage == "sv"); - scraper_language->add("Magyar", "hu", selectedScraperLanguage == "hu"); - scraper_language->add("Norsk", "no", selectedScraperLanguage == "no"); - scraper_language->add("Polski", "pl", selectedScraperLanguage == "pl"); - scraper_language->add("Čeština", "cz", selectedScraperLanguage == "cz"); - scraper_language->add("Slovenčina", "sk", selectedScraperLanguage == "sk"); - scraper_language->add("Türkçe", "tr", selectedScraperLanguage == "tr"); + scraperLanguage->add("English", "en", selectedScraperLanguage == "en"); + scraperLanguage->add("Español", "es", selectedScraperLanguage == "es"); + scraperLanguage->add("Português", "pt", selectedScraperLanguage == "pt"); + scraperLanguage->add("Français", "fr", selectedScraperLanguage == "fr"); + scraperLanguage->add("Deutsch", "de", selectedScraperLanguage == "de"); + scraperLanguage->add("Italiano", "it", selectedScraperLanguage == "it"); + scraperLanguage->add("Nederlands", "nl", selectedScraperLanguage == "nl"); + scraperLanguage->add("日本語", "ja", selectedScraperLanguage == "ja"); + scraperLanguage->add("简体中文", "zh", selectedScraperLanguage == "zh"); + scraperLanguage->add("한국어", "ko", selectedScraperLanguage == "ko"); + scraperLanguage->add("Русский", "ru", selectedScraperLanguage == "ru"); + scraperLanguage->add("Dansk", "da", selectedScraperLanguage == "da"); + scraperLanguage->add("Suomi", "fi", selectedScraperLanguage == "fi"); + scraperLanguage->add("Svenska", "sv", selectedScraperLanguage == "sv"); + scraperLanguage->add("Magyar", "hu", selectedScraperLanguage == "hu"); + scraperLanguage->add("Norsk", "no", selectedScraperLanguage == "no"); + scraperLanguage->add("Polski", "pl", selectedScraperLanguage == "pl"); + scraperLanguage->add("Čeština", "cz", selectedScraperLanguage == "cz"); + scraperLanguage->add("Slovenčina", "sk", selectedScraperLanguage == "sk"); + scraperLanguage->add("Türkçe", "tr", selectedScraperLanguage == "tr"); // clang-format on // If there are no objects returned, then there must be a manually modified entry in the // configuration file. Simply set the language to "English" in this case. - if (scraper_language->getSelectedObjects().size() == 0) - scraper_language->selectEntry(0); - s->addWithLabel("PREFERRED LANGUAGE", scraper_language); - s->addSaveFunc([scraper_language, s] { - if (scraper_language->getSelected() != + if (scraperLanguage->getSelectedObjects().size() == 0) + scraperLanguage->selectEntry(0); + s->addWithLabel("PREFERRED LANGUAGE", scraperLanguage); + s->addSaveFunc([scraperLanguage, s] { + if (scraperLanguage->getSelected() != Settings::getInstance()->getString("ScraperLanguage")) { - Settings::getInstance()->setString("ScraperLanguage", scraper_language->getSelected()); + Settings::getInstance()->setString("ScraperLanguage", scraperLanguage->getSelected()); s->setNeedsSaving(); } }); @@ -747,135 +750,135 @@ void GuiScraperMenu::openOtherOptions() // Languages are not supported by TheGamesDB, so gray out the option if this scraper is // selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scraper_language->setEnabled(false); - scraper_language->setOpacity(DISABLED_OPACITY); - scraper_language->getParent() - ->getChild(scraper_language->getChildIndex() - 1) + scraperLanguage->setEnabled(false); + scraperLanguage->setOpacity(DISABLED_OPACITY); + scraperLanguage->getParent() + ->getChild(scraperLanguage->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } // Overwrite files and data. - auto scraper_overwrite_data = std::make_shared(); - scraper_overwrite_data->setState(Settings::getInstance()->getBool("ScraperOverwriteData")); - s->addWithLabel("OVERWRITE FILES AND DATA", scraper_overwrite_data); - s->addSaveFunc([scraper_overwrite_data, s] { - if (scraper_overwrite_data->getState() != + auto scraperOverwriteData = std::make_shared(); + scraperOverwriteData->setState(Settings::getInstance()->getBool("ScraperOverwriteData")); + s->addWithLabel("OVERWRITE FILES AND DATA", scraperOverwriteData); + s->addSaveFunc([scraperOverwriteData, s] { + if (scraperOverwriteData->getState() != Settings::getInstance()->getBool("ScraperOverwriteData")) { Settings::getInstance()->setBool("ScraperOverwriteData", - scraper_overwrite_data->getState()); + scraperOverwriteData->getState()); s->setNeedsSaving(); } }); // Halt scraping on invalid media files. - auto scraper_halt_on_invalid_media = std::make_shared(); - scraper_halt_on_invalid_media->setState( + auto scraperHaltOnInvalidMedia = std::make_shared(); + scraperHaltOnInvalidMedia->setState( Settings::getInstance()->getBool("ScraperHaltOnInvalidMedia")); - s->addWithLabel("HALT ON INVALID MEDIA FILES", scraper_halt_on_invalid_media); - s->addSaveFunc([scraper_halt_on_invalid_media, s] { - if (scraper_halt_on_invalid_media->getState() != + s->addWithLabel("HALT ON INVALID MEDIA FILES", scraperHaltOnInvalidMedia); + s->addSaveFunc([scraperHaltOnInvalidMedia, s] { + if (scraperHaltOnInvalidMedia->getState() != Settings::getInstance()->getBool("ScraperHaltOnInvalidMedia")) { Settings::getInstance()->setBool("ScraperHaltOnInvalidMedia", - scraper_halt_on_invalid_media->getState()); + scraperHaltOnInvalidMedia->getState()); s->setNeedsSaving(); } }); // Search using metadata names. - auto scraper_search_metadata_name = std::make_shared(); - scraper_search_metadata_name->setState( + auto scraperSearchMetadataName = std::make_shared(); + scraperSearchMetadataName->setState( Settings::getInstance()->getBool("ScraperSearchMetadataName")); - s->addWithLabel("SEARCH USING METADATA NAMES", scraper_search_metadata_name); - s->addSaveFunc([scraper_search_metadata_name, s] { - if (scraper_search_metadata_name->getState() != + s->addWithLabel("SEARCH USING METADATA NAMES", scraperSearchMetadataName); + s->addSaveFunc([scraperSearchMetadataName, s] { + if (scraperSearchMetadataName->getState() != Settings::getInstance()->getBool("ScraperSearchMetadataName")) { Settings::getInstance()->setBool("ScraperSearchMetadataName", - scraper_search_metadata_name->getState()); + scraperSearchMetadataName->getState()); s->setNeedsSaving(); } }); // Include actual folders when scraping. - auto scraper_include_folders = std::make_shared(); - scraper_include_folders->setState(Settings::getInstance()->getBool("ScraperIncludeFolders")); - s->addWithLabel("SCRAPE ACTUAL FOLDERS", scraper_include_folders); - s->addSaveFunc([scraper_include_folders, s] { - if (scraper_include_folders->getState() != + auto scraperIncludeFolders = std::make_shared(); + scraperIncludeFolders->setState(Settings::getInstance()->getBool("ScraperIncludeFolders")); + s->addWithLabel("SCRAPE ACTUAL FOLDERS", scraperIncludeFolders); + s->addSaveFunc([scraperIncludeFolders, s] { + if (scraperIncludeFolders->getState() != Settings::getInstance()->getBool("ScraperIncludeFolders")) { Settings::getInstance()->setBool("ScraperIncludeFolders", - scraper_include_folders->getState()); + scraperIncludeFolders->getState()); s->setNeedsSaving(); } }); // Interactive scraping. - auto scraper_interactive = std::make_shared(); - scraper_interactive->setState(Settings::getInstance()->getBool("ScraperInteractive")); - s->addWithLabel("INTERACTIVE MODE", scraper_interactive); - s->addSaveFunc([scraper_interactive, s] { - if (scraper_interactive->getState() != + auto scraperInteractive = std::make_shared(); + scraperInteractive->setState(Settings::getInstance()->getBool("ScraperInteractive")); + s->addWithLabel("INTERACTIVE MODE", scraperInteractive); + s->addSaveFunc([scraperInteractive, s] { + if (scraperInteractive->getState() != Settings::getInstance()->getBool("ScraperInteractive")) { - Settings::getInstance()->setBool("ScraperInteractive", scraper_interactive->getState()); + Settings::getInstance()->setBool("ScraperInteractive", scraperInteractive->getState()); s->setNeedsSaving(); } }); // Semi-automatic scraping. - auto scraper_semiautomatic = std::make_shared(); - scraper_semiautomatic->setState(Settings::getInstance()->getBool("ScraperSemiautomatic")); - s->addWithLabel("AUTO-ACCEPT SINGLE GAME MATCHES", scraper_semiautomatic); - s->addSaveFunc([scraper_semiautomatic, s] { - if (scraper_semiautomatic->getState() != + auto scraperSemiautomatic = std::make_shared(); + scraperSemiautomatic->setState(Settings::getInstance()->getBool("ScraperSemiautomatic")); + s->addWithLabel("AUTO-ACCEPT SINGLE GAME MATCHES", scraperSemiautomatic); + s->addSaveFunc([scraperSemiautomatic, s] { + if (scraperSemiautomatic->getState() != Settings::getInstance()->getBool("ScraperSemiautomatic")) { Settings::getInstance()->setBool("ScraperSemiautomatic", - scraper_semiautomatic->getState()); + scraperSemiautomatic->getState()); s->setNeedsSaving(); } }); // If interactive mode is set to off, then gray out this option. if (!Settings::getInstance()->getBool("ScraperInteractive")) { - scraper_semiautomatic->setEnabled(false); - scraper_semiautomatic->setOpacity(DISABLED_OPACITY); - scraper_semiautomatic->getParent() - ->getChild(scraper_semiautomatic->getChildIndex() - 1) + scraperSemiautomatic->setEnabled(false); + scraperSemiautomatic->setOpacity(DISABLED_OPACITY); + scraperSemiautomatic->getParent() + ->getChild(scraperSemiautomatic->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } // Respect the per-file multi-scraper exclusion flag. - auto scraper_respect_exclusions = std::make_shared(); - scraper_respect_exclusions->setState( + auto scraperRespectExclusions = std::make_shared(); + scraperRespectExclusions->setState( Settings::getInstance()->getBool("ScraperRespectExclusions")); - s->addWithLabel("RESPECT PER-FILE SCRAPER EXCLUSIONS", scraper_respect_exclusions); - s->addSaveFunc([scraper_respect_exclusions, s] { - if (scraper_respect_exclusions->getState() != + s->addWithLabel("RESPECT PER-FILE SCRAPER EXCLUSIONS", scraperRespectExclusions); + s->addSaveFunc([scraperRespectExclusions, s] { + if (scraperRespectExclusions->getState() != Settings::getInstance()->getBool("ScraperRespectExclusions")) { Settings::getInstance()->setBool("ScraperRespectExclusions", - scraper_respect_exclusions->getState()); + scraperRespectExclusions->getState()); s->setNeedsSaving(); } }); // Exclude files recursively for excluded folders. - auto scraper_exclude_recursively = std::make_shared(); - scraper_exclude_recursively->setState( + auto scraperExcludeRecursively = std::make_shared(); + scraperExcludeRecursively->setState( Settings::getInstance()->getBool("ScraperExcludeRecursively")); - s->addWithLabel("EXCLUDE FOLDERS RECURSIVELY", scraper_exclude_recursively); - s->addSaveFunc([scraper_exclude_recursively, s] { - if (scraper_exclude_recursively->getState() != + s->addWithLabel("EXCLUDE FOLDERS RECURSIVELY", scraperExcludeRecursively); + s->addSaveFunc([scraperExcludeRecursively, s] { + if (scraperExcludeRecursively->getState() != Settings::getInstance()->getBool("ScraperExcludeRecursively")) { Settings::getInstance()->setBool("ScraperExcludeRecursively", - scraper_exclude_recursively->getState()); + scraperExcludeRecursively->getState()); s->setNeedsSaving(); } }); // If respecting excluded files is set to off, then gray out this option. if (!Settings::getInstance()->getBool("ScraperRespectExclusions")) { - scraper_exclude_recursively->setEnabled(false); - scraper_exclude_recursively->setOpacity(DISABLED_OPACITY); - scraper_exclude_recursively->getParent() - ->getChild(scraper_exclude_recursively->getChildIndex() - 1) + scraperExcludeRecursively->setEnabled(false); + scraperExcludeRecursively->setOpacity(DISABLED_OPACITY); + scraperExcludeRecursively->getParent() + ->getChild(scraperExcludeRecursively->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } @@ -916,15 +919,15 @@ void GuiScraperMenu::openOtherOptions() } // Retry search on peer verification errors (TLS/certificate issues). - auto retry_peer_verification = std::make_shared(); - retry_peer_verification->setState( + auto scraperRetryPeerVerification = std::make_shared(); + scraperRetryPeerVerification->setState( Settings::getInstance()->getBool("ScraperRetryPeerVerification")); - s->addWithLabel("AUTO-RETRY ON PEER VERIFICATION ERRORS", retry_peer_verification); - s->addSaveFunc([retry_peer_verification, s] { - if (retry_peer_verification->getState() != + s->addWithLabel("AUTO-RETRY ON PEER VERIFICATION ERRORS", scraperRetryPeerVerification); + s->addSaveFunc([scraperRetryPeerVerification, s] { + if (scraperRetryPeerVerification->getState() != Settings::getInstance()->getBool("ScraperRetryPeerVerification")) { Settings::getInstance()->setBool("ScraperRetryPeerVerification", - retry_peer_verification->getState()); + scraperRetryPeerVerification->getState()); s->setNeedsSaving(); } }); @@ -932,50 +935,50 @@ void GuiScraperMenu::openOtherOptions() // The TLS/certificate issue is not present for TheGamesDB, so gray out the option if this // scraper is selected. if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - retry_peer_verification->setEnabled(false); - retry_peer_verification->setOpacity(DISABLED_OPACITY); - retry_peer_verification->getParent() - ->getChild(retry_peer_verification->getChildIndex() - 1) + scraperRetryPeerVerification->setEnabled(false); + scraperRetryPeerVerification->setOpacity(DISABLED_OPACITY); + scraperRetryPeerVerification->getParent() + ->getChild(scraperRetryPeerVerification->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } // Switch callbacks. - auto interactiveToggleFunc = [scraper_semiautomatic]() { - if (scraper_semiautomatic->getEnabled()) { - scraper_semiautomatic->setEnabled(false); - scraper_semiautomatic->setOpacity(DISABLED_OPACITY); - scraper_semiautomatic->getParent() - ->getChild(scraper_semiautomatic->getChildIndex() - 1) + auto interactiveToggleFunc = [scraperSemiautomatic]() { + if (scraperSemiautomatic->getEnabled()) { + scraperSemiautomatic->setEnabled(false); + scraperSemiautomatic->setOpacity(DISABLED_OPACITY); + scraperSemiautomatic->getParent() + ->getChild(scraperSemiautomatic->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } else { - scraper_semiautomatic->setEnabled(true); - scraper_semiautomatic->setOpacity(1.0f); - scraper_semiautomatic->getParent() - ->getChild(scraper_semiautomatic->getChildIndex() - 1) + scraperSemiautomatic->setEnabled(true); + scraperSemiautomatic->setOpacity(1.0f); + scraperSemiautomatic->getParent() + ->getChild(scraperSemiautomatic->getChildIndex() - 1) ->setOpacity(1.0f); } }; - auto excludeRecursivelyToggleFunc = [scraper_exclude_recursively]() { - if (scraper_exclude_recursively->getEnabled()) { - scraper_exclude_recursively->setEnabled(false); - scraper_exclude_recursively->setOpacity(DISABLED_OPACITY); - scraper_exclude_recursively->getParent() - ->getChild(scraper_exclude_recursively->getChildIndex() - 1) + auto excludeRecursivelyToggleFunc = [scraperExcludeRecursively]() { + if (scraperExcludeRecursively->getEnabled()) { + scraperExcludeRecursively->setEnabled(false); + scraperExcludeRecursively->setOpacity(DISABLED_OPACITY); + scraperExcludeRecursively->getParent() + ->getChild(scraperExcludeRecursively->getChildIndex() - 1) ->setOpacity(DISABLED_OPACITY); } else { - scraper_exclude_recursively->setEnabled(true); - scraper_exclude_recursively->setOpacity(1.0f); - scraper_exclude_recursively->getParent() - ->getChild(scraper_exclude_recursively->getChildIndex() - 1) + scraperExcludeRecursively->setEnabled(true); + scraperExcludeRecursively->setOpacity(1.0f); + scraperExcludeRecursively->getParent() + ->getChild(scraperExcludeRecursively->getChildIndex() - 1) ->setOpacity(1.0f); } }; - scraper_interactive->setCallback(interactiveToggleFunc); - scraper_respect_exclusions->setCallback(excludeRecursivelyToggleFunc); + scraperInteractive->setCallback(interactiveToggleFunc); + scraperRespectExclusions->setCallback(excludeRecursivelyToggleFunc); mWindow->pushGui(s); } @@ -987,7 +990,7 @@ void GuiScraperMenu::pressedStart() if (mScraper->getSelected() != Settings::getInstance()->getString("Scraper")) mMenu.save(); - std::vector sys = mSystems->getSelectedObjects(); + std::vector sys {mSystems->getSelectedObjects()}; for (auto it = sys.cbegin(); it != sys.cend(); ++it) { if ((*it)->getPlatformIds().empty()) { std::string warningString; @@ -1019,8 +1022,8 @@ void GuiScraperMenu::start() return; } - bool contentToScrape = false; - std::string scraperService = Settings::getInstance()->getString("Scraper"); + bool contentToScrape {false}; + std::string scraperService {Settings::getInstance()->getString("Scraper")}; // Check if there is actually any type of content selected for scraping. do { @@ -1096,8 +1099,8 @@ void GuiScraperMenu::start() new GuiMsgBox(getHelpStyle(), "ALL GAMES WERE FILTERED, NOTHING TO SCRAPE")); } else { - GuiScraperMulti* gsm = - new GuiScraperMulti(searches, Settings::getInstance()->getBool("ScraperInteractive")); + GuiScraperMulti* gsm { + new GuiScraperMulti(searches, Settings::getInstance()->getBool("ScraperInteractive"))}; mWindow->pushGui(gsm); mMenu.setCursorToList(); mMenu.setCursorToFirstListEntry(); @@ -1109,10 +1112,10 @@ std::queue GuiScraperMenu::getSearches(std::vector queue; for (auto sys = systems.cbegin(); sys != systems.cend(); ++sys) { - std::vector games = (*sys)->getRootFolder()->getScrapeFilesRecursive( + std::vector games {(*sys)->getRootFolder()->getScrapeFilesRecursive( Settings::getInstance()->getBool("ScraperIncludeFolders"), Settings::getInstance()->getBool("ScraperExcludeRecursively"), - Settings::getInstance()->getBool("ScraperRespectExclusions")); + Settings::getInstance()->getBool("ScraperRespectExclusions"))}; for (auto game = games.cbegin(); game != games.cend(); ++game) { if (selector((*sys), (*game))) { ScraperSearchParams search; @@ -1131,7 +1134,7 @@ void GuiScraperMenu::addEntry(const std::string& name, bool add_arrow, const std::function& func) { - std::shared_ptr font = Font::get(FONT_SIZE_MEDIUM); + std::shared_ptr font {Font::get(FONT_SIZE_MEDIUM)}; // Populate the list. ComponentListRow row; @@ -1164,7 +1167,7 @@ bool GuiScraperMenu::input(InputConfig* config, Input input) std::vector GuiScraperMenu::getHelpPrompts() { - std::vector prompts = mMenu.getHelpPrompts(); + std::vector prompts {mMenu.getHelpPrompts()}; prompts.push_back(HelpPrompt("b", "back")); prompts.push_back(HelpPrompt("y", "start")); return prompts; diff --git a/es-app/src/guis/GuiScraperMulti.cpp b/es-app/src/guis/GuiScraperMulti.cpp index 7ed944d66..bcbc9897a 100644 --- a/es-app/src/guis/GuiScraperMulti.cpp +++ b/es-app/src/guis/GuiScraperMulti.cpp @@ -147,13 +147,13 @@ GuiScraperMulti::GuiScraperMulti(const std::queue& searches // Limit the width of the GUI on ultrawide monitors. The 1.778 aspect ratio value is // the 16:9 reference. - float aspectValue = 1.778f / Renderer::getScreenAspectRatio(); - float width = glm::clamp(0.95f * aspectValue, 0.70f, 0.95f) * Renderer::getScreenWidth(); + float aspectValue {1.778f / Renderer::getScreenAspectRatio()}; + float width {glm::clamp(0.95f * aspectValue, 0.70f, 0.95f) * Renderer::getScreenWidth()}; - float height = (mTitle->getFont()->getLetterHeight() + Renderer::getScreenHeight() * 0.0637f) + - mSystem->getFont()->getLetterHeight() + - mSubtitle->getFont()->getHeight() * 1.75f + mButtonGrid->getSize().y + - Font::get(FONT_SIZE_MEDIUM)->getHeight() * 7.0f; + float height {(mTitle->getFont()->getLetterHeight() + Renderer::getScreenHeight() * 0.0637f) + + mSystem->getFont()->getLetterHeight() + + mSubtitle->getFont()->getHeight() * 1.75f + mButtonGrid->getSize().y + + Font::get(FONT_SIZE_MEDIUM)->getHeight() * 7.0f}; // TODO: Temporary hack, see below. height -= 7.0f * Renderer::getScreenHeightModifier(); @@ -308,6 +308,6 @@ void GuiScraperMulti::finish() std::vector GuiScraperMulti::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; return prompts; } diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index 4e89ec41b..f050f95cd 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -80,8 +80,8 @@ GuiScraperSearch::GuiScraperSearch(SearchType type, unsigned int scrapeCount) // Metadata. auto font = Font::get(FONT_SIZE_SMALL); // Placeholder, gets replaced in onSizeChanged(). - const unsigned int mdColor = 0x777777FF; - const unsigned int mdLblColor = 0x666666FF; + const unsigned int mdColor {0x777777FF}; + const unsigned int mdLblColor {0x666666FF}; mMD_Rating = std::make_shared(); mMD_ReleaseDate = std::make_shared(); mMD_ReleaseDate->setColor(mdColor); @@ -118,7 +118,7 @@ GuiScraperSearch::GuiScraperSearch(SearchType type, unsigned int scrapeCount) mMD_Grid = std::make_shared(glm::ivec2 {2, static_cast(mMD_Pairs.size() * 2 - 1)}); - unsigned int i = 0; + unsigned int i {0}; for (auto it = mMD_Pairs.cbegin(); it != mMD_Pairs.cend(); ++it) { mMD_Grid->setEntry(it->first, glm::ivec2 {0, i}, false, true); mMD_Grid->setEntry(it->second, glm::ivec2 {1, i}, false, it->resize); @@ -202,7 +202,7 @@ void GuiScraperSearch::onSizeChanged() else mGrid.setRowHeightPerc(1, 0.505f); - const float thumbnailCellScale = 0.93f; + const float thumbnailCellScale {0.93f}; // Limit thumbnail size using setMaxHeight - we do this instead of letting mGrid // call setSize because it maintains the aspect ratio. @@ -236,12 +236,12 @@ void GuiScraperSearch::resizeMetadata() { mMD_Grid->setSize(mGrid.getColWidth(2), mGrid.getRowHeight(1)); if (mMD_Grid->getSize().y > mMD_Pairs.size()) { - const int fontHeight = static_cast(mMD_Grid->getSize().y / mMD_Pairs.size() * 0.8f); + const int fontHeight {static_cast(mMD_Grid->getSize().y / mMD_Pairs.size() * 0.8f)}; auto fontLbl = Font::get(fontHeight, FONT_PATH_REGULAR); auto fontComp = Font::get(fontHeight, FONT_PATH_LIGHT); // Update label fonts. - float maxLblWidth = 0; + float maxLblWidth {0.0f}; for (auto it = mMD_Pairs.cbegin(); it != mMD_Pairs.cend(); ++it) { it->first->setFont(fontLbl); it->first->setSize(0, 0); @@ -364,7 +364,7 @@ void GuiScraperSearch::onSearchDone(std::vector& results) mResultList->setLoopRows(true); auto font = Font::get(FONT_SIZE_MEDIUM); - unsigned int color = 0x777777FF; + unsigned int color {0x777777FF}; if (results.empty()) { // Check if the scraper used is still valid. if (!isValidConfiguredScraper()) { @@ -393,7 +393,7 @@ void GuiScraperSearch::onSearchDone(std::vector& results) // If the platform IDs returned by the scraper do not match the platform IDs of the // scraped game, then add the additional platform information to the end of the game // name (within square brackets). - std::string gameName = results.at(i).mdl.get("name"); + std::string gameName {results.at(i).mdl.get("name")}; std::string otherPlatforms; // As the platform names are found via reverse lookup there could be multiple entries. @@ -530,20 +530,20 @@ void GuiScraperSearch::updateInfoPane() i = 0; if (i != -1 && static_cast(mScraperResults.size()) > i) { - ScraperSearchResult& res = mScraperResults.at(i); + ScraperSearchResult& res {mScraperResults.at(i)}; mResultName->setText(Utils::String::toUpper(res.mdl.get("name"))); mResultDesc->setText(Utils::String::toUpper(res.mdl.get("desc"))); mDescContainer->reset(); mResultThumbnail->setImage(""); - const std::string& thumb = res.screenshotUrl.empty() ? res.coverUrl : res.screenshotUrl; + const std::string& thumb {res.screenshotUrl.empty() ? res.coverUrl : res.screenshotUrl}; mScraperResults[i].thumbnailImageUrl = thumb; // Cache the thumbnail image in mScraperResults so that we don't need to download // it every time the list is scrolled back and forth. if (mScraperResults[i].thumbnailImageData.size() > 0) { - std::string content = mScraperResults[i].thumbnailImageData; + std::string content {mScraperResults[i].thumbnailImageData}; mResultThumbnail->setImage(content.data(), content.length()); mGrid.onSizeChanged(); // A hack to fix the thumbnail position since its size changed. } @@ -606,7 +606,7 @@ bool GuiScraperSearch::input(InputConfig* config, Input input) // Check whether we should allow a refine of the game name. if (!mAcceptedResult && config->isMappedTo("y", input) && input.value != 0) { - bool allowRefine = false; + bool allowRefine {false}; // Previously refined. if (mRefinedSearch) @@ -824,7 +824,7 @@ void GuiScraperSearch::updateThumbnail() mScraperResults[mResultList->getCursorId()].thumbnailDownloadStatus = COMPLETED; } // Activate the thumbnail in the GUI. - std::string content = mScraperResults[mResultList->getCursorId()].thumbnailImageData; + std::string content {mScraperResults[mResultList->getCursorId()].thumbnailImageData}; if (content.size() > 0) { mResultThumbnail->setImage(content.data(), content.length()); mGrid.onSizeChanged(); // A hack to fix the thumbnail position since its size changed. @@ -920,9 +920,9 @@ bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result, MetaDataList& metadata, FileData* scrapedGame) { - bool metadataUpdated = false; - bool hasDefaultName = false; - std::vector mMetaDataDecl = metadata.getMDD(); + bool metadataUpdated {false}; + bool hasDefaultName {false}; + std::vector mMetaDataDecl {metadata.getMDD()}; std::string defaultName; // Get the default name, which is either the MAME name or the name of the physical file @@ -942,7 +942,7 @@ bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result, if (!mMetaDataDecl.at(i).shouldScrape) continue; - const std::string& key = mMetaDataDecl.at(i).key; + const std::string& key {mMetaDataDecl.at(i).key}; // Skip element if the setting to not scrape metadata has been set, // unless its type is rating, controller or name. diff --git a/es-app/src/guis/GuiScraperSingle.cpp b/es-app/src/guis/GuiScraperSingle.cpp index cb026282f..786f8e40b 100644 --- a/es-app/src/guis/GuiScraperSingle.cpp +++ b/es-app/src/guis/GuiScraperSingle.cpp @@ -153,7 +153,7 @@ void GuiScraperSingle::onSizeChanged() mBackground.fitTo(mSize, glm::vec3 {}, glm::vec2 {-32.0f, -32.0f}); // Add some extra margins to the game name. - const float newSizeX = mSize.x * 0.96f; + const float newSizeX {mSize.x * 0.96f}; mGameName->setSize(newSizeX, mGameName->getSize().y); mGameName->setPosition((mSize.x - newSizeX) / 2.0f, 0.0f); } @@ -185,7 +185,7 @@ void GuiScraperSingle::update(int deltaTime) std::vector GuiScraperSingle::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; prompts.push_back(HelpPrompt("b", "back (cancel)")); return prompts; diff --git a/es-app/src/guis/GuiScreensaverOptions.cpp b/es-app/src/guis/GuiScreensaverOptions.cpp index 905d86c14..323c447db 100644 --- a/es-app/src/guis/GuiScreensaverOptions.cpp +++ b/es-app/src/guis/GuiScreensaverOptions.cpp @@ -20,22 +20,22 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title) : GuiSettings {title} { // Screensaver timer. - auto screensaver_timer = std::make_shared(0.0f, 30.0f, 1.0f, "m"); - screensaver_timer->setValue( + auto screensaverTimer = std::make_shared(0.0f, 30.0f, 1.0f, "m"); + screensaverTimer->setValue( static_cast(Settings::getInstance()->getInt("ScreensaverTimer") / (1000 * 60))); - addWithLabel("START SCREENSAVER AFTER (MINUTES)", screensaver_timer); - addSaveFunc([screensaver_timer, this] { - if (static_cast(std::round(screensaver_timer->getValue()) * (1000 * 60)) != + addWithLabel("START SCREENSAVER AFTER (MINUTES)", screensaverTimer); + addSaveFunc([screensaverTimer, this] { + if (static_cast(std::round(screensaverTimer->getValue()) * (1000 * 60)) != Settings::getInstance()->getInt("ScreensaverTimer")) { Settings::getInstance()->setInt( "ScreensaverTimer", - static_cast(std::round(screensaver_timer->getValue()) * (1000 * 60))); + static_cast(std::round(screensaverTimer->getValue()) * (1000 * 60))); setNeedsSaving(); } }); // Screensaver type. - auto screensaver_type = std::make_shared>( + auto screensaverType = std::make_shared>( getHelpStyle(), "SCREENSAVER TYPE", false); std::vector screensavers; screensavers.push_back("dim"); @@ -43,13 +43,13 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title) screensavers.push_back("slideshow"); screensavers.push_back("video"); for (auto it = screensavers.cbegin(); it != screensavers.cend(); ++it) - screensaver_type->add(*it, *it, - Settings::getInstance()->getString("ScreensaverType") == *it); - addWithLabel("SCREENSAVER TYPE", screensaver_type); - addSaveFunc([screensaver_type, this] { - if (screensaver_type->getSelected() != + screensaverType->add(*it, *it, + Settings::getInstance()->getString("ScreensaverType") == *it); + addWithLabel("SCREENSAVER TYPE", screensaverType); + addSaveFunc([screensaverType, this] { + if (screensaverType->getSelected() != Settings::getInstance()->getString("ScreensaverType")) { - if (screensaver_type->getSelected() == "video") { + if (screensaverType->getSelected() == "video") { // If before it wasn't risky but now there's a risk of problems, show warning. mWindow->pushGui(new GuiMsgBox( getHelpStyle(), @@ -59,20 +59,20 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title) "SCREENSAVER WILL DEFAULT TO 'DIM'", "OK", [] { return; }, "", nullptr, "", nullptr)); } - Settings::getInstance()->setString("ScreensaverType", screensaver_type->getSelected()); + Settings::getInstance()->setString("ScreensaverType", screensaverType->getSelected()); setNeedsSaving(); } }); // Whether to enable screensaver controls. - auto screensaver_controls = std::make_shared(); - screensaver_controls->setState(Settings::getInstance()->getBool("ScreensaverControls")); - addWithLabel("ENABLE SCREENSAVER CONTROLS", screensaver_controls); - addSaveFunc([screensaver_controls, this] { - if (screensaver_controls->getState() != + auto screensaverControls = std::make_shared(); + screensaverControls->setState(Settings::getInstance()->getBool("ScreensaverControls")); + addWithLabel("ENABLE SCREENSAVER CONTROLS", screensaverControls); + addSaveFunc([screensaverControls, this] { + if (screensaverControls->getState() != Settings::getInstance()->getBool("ScreensaverControls")) { Settings::getInstance()->setBool("ScreensaverControls", - screensaver_controls->getState()); + screensaverControls->getState()); setNeedsSaving(); } }); @@ -105,104 +105,103 @@ void GuiScreensaverOptions::openSlideshowScreensaverOptions() auto s = new GuiSettings("SLIDESHOW SCREENSAVER"); // Timer for swapping images (in seconds). - auto screensaver_swap_image_timeout = - std::make_shared(2.0f, 120.0f, 2.0f, "s"); - screensaver_swap_image_timeout->setValue(static_cast( + auto screensaverSwapImageTimeout = std::make_shared(2.0f, 120.0f, 2.0f, "s"); + screensaverSwapImageTimeout->setValue(static_cast( Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") / (1000))); - s->addWithLabel("SWAP IMAGES AFTER (SECONDS)", screensaver_swap_image_timeout); - s->addSaveFunc([screensaver_swap_image_timeout, s] { - if (screensaver_swap_image_timeout->getValue() != + s->addWithLabel("SWAP IMAGES AFTER (SECONDS)", screensaverSwapImageTimeout); + s->addSaveFunc([screensaverSwapImageTimeout, s] { + if (screensaverSwapImageTimeout->getValue() != static_cast(Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") / (1000))) { Settings::getInstance()->setInt( "ScreensaverSwapImageTimeout", - static_cast(std::round(screensaver_swap_image_timeout->getValue()) * (1000))); + static_cast(std::round(screensaverSwapImageTimeout->getValue()) * (1000))); s->setNeedsSaving(); } }); // Stretch images to screen resolution. - auto screensaver_stretch_images = std::make_shared(); - screensaver_stretch_images->setState( + auto screensaverStretchImages = std::make_shared(); + screensaverStretchImages->setState( Settings::getInstance()->getBool("ScreensaverStretchImages")); - s->addWithLabel("STRETCH IMAGES TO SCREEN RESOLUTION", screensaver_stretch_images); - s->addSaveFunc([screensaver_stretch_images, s] { - if (screensaver_stretch_images->getState() != + s->addWithLabel("STRETCH IMAGES TO SCREEN RESOLUTION", screensaverStretchImages); + s->addSaveFunc([screensaverStretchImages, s] { + if (screensaverStretchImages->getState() != Settings::getInstance()->getBool("ScreensaverStretchImages")) { Settings::getInstance()->setBool("ScreensaverStretchImages", - screensaver_stretch_images->getState()); + screensaverStretchImages->getState()); s->setNeedsSaving(); } }); // Show game info overlay for slideshow screensaver. - auto screensaver_slideshow_game_info = std::make_shared(); - screensaver_slideshow_game_info->setState( + auto screensaverSlideshowGameInfo = std::make_shared(); + screensaverSlideshowGameInfo->setState( Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo")); - s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaver_slideshow_game_info); - s->addSaveFunc([screensaver_slideshow_game_info, s] { - if (screensaver_slideshow_game_info->getState() != + s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaverSlideshowGameInfo); + s->addSaveFunc([screensaverSlideshowGameInfo, s] { + if (screensaverSlideshowGameInfo->getState() != Settings::getInstance()->getBool("ScreensaverSlideshowGameInfo")) { Settings::getInstance()->setBool("ScreensaverSlideshowGameInfo", - screensaver_slideshow_game_info->getState()); + screensaverSlideshowGameInfo->getState()); s->setNeedsSaving(); } }); // Render scanlines using a shader. - auto screensaver_slideshow_scanlines = std::make_shared(); - screensaver_slideshow_scanlines->setState( + auto screensaverSlideshowScanlines = std::make_shared(); + screensaverSlideshowScanlines->setState( Settings::getInstance()->getBool("ScreensaverSlideshowScanlines")); - s->addWithLabel("RENDER SCANLINES", screensaver_slideshow_scanlines); - s->addSaveFunc([screensaver_slideshow_scanlines, s] { - if (screensaver_slideshow_scanlines->getState() != + s->addWithLabel("RENDER SCANLINES", screensaverSlideshowScanlines); + s->addSaveFunc([screensaverSlideshowScanlines, s] { + if (screensaverSlideshowScanlines->getState() != Settings::getInstance()->getBool("ScreensaverSlideshowScanlines")) { Settings::getInstance()->setBool("ScreensaverSlideshowScanlines", - screensaver_slideshow_scanlines->getState()); + screensaverSlideshowScanlines->getState()); s->setNeedsSaving(); } }); // Whether to use custom images. - auto screensaver_slideshow_custom_images = std::make_shared(); - screensaver_slideshow_custom_images->setState( + auto screensaverSlideshowCustomImages = std::make_shared(); + screensaverSlideshowCustomImages->setState( Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")); - s->addWithLabel("USE CUSTOM IMAGES", screensaver_slideshow_custom_images); - s->addSaveFunc([screensaver_slideshow_custom_images, s] { - if (screensaver_slideshow_custom_images->getState() != + s->addWithLabel("USE CUSTOM IMAGES", screensaverSlideshowCustomImages); + s->addSaveFunc([screensaverSlideshowCustomImages, s] { + if (screensaverSlideshowCustomImages->getState() != Settings::getInstance()->getBool("ScreensaverSlideshowCustomImages")) { Settings::getInstance()->setBool("ScreensaverSlideshowCustomImages", - screensaver_slideshow_custom_images->getState()); + screensaverSlideshowCustomImages->getState()); s->setNeedsSaving(); } }); // Whether to recurse the custom image directory. - auto screensaver_slideshow_recurse = std::make_shared(); - screensaver_slideshow_recurse->setState( + auto screensaverSlideshowRecurse = std::make_shared(); + screensaverSlideshowRecurse->setState( Settings::getInstance()->getBool("ScreensaverSlideshowRecurse")); - s->addWithLabel("CUSTOM IMAGE DIRECTORY RECURSIVE SEARCH", screensaver_slideshow_recurse); - s->addSaveFunc([screensaver_slideshow_recurse, s] { - if (screensaver_slideshow_recurse->getState() != + s->addWithLabel("CUSTOM IMAGE DIRECTORY RECURSIVE SEARCH", screensaverSlideshowRecurse); + s->addSaveFunc([screensaverSlideshowRecurse, s] { + if (screensaverSlideshowRecurse->getState() != Settings::getInstance()->getBool("ScreensaverSlideshowRecurse")) { Settings::getInstance()->setBool("ScreensaverSlideshowRecurse", - screensaver_slideshow_recurse->getState()); + screensaverSlideshowRecurse->getState()); s->setNeedsSaving(); } }); // Custom image directory. - auto screensaver_slideshow_image_dir = + auto screensaverSlideshowImageDir = std::make_shared("", Font::get(FONT_SIZE_SMALL), 0x777777FF, ALIGN_RIGHT); s->addEditableTextComponent( - "CUSTOM IMAGE DIRECTORY", screensaver_slideshow_image_dir, + "CUSTOM IMAGE DIRECTORY", screensaverSlideshowImageDir, Settings::getInstance()->getString("ScreensaverSlideshowImageDir"), Settings::getInstance()->getDefaultString("ScreensaverSlideshowImageDir")); - s->addSaveFunc([screensaver_slideshow_image_dir, s] { - if (screensaver_slideshow_image_dir->getValue() != + s->addSaveFunc([screensaverSlideshowImageDir, s] { + if (screensaverSlideshowImageDir->getValue() != Settings::getInstance()->getString("ScreensaverSlideshowImageDir")) { Settings::getInstance()->setString("ScreensaverSlideshowImageDir", - screensaver_slideshow_image_dir->getValue()); + screensaverSlideshowImageDir->getValue()); s->setNeedsSaving(); } }); @@ -216,73 +215,72 @@ void GuiScreensaverOptions::openVideoScreensaverOptions() auto s = new GuiSettings("VIDEO SCREENSAVER"); // Timer for swapping videos (in seconds). - auto screensaver_swap_video_timeout = - std::make_shared(0.0f, 120.0f, 2.0f, "s"); - screensaver_swap_video_timeout->setValue(static_cast( + auto screensaverSwapVideoTimeout = std::make_shared(0.0f, 120.0f, 2.0f, "s"); + screensaverSwapVideoTimeout->setValue(static_cast( Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") / (1000))); - s->addWithLabel("SWAP VIDEOS AFTER (SECONDS)", screensaver_swap_video_timeout); - s->addSaveFunc([screensaver_swap_video_timeout, s] { - if (screensaver_swap_video_timeout->getValue() != + s->addWithLabel("SWAP VIDEOS AFTER (SECONDS)", screensaverSwapVideoTimeout); + s->addSaveFunc([screensaverSwapVideoTimeout, s] { + if (screensaverSwapVideoTimeout->getValue() != static_cast(Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") / (1000))) { Settings::getInstance()->setInt( "ScreensaverSwapVideoTimeout", - static_cast(std::round(screensaver_swap_video_timeout->getValue()) * (1000))); + static_cast(std::round(screensaverSwapVideoTimeout->getValue()) * (1000))); s->setNeedsSaving(); } }); // Stretch videos to screen resolution. - auto screensaver_stretch_videos = std::make_shared(); - screensaver_stretch_videos->setState( + auto screensaverStretchVideos = std::make_shared(); + screensaverStretchVideos->setState( Settings::getInstance()->getBool("ScreensaverStretchVideos")); - s->addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", screensaver_stretch_videos); - s->addSaveFunc([screensaver_stretch_videos, s] { - if (screensaver_stretch_videos->getState() != + s->addWithLabel("STRETCH VIDEOS TO SCREEN RESOLUTION", screensaverStretchVideos); + s->addSaveFunc([screensaverStretchVideos, s] { + if (screensaverStretchVideos->getState() != Settings::getInstance()->getBool("ScreensaverStretchVideos")) { Settings::getInstance()->setBool("ScreensaverStretchVideos", - screensaver_stretch_videos->getState()); + screensaverStretchVideos->getState()); s->setNeedsSaving(); } }); // Show game info overlay for video screensaver. - auto screensaver_video_game_info = std::make_shared(); - screensaver_video_game_info->setState( + auto screensaverVideoGameInfo = std::make_shared(); + screensaverVideoGameInfo->setState( Settings::getInstance()->getBool("ScreensaverVideoGameInfo")); - s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaver_video_game_info); - s->addSaveFunc([screensaver_video_game_info, s] { - if (screensaver_video_game_info->getState() != + s->addWithLabel("DISPLAY GAME INFO OVERLAY", screensaverVideoGameInfo); + s->addSaveFunc([screensaverVideoGameInfo, s] { + if (screensaverVideoGameInfo->getState() != Settings::getInstance()->getBool("ScreensaverVideoGameInfo")) { Settings::getInstance()->setBool("ScreensaverVideoGameInfo", - screensaver_video_game_info->getState()); + screensaverVideoGameInfo->getState()); s->setNeedsSaving(); } }); // Render scanlines using a shader. - auto screensaver_video_scanlines = std::make_shared(); - screensaver_video_scanlines->setState( + auto screensaverVideoScanlines = std::make_shared(); + screensaverVideoScanlines->setState( Settings::getInstance()->getBool("ScreensaverVideoScanlines")); - s->addWithLabel("RENDER SCANLINES", screensaver_video_scanlines); - s->addSaveFunc([screensaver_video_scanlines, s] { - if (screensaver_video_scanlines->getState() != + s->addWithLabel("RENDER SCANLINES", screensaverVideoScanlines); + s->addSaveFunc([screensaverVideoScanlines, s] { + if (screensaverVideoScanlines->getState() != Settings::getInstance()->getBool("ScreensaverVideoScanlines")) { Settings::getInstance()->setBool("ScreensaverVideoScanlines", - screensaver_video_scanlines->getState()); + screensaverVideoScanlines->getState()); s->setNeedsSaving(); } }); // Render blur using a shader. - auto screensaver_video_blur = std::make_shared(); - screensaver_video_blur->setState(Settings::getInstance()->getBool("ScreensaverVideoBlur")); - s->addWithLabel("RENDER BLUR", screensaver_video_blur); - s->addSaveFunc([screensaver_video_blur, s] { - if (screensaver_video_blur->getState() != + auto screensaverVideoBlur = std::make_shared(); + screensaverVideoBlur->setState(Settings::getInstance()->getBool("ScreensaverVideoBlur")); + s->addWithLabel("RENDER BLUR", screensaverVideoBlur); + s->addSaveFunc([screensaverVideoBlur, s] { + if (screensaverVideoBlur->getState() != Settings::getInstance()->getBool("ScreensaverVideoBlur")) { Settings::getInstance()->setBool("ScreensaverVideoBlur", - screensaver_video_blur->getState()); + screensaverVideoBlur->getState()); s->setNeedsSaving(); } }); diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index 306288310..9ffd09434 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -76,7 +76,7 @@ void GuiSettings::save() (*it)->sortSystem(true); // Jump to the first row of the gamelist. - GamelistView* gameList = ViewController::getInstance()->getGamelistView((*it)).get(); + GamelistView* gameList {ViewController::getInstance()->getGamelistView((*it)).get()}; gameList->setCursor(gameList->getFirstEntry()); } } @@ -102,7 +102,7 @@ void GuiSettings::save() ViewController::getInstance()->goToSystem(mGoToSystem, false); if (mNeedsGoToGroupedCollections) { - bool groupedSystemExists = false; + bool groupedSystemExists {false}; for (SystemData* system : SystemData::sSystemVector) { if (system->getThemeFolder() == "custom-collections") { ViewController::getInstance()->goToSystem(system, false); @@ -234,7 +234,7 @@ bool GuiSettings::input(InputConfig* config, Input input) std::vector GuiSettings::getHelpPrompts() { - std::vector prompts = mMenu.getHelpPrompts(); + std::vector prompts {mMenu.getHelpPrompts()}; prompts.push_back(HelpPrompt("b", "back")); return prompts; }