DolphinQt: Don't update debug widgets when hidden

Saves on CPU usage when pausing/unpausing with the debugger disabled.
This is especially important when using frame advance rapidly.
This commit is contained in:
JosJuice
2019-07-06 10:50:11 +02:00
parent 0a7395bfba
commit 92a655c8b9
14 changed files with 108 additions and 32 deletions

View File

@ -43,12 +43,7 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
ConnectWidgets();
connect(&Settings::Instance(), &Settings::EmulationStateChanged, [this](Core::State state) {
if (!Settings::Instance().IsDebugModeEnabled())
return;
m_load->setEnabled(Core::IsRunning());
m_save->setEnabled(Core::IsRunning());
UpdateButtonsEnabled();
if (state != Core::State::Starting)
Update();
});
@ -61,8 +56,6 @@ WatchWidget::WatchWidget(QWidget* parent) : QDockWidget(parent)
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &WatchWidget::UpdateIcons);
UpdateIcons();
Update();
}
WatchWidget::~WatchWidget()
@ -117,8 +110,20 @@ void WatchWidget::UpdateIcons()
m_save->setIcon(Resources::GetScaledThemeIcon("debugger_save"));
}
void WatchWidget::UpdateButtonsEnabled()
{
if (!isVisible())
return;
m_load->setEnabled(Core::IsRunning());
m_save->setEnabled(Core::IsRunning());
}
void WatchWidget::Update()
{
if (!isVisible())
return;
m_updating = true;
m_table->clear();
@ -200,6 +205,12 @@ void WatchWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetWatchVisible(false);
}
void WatchWidget::showEvent(QShowEvent* event)
{
UpdateButtonsEnabled();
Update();
}
void WatchWidget::OnLoad()
{
IniFile ini;