mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-11-24 17:32:48 +00:00
main: rewrite (save as) screenshot saving
This picks a default directory and file name. If on Windows and save-as screenshot saving is enabled, it asks the user, first defaulting to the default screenshot path, and with a default filename in the format `[title_id]_[year-mt-dy_hr-mn-sc-msc].png`. Otherwise, or on Linux for now, it simply saves a file in that directory with that file name.
This commit is contained in:
parent
71b902cf62
commit
a723ed31fd
|
@ -2153,17 +2153,26 @@ void GMainWindow::OnToggleFilterBar() {
|
||||||
|
|
||||||
void GMainWindow::OnCaptureScreenshot() {
|
void GMainWindow::OnCaptureScreenshot() {
|
||||||
OnPauseGame();
|
OnPauseGame();
|
||||||
QFileDialog png_dialog(this, tr("Capture Screenshot"), UISettings::values.screenshot_path,
|
|
||||||
tr("PNG Image (*.png)"));
|
const u64 title_id = Core::System::GetInstance().CurrentProcess()->GetTitleID();
|
||||||
png_dialog.setAcceptMode(QFileDialog::AcceptSave);
|
const auto screenshot_path = FileUtil::GetUserPath(FileUtil::UserPath::ScreenshotsDir);
|
||||||
png_dialog.setDefaultSuffix(QStringLiteral("png"));
|
const auto date = QDateTime::currentDateTime()
|
||||||
if (png_dialog.exec()) {
|
.toString(QStringLiteral("yyyy-MM-dd_hh-mm-ss-zzz"))
|
||||||
const QString path = png_dialog.selectedFiles().first();
|
.toStdString();
|
||||||
if (!path.isEmpty()) {
|
QString filename = QString::fromStdString(screenshot_path + fmt::format("{:016X}", title_id) +
|
||||||
UISettings::values.screenshot_path = QFileInfo(path).path();
|
"_" + date + ".png");
|
||||||
render_window->CaptureScreenshot(UISettings::values.screenshot_resolution_factor, path);
|
|
||||||
|
#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();
|
OnStartGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue