Merge pull request #10621 from TryTwo/PR_Register_Column_Type

Debugger RegisterWidget Add option to change column's display type
This commit is contained in:
Admiral H. Curtiss 2022-05-08 10:59:05 +02:00 committed by GitHub
commit 67ee78b9dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 42 additions and 2 deletions

View File

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

View File

@ -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<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})
{
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<RegisterColumn*>(m_table->item(i, col));
update_item->SetDisplay(static_cast<RegisterDisplay>(action->data().toInt()));
}
});
}
menu->addSeparator();
}