diff options
| author | JosJuice <josjuice@gmail.com> | 2019-07-06 10:50:11 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2019-07-06 11:30:17 +0200 |
| commit | 92a655c8b90c62255bcd3fcc160e240c98f79217 (patch) | |
| tree | 8c3fbc41272e1ffb63bdd2315668fd573a386489 /Source/Core/DolphinQt/Debugger/WatchWidget.cpp | |
| parent | 0a7395bfba99719f71de5186a9916e66c1901f37 (diff) | |
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.
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/WatchWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/WatchWidget.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp index c122318f20..3a19ed26a4 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp @@ -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; |
