From 5a365506f731fc5527756c4270ae1246115ceeb0 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sun, 28 May 2023 10:57:15 +0300 Subject: [PATCH] Qt/Debugger: Add Ctrl+F (find thread), Ctrl+C (copy) --- rpcs3/rpcs3qt/debugger_frame.cpp | 62 ++++++++++++++++++++++++++------ rpcs3/rpcs3qt/debugger_list.cpp | 9 ++++- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 11ccd1e9c9..16451bbf6d 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -101,6 +101,7 @@ debugger_frame::debugger_frame(std::shared_ptr gui_settings, QWidg m_choice_units->completer()->setCompletionMode(QCompleter::PopupCompletion); m_choice_units->completer()->setMaxVisibleItems(30); m_choice_units->completer()->setFilterMode(Qt::MatchContains); + m_choice_units->installEventFilter(this); m_go_to_addr = new QPushButton(tr("Go To Address"), this); m_go_to_pc = new QPushButton(tr("Go To PC"), this); @@ -211,7 +212,19 @@ bool debugger_frame::eventFilter(QObject* object, QEvent* event) if (object == m_debugger_list && event->type() == QEvent::KeyPress) { keyPressEvent(static_cast(event)); + event->accept(); // Restore accepted state + return false; } + + if (object == m_choice_units && event->type() == QEvent::FocusOut) + { + if (int index = m_choice_units->currentIndex(); index >= 0) + { + // Restore item text automatically on focus-out after search + m_choice_units->setCurrentText(m_choice_units->itemText(index)); + } + } + return false; } @@ -263,13 +276,14 @@ void debugger_frame::open_breakpoints_settings() hbox_layout->addWidget(button_ok); dlg->setLayout(hbox_layout); dlg->setAttribute(Qt::WA_DeleteOnClose); - dlg->exec(); + dlg->open(); } void debugger_frame::keyPressEvent(QKeyEvent* event) { if (!isActiveWindow()) { + event->ignore(); return; } @@ -282,6 +296,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { + event->ignore(); return; } @@ -292,6 +307,8 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) QLabel* l = new QLabel(tr( "Keys Ctrl+G: Go to typed address." "\nKeys Ctrl+B: Open breakpoints settings." + "\nKeys Ctrl+C: Copy instruction contents." + "\nKeys Ctrl+F: Find thread." "\nKeys Alt+S: Capture SPU images of selected SPU or generalized form when used from PPU." "\nKeys Alt+R: Load last saved SPU state capture." "\nKey D: SPU MFC commands logger, MFC debug setting must be enabled." @@ -318,7 +335,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) dlg->setLayout(layout); dlg->setFixedSize(dlg->sizeHint()); dlg->move(QCursor::pos()); - dlg->exec(); + dlg->open(); return; } default: break; @@ -333,6 +350,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { + event->ignore(); break; } @@ -348,12 +366,19 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) return; } + case Qt::Key_F: + { + m_choice_units->clearEditText(); + m_choice_units->setFocus(); + return; + } default: break; } } if (!cpu) { + event->ignore(); return; } @@ -367,6 +392,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { + event->ignore(); return; } @@ -393,7 +419,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { - return; + break; } auto get_max_allowed = [&](QString title, QString description, u32 limit) -> u32 @@ -552,7 +578,7 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { - return; + break; } if (cpu->id_type() == 1 || cpu->id_type() == 2) @@ -564,15 +590,20 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) m_inst_editor->show(); } } + return; } case Qt::Key_F: { if (event->isAutoRepeat()) - return; + { + break; + } if (cpu->id_type() != 2) - return; + { + break; + } static_cast(cpu)->debugger_float_mode ^= 1; // Switch mode return; @@ -580,7 +611,9 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) case Qt::Key_R: { if (event->isAutoRepeat()) - return; + { + break; + } if (cpu->id_type() == 1 || cpu->id_type() == 2) { @@ -597,12 +630,15 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) m_reg_editor->show(); } } + return; } case Qt::Key_S: { if (event->isAutoRepeat()) - return; + { + break; + } if (modifiers & Qt::AltModifier) { @@ -624,8 +660,10 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) } static_cast(cpu)->capture_state(); + return; } - return; + + break; } case Qt::Key_N: { @@ -663,7 +701,9 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) case Qt::Key_M: { if (event->isAutoRepeat()) - return; + { + break; + } if (m_disasm && cpu->id_type() == 2) { @@ -688,6 +728,8 @@ void debugger_frame::keyPressEvent(QKeyEvent* event) default: break; } } + + event->ignore(); } cpu_thread* debugger_frame::get_cpu() diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index 53d19bf09f..0f7a6066f4 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -269,11 +269,13 @@ void debugger_list::keyPressEvent(QKeyEvent* event) { if (!isActiveWindow()) { + QListWidget::keyPressEvent(event); return; } if (event->modifiers()) { + QListWidget::keyPressEvent(event); return; } @@ -287,17 +289,22 @@ void debugger_list::keyPressEvent(QKeyEvent* event) { if (event->isAutoRepeat()) { + QListWidget::keyPressEvent(event); return; } + if (m_cpu && m_cpu->id_type() == 0x55) { create_rsx_command_detail(m_showing_selected_instruction ? m_selected_instruction : m_pc); return; } - return; + + break; } default: break; } + + QListWidget::keyPressEvent(event); }