summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt2/MainWindow.cpp
diff options
context:
space:
mode:
authorLeo Lam <leolino.lam@gmail.com>2017-09-15 18:45:17 +0200
committerGitHub <noreply@github.com>2017-09-15 18:45:17 +0200
commit0d078219358b04266206ea1e2622396db7724136 (patch)
treeefafafd00041afae7f3d390e19a0a4a5d650f9fe /Source/Core/DolphinQt2/MainWindow.cpp
parent30dd544931575f5136bc4a5cc972d0f3c55979c5 (diff)
parent3e1072b24dd8f60fd13b9aca3527066d478f9774 (diff)
Merge pull request #6024 from ligfx/coreonstatechangedcallback
Qt: use Settings::EmulationStateChanged
Diffstat (limited to 'Source/Core/DolphinQt2/MainWindow.cpp')
-rw-r--r--Source/Core/DolphinQt2/MainWindow.cpp33
1 files changed, 5 insertions, 28 deletions
diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp
index 96616fd3b2..a55b5b94b2 100644
--- a/Source/Core/DolphinQt2/MainWindow.cpp
+++ b/Source/Core/DolphinQt2/MainWindow.cpp
@@ -122,7 +122,10 @@ void MainWindow::ShutdownControllers()
void MainWindow::InitCoreCallbacks()
{
- Core::SetOnStoppedCallback([this] { emit EmulationStopped(); });
+ connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) {
+ if (state == Core::State::Uninitialized)
+ OnStopComplete();
+ });
installEventFilter(this);
m_render_widget->installEventFilter(this);
}
@@ -151,11 +154,6 @@ void MainWindow::CreateComponents()
m_log_widget = new LogWidget(this);
m_log_config_widget = new LogConfigWidget(this);
- connect(this, &MainWindow::EmulationStarted, m_settings_window,
- &SettingsWindow::EmulationStarted);
- connect(this, &MainWindow::EmulationStopped, m_settings_window,
- &SettingsWindow::EmulationStopped);
-
#if defined(HAVE_XRANDR) && HAVE_XRANDR
m_graphics_window = new GraphicsWindow(
new X11Utils::XRRConfiguration(
@@ -232,17 +230,9 @@ void MainWindow::ConnectMenuBar()
connect(m_menu_bar, &MenuBar::ShowAboutDialog, this, &MainWindow::ShowAboutDialog);
- connect(this, &MainWindow::EmulationStarted, m_menu_bar, &MenuBar::EmulationStarted);
- connect(this, &MainWindow::EmulationPaused, m_menu_bar, &MenuBar::EmulationPaused);
- connect(this, &MainWindow::EmulationStopped, m_menu_bar, &MenuBar::EmulationStopped);
connect(m_game_list, &GameList::SelectionChanged, m_menu_bar, &MenuBar::SelectionChanged);
connect(this, &MainWindow::ReadOnlyModeChanged, m_menu_bar, &MenuBar::ReadOnlyModeChanged);
connect(this, &MainWindow::RecordingStatusChanged, m_menu_bar, &MenuBar::RecordingStatusChanged);
-
- connect(this, &MainWindow::EmulationStarted, this,
- [=]() { m_controllers_window->OnEmulationStateChanged(true); });
- connect(this, &MainWindow::EmulationStopped, this,
- [=]() { m_controllers_window->OnEmulationStateChanged(false); });
}
void MainWindow::ConnectHotkeys()
@@ -283,20 +273,12 @@ void MainWindow::ConnectToolBar()
connect(m_tool_bar, &ToolBar::SettingsPressed, this, &MainWindow::ShowSettingsWindow);
connect(m_tool_bar, &ToolBar::ControllersPressed, this, &MainWindow::ShowControllersWindow);
connect(m_tool_bar, &ToolBar::GraphicsPressed, this, &MainWindow::ShowGraphicsWindow);
-
- connect(this, &MainWindow::EmulationStarted, m_tool_bar, &ToolBar::EmulationStarted);
- connect(this, &MainWindow::EmulationPaused, m_tool_bar, &ToolBar::EmulationPaused);
- connect(this, &MainWindow::EmulationStopped, m_tool_bar, &ToolBar::EmulationStopped);
-
- connect(this, &MainWindow::EmulationStopped, this, &MainWindow::OnStopComplete);
}
void MainWindow::ConnectGameList()
{
connect(m_game_list, &GameList::GameSelected, this, &MainWindow::Play);
connect(m_game_list, &GameList::NetPlayHost, this, &MainWindow::NetPlayHost);
- connect(this, &MainWindow::EmulationStarted, m_game_list, &GameList::EmulationStarted);
- connect(this, &MainWindow::EmulationStopped, m_game_list, &GameList::EmulationStopped);
}
void MainWindow::ConnectRenderWidget()
@@ -340,7 +322,6 @@ void MainWindow::Play()
if (Core::GetState() == Core::State::Paused)
{
Core::SetState(Core::State::Running);
- emit EmulationStarted();
}
else
{
@@ -367,7 +348,6 @@ void MainWindow::Play()
void MainWindow::Pause()
{
Core::SetState(Core::State::Paused);
- emit EmulationPaused();
}
void MainWindow::OnStopComplete()
@@ -457,8 +437,7 @@ void MainWindow::Reset()
void MainWindow::FrameAdvance()
{
- Movie::DoFrameStep();
- EmulationPaused();
+ Core::DoFrameStep();
}
void MainWindow::FullScreen()
@@ -503,7 +482,6 @@ void MainWindow::StartGame(std::unique_ptr<BootParameters>&& parameters)
return;
}
ShowRenderWidget();
- emit EmulationStarted();
#ifdef Q_OS_WIN
// Prevents Windows from sleeping, turning off the display, or idling
@@ -680,7 +658,6 @@ void MainWindow::NetPlayInit()
static_cast<void (MainWindow::*)(const QString&)>(&MainWindow::StartGame));
connect(m_netplay_dialog, &NetPlayDialog::Stop, this, &MainWindow::RequestStop);
connect(m_netplay_dialog, &NetPlayDialog::rejected, this, &MainWindow::NetPlayQuit);
- connect(this, &MainWindow::EmulationStopped, m_netplay_dialog, &NetPlayDialog::EmulationStopped);
connect(m_netplay_setup_dialog, &NetPlaySetupDialog::Join, this, &MainWindow::NetPlayJoin);
connect(m_netplay_setup_dialog, &NetPlaySetupDialog::Host, this, &MainWindow::NetPlayHost);
}