diff options
author | lat9nq <lat9nq@virginia.edu> | 2020-07-07 05:30:49 +0200 |
---|---|---|
committer | lat9nq <lat9nq@virginia.edu> | 2020-07-21 05:03:55 +0200 |
commit | a723ed31fd4c5b3dbad5f2ad53a6d1556db15569 (patch) | |
tree | ca77b2c42d671df2ee7b1e0dda40ebd22383db54 | |
parent | configuration: Setup UI to config screenshot path and saving (diff) | |
download | yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar.gz yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar.bz2 yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar.lz yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar.xz yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.tar.zst yuzu-a723ed31fd4c5b3dbad5f2ad53a6d1556db15569.zip |
-rw-r--r-- | src/yuzu/main.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 31a635176..c6bf5214e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2153,17 +2153,26 @@ void GMainWindow::OnToggleFilterBar() { void GMainWindow::OnCaptureScreenshot() { OnPauseGame(); - QFileDialog png_dialog(this, tr("Capture Screenshot"), UISettings::values.screenshot_path, - tr("PNG Image (*.png)")); - png_dialog.setAcceptMode(QFileDialog::AcceptSave); - png_dialog.setDefaultSuffix(QStringLiteral("png")); - if (png_dialog.exec()) { - const QString path = png_dialog.selectedFiles().first(); - if (!path.isEmpty()) { - UISettings::values.screenshot_path = QFileInfo(path).path(); - render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, path); + + const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID(); + const auto screenshot_path = FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir); + const auto date = QDateTime::currentDateTime() + .toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz")) + .toStdString(); + QString filename = QString::fromStdString(screenshot_path + fmt::format("{:016X}", title_id) + + "_" + date + ".png"); + +#ifdef _WIN32 + if (UISettings::values.enable_screenshot_save_as) { + filename = QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), filename, + tr("PNG Image (*.png)")); + if (filename.isEmpty()) { + OnStartGame(); + return; } } +#endif + render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, filename); OnStartGame(); } |