Qt: use Settings::EmulationStateChanged

This commit is contained in:
Michael M
2017-09-04 11:12:13 -07:00
parent 8e805dcbf4
commit 3e1072b24d
22 changed files with 97 additions and 160 deletions

View File

@ -121,9 +121,9 @@ void MainWindow::ShutdownControllers()
void MainWindow::InitCoreCallbacks()
{
Core::SetOnStateChangedCallback([=](Core::State state) {
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [=](Core::State state) {
if (state == Core::State::Uninitialized)
emit EmulationStopped();
OnStopComplete();
});
installEventFilter(this);
m_render_widget->installEventFilter(this);
@ -152,11 +152,6 @@ void MainWindow::CreateComponents()
m_hotkey_window = new MappingWindow(this, 0);
m_logger_widget = new LoggerWidget(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(
@ -233,17 +228,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()
@ -284,20 +271,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()
@ -336,7 +315,6 @@ void MainWindow::Play()
if (Core::GetState() == Core::State::Paused)
{
Core::SetState(Core::State::Running);
emit EmulationStarted();
}
else
{
@ -363,7 +341,6 @@ void MainWindow::Play()
void MainWindow::Pause()
{
Core::SetState(Core::State::Paused);
emit EmulationPaused();
}
void MainWindow::OnStopComplete()
@ -454,7 +431,6 @@ void MainWindow::Reset()
void MainWindow::FrameAdvance()
{
Core::DoFrameStep();
EmulationPaused();
}
void MainWindow::FullScreen()
@ -499,7 +475,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
@ -676,7 +651,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);
}