From 82acde7e4bebd30bb599b3e2f97ab2b654ad0eb2 Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sat, 19 Jan 2019 22:10:30 -0500 Subject: [PATCH 1/2] Add file extension to screenshot filename if not provided --- src/citra_qt/main.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index a62e232600..baac057c7b 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1561,9 +1561,13 @@ void GMainWindow::OnStopRecordingPlayback() { 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); From c6d623f4ba50c05b09bd547ebe610a8b675f30dd Mon Sep 17 00:00:00 2001 From: xperia64 Date: Sat, 19 Jan 2019 22:14:19 -0500 Subject: [PATCH 2/2] Fix crash when no files are selected --- src/citra_qt/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index baac057c7b..5c90ed92e4 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1565,12 +1565,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(); }