[Debugger] CTRL+G support in code and memory view

This commit is contained in:
Nitch2024 2025-03-29 12:43:15 -07:00
parent 1981f22228
commit 1b87ea83e6
8 changed files with 35 additions and 0 deletions

View file

@ -1085,6 +1085,11 @@ void CodeViewWidget::keyPressEvent(QKeyEvent* event)
m_address += rowCount() * sizeof(u32); m_address += rowCount() * sizeof(u32);
Update(); Update();
return; return;
case Qt::Key_G:
if (event->modifiers() == Qt::ControlModifier)
{
emit ActivateSearch();
}
default: default:
QWidget::keyPressEvent(event); QWidget::keyPressEvent(event);
break; break;

View file

@ -58,6 +58,7 @@ signals:
void RequestPPCComparison(u32 address, bool translate_address); void RequestPPCComparison(u32 address, bool translate_address);
void ShowMemory(u32 address); void ShowMemory(u32 address);
void UpdateCodeWidget(); void UpdateCodeWidget();
void ActivateSearch();
private: private:
enum class ReplaceWith enum class ReplaceWith

View file

@ -212,6 +212,7 @@ void CodeWidget::ConnectWidgets()
connect(m_code_view, &CodeViewWidget::RequestPPCComparison, this, connect(m_code_view, &CodeViewWidget::RequestPPCComparison, this,
&CodeWidget::RequestPPCComparison); &CodeWidget::RequestPPCComparison);
connect(m_code_view, &CodeViewWidget::ShowMemory, this, &CodeWidget::ShowMemory); connect(m_code_view, &CodeViewWidget::ShowMemory, this, &CodeWidget::ShowMemory);
connect(m_code_view, &CodeViewWidget::ActivateSearch, this, &CodeWidget::ActivateSearchAddress);
} }
void CodeWidget::OnBranchWatchDialog() void CodeWidget::OnBranchWatchDialog()
@ -243,6 +244,12 @@ void CodeWidget::OnPPCSymbolsChanged()
} }
} }
void CodeWidget::ActivateSearchAddress()
{
m_search_address->setFocus();
m_search_address->selectAll();
}
void CodeWidget::OnSearchAddress() void CodeWidget::OnSearchAddress()
{ {
bool good = true; bool good = true;

View file

@ -50,6 +50,7 @@ public:
void Update(); void Update();
void UpdateSymbols(); void UpdateSymbols();
void ActivateSearchAddress();
signals: signals:
void RequestPPCComparison(u32 address, bool translate_address); void RequestPPCComparison(u32 address, bool translate_address);
void ShowMemory(u32 address); void ShowMemory(u32 address);

View file

@ -123,6 +123,11 @@ public:
case Qt::Key_PageDown: case Qt::Key_PageDown:
m_view->m_address += this->rowCount() * m_view->m_bytes_per_row; m_view->m_address += this->rowCount() * m_view->m_bytes_per_row;
break; break;
case Qt::Key_G:
if (event->modifiers() == Qt::ControlModifier)
{
m_view->TriggerActivateSearch();
}
default: default:
QWidget::keyPressEvent(event); QWidget::keyPressEvent(event);
return; return;
@ -252,6 +257,11 @@ void MemoryViewWidget::UpdateFont(const QFont& font)
UpdateDispatcher(UpdateType::Full); UpdateDispatcher(UpdateType::Full);
} }
void MemoryViewWidget::TriggerActivateSearch()
{
emit ActivateSearch();
}
constexpr int GetTypeSize(MemoryViewWidget::Type type) constexpr int GetTypeSize(MemoryViewWidget::Type type)
{ {
switch (type) switch (type)

View file

@ -105,12 +105,14 @@ signals:
void AutoUpdate(); void AutoUpdate();
void ShowCode(u32 address); void ShowCode(u32 address);
void RequestWatch(QString name, u32 address); void RequestWatch(QString name, u32 address);
void ActivateSearch();
private: private:
void OnContextMenu(const QPoint& pos); void OnContextMenu(const QPoint& pos);
void OnCopyAddress(u32 addr); void OnCopyAddress(u32 addr);
void OnCopyHex(u32 addr); void OnCopyHex(u32 addr);
void UpdateBreakpointTags(); void UpdateBreakpointTags();
void TriggerActivateSearch();
void UpdateColumns(); void UpdateColumns();
void ScrollbarActionTriggered(int action); void ScrollbarActionTriggered(int action);
void ScrollbarSliderReleased(); void ScrollbarSliderReleased();

View file

@ -361,6 +361,8 @@ void MemoryWidget::ConnectWidgets()
connect(m_bp_log_check, &QCheckBox::toggled, this, &MemoryWidget::OnBPLogChanged); connect(m_bp_log_check, &QCheckBox::toggled, this, &MemoryWidget::OnBPLogChanged);
connect(m_memory_view, &MemoryViewWidget::ShowCode, this, &MemoryWidget::ShowCode); connect(m_memory_view, &MemoryViewWidget::ShowCode, this, &MemoryWidget::ShowCode);
connect(m_memory_view, &MemoryViewWidget::RequestWatch, this, &MemoryWidget::RequestWatch); connect(m_memory_view, &MemoryViewWidget::RequestWatch, this, &MemoryWidget::RequestWatch);
connect(m_memory_view, &MemoryViewWidget::ActivateSearch, this,
&MemoryWidget::ActivateSearchAddress);
} }
void MemoryWidget::closeEvent(QCloseEvent*) void MemoryWidget::closeEvent(QCloseEvent*)
@ -565,6 +567,12 @@ void MemoryWidget::SetAddress(u32 address)
m_memory_view->setFocus(); m_memory_view->setFocus();
} }
void MemoryWidget::ActivateSearchAddress()
{
m_search_address->setFocus();
m_search_address->lineEdit()->selectAll();
}
void MemoryWidget::OnSearchAddress() void MemoryWidget::OnSearchAddress()
{ {
const auto target_addr = GetTargetAddress(); const auto target_addr = GetTargetAddress();

View file

@ -82,6 +82,7 @@ private:
void RegisterAfterFrameEventCallback(); void RegisterAfterFrameEventCallback();
void RemoveAfterFrameEventCallback(); void RemoveAfterFrameEventCallback();
void AutoUpdateTable(); void AutoUpdateTable();
void ActivateSearchAddress();
Core::System& m_system; Core::System& m_system;