diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/common/common_paths.h | 1 | ||||
| -rw-r--r-- | src/common/file_util.cpp | 1 | ||||
| -rw-r--r-- | src/common/file_util.h | 1 | ||||
| -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 | 22 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ui.ui | 45 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 29 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 2 |
9 files changed, 120 insertions, 14 deletions
diff --git a/src/common/common_paths.h b/src/common/common_paths.h index 076752d3b..3c593d5f6 100644 --- a/src/common/common_paths.h +++ b/src/common/common_paths.h | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #define KEYS_DIR "keys" | 35 | #define KEYS_DIR "keys" |
| 36 | #define LOAD_DIR "load" | 36 | #define LOAD_DIR "load" |
| 37 | #define DUMP_DIR "dump" | 37 | #define DUMP_DIR "dump" |
| 38 | #define SCREENSHOTS_DIR "screenshots" | ||
| 38 | #define SHADER_DIR "shader" | 39 | #define SHADER_DIR "shader" |
| 39 | #define LOG_DIR "log" | 40 | #define LOG_DIR "log" |
| 40 | 41 | ||
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp index 45b750e1e..4ede9f72c 100644 --- a/src/common/file_util.cpp +++ b/src/common/file_util.cpp | |||
| @@ -695,6 +695,7 @@ const std::string& GetUserPath(UserPath path, const std::string& new_path) { | |||
| 695 | paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); | 695 | paths.emplace(UserPath::NANDDir, user_path + NAND_DIR DIR_SEP); |
| 696 | paths.emplace(UserPath::LoadDir, user_path + LOAD_DIR DIR_SEP); | 696 | paths.emplace(UserPath::LoadDir, user_path + LOAD_DIR DIR_SEP); |
| 697 | paths.emplace(UserPath::DumpDir, user_path + DUMP_DIR DIR_SEP); | 697 | paths.emplace(UserPath::DumpDir, user_path + DUMP_DIR DIR_SEP); |
| 698 | paths.emplace(UserPath::ScreenshotsDir, user_path + SCREENSHOTS_DIR DIR_SEP); | ||
| 698 | paths.emplace(UserPath::ShaderDir, user_path + SHADER_DIR DIR_SEP); | 699 | paths.emplace(UserPath::ShaderDir, user_path + SHADER_DIR DIR_SEP); |
| 699 | paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); | 700 | paths.emplace(UserPath::SysDataDir, user_path + SYSDATA_DIR DIR_SEP); |
| 700 | paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); | 701 | paths.emplace(UserPath::KeysDir, user_path + KEYS_DIR DIR_SEP); |
diff --git a/src/common/file_util.h b/src/common/file_util.h index f7a0c33fa..187b93161 100644 --- a/src/common/file_util.h +++ b/src/common/file_util.h | |||
| @@ -32,6 +32,7 @@ enum class UserPath { | |||
| 32 | SDMCDir, | 32 | SDMCDir, |
| 33 | LoadDir, | 33 | LoadDir, |
| 34 | DumpDir, | 34 | DumpDir, |
| 35 | ScreenshotsDir, | ||
| 35 | ShaderDir, | 36 | ShaderDir, |
| 36 | SysDataDir, | 37 | SysDataDir, |
| 37 | UserDir, | 38 | UserDir, |
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 94b96afb4..cb71b8d11 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 = |
| @@ -673,6 +672,22 @@ void Config::ReadRendererValues() { | |||
| 673 | qt_config->endGroup(); | 672 | qt_config->endGroup(); |
| 674 | } | 673 | } |
| 675 | 674 | ||
| 675 | void Config::ReadScreenshotValues() { | ||
| 676 | qt_config->beginGroup(QStringLiteral("Screenshots")); | ||
| 677 | |||
| 678 | UISettings::values.enable_screenshot_save_as = | ||
| 679 | ReadSetting(QStringLiteral("enable_screenshot_save_as"), true).toBool(); | ||
| 680 | FileUtil::GetUserPath( | ||
| 681 | FileUtil::UserPath::ScreenshotsDir, | ||
| 682 | qt_config | ||
| 683 | ->value(QStringLiteral("screenshot_path"), QString::fromStdString(FileUtil::GetUserPath( | ||
| 684 | FileUtil::UserPath::ScreenshotsDir))) | ||
| 685 | .toString() | ||
| 686 | .toStdString()); | ||
| 687 | |||
| 688 | qt_config->endGroup(); | ||
| 689 | } | ||
| 690 | |||
| 676 | void Config::ReadShortcutValues() { | 691 | void Config::ReadShortcutValues() { |
| 677 | qt_config->beginGroup(QStringLiteral("Shortcuts")); | 692 | qt_config->beginGroup(QStringLiteral("Shortcuts")); |
| 678 | 693 | ||
| @@ -754,6 +769,7 @@ void Config::ReadUIValues() { | |||
| 754 | ReadUIGamelistValues(); | 769 | ReadUIGamelistValues(); |
| 755 | ReadUILayoutValues(); | 770 | ReadUILayoutValues(); |
| 756 | ReadPathValues(); | 771 | ReadPathValues(); |
| 772 | ReadScreenshotValues(); | ||
| 757 | ReadShortcutValues(); | 773 | ReadShortcutValues(); |
| 758 | 774 | ||
| 759 | UISettings::values.single_window_mode = | 775 | UISettings::values.single_window_mode = |
| @@ -1083,7 +1099,6 @@ void Config::SavePathValues() { | |||
| 1083 | 1099 | ||
| 1084 | WriteSetting(QStringLiteral("romsPath"), UISettings::values.roms_path); | 1100 | WriteSetting(QStringLiteral("romsPath"), UISettings::values.roms_path); |
| 1085 | WriteSetting(QStringLiteral("symbolsPath"), UISettings::values.symbols_path); | 1101 | WriteSetting(QStringLiteral("symbolsPath"), UISettings::values.symbols_path); |
| 1086 | WriteSetting(QStringLiteral("screenshotPath"), UISettings::values.screenshot_path); | ||
| 1087 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); | 1102 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); |
| 1088 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { | 1103 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { |
| 1089 | qt_config->setArrayIndex(i); | 1104 | qt_config->setArrayIndex(i); |
| @@ -1159,6 +1174,17 @@ void Config::SaveRendererValues() { | |||
| 1159 | qt_config->endGroup(); | 1174 | qt_config->endGroup(); |
| 1160 | } | 1175 | } |
| 1161 | 1176 | ||
| 1177 | void Config::SaveScreenshotValues() { | ||
| 1178 | qt_config->beginGroup(QStringLiteral("Screenshots")); | ||
| 1179 | |||
| 1180 | WriteSetting(QStringLiteral("enable_screenshot_save_as"), | ||
| 1181 | UISettings::values.enable_screenshot_save_as); | ||
| 1182 | WriteSetting(QStringLiteral("screenshot_path"), | ||
| 1183 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); | ||
| 1184 | |||
| 1185 | qt_config->endGroup(); | ||
| 1186 | } | ||
| 1187 | |||
| 1162 | void Config::SaveShortcutValues() { | 1188 | void Config::SaveShortcutValues() { |
| 1163 | qt_config->beginGroup(QStringLiteral("Shortcuts")); | 1189 | qt_config->beginGroup(QStringLiteral("Shortcuts")); |
| 1164 | 1190 | ||
| @@ -1221,6 +1247,7 @@ void Config::SaveUIValues() { | |||
| 1221 | SaveUIGamelistValues(); | 1247 | SaveUIGamelistValues(); |
| 1222 | SaveUILayoutValues(); | 1248 | SaveUILayoutValues(); |
| 1223 | SavePathValues(); | 1249 | SavePathValues(); |
| 1250 | SaveScreenshotValues(); | ||
| 1224 | SaveShortcutValues(); | 1251 | SaveShortcutValues(); |
| 1225 | 1252 | ||
| 1226 | WriteSetting(QStringLiteral("singleWindowMode"), UISettings::values.single_window_mode, true); | 1253 | 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..91c21c572 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,18 @@ 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 = | ||
| 64 | QFileDialog::getExistingDirectory( | ||
| 65 | this, tr("Select Screenshots Path..."), | ||
| 66 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))) + | ||
| 67 | QDir::separator(); | ||
| 68 | if (!filename.isEmpty()) { | ||
| 69 | ui->screenshot_path_edit->setText(filename); | ||
| 70 | } | ||
| 71 | }); | ||
| 58 | } | 72 | } |
| 59 | 73 | ||
| 60 | ConfigureUi::~ConfigureUi() = default; | 74 | ConfigureUi::~ConfigureUi() = default; |
| @@ -66,6 +80,10 @@ void ConfigureUi::ApplyConfiguration() { | |||
| 66 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | 80 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); |
| 67 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | 81 | 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(); | 82 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); |
| 83 | |||
| 84 | UISettings::values.enable_screenshot_save_as = ui->enable_screenshot_save_as->isChecked(); | ||
| 85 | FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir, | ||
| 86 | ui->screenshot_path_edit->text().toStdString()); | ||
| 69 | Settings::Apply(); | 87 | Settings::Apply(); |
| 70 | } | 88 | } |
| 71 | 89 | ||
| @@ -80,6 +98,10 @@ void ConfigureUi::SetConfiguration() { | |||
| 80 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); | 98 | ui->show_add_ons->setChecked(UISettings::values.show_add_ons); |
| 81 | ui->icon_size_combobox->setCurrentIndex( | 99 | ui->icon_size_combobox->setCurrentIndex( |
| 82 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | 100 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); |
| 101 | |||
| 102 | ui->enable_screenshot_save_as->setChecked(UISettings::values.enable_screenshot_save_as); | ||
| 103 | ui->screenshot_path_edit->setText( | ||
| 104 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir))); | ||
| 83 | } | 105 | } |
| 84 | 106 | ||
| 85 | void ConfigureUi::changeEvent(QEvent* event) { | 107 | 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/main.cpp b/src/yuzu/main.cpp index 2ff559746..e26cec78c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -2321,17 +2321,28 @@ void GMainWindow::OnToggleFilterBar() { | |||
| 2321 | 2321 | ||
| 2322 | void GMainWindow::OnCaptureScreenshot() { | 2322 | void GMainWindow::OnCaptureScreenshot() { |
| 2323 | OnPauseGame(); | 2323 | OnPauseGame(); |
| 2324 | QFileDialog png_dialog(this, tr("Capture Screenshot"), UISettings::values.screenshot_path, | 2324 | |
| 2325 | tr("PNG Image (*.png)")); | 2325 | const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); |
| 2326 | png_dialog.setAcceptMode(QFileDialog::AcceptSave); | 2326 | const auto screenshot_path = |
| 2327 | png_dialog.setDefaultSuffix(QStringLiteral("png")); | 2327 | QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir)); |
| 2328 | if (png_dialog.exec()) { | 2328 | const auto date = |
| 2329 | const QString path = png_dialog.selectedFiles().first(); | 2329 | QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz")); |
| 2330 | if (!path.isEmpty()) { | 2330 | QString filename = QStringLiteral("%1%2_%3.png") |
| 2331 | UISettings::values.screenshot_path = QFileInfo(path).path(); | 2331 | .arg(screenshot_path) |
| 2332 | render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, path); | 2332 | .arg(title_id, 16, 16, QLatin1Char{'0'}) |
| 2333 | .arg(date); | ||
| 2334 | |||
| 2335 | #ifdef _WIN32 | ||
| 2336 | if (UISettings::values.enable_screenshot_save_as) { | ||
| 2337 | filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename, | ||
| 2338 | tr("PNG Image (*.png)")); | ||
| 2339 | if (filename.isEmpty()) { | ||
| 2340 | OnStartGame(); | ||
| 2341 | return; | ||
| 2333 | } | 2342 | } |
| 2334 | } | 2343 | } |
| 2344 | #endif | ||
| 2345 | render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename); | ||
| 2335 | OnStartGame(); | 2346 | OnStartGame(); |
| 2336 | } | 2347 | } |
| 2337 | 2348 | ||
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index ac7b9aef6..bbfeafc55 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; |