mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 14:58:11 -05:00
Merge pull request #4263 from lat9nq/fix-screencaps-2
screenshots: Option to save screenshots immediately in a specified directory + Linux workaround
This commit is contained in:
@ -2321,17 +2321,28 @@ 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 =
|
||||
QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir));
|
||||
const auto date =
|
||||
QDateTime::currentDateTime().toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz"));
|
||||
QString filename = QStringLiteral("%1%2_%3.png")
|
||||
.arg(screenshot_path)
|
||||
.arg(title_id, 16, 16, QLatin1Char{'0'})
|
||||
.arg(date);
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user