From 284536a62611850229c3a33d352223f496cce528 Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sat, 19 Jan 2019 22:10:30 -0500 Subject: Add file extension to screenshot filename if not provided --- src/yuzu/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index ab403b3ac..3a105dc4f 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1682,9 +1682,13 @@ void GMainWindow::OnToggleFilterBar() { void GMainWindow::OnCaptureScreenshot() { OnPauseGame(); - const QString path = - QFileDialog::getSaveFileName(this, tr("Capture Screenshot"), - UISettings::values.screenshot_path, tr("PNG Image (*.png)")); + QFileDialog png_dialog(this, tr("Capture Screenshot"), UISettings::values.screenshot_path, + tr("PNG Image (*.png)")); + png_dialog.setAcceptMode(QFileDialog::AcceptSave); + png_dialog.setDefaultSuffix("png"); + 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); -- cgit v1.2.3 From f598490b57163680b0029bcb8f0077012b962498 Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sat, 19 Jan 2019 22:14:19 -0500 Subject: Fix crash when no files are selected --- src/yuzu/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 3a105dc4f..485e29de2 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1686,12 +1686,12 @@ void GMainWindow::OnCaptureScreenshot() { tr("PNG Image (*.png)")); png_dialog.setAcceptMode(QFileDialog::AcceptSave); png_dialog.setDefaultSuffix("png"); - 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); + 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); + } } OnStartGame(); } -- cgit v1.2.3