summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2019-07-06 10:50:11 +0200
committerJosJuice <josjuice@gmail.com>2019-07-06 11:30:17 +0200
commit92a655c8b90c62255bcd3fcc160e240c98f79217 (patch)
tree8c3fbc41272e1ffb63bdd2315668fd573a386489 /Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
parent0a7395bfba99719f71de5186a9916e66c1901f37 (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/RegisterWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/RegisterWidget.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
index 0c829ed6df..7d2c61d88b 100644
--- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp
@@ -38,14 +38,7 @@ RegisterWidget::RegisterWidget(QWidget* parent) : QDockWidget(parent)
PopulateTable();
ConnectWidgets();
- connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, [this] {
- if (Settings::Instance().IsDebugModeEnabled() && Core::GetState() == Core::State::Paused)
- {
- m_updating = true;
- emit UpdateTable();
- m_updating = false;
- }
- });
+ connect(Host::GetInstance(), &Host::UpdateDisasmDialog, this, &RegisterWidget::Update);
connect(&Settings::Instance(), &Settings::RegistersVisibilityChanged,
[this](bool visible) { setHidden(!visible); });
@@ -68,6 +61,11 @@ void RegisterWidget::closeEvent(QCloseEvent*)
Settings::Instance().SetRegistersVisible(false);
}
+void RegisterWidget::showEvent(QShowEvent* event)
+{
+ Update();
+}
+
void RegisterWidget::CreateWidgets()
{
m_table = new QTableWidget;
@@ -375,3 +373,13 @@ void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::st
connect(this, &RegisterWidget::UpdateTable, [value] { value->RefreshValue(); });
}
+
+void RegisterWidget::Update()
+{
+ if (isVisible() && Core::GetState() == Core::State::Paused)
+ {
+ m_updating = true;
+ emit UpdateTable();
+ m_updating = false;
+ }
+}