From 95175bbb96d3d8379ec4b7a727f17b40f618b86e Mon Sep 17 00:00:00 2001 From: TryTwo Date: Fri, 29 Apr 2022 08:19:03 -0700 Subject: [PATCH] Debugger RegisterWidget: Add context options to change entire column's display type. --- .../Core/DolphinQt/Debugger/RegisterColumn.h | 4 +- .../DolphinQt/Debugger/RegisterWidget.cpp | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/Debugger/RegisterColumn.h b/Source/Core/DolphinQt/Debugger/RegisterColumn.h index f95a0bafcd..9547becce2 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterColumn.h +++ b/Source/Core/DolphinQt/Debugger/RegisterColumn.h @@ -35,9 +35,9 @@ enum class RegisterType pt_hashmask // ??? }; -enum class RegisterDisplay +enum class RegisterDisplay : int { - Hex, + Hex = 0, SInt32, UInt32, Float, diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp index e0538825c2..0d53155519 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp @@ -149,6 +149,21 @@ void RegisterWidget::ShowContextMenu() // i18n: A double precision floating point number auto* view_double = menu->addAction(tr("Double")); + menu->addSeparator(); + + auto* view_hex_column = menu->addAction(tr("All Hexadecimal")); + view_hex_column->setData(static_cast(RegisterDisplay::Hex)); + auto* view_int_column = menu->addAction(tr("All Signed Integer")); + view_int_column->setData(static_cast(RegisterDisplay::SInt32)); + auto* view_uint_column = menu->addAction(tr("All Unsigned Integer")); + view_uint_column->setData(static_cast(RegisterDisplay::UInt32)); + // i18n: A floating point number + auto* view_float_column = menu->addAction(tr("All Float")); + view_float_column->setData(static_cast(RegisterDisplay::Float)); + // i18n: A double precision floating point number + auto* view_double_column = menu->addAction(tr("All Double")); + view_double_column->setData(static_cast(RegisterDisplay::Double)); + for (auto* action : {view_hex, view_int, view_uint, view_float, view_double}) { action->setCheckable(true); @@ -156,6 +171,12 @@ void RegisterWidget::ShowContextMenu() action->setActionGroup(group); } + for (auto* action : {view_hex_column, view_int_column, view_uint_column, view_float_column, + view_double_column}) + { + action->setVisible(false); + } + switch (display) { case RegisterDisplay::Hex: @@ -182,10 +203,16 @@ void RegisterWidget::ShowContextMenu() view_int->setVisible(true); view_uint->setVisible(true); view_float->setVisible(true); + view_hex_column->setVisible(true); + view_int_column->setVisible(true); + view_uint_column->setVisible(true); + view_float_column->setVisible(true); break; case RegisterType::fpr: view_hex->setVisible(true); view_double->setVisible(true); + view_hex_column->setVisible(true); + view_double_column->setVisible(true); break; default: break; @@ -221,6 +248,19 @@ void RegisterWidget::ShowContextMenu() m_updating = false; }); + for (auto* action : {view_hex_column, view_int_column, view_uint_column, view_float_column, + view_double_column}) + { + connect(action, &QAction::triggered, [this, action] { + auto col = m_table->currentItem()->column(); + for (int i = 0; i < 32; i++) + { + auto* update_item = static_cast(m_table->item(i, col)); + update_item->SetDisplay(static_cast(action->data().toInt())); + } + }); + } + menu->addSeparator(); }