Expose asm.reloff.flags in Preferences (#2244)

This commit is contained in:
Surendrajat 2020-06-16 16:24:36 +05:30 committed by GitHub
parent e28ee3bebd
commit 7736088ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 124 additions and 93 deletions

View File

@ -130,6 +130,7 @@ static const QHash<QString, QVariant> asmOptions = {
{ "asm.refptr", false }, { "asm.refptr", false },
{ "asm.flags.real", true }, { "asm.flags.real", true },
{ "asm.reloff", false }, { "asm.reloff", false },
{ "asm.reloff.flags", false },
{ "esil.breakoninvalid",true }, { "esil.breakoninvalid",true },
{ "graph.offset", false} { "graph.offset", false}
}; };

View File

@ -35,6 +35,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
{ ui->indentCheckBox, "asm.indent" }, { ui->indentCheckBox, "asm.indent" },
{ ui->offsetCheckBox, "asm.offset" }, { ui->offsetCheckBox, "asm.offset" },
{ ui->relOffsetCheckBox, "asm.reloff" }, { ui->relOffsetCheckBox, "asm.reloff" },
{ ui->relOffFlagsCheckBox, "asm.reloff.flags" },
{ ui->slowCheckBox, "asm.slow" }, { ui->slowCheckBox, "asm.slow" },
{ ui->linesCheckBox, "asm.lines" }, { ui->linesCheckBox, "asm.lines" },
{ ui->fcnlinesCheckBox, "asm.lines.fcn" }, { ui->fcnlinesCheckBox, "asm.lines.fcn" },
@ -62,6 +63,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
connect(ui->asmComboBox, static_cast<indexSignalType>(&QComboBox::currentIndexChanged), this, connect(ui->asmComboBox, static_cast<indexSignalType>(&QComboBox::currentIndexChanged), this,
&AsmOptionsWidget::asmComboBoxChanged); &AsmOptionsWidget::asmComboBoxChanged);
connect(ui->offsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::offsetCheckBoxToggled); connect(ui->offsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::offsetCheckBoxToggled);
connect(ui->relOffsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::relOffCheckBoxToggled);
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(updateAsmOptionsFromVars())); connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(updateAsmOptionsFromVars()));
updateAsmOptionsFromVars(); updateAsmOptionsFromVars();
} }
@ -78,7 +80,9 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
ui->cmtcolSpinBox->setEnabled(cmtRightEnabled); ui->cmtcolSpinBox->setEnabled(cmtRightEnabled);
bool offsetsEnabled = Config()->getConfigBool("asm.offset") || Config()->getConfigBool("graph.offset"); bool offsetsEnabled = Config()->getConfigBool("asm.offset") || Config()->getConfigBool("graph.offset");
ui->relOffsetLabel->setEnabled(offsetsEnabled);
ui->relOffsetCheckBox->setEnabled(offsetsEnabled); ui->relOffsetCheckBox->setEnabled(offsetsEnabled);
ui->relOffFlagsCheckBox->setEnabled(Config()->getConfigBool("asm.offset") && Config()->getConfigBool("asm.reloff"));
bool bytesEnabled = Config()->getConfigBool("asm.bytes"); bool bytesEnabled = Config()->getConfigBool("asm.bytes");
ui->bytespaceCheckBox->setEnabled(bytesEnabled); ui->bytespaceCheckBox->setEnabled(bytesEnabled);
@ -263,7 +267,14 @@ void AsmOptionsWidget::asmComboBoxChanged(int index)
void AsmOptionsWidget::offsetCheckBoxToggled(bool checked) void AsmOptionsWidget::offsetCheckBoxToggled(bool checked)
{ {
ui->relOffsetLabel->setEnabled(checked || Config()->getConfigBool("graph.offset"));
ui->relOffsetCheckBox->setEnabled(checked || Config()->getConfigBool("graph.offset")); ui->relOffsetCheckBox->setEnabled(checked || Config()->getConfigBool("graph.offset"));
ui->relOffFlagsCheckBox->setEnabled(checked && Config()->getConfigBool("asm.reloff"));
}
void AsmOptionsWidget::relOffCheckBoxToggled(bool checked)
{
ui->relOffFlagsCheckBox->setEnabled(checked && Config()->getConfigBool("asm.offset"));
} }
/** /**

View File

@ -53,6 +53,7 @@ private slots:
void commentsComboBoxChanged(int index); void commentsComboBoxChanged(int index);
void asmComboBoxChanged(int index); void asmComboBoxChanged(int index);
void offsetCheckBoxToggled(bool checked); void offsetCheckBoxToggled(bool checked);
void relOffCheckBoxToggled(bool checked);
void checkboxEnabler(QCheckBox *checkbox, QString config); void checkboxEnabler(QCheckBox *checkbox, QString config);
}; };

View File

@ -65,33 +65,30 @@
<string>Disassembly</string> <string>Disassembly</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="10" column="2"> <item row="11" column="1">
<widget class="QSpinBox" name="nbytesSpinBox"> <widget class="QCheckBox" name="bytesCheckBox">
<property name="enabled"> <property name="text">
<bool>true</bool> <string>Display the bytes of each instruction (asm.bytes)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="1"> <item row="4" column="1">
<widget class="QLabel" name="nbytesLabel"> <widget class="QLabel" name="syntaxLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text"> <property name="text">
<string>Number of bytes to display (asm.nbytes):</string> <string>Syntax (asm.syntax):</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="1"> <item row="16" column="2">
<widget class="QLabel" name="asmTabsOffLabel"> <widget class="QSpinBox" name="asmTabsOffSpinBox">
<property name="text"> <property name="maximum">
<string>Tabs before assembly (asm.tabs.off):</string> <number>100</number>
</property> </property>
<property name="textInteractionFlags"> <property name="singleStep">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <number>5</number>
</property> </property>
</widget> </widget>
</item> </item>
@ -105,54 +102,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="2"> <item row="12" column="1">
<widget class="QSpinBox" name="asmTabsOffSpinBox"> <widget class="QLabel" name="nbytesLabel">
<property name="maximum"> <property name="enabled">
<number>100</number> <bool>true</bool>
</property> </property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
<item row="17" column="1" colspan="2">
<widget class="QCheckBox" name="bytespaceCheckBox">
<property name="text"> <property name="text">
<string>Separate bytes with whitespace (asm.bytespace)</string> <string>Number of bytes to display (asm.nbytes):</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="2">
<widget class="QCheckBox" name="indentCheckBox">
<property name="text">
<string>Indent disassembly based on reflines depth (asm.indent)</string>
</property>
</widget>
</item>
<item row="13" column="2">
<widget class="QSpinBox" name="asmTabsSpinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLabel" name="asmTabsLabel">
<property name="text">
<string>Tabs in assembly (asm.tabs):</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="16" column="1" colspan="2"> <item row="17" column="1" colspan="2">
<widget class="QCheckBox" name="lbytesCheckBox"> <widget class="QCheckBox" name="indentCheckBox">
<property name="text"> <property name="text">
<string>Align bytes to the left (asm.lbytes)</string> <string>Indent disassembly based on reflines depth (asm.indent)</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -172,23 +138,11 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="5" column="2"> <item row="12" column="2">
<widget class="QComboBox" name="caseComboBox"> <widget class="QSpinBox" name="nbytesSpinBox">
<item> <property name="enabled">
<property name="text"> <bool>true</bool>
<string>Lowercase</string> </property>
</property>
</item>
<item>
<property name="text">
<string>Uppercase (asm.ucase)</string>
</property>
</item>
<item>
<property name="text">
<string>Capitalize (asm.capitalize)</string>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="3" column="2" colspan="2"> <item row="3" column="2" colspan="2">
@ -210,13 +164,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="12" column="1" colspan="2">
<widget class="QCheckBox" name="bblineCheckBox">
<property name="text">
<string>Show empty line after every basic block (asm.bb.line)</string>
</property>
</widget>
</item>
<item row="7" column="1"> <item row="7" column="1">
<widget class="QCheckBox" name="offsetCheckBox"> <widget class="QCheckBox" name="offsetCheckBox">
<property name="text"> <property name="text">
@ -224,37 +171,108 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="16" column="1">
<widget class="QLabel" name="syntaxLabel"> <widget class="QLabel" name="asmTabsOffLabel">
<property name="text"> <property name="text">
<string>Syntax (asm.syntax):</string> <string>Tabs before assembly (asm.tabs.off):</string>
</property> </property>
<property name="textInteractionFlags"> <property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1">
<widget class="QCheckBox" name="bytesCheckBox">
<property name="text">
<string>Display the bytes of each instruction (asm.bytes)</string>
</property>
</widget>
</item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QComboBox" name="syntaxComboBox"/> <widget class="QComboBox" name="syntaxComboBox"/>
</item> </item>
<item row="11" column="1"> <item row="14" column="1" colspan="2">
<widget class="QCheckBox" name="bblineCheckBox">
<property name="text">
<string>Show empty line after every basic block (asm.bb.line)</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="caseComboBox">
<item>
<property name="text">
<string>Lowercase</string>
</property>
</item>
<item>
<property name="text">
<string>Uppercase (asm.ucase)</string>
</property>
</item>
<item>
<property name="text">
<string>Capitalize (asm.capitalize)</string>
</property>
</item>
</widget>
</item>
<item row="18" column="1" colspan="2">
<widget class="QCheckBox" name="lbytesCheckBox">
<property name="text">
<string>Align bytes to the left (asm.lbytes)</string>
</property>
</widget>
</item>
<item row="19" column="1" colspan="2">
<widget class="QCheckBox" name="bytespaceCheckBox">
<property name="text">
<string>Separate bytes with whitespace (asm.bytespace)</string>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="realnameCheckBox"> <widget class="QCheckBox" name="realnameCheckBox">
<property name="text"> <property name="text">
<string>Display flags' real name (asm.flags.real)</string> <string>Display flags' real name (asm.flags.real)</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="15" column="1">
<widget class="QCheckBox" name="relOffsetCheckBox"> <widget class="QLabel" name="asmTabsLabel">
<property name="text"> <property name="text">
<string>Show offsets relative to a function (asm.reloff)</string> <string>Tabs in assembly (asm.tabs):</string>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item row="15" column="2">
<widget class="QSpinBox" name="asmTabsSpinBox">
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>5</number>
</property>
</widget>
</item>
<item row="8" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="relOffsetLabel">
<property name="text">
<string>Show offsets relative to:</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="relOffsetCheckBox">
<property name="text">
<string>Functions (asm.reloff)</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="8" column="2">
<widget class="QCheckBox" name="relOffFlagsCheckBox">
<property name="text">
<string>Flags (asm.reloff.flags)</string>
</property> </property>
</widget> </widget>
</item> </item>