diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 31 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.cpp | 18 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.ui | 45 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 2 |
5 files changed, 93 insertions, 5 deletions
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() { | |||
| 578 | 578 | ||
| 579 | UISettings::values.roms_path = ReadSetting(QStringLiteral("romsPath")).toString(); | 579 | UISettings::values.roms_path = ReadSetting(QStringLiteral("romsPath")).toString(); |
| 580 | UISettings::values.symbols_path = ReadSetting(QStringLiteral("symbolsPath")).toString(); | 580 | UISettings::values.symbols_path = ReadSetting(QStringLiteral("symbolsPath")).toString(); |
| 581 | UISettings::values.screenshot_path = ReadSetting(QStringLiteral("screenshotPath")).toString(); | ||
| 582 | UISettings::values.game_dir_deprecated = | 581 | UISettings::values.game_dir_deprecated = |
| 583 | ReadSetting(QStringLiteral("gameListRootDir"), QStringLiteral(".")).toString(); | 582 | ReadSetting(QStringLiteral("gameListRootDir"), QStringLiteral(".")).toString(); |
| 584 | UISettings::values.game_dir_deprecated_deepscan = | 583 | UISettings::values.game_dir_deprecated_deepscan = |
| @@ -675,6 +674,22 @@ void Config::ReadRendererValues() { | |||
| 675 | qt_config->endGroup(); | 674 | qt_config->endGroup(); |
| 676 | } | 675 | } |
| 677 | 676 | ||
| 677 | void Config::ReadScreenshotValues() { | ||
| 678 | qt_config->beginGroup(QStringLiteral("Screenshots")); | ||
| 679 | |||
| 680 | UISettings::values.enable_screenshot_save_as = | ||
| 681 | ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool(); | ||
| 682 | FileUtil::GetUserPath( | ||
| 683 | FileUtil::UserPath::ScreenshotsDir, | ||
| 684 | qt_config | ||
| 685 | ->value(QStringLiteral("screenshot_path"), QString::fromStdString(FileUtil::GetUserPath( | ||
| 686 | FileUtil::UserPath::ScreenshotsDir))) | ||
| 687 | .toString() | ||
| 688 | .toStdString()); | ||
| 689 | |||
| 690 | qt_config->endGroup(); | ||
| 691 | } | ||
| 692 | |||
| 678 | void Config::ReadShortcutValues() { | 693 | void Config::ReadShortcutValues() { |
| 679 | qt_config->beginGroup(QStringLiteral("Shortcuts")); | 694 | qt_config->beginGroup(QStringLiteral("Shortcuts")); |
| 680 | 695 | ||
| @@ -756,6 +771,7 @@ void Config::ReadUIValues() { | |||
| 756 | ReadUIGamelistValues(); | 771 | ReadUIGamelistValues(); |
| 757 | ReadUILayoutValues(); | 772 | ReadUILayoutValues(); |
| 758 | ReadPathValues(); | 773 | ReadPathValues(); |
| 774 | ReadScreenshotValues(); | ||
| 759 | ReadShortcutValues(); | 775 | ReadShortcutValues(); |
| 760 | 776 | ||
| 761 | UISettings::values.single_window_mode = | 777 | UISettings::values.single_window_mode = |
| @@ -1085,7 +1101,6 @@ void Config::SavePathValues() { | |||
| 1085 | 1101 | ||
| 1086 | WriteSetting(QStringLiteral("romsPath"), UISettings::values.roms_path); | 1102 | WriteSetting(QStringLiteral("romsPath"), UISettings::values.roms_path); |
| 1087 | WriteSetting(QStringLiteral("symbolsPath"), UISettings::values.symbols_path); | 1103 | WriteSetting(QStringLiteral("symbolsPath"), UISettings::values.symbols_path); |
| 1088 | WriteSetting(QStringLiteral("screenshotPath"), UISettings::values.screenshot_path); | ||
| 1089 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); | 1104 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); |
| 1090 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { | 1105 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { |
| 1091 | qt_config->setArrayIndex(i); | 1106 | qt_config->setArrayIndex(i); |
| @@ -1164,6 +1179,17 @@ void Config::SaveRendererValues() { | |||
| 1164 | qt_config->endGroup(); | 1179 | qt_config->endGroup(); |
| 1165 | } | 1180 | } |
| 1166 | 1181 | ||
| 1182 | void Config::SaveScreenshotValues() { | ||
| 1183 | qt_config->beginGroup(QStringLiteral("Screenshots")); | ||
| 1184 | |||
| 1185 | WriteSetting(QStringLiteral("enableScreenshotSaveAs"), | ||
| 1186 | UISettings::values.enable_screenshot_save_as); | ||
| 1187 | WriteSetting(QStringLiteral("screenshotPath"), | ||
| 1188 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); | ||
| 1189 | |||
| 1190 | qt_config->endGroup(); | ||
| 1191 | } | ||
| 1192 | |||
| 1167 | void Config::SaveShortcutValues() { | 1193 | void Config::SaveShortcutValues() { |
| 1168 | qt_config->beginGroup(QStringLiteral("Shortcuts")); | 1194 | qt_config->beginGroup(QStringLiteral("Shortcuts")); |
| 1169 | 1195 | ||
| @@ -1226,6 +1252,7 @@ void Config::SaveUIValues() { | |||
| 1226 | SaveUIGamelistValues(); | 1252 | SaveUIGamelistValues(); |
| 1227 | SaveUILayoutValues(); | 1253 | SaveUILayoutValues(); |
| 1228 | SavePathValues(); | 1254 | SavePathValues(); |
| 1255 | SaveScreenshotValues(); | ||
| 1229 | SaveShortcutValues(); | 1256 | SaveShortcutValues(); |
| 1230 | 1257 | ||
| 1231 | WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true); | 1258 | WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true); |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 8e815f829..e5f39b040 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -51,6 +51,7 @@ private: | |||
| 51 | void ReadPathValues(); | 51 | void ReadPathValues(); |
| 52 | void ReadCpuValues(); | 52 | void ReadCpuValues(); |
| 53 | void ReadRendererValues(); | 53 | void ReadRendererValues(); |
| 54 | void ReadScreenshotValues(); | ||
| 54 | void ReadShortcutValues(); | 55 | void ReadShortcutValues(); |
| 55 | void ReadSystemValues(); | 56 | void ReadSystemValues(); |
| 56 | void ReadUIValues(); | 57 | void ReadUIValues(); |
| @@ -76,6 +77,7 @@ private: | |||
| 76 | void SavePathValues(); | 77 | void SavePathValues(); |
| 77 | void SaveCpuValues(); | 78 | void SaveCpuValues(); |
| 78 | void SaveRendererValues(); | 79 | void SaveRendererValues(); |
| 80 | void SaveScreenshotValues(); | ||
| 79 | void SaveShortcutValues(); | 81 | void SaveShortcutValues(); |
| 80 | void SaveSystemValues(); | 82 | void SaveSystemValues(); |
| 81 | void SaveUIValues(); | 83 | void SaveUIValues(); |
diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 24b6c5b72..fdf9d3351 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp | |||
| @@ -4,9 +4,11 @@ | |||
| 4 | 4 | ||
| 5 | #include <array> | 5 | #include <array> |
| 6 | #include <utility> | 6 | #include <utility> |
| 7 | #include <QFileDialog> | ||
| 7 | 8 | ||
| 8 | #include <QDirIterator> | 9 | #include <QDirIterator> |
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 11 | #include "common/file_util.h" | ||
| 10 | #include "core/settings.h" | 12 | #include "core/settings.h" |
| 11 | #include "ui_configure_ui.h" | 13 | #include "ui_configure_ui.h" |
| 12 | #include "yuzu/configuration/configure_ui.h" | 14 | #include "yuzu/configuration/configure_ui.h" |
| @@ -55,6 +57,14 @@ ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::Configur | |||
| 55 | [=]() { ConfigureUi::UpdateSecondRowComboBox(); }); | 57 | [=]() { ConfigureUi::UpdateSecondRowComboBox(); }); |
| 56 | connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated), | 58 | connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated), |
| 57 | [=]() { ConfigureUi::UpdateFirstRowComboBox(); }); | 59 | [=]() { ConfigureUi::UpdateFirstRowComboBox(); }); |
| 60 | |||
| 61 | // Set screenshot path to user specification. | ||
| 62 | connect(ui->screenshot_path_button, &QToolButton::pressed, this, [this] { | ||
| 63 | const QString& filename = QFileDialog::getExistingDirectory( | ||
| 64 | this, tr("Select Screenshots Path..."), | ||
| 65 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); | ||
| 66 | ui->screenshot_path_edit->setText(filename); | ||
| 67 | }); | ||
| 58 | } | 68 | } |
| 59 | 69 | ||
| 60 | ConfigureUi::~ConfigureUi() = default; | 70 | ConfigureUi::~ConfigureUi() = default; |
| @@ -66,6 +76,10 @@ void ConfigureUi::ApplyConfiguration() { | |||
| 66 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | 76 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); |
| 67 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | 77 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); |
| 68 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); | 78 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); |
| 79 | |||
| 80 | UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); | ||
| 81 | FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir, | ||
| 82 | ui->screenshot_path_edit->text().toStdString()); | ||
| 69 | Settings::Apply(); | 83 | Settings::Apply(); |
| 70 | } | 84 | } |
| 71 | 85 | ||
| @@ -80,6 +94,10 @@ void ConfigureUi::SetConfiguration() { | |||
| 80 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | 94 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); |
| 81 | ui->icon_size_combobox->setCurrentIndex( | 95 | ui->icon_size_combobox->setCurrentIndex( |
| 82 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | 96 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); |
| 97 | |||
| 98 | ui->enable_screenshot_save_as->setChecked(UISettings::values.enable_screenshot_save_as); | ||
| 99 | ui->screenshot_path_edit->setText( | ||
| 100 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); | ||
| 83 | } | 101 | } |
| 84 | 102 | ||
| 85 | void ConfigureUi::changeEvent(QEvent* event) { | 103 | void ConfigureUi::changeEvent(QEvent* event) { |
diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui index 0b81747d7..d895b799f 100644 --- a/src/yuzu/configuration/configure_ui.ui +++ b/src/yuzu/configuration/configure_ui.ui | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | <rect> | 6 | <rect> |
| 7 | <x>0</x> | 7 | <x>0</x> |
| 8 | <y>0</y> | 8 | <y>0</y> |
| 9 | <width>300</width> | 9 | <width>363</width> |
| 10 | <height>377</height> | 10 | <height>391</height> |
| 11 | </rect> | 11 | </rect> |
| 12 | </property> | 12 | </property> |
| 13 | <property name="windowTitle"> | 13 | <property name="windowTitle"> |
| @@ -128,6 +128,47 @@ | |||
| 128 | </widget> | 128 | </widget> |
| 129 | </item> | 129 | </item> |
| 130 | <item> | 130 | <item> |
| 131 | <widget class="QGroupBox" name="screenshots_GroupBox"> | ||
| 132 | <property name="title"> | ||
| 133 | <string>Screenshots</string> | ||
| 134 | </property> | ||
| 135 | <layout class="QVBoxLayout" name="verticalLayout_4"> | ||
| 136 | <item> | ||
| 137 | <layout class="QVBoxLayout" name="verticalLayout_3"> | ||
| 138 | <item> | ||
| 139 | <widget class="QCheckBox" name="enable_screenshot_save_as"> | ||
| 140 | <property name="text"> | ||
| 141 | <string>Ask Where To Save Screenshots (Windows Only)</string> | ||
| 142 | </property> | ||
| 143 | </widget> | ||
| 144 | </item> | ||
| 145 | <item> | ||
| 146 | <layout class="QHBoxLayout" name="horizontalLayout_4"> | ||
| 147 | <item> | ||
| 148 | <widget class="QLabel" name="label"> | ||
| 149 | <property name="text"> | ||
| 150 | <string>Screenshots Path: </string> | ||
| 151 | </property> | ||
| 152 | </widget> | ||
| 153 | </item> | ||
| 154 | <item> | ||
| 155 | <widget class="QLineEdit" name="screenshot_path_edit"/> | ||
| 156 | </item> | ||
| 157 | <item> | ||
| 158 | <widget class="QToolButton" name="screenshot_path_button"> | ||
| 159 | <property name="text"> | ||
| 160 | <string>...</string> | ||
| 161 | </property> | ||
| 162 | </widget> | ||
| 163 | </item> | ||
| 164 | </layout> | ||
| 165 | </item> | ||
| 166 | </layout> | ||
| 167 | </item> | ||
| 168 | </layout> | ||
| 169 | </widget> | ||
| 170 | </item> | ||
| 171 | <item> | ||
| 131 | <spacer name="verticalSpacer"> | 172 | <spacer name="verticalSpacer"> |
| 132 | <property name="orientation"> | 173 | <property name="orientation"> |
| 133 | <enum>Qt::Vertical</enum> | 174 | <enum>Qt::Vertical</enum> |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 6cc65736d..e82318d50 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -66,11 +66,11 @@ struct Values { | |||
| 66 | // Discord RPC | 66 | // Discord RPC |
| 67 | bool enable_discord_presence; | 67 | bool enable_discord_presence; |
| 68 | 68 | ||
| 69 | bool enable_screenshot_save_as; | ||
| 69 | u16 screenshot_resolution_factor; | 70 | u16 screenshot_resolution_factor; |
| 70 | 71 | ||
| 71 | QString roms_path; | 72 | QString roms_path; |
| 72 | QString symbols_path; | 73 | QString symbols_path; |
| 73 | QString screenshot_path; | ||
| 74 | QString game_dir_deprecated; | 74 | QString game_dir_deprecated; |
| 75 | bool game_dir_deprecated_deepscan; | 75 | bool game_dir_deprecated_deepscan; |
| 76 | QVector<UISettings::GameDir> game_dirs; | 76 | QVector<UISettings::GameDir> game_dirs; |