mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Qt: use Settings::EmulationStateChanged
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "DolphinQt2/QtUtils/ActionHelper.h"
|
||||
#include "DolphinQt2/Resources.h"
|
||||
#include "DolphinQt2/Settings.h"
|
||||
@ -22,40 +23,24 @@ ToolBar::ToolBar(QWidget* parent) : QToolBar(parent)
|
||||
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &ToolBar::UpdateIcons);
|
||||
UpdateIcons();
|
||||
|
||||
EmulationStopped();
|
||||
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this,
|
||||
[this](Core::State state) { OnEmulationStateChanged(state); });
|
||||
OnEmulationStateChanged(Core::GetState());
|
||||
}
|
||||
|
||||
void ToolBar::EmulationStarted()
|
||||
void ToolBar::OnEmulationStateChanged(Core::State state)
|
||||
{
|
||||
m_play_action->setEnabled(false);
|
||||
m_play_action->setVisible(false);
|
||||
m_pause_action->setEnabled(true);
|
||||
m_pause_action->setVisible(true);
|
||||
m_stop_action->setEnabled(true);
|
||||
m_stop_action->setVisible(true);
|
||||
m_fullscreen_action->setEnabled(true);
|
||||
m_screenshot_action->setEnabled(true);
|
||||
}
|
||||
bool running = state != Core::State::Uninitialized;
|
||||
m_stop_action->setEnabled(running);
|
||||
m_stop_action->setVisible(running);
|
||||
m_fullscreen_action->setEnabled(running);
|
||||
m_screenshot_action->setEnabled(running);
|
||||
|
||||
void ToolBar::EmulationPaused()
|
||||
{
|
||||
m_play_action->setEnabled(true);
|
||||
m_play_action->setVisible(true);
|
||||
m_pause_action->setEnabled(false);
|
||||
m_pause_action->setVisible(false);
|
||||
m_stop_action->setEnabled(true);
|
||||
m_stop_action->setVisible(true);
|
||||
}
|
||||
|
||||
void ToolBar::EmulationStopped()
|
||||
{
|
||||
m_play_action->setEnabled(true);
|
||||
m_play_action->setVisible(true);
|
||||
m_pause_action->setEnabled(false);
|
||||
m_pause_action->setVisible(false);
|
||||
m_stop_action->setEnabled(false);
|
||||
m_fullscreen_action->setEnabled(false);
|
||||
m_screenshot_action->setEnabled(false);
|
||||
bool playing = running && state != Core::State::Paused;
|
||||
m_play_action->setEnabled(!playing);
|
||||
m_play_action->setVisible(!playing);
|
||||
m_pause_action->setEnabled(playing);
|
||||
m_pause_action->setVisible(playing);
|
||||
}
|
||||
|
||||
void ToolBar::MakeActions()
|
||||
|
Reference in New Issue
Block a user