Code cleanup of various GUIs.

This commit is contained in:
Leon Styhre 2022-09-03 12:44:49 +02:00
parent ce50c1121b
commit 2a83f616e6
16 changed files with 849 additions and 854 deletions

View file

@ -109,9 +109,9 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
// es_systems.xml.
if (!mHasSystems) {
ComponentListRow row;
std::shared_ptr<TextComponent> systemText = std::make_shared<TextComponent>(
std::shared_ptr<TextComponent> systemText {std::make_shared<TextComponent>(
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<HelpPrompt> GuiAlternativeEmulators::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mMenu.getHelpPrompts();
std::vector<HelpPrompt> prompts {mMenu.getHelpPrompts()};
prompts.push_back(HelpPrompt("b", "back"));
if (mHasSystems)
prompts.push_back(HelpPrompt("a", "select"));

View file

@ -44,7 +44,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
}
// Automatic collections.
collection_systems_auto = std::make_shared<OptionListComponent<std::string>>(
mCollectionSystemsAuto = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SELECT COLLECTIONS", true);
std::map<std::string, CollectionSystemData, StringComparator> autoSystems {
CollectionSystemsManager::getInstance()->getAutoCollectionSystems()};
@ -52,13 +52,13 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
for (std::map<std::string, CollectionSystemData, StringComparator>::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<OptionListComponent<std::string>>(
mCollectionSystemsCustom = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SELECT COLLECTIONS", true);
std::map<std::string, CollectionSystemData, StringComparator> customSystems {
CollectionSystemsManager::getInstance()->getCustomCollectionSystems()};
@ -101,14 +101,14 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
for (std::map<std::string, CollectionSystemData, StringComparator>::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<std::string> 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();

View file

@ -22,8 +22,8 @@ public:
private:
void createCustomCollection(std::string inName);
std::shared_ptr<OptionListComponent<std::string>> collection_systems_auto;
std::shared_ptr<OptionListComponent<std::string>> collection_systems_custom;
std::shared_ptr<OptionListComponent<std::string>> mCollectionSystemsAuto;
std::shared_ptr<OptionListComponent<std::string>> mCollectionSystemsCustom;
bool mAddedCustomCollection;
bool mDeletedCustomCollection;

View file

@ -69,8 +69,8 @@ void GuiGamelistFilter::initializeMenu()
std::shared_ptr<OptionListComponent<std::string>>>::const_iterator it =
mFilterOptions.cbegin();
it != mFilterOptions.cend(); ++it) {
std::shared_ptr<OptionListComponent<std::string>> optionList = it->second;
std::vector<std::string> filters = optionList->getSelectedObjects();
std::shared_ptr<OptionListComponent<std::string>> optionList {it->second};
std::vector<std::string> filters {optionList->getSelectedObjects()};
mInitialFilters.push_back(filters);
}
}
@ -82,7 +82,7 @@ void GuiGamelistFilter::resetAllFilters()
std::shared_ptr<OptionListComponent<std::string>>>::const_iterator it =
mFilterOptions.cbegin();
it != mFilterOptions.cend(); ++it) {
std::shared_ptr<OptionListComponent<std::string>> optionList = it->second;
std::shared_ptr<OptionListComponent<std::string>> optionList {it->second};
optionList->selectNone();
}
@ -142,20 +142,20 @@ void GuiGamelistFilter::addFiltersToMenu()
mMenu.addRow(row);
std::vector<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
std::vector<FilterDataDecl> decls {mFilterIndex->getFilterDataDecls()};
for (std::vector<FilterDataDecl>::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<std::string, int>* allKeys = (*it).allIndexKeys;
std::map<std::string, int>* 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<OptionListComponent<std::string>> 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<FilterDataDecl> decls = mFilterIndex->getFilterDataDecls();
std::vector<FilterDataDecl> decls {mFilterIndex->getFilterDataDecls()};
for (std::map<FilterIndexType,
std::shared_ptr<OptionListComponent<std::string>>>::const_iterator it =
mFilterOptions.cbegin();
it != mFilterOptions.cend(); ++it) {
std::shared_ptr<OptionListComponent<std::string>> optionList = it->second;
std::vector<std::string> filters = optionList->getSelectedObjects();
std::shared_ptr<OptionListComponent<std::string>> optionList {it->second};
std::vector<std::string> 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<HelpPrompt> GuiGamelistFilter::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mMenu.getHelpPrompts();
std::vector<HelpPrompt> prompts {mMenu.getHelpPrompts()};
prompts.push_back(HelpPrompt("b", "back"));
prompts.push_back(HelpPrompt("a", "select"));
return prompts;

View file

@ -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<unsigned int>(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<FileData*>& files =
getGamelist()->getCursor()->getParent()->getChildrenListToDisplay();
const std::vector<FileData*>& 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) {

View file

@ -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<GuiComponent>(), 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)

View file

@ -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<SwitchComponent>();
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<SwitchComponent>();
keepVideoRunning->setState(Settings::getInstance()->getBool("MediaViewerKeepVideoRunning"));
addWithLabel("KEEP VIDEOS RUNNING WHEN VIEWING IMAGES", keepVideoRunning);
addSaveFunc([keepVideoRunning, this] {
if (keepVideoRunning->getState() !=
Settings::getInstance()->getBool("MediaViewerKeepVideoRunning")) {
Settings::getInstance()->setBool("MediaViewerKeepVideoRunning",
keep_video_running->getState());
keepVideoRunning->getState());
setNeedsSaving();
}
});
// Stretch videos to screen resolution.
auto stretch_videos = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
videoBlur->setState(Settings::getInstance()->getBool("MediaViewerVideoBlur"));
addWithLabel("RENDER BLUR FOR VIDEOS", videoBlur);
addSaveFunc([videoBlur, this] {
if (videoBlur->getState() != Settings::getInstance()->getBool("MediaViewerVideoBlur")) {
Settings::getInstance()->setBool("MediaViewerVideoBlur", videoBlur->getState());
setNeedsSaving();
}
});
// Render scanlines for screenshots and title screens using a shader.
auto screenshot_scanlines = std::make_shared<SwitchComponent>();
screenshot_scanlines->setState(
auto screenshotScanlines = std::make_shared<SwitchComponent>();
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();
}
});

File diff suppressed because it is too large Load diff

View file

@ -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<HelpPrompt> GuiMetaDataEd::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
prompts.push_back(HelpPrompt("y", "scrape"));
prompts.push_back(HelpPrompt("b", "back"));
return prompts;

View file

@ -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<HelpPrompt> GuiOfflineGenerator::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
return prompts;
}

View file

@ -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<SystemData*> sys = mSystems->getSelectedObjects();
std::vector<SystemData*> 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<TextComponent>("", 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<TextComponent>("", 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<SwitchComponent>();
scraper_use_account_screenscraper->setState(
auto scraperUseAccountScreenScraper = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<OptionListComponent<std::string>>(
auto miximageResolution = std::make_shared<OptionListComponent<std::string>>(
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<OptionListComponent<std::string>>(
auto miximageScaling = std::make_shared<OptionListComponent<std::string>>(
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<OptionListComponent<std::string>>(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<OptionListComponent<std::string>>(
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
miximagePhysicalMedia->setState(
auto miximageIncludePhysicalMedia = std::make_shared<SwitchComponent>();
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<TextComponent>("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<TextComponent>("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<FileData*> gameQueue;
std::vector<SystemData*> systems = mSystems->getSelectedObjects();
std::vector<SystemData*> systems {mSystems->getSelectedObjects()};
for (auto sys = systems.cbegin(); sys != systems.cend(); ++sys) {
std::vector<FileData*> games = (*sys)->getRootFolder()->getChildrenRecursive();
std::vector<FileData*> 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<OptionListComponent<std::string>>(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<OptionListComponent<std::string>>(
auto scraperLanguage = std::make_shared<OptionListComponent<std::string>>(
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
scraper_halt_on_invalid_media->setState(
auto scraperHaltOnInvalidMedia = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
scraper_search_metadata_name->setState(
auto scraperSearchMetadataName = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
scraper_respect_exclusions->setState(
auto scraperRespectExclusions = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
scraper_exclude_recursively->setState(
auto scraperExcludeRecursively = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
retry_peer_verification->setState(
auto scraperRetryPeerVerification = std::make_shared<SwitchComponent>();
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<SystemData*> sys = mSystems->getSelectedObjects();
std::vector<SystemData*> 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<ScraperSearchParams> GuiScraperMenu::getSearches(std::vector<SystemDa
{
std::queue<ScraperSearchParams> queue;
for (auto sys = systems.cbegin(); sys != systems.cend(); ++sys) {
std::vector<FileData*> games = (*sys)->getRootFolder()->getScrapeFilesRecursive(
std::vector<FileData*> 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<void()>& func)
{
std::shared_ptr<Font> font = Font::get(FONT_SIZE_MEDIUM);
std::shared_ptr<Font> font {Font::get(FONT_SIZE_MEDIUM)};
// Populate the list.
ComponentListRow row;
@ -1164,7 +1167,7 @@ bool GuiScraperMenu::input(InputConfig* config, Input input)
std::vector<HelpPrompt> GuiScraperMenu::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mMenu.getHelpPrompts();
std::vector<HelpPrompt> prompts {mMenu.getHelpPrompts()};
prompts.push_back(HelpPrompt("b", "back"));
prompts.push_back(HelpPrompt("y", "start"));
return prompts;

View file

@ -147,13 +147,13 @@ GuiScraperMulti::GuiScraperMulti(const std::queue<ScraperSearchParams>& 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<HelpPrompt> GuiScraperMulti::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
return prompts;
}

View file

@ -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<RatingComponent>();
mMD_ReleaseDate = std::make_shared<DateTimeEditComponent>();
mMD_ReleaseDate->setColor(mdColor);
@ -118,7 +118,7 @@ GuiScraperSearch::GuiScraperSearch(SearchType type, unsigned int scrapeCount)
mMD_Grid =
std::make_shared<ComponentGrid>(glm::ivec2 {2, static_cast<int>(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<int>(mMD_Grid->getSize().y / mMD_Pairs.size() * 0.8f);
const int fontHeight {static_cast<int>(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<ScraperSearchResult>& 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<ScraperSearchResult>& 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<int>(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<MetaDataDecl> mMetaDataDecl = metadata.getMDD();
bool metadataUpdated {false};
bool hasDefaultName {false};
std::vector<MetaDataDecl> 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.

View file

@ -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<HelpPrompt> GuiScraperSingle::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts();
std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
prompts.push_back(HelpPrompt("b", "back (cancel)"));
return prompts;

View file

@ -20,22 +20,22 @@ GuiScreensaverOptions::GuiScreensaverOptions(const std::string& title)
: GuiSettings {title}
{
// Screensaver timer.
auto screensaver_timer = std::make_shared<SliderComponent>(0.0f, 30.0f, 1.0f, "m");
screensaver_timer->setValue(
auto screensaverTimer = std::make_shared<SliderComponent>(0.0f, 30.0f, 1.0f, "m");
screensaverTimer->setValue(
static_cast<float>(Settings::getInstance()->getInt("ScreensaverTimer") / (1000 * 60)));
addWithLabel("START SCREENSAVER AFTER (MINUTES)", screensaver_timer);
addSaveFunc([screensaver_timer, this] {
if (static_cast<int>(std::round(screensaver_timer->getValue()) * (1000 * 60)) !=
addWithLabel("START SCREENSAVER AFTER (MINUTES)", screensaverTimer);
addSaveFunc([screensaverTimer, this] {
if (static_cast<int>(std::round(screensaverTimer->getValue()) * (1000 * 60)) !=
Settings::getInstance()->getInt("ScreensaverTimer")) {
Settings::getInstance()->setInt(
"ScreensaverTimer",
static_cast<int>(std::round(screensaver_timer->getValue()) * (1000 * 60)));
static_cast<int>(std::round(screensaverTimer->getValue()) * (1000 * 60)));
setNeedsSaving();
}
});
// Screensaver type.
auto screensaver_type = std::make_shared<OptionListComponent<std::string>>(
auto screensaverType = std::make_shared<OptionListComponent<std::string>>(
getHelpStyle(), "SCREENSAVER TYPE", false);
std::vector<std::string> 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<SwitchComponent>();
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<SwitchComponent>();
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<SliderComponent>(2.0f, 120.0f, 2.0f, "s");
screensaver_swap_image_timeout->setValue(static_cast<float>(
auto screensaverSwapImageTimeout = std::make_shared<SliderComponent>(2.0f, 120.0f, 2.0f, "s");
screensaverSwapImageTimeout->setValue(static_cast<float>(
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<float>(Settings::getInstance()->getInt("ScreensaverSwapImageTimeout") /
(1000))) {
Settings::getInstance()->setInt(
"ScreensaverSwapImageTimeout",
static_cast<int>(std::round(screensaver_swap_image_timeout->getValue()) * (1000)));
static_cast<int>(std::round(screensaverSwapImageTimeout->getValue()) * (1000)));
s->setNeedsSaving();
}
});
// Stretch images to screen resolution.
auto screensaver_stretch_images = std::make_shared<SwitchComponent>();
screensaver_stretch_images->setState(
auto screensaverStretchImages = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_slideshow_game_info->setState(
auto screensaverSlideshowGameInfo = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_slideshow_scanlines->setState(
auto screensaverSlideshowScanlines = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_slideshow_custom_images->setState(
auto screensaverSlideshowCustomImages = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_slideshow_recurse->setState(
auto screensaverSlideshowRecurse = std::make_shared<SwitchComponent>();
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<TextComponent>("", 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<SliderComponent>(0.0f, 120.0f, 2.0f, "s");
screensaver_swap_video_timeout->setValue(static_cast<float>(
auto screensaverSwapVideoTimeout = std::make_shared<SliderComponent>(0.0f, 120.0f, 2.0f, "s");
screensaverSwapVideoTimeout->setValue(static_cast<float>(
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<float>(Settings::getInstance()->getInt("ScreensaverSwapVideoTimeout") /
(1000))) {
Settings::getInstance()->setInt(
"ScreensaverSwapVideoTimeout",
static_cast<int>(std::round(screensaver_swap_video_timeout->getValue()) * (1000)));
static_cast<int>(std::round(screensaverSwapVideoTimeout->getValue()) * (1000)));
s->setNeedsSaving();
}
});
// Stretch videos to screen resolution.
auto screensaver_stretch_videos = std::make_shared<SwitchComponent>();
screensaver_stretch_videos->setState(
auto screensaverStretchVideos = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_video_game_info->setState(
auto screensaverVideoGameInfo = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
screensaver_video_scanlines->setState(
auto screensaverVideoScanlines = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
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<SwitchComponent>();
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();
}
});

View file

@ -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<HelpPrompt> GuiSettings::getHelpPrompts()
{
std::vector<HelpPrompt> prompts = mMenu.getHelpPrompts();
std::vector<HelpPrompt> prompts {mMenu.getHelpPrompts()};
prompts.push_back(HelpPrompt("b", "back"));
return prompts;
}