mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
DolphinQt: A Ubiquitous Signal For When Breakpoints Change
There were three distinct mechanisms for signaling breakpoint changes in DolphinQt, and the wiring had room for improvement. The behavior of these signals has been consolidated into the new `Host::PPCBreakpointsChanged` signal, which can be emitted from anywhere in DolphinQt to properly update breakpoints everywhere in DolphinQt. This improves a few things: - For the `CodeViewWidget` and `MemoryViewWidget`, signals no longer need to propagate through the `CodeWidget` and `MemoryWidget` (respectively) to reach their destination (incoming or outgoing). - For the `BreakpointWidget`, by self-triggering from its own signal, it no longer must manually call `Update()` after all of the emission sites. - For the `BranchWatchDialog`, it now has one less thing it must go through the `CodeWidget` for, which is a plus.
This commit is contained in:
@ -28,6 +28,7 @@
|
||||
|
||||
#include "DolphinQt/Debugger/BreakpointDialog.h"
|
||||
#include "DolphinQt/Debugger/MemoryWidget.h"
|
||||
#include "DolphinQt/Host.h"
|
||||
#include "DolphinQt/QtUtils/SetWindowDecorations.h"
|
||||
#include "DolphinQt/Resources.h"
|
||||
#include "DolphinQt/Settings.h"
|
||||
@ -130,6 +131,8 @@ BreakpointWidget::BreakpointWidget(QWidget* parent)
|
||||
Update();
|
||||
});
|
||||
|
||||
connect(Host::GetInstance(), &Host::PPCBreakpointsChanged, this, &BreakpointWidget::Update);
|
||||
|
||||
UpdateIcons();
|
||||
}
|
||||
|
||||
@ -222,8 +225,7 @@ void BreakpointWidget::OnClicked(QTableWidgetItem* item)
|
||||
else
|
||||
m_system.GetPowerPC().GetBreakPoints().ToggleEnable(address);
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -431,8 +433,7 @@ void BreakpointWidget::OnClear()
|
||||
|
||||
m_table->setRowCount(0);
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::OnNewBreakpoint()
|
||||
@ -462,8 +463,7 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp)
|
||||
dialog->exec();
|
||||
}
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::OnLoad()
|
||||
@ -492,8 +492,7 @@ void BreakpointWidget::OnLoad()
|
||||
memchecks.AddFromStrings(new_mcs);
|
||||
}
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::OnSave()
|
||||
@ -532,8 +531,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
|
||||
menu->addAction(tr("Edit..."), [this, bp_address] { OnEditBreakpoint(bp_address, true); });
|
||||
menu->addAction(tr("Delete"), [this, &bp_address]() {
|
||||
m_system.GetPowerPC().GetBreakPoints().Remove(bp_address);
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
});
|
||||
}
|
||||
else
|
||||
@ -550,8 +548,7 @@ void BreakpointWidget::OnContextMenu(const QPoint& pos)
|
||||
menu->addAction(tr("Delete"), [this, &bp_address]() {
|
||||
const QSignalBlocker blocker(Settings::Instance());
|
||||
m_system.GetPowerPC().GetMemChecks().Remove(bp_address);
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
});
|
||||
}
|
||||
|
||||
@ -615,8 +612,7 @@ void BreakpointWidget::AddBP(u32 addr, bool break_on_hit, bool log_on_hit, const
|
||||
addr, break_on_hit, log_on_hit,
|
||||
!condition.isEmpty() ? Expression::TryParse(condition.toUtf8().constData()) : std::nullopt);
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional<QString> string)
|
||||
@ -650,8 +646,7 @@ void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional<QStri
|
||||
m_system.GetPowerPC().GetBreakPoints().Remove(address);
|
||||
m_system.GetPowerPC().GetBreakPoints().Add(std::move(bp));
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool do_log,
|
||||
@ -673,8 +668,7 @@ void BreakpointWidget::AddAddressMBP(u32 addr, bool on_read, bool on_write, bool
|
||||
m_system.GetPowerPC().GetMemChecks().Add(std::move(check));
|
||||
}
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_write, bool do_log,
|
||||
@ -696,8 +690,7 @@ void BreakpointWidget::AddRangedMBP(u32 from, u32 to, bool on_read, bool on_writ
|
||||
m_system.GetPowerPC().GetMemChecks().Add(std::move(check));
|
||||
}
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
||||
void BreakpointWidget::EditMBP(u32 address, int edit, std::optional<QString> string)
|
||||
@ -754,6 +747,5 @@ void BreakpointWidget::EditMBP(u32 address, int edit, std::optional<QString> str
|
||||
m_system.GetPowerPC().GetMemChecks().Remove(address);
|
||||
}
|
||||
|
||||
emit BreakpointsChanged();
|
||||
Update();
|
||||
emit Host::GetInstance()->PPCBreakpointsChanged();
|
||||
}
|
||||
|
Reference in New Issue
Block a user