Merge pull request #13471 from Nitch2024/CTRL+G

[Debugger] CTRL+G support in code and memory view
This commit is contained in:
Admiral H. Curtiss 2025-03-30 15:39:54 +02:00 committed by GitHub
commit 1b85da9b85
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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);
Update();
return;
case Qt::Key_G:
if (event->modifiers() == Qt::ControlModifier)
{
emit ActivateSearch();
}
default:
QWidget::keyPressEvent(event);
break;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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