citra_qt: Use the new dumping dialog

Note that it is only compiled in for FFmpeg video dumper enabled builds
This commit is contained in:
zhupengfei 2020-02-01 12:38:46 +08:00
parent f82ba41fe0
commit 71c64c2617
No known key found for this signature in database
GPG Key ID: DD129E108BD09378
3 changed files with 31 additions and 8 deletions

View File

@ -162,6 +162,20 @@ add_executable(citra-qt
util/util.h 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 file(GLOB COMPAT_LIST
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json) ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)

View File

@ -87,6 +87,10 @@
#include "citra_qt/discord_impl.h" #include "citra_qt/discord_impl.h"
#endif #endif
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
#include "citra_qt/dumping/dumping_dialog.h"
#endif
#ifdef QT_STATICPLUGIN #ifdef QT_STATICPLUGIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
#endif #endif
@ -679,9 +683,7 @@ void GMainWindow::ConnectMenuEvents() {
connect(ui.action_Capture_Screenshot, &QAction::triggered, this, connect(ui.action_Capture_Screenshot, &QAction::triggered, this,
&GMainWindow::OnCaptureScreenshot); &GMainWindow::OnCaptureScreenshot);
#ifndef ENABLE_FFMPEG_VIDEO_DUMPER #ifdef ENABLE_FFMPEG_VIDEO_DUMPER
ui.action_Dump_Video->setEnabled(false);
#endif
connect(ui.action_Dump_Video, &QAction::triggered, [this] { connect(ui.action_Dump_Video, &QAction::triggered, [this] {
if (ui.action_Dump_Video->isChecked()) { if (ui.action_Dump_Video->isChecked()) {
OnStartVideoDumping(); OnStartVideoDumping();
@ -689,6 +691,9 @@ void GMainWindow::ConnectMenuEvents() {
OnStopVideoDumping(); OnStopVideoDumping();
} }
}); });
#else
ui.action_Dump_Video->setEnabled(false);
#endif
// Help // Help
connect(ui.action_Open_Citra_Folder, &QAction::triggered, this, connect(ui.action_Open_Citra_Folder, &QAction::triggered, this,
@ -992,11 +997,13 @@ void GMainWindow::ShutdownGame() {
HideFullscreen(); HideFullscreen();
} }
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
if (Core::System::GetInstance().VideoDumper().IsDumping()) { if (Core::System::GetInstance().VideoDumper().IsDumping()) {
game_shutdown_delayed = true; game_shutdown_delayed = true;
OnStopVideoDumping(); OnStopVideoDumping();
return; return;
} }
#endif
AllowOSSleep(); AllowOSSleep();
@ -1804,14 +1811,13 @@ void GMainWindow::OnCaptureScreenshot() {
OnStartGame(); OnStartGame();
} }
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
void GMainWindow::OnStartVideoDumping() { void GMainWindow::OnStartVideoDumping() {
const QString path = QFileDialog::getSaveFileName( DumpingDialog dialog(this);
this, tr("Save Video"), UISettings::values.video_dumping_path, tr("WebM Videos (*.webm)")); if (dialog.exec() != QDialog::DialogCode::Accepted) {
if (path.isEmpty()) {
ui.action_Dump_Video->setChecked(false);
return; return;
} }
UISettings::values.video_dumping_path = QFileInfo(path).path(); const auto path = dialog.GetFilePath();
if (emulation_running) { if (emulation_running) {
Layout::FramebufferLayout layout{ Layout::FramebufferLayout layout{
Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())};
@ -1848,6 +1854,7 @@ void GMainWindow::OnStopVideoDumping() {
future_watcher->setFuture(future); future_watcher->setFuture(future);
} }
} }
#endif
void GMainWindow::UpdateStatusBar() { void GMainWindow::UpdateStatusBar() {
if (emu_thread == nullptr) { if (emu_thread == nullptr) {

View File

@ -200,8 +200,10 @@ private slots:
void OnPlayMovie(); void OnPlayMovie();
void OnStopRecordingPlayback(); void OnStopRecordingPlayback();
void OnCaptureScreenshot(); void OnCaptureScreenshot();
#ifdef ENABLE_FFMPEG_VIDEO_DUMPER
void OnStartVideoDumping(); void OnStartVideoDumping();
void OnStopVideoDumping(); void OnStopVideoDumping();
#endif
void OnCoreError(Core::System::ResultStatus, std::string); void OnCoreError(Core::System::ResultStatus, std::string);
/// Called whenever a user selects Help->About Citra /// Called whenever a user selects Help->About Citra
void OnMenuAboutCitra(); void OnMenuAboutCitra();