From 71b902cf622e02341334dcb16d70142503e0d045 Mon Sep 17 00:00:00 2001 From: lat9nq Date: Mon, 20 Jul 2020 23:03:49 -0400 Subject: configuration: Setup UI to config screenshot path and saving This adds two options to the General -> UI tab. The first disables picking a place to save the file. The second chooses a default directory for saving screenshots. --- src/yuzu/configuration/config.cpp | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'src/yuzu/configuration/config.cpp') diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 59a193edd..eb73481bd 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -578,7 +578,6 @@ void Config::ReadPathValues() { UISettings::values.roms_path = ReadSetting(QStringLiteral("romsPath")).toString(); UISettings::values.symbols_path = ReadSetting(QStringLiteral("symbolsPath")).toString(); - UISettings::values.screenshot_path = ReadSetting(QStringLiteral("screenshotPath")).toString(); UISettings::values.game_dir_deprecated = ReadSetting(QStringLiteral("gameListRootDir"), QStringLiteral(".")).toString(); UISettings::values.game_dir_deprecated_deepscan = @@ -675,6 +674,22 @@ void Config::ReadRendererValues() { qt_config->endGroup(); } +void Config::ReadScreenshotValues() { + qt_config->beginGroup(QStringLiteral("Screenshots")); + + UISettings::values.enable_screenshot_save_as = + ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool(); + FileUtil::GetUserPath( + FileUtil::UserPath::ScreenshotsDir, + qt_config + ->value(QStringLiteral("screenshot_path"), QString::fromStdString(FileUtil::GetUserPath( + FileUtil::UserPath::ScreenshotsDir))) + .toString() + .toStdString()); + + qt_config->endGroup(); +} + void Config::ReadShortcutValues() { qt_config->beginGroup(QStringLiteral("Shortcuts")); @@ -756,6 +771,7 @@ void Config::ReadUIValues() { ReadUIGamelistValues(); ReadUILayoutValues(); ReadPathValues(); + ReadScreenshotValues(); ReadShortcutValues(); UISettings::values.single_window_mode = @@ -1085,7 +1101,6 @@ void Config::SavePathValues() { WriteSetting(QStringLiteral("romsPath"), UISettings::values.roms_path); WriteSetting(QStringLiteral("symbolsPath"), UISettings::values.symbols_path); - WriteSetting(QStringLiteral("screenshotPath"), UISettings::values.screenshot_path); qt_config->beginWriteArray(QStringLiteral("gamedirs")); for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { qt_config->setArrayIndex(i); @@ -1164,6 +1179,17 @@ void Config::SaveRendererValues() { qt_config->endGroup(); } +void Config::SaveScreenshotValues() { + qt_config->beginGroup(QStringLiteral("Screenshots")); + + WriteSetting(QStringLiteral("enableScreenshotSaveAs"), + UISettings::values.enable_screenshot_save_as); + WriteSetting(QStringLiteral("screenshotPath"), + QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); + + qt_config->endGroup(); +} + void Config::SaveShortcutValues() { qt_config->beginGroup(QStringLiteral("Shortcuts")); @@ -1226,6 +1252,7 @@ void Config::SaveUIValues() { SaveUIGamelistValues(); SaveUILayoutValues(); SavePathValues(); + SaveScreenshotValues(); SaveShortcutValues(); WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true); -- cgit v1.2.3 From 156bf5b2976b9df3451a06ca32092c252c6f039f Mon Sep 17 00:00:00 2001 From: lat9nq Date: Sun, 26 Jul 2020 13:29:47 -0400 Subject: config: Make the save-as identifier more consistent Solves an issue with restoring the value upon reloading program. --- src/yuzu/configuration/config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/yuzu/configuration/config.cpp') diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index eb73481bd..11633fd90 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -1182,9 +1182,9 @@ void Config::SaveRendererValues() { void Config::SaveScreenshotValues() { qt_config->beginGroup(QStringLiteral("Screenshots")); - WriteSetting(QStringLiteral("enableScreenshotSaveAs"), + WriteSetting(QStringLiteral("enable_screenshot_save_as"), UISettings::values.enable_screenshot_save_as); - WriteSetting(QStringLiteral("screenshotPath"), + WriteSetting(QStringLiteral("screenshot_path"), QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); qt_config->endGroup(); -- cgit v1.2.3