From 5b96915c6992fb5446f2cc1fba49e21152730f0b Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 18 Feb 2017 02:26:57 -0800 Subject: [PATCH] Qt: Reorganize connection of menu events --- src/citra_qt/main.cpp | 35 ++++++++++++++++++++++------------- src/citra_qt/main.h | 1 + 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 96ec422144..05709fcb0b 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -66,6 +66,7 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { SetDefaultUIGeometry(); RestoreUIState(); + ConnectMenuEvents(); ConnectWidgetEvents(); setWindowTitle(QString("Citra | %1-%2").arg(Common::g_scm_branch, Common::g_scm_desc)); @@ -231,26 +232,34 @@ void GMainWindow::RestoreUIState() { } void GMainWindow::ConnectWidgetEvents() { - connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString)), - Qt::DirectConnection); + connect(game_list, SIGNAL(GameChosen(QString)), this, SLOT(OnGameListLoadFile(QString))); connect(game_list, SIGNAL(OpenSaveFolderRequested(u64)), this, - SLOT(OnGameListOpenSaveFolder(u64)), Qt::DirectConnection); - connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(OnConfigure())); - connect(ui.action_Load_File, SIGNAL(triggered()), this, SLOT(OnMenuLoadFile()), - Qt::DirectConnection); - connect(ui.action_Load_Symbol_Map, SIGNAL(triggered()), this, SLOT(OnMenuLoadSymbolMap())); - connect(ui.action_Select_Game_List_Root, SIGNAL(triggered()), this, - SLOT(OnMenuSelectGameListRoot())); - connect(ui.action_Start, SIGNAL(triggered()), this, SLOT(OnStartGame())); - connect(ui.action_Pause, SIGNAL(triggered()), this, SLOT(OnPauseGame())); - connect(ui.action_Stop, SIGNAL(triggered()), this, SLOT(OnStopGame())); - connect(ui.action_Single_Window_Mode, SIGNAL(triggered(bool)), this, SLOT(ToggleWindowMode())); + SLOT(OnGameListOpenSaveFolder(u64))); connect(this, SIGNAL(EmulationStarting(EmuThread*)), render_window, SLOT(OnEmulationStarting(EmuThread*))); connect(this, SIGNAL(EmulationStopping()), render_window, SLOT(OnEmulationStopping())); } +void GMainWindow::ConnectMenuEvents() { + // File + connect(ui.action_Load_File, &QAction::triggered, this, &GMainWindow::OnMenuLoadFile); + connect(ui.action_Load_Symbol_Map, &QAction::triggered, this, + &GMainWindow::OnMenuLoadSymbolMap); + connect(ui.action_Select_Game_List_Root, &QAction::triggered, this, + &GMainWindow::OnMenuSelectGameListRoot); + + // Emulation + connect(ui.action_Start, &QAction::triggered, this, &GMainWindow::OnStartGame); + connect(ui.action_Pause, &QAction::triggered, this, &GMainWindow::OnPauseGame); + connect(ui.action_Stop, &QAction::triggered, this, &GMainWindow::OnStopGame); + connect(ui.action_Configure, &QAction::triggered, this, &GMainWindow::OnConfigure); + + // View + connect(ui.action_Single_Window_Mode, &QAction::triggered, this, + &GMainWindow::ToggleWindowMode); +} + void GMainWindow::OnDisplayTitleBars(bool show) { QList widgets = findChildren(); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index e0d9a545b4..87637b92b1 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -72,6 +72,7 @@ private: void RestoreUIState(); void ConnectWidgetEvents(); + void ConnectMenuEvents(); bool LoadROM(const QString& filename); void BootGame(const QString& filename);