Debugger RegisterWidget: Add context options to change entire column's display type.

This commit is contained in:
TryTwo 2022-04-29 08:19:03 -07:00
parent 4cd48e609c
commit 95175bbb96
2 changed files with 42 additions and 2 deletions

View File

@ -35,9 +35,9 @@ enum class RegisterType
pt_hashmask // ??? pt_hashmask // ???
}; };
enum class RegisterDisplay enum class RegisterDisplay : int
{ {
Hex, Hex = 0,
SInt32, SInt32,
UInt32, UInt32,
Float, Float,

View File

@ -149,6 +149,21 @@ void RegisterWidget::ShowContextMenu()
// i18n: A double precision floating point number // i18n: A double precision floating point number
auto* view_double = menu->addAction(tr("Double")); auto* view_double = menu->addAction(tr("Double"));
menu->addSeparator();
auto* view_hex_column = menu->addAction(tr("All Hexadecimal"));
view_hex_column->setData(static_cast<int>(RegisterDisplay::Hex));
auto* view_int_column = menu->addAction(tr("All Signed Integer"));
view_int_column->setData(static_cast<int>(RegisterDisplay::SInt32));
auto* view_uint_column = menu->addAction(tr("All Unsigned Integer"));
view_uint_column->setData(static_cast<int>(RegisterDisplay::UInt32));
// i18n: A floating point number
auto* view_float_column = menu->addAction(tr("All Float"));
view_float_column->setData(static_cast<int>(RegisterDisplay::Float));
// i18n: A double precision floating point number
auto* view_double_column = menu->addAction(tr("All Double"));
view_double_column->setData(static_cast<int>(RegisterDisplay::Double));
for (auto* action : {view_hex, view_int, view_uint, view_float, view_double}) for (auto* action : {view_hex, view_int, view_uint, view_float, view_double})
{ {
action->setCheckable(true); action->setCheckable(true);
@ -156,6 +171,12 @@ void RegisterWidget::ShowContextMenu()
action->setActionGroup(group); 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) switch (display)
{ {
case RegisterDisplay::Hex: case RegisterDisplay::Hex:
@ -182,10 +203,16 @@ void RegisterWidget::ShowContextMenu()
view_int->setVisible(true); view_int->setVisible(true);
view_uint->setVisible(true); view_uint->setVisible(true);
view_float->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; break;
case RegisterType::fpr: case RegisterType::fpr:
view_hex->setVisible(true); view_hex->setVisible(true);
view_double->setVisible(true); view_double->setVisible(true);
view_hex_column->setVisible(true);
view_double_column->setVisible(true);
break; break;
default: default:
break; break;
@ -221,6 +248,19 @@ void RegisterWidget::ShowContextMenu()
m_updating = false; 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<RegisterColumn*>(m_table->item(i, col));
update_item->SetDisplay(static_cast<RegisterDisplay>(action->data().toInt()));
}
});
}
menu->addSeparator(); menu->addSeparator();
} }