From 71c64c261719ccf2a0255b734b442e9cc8fbe642 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Sat, 1 Feb 2020 12:38:46 +0800 Subject: [PATCH] citra_qt: Use the new dumping dialog Note that it is only compiled in for FFmpeg video dumper enabled builds --- src/citra_qt/CMakeLists.txt | 14 ++++++++++++++ src/citra_qt/main.cpp | 23 +++++++++++++++-------- src/citra_qt/main.h | 2 ++ 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index 7ca0398fa..836e3c8ae 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -162,6 +162,20 @@ add_executable(citra-qt util/util.h ) +if (ENABLE_FFMPEG_VIDEO_DUMPER) + target_sources(citra-qt PRIVATE + dumping/dumping_dialog.cpp + dumping/dumping_dialog.h + dumping/dumping_dialog.ui + dumping/option_set_dialog.cpp + dumping/option_set_dialog.h + dumping/option_set_dialog.ui + dumping/options_dialog.cpp + dumping/options_dialog.h + dumping/options_dialog.ui + ) +endif() + file(GLOB COMPAT_LIST ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index e106bf170..fe0ef4f35 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -87,6 +87,10 @@ #include "citra_qt/discord_impl.h" #endif +#ifdef ENABLE_FFMPEG_VIDEO_DUMPER +#include "citra_qt/dumping/dumping_dialog.h" +#endif + #ifdef QT_STATICPLUGIN Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #endif @@ -679,9 +683,7 @@ void GMainWindow::ConnectMenuEvents() { connect(ui.action_Capture_Screenshot, &QAction::triggered, this, &GMainWindow::OnCaptureScreenshot); -#ifndef ENABLE_FFMPEG_VIDEO_DUMPER - ui.action_Dump_Video->setEnabled(false); -#endif +#ifdef ENABLE_FFMPEG_VIDEO_DUMPER connect(ui.action_Dump_Video, &QAction::triggered, [this] { if (ui.action_Dump_Video->isChecked()) { OnStartVideoDumping(); @@ -689,6 +691,9 @@ void GMainWindow::ConnectMenuEvents() { OnStopVideoDumping(); } }); +#else + ui.action_Dump_Video->setEnabled(false); +#endif // Help connect(ui.action_Open_Citra_Folder, &QAction::triggered, this, @@ -992,11 +997,13 @@ void GMainWindow::ShutdownGame() { HideFullscreen(); } +#ifdef ENABLE_FFMPEG_VIDEO_DUMPER if (Core::System::GetInstance().VideoDumper().IsDumping()) { game_shutdown_delayed = true; OnStopVideoDumping(); return; } +#endif AllowOSSleep(); @@ -1804,14 +1811,13 @@ void GMainWindow::OnCaptureScreenshot() { OnStartGame(); } +#ifdef ENABLE_FFMPEG_VIDEO_DUMPER void GMainWindow::OnStartVideoDumping() { - const QString path = QFileDialog::getSaveFileName( - this, tr("Save Video"), UISettings::values.video_dumping_path, tr("WebM Videos (*.webm)")); - if (path.isEmpty()) { - ui.action_Dump_Video->setChecked(false); + DumpingDialog dialog(this); + if (dialog.exec() != QDialog::DialogCode::Accepted) { return; } - UISettings::values.video_dumping_path = QFileInfo(path).path(); + const auto path = dialog.GetFilePath(); if (emulation_running) { Layout::FramebufferLayout layout{ Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; @@ -1848,6 +1854,7 @@ void GMainWindow::OnStopVideoDumping() { future_watcher->setFuture(future); } } +#endif void GMainWindow::UpdateStatusBar() { if (emu_thread == nullptr) { diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 75a1bbb3d..995983e5a 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -200,8 +200,10 @@ private slots: void OnPlayMovie(); void OnStopRecordingPlayback(); void OnCaptureScreenshot(); +#ifdef ENABLE_FFMPEG_VIDEO_DUMPER void OnStartVideoDumping(); void OnStopVideoDumping(); +#endif void OnCoreError(Core::System::ResultStatus, std::string); /// Called whenever a user selects Help->About Citra void OnMenuAboutCitra();