mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Expose asm.reloff in configuration (#2243)
* Expose asm.reloff in configuration
This commit is contained in:
parent
592c050617
commit
498d2076c8
@ -129,6 +129,7 @@ static const QHash<QString, QVariant> asmOptions = {
|
||||
{ "asm.marks", false },
|
||||
{ "asm.refptr", false },
|
||||
{ "asm.flags.real", true },
|
||||
{ "asm.reloff", false },
|
||||
{ "esil.breakoninvalid",true },
|
||||
{ "graph.offset", false}
|
||||
};
|
||||
@ -766,4 +767,3 @@ bool Configuration::getOutputRedirectionEnabled() const
|
||||
{
|
||||
return outputRedirectEnabled;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
|
||||
{ ui->xrefCheckBox, "asm.xrefs" },
|
||||
{ ui->indentCheckBox, "asm.indent" },
|
||||
{ ui->offsetCheckBox, "asm.offset" },
|
||||
{ ui->relOffsetCheckBox, "asm.reloff" },
|
||||
{ ui->slowCheckBox, "asm.slow" },
|
||||
{ ui->linesCheckBox, "asm.lines" },
|
||||
{ ui->fcnlinesCheckBox, "asm.lines.fcn" },
|
||||
@ -60,6 +61,7 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog *dialog)
|
||||
&AsmOptionsWidget::commentsComboBoxChanged);
|
||||
connect(ui->asmComboBox, static_cast<indexSignalType>(&QComboBox::currentIndexChanged), this,
|
||||
&AsmOptionsWidget::asmComboBoxChanged);
|
||||
connect(ui->offsetCheckBox, &QCheckBox::toggled, this, &AsmOptionsWidget::offsetCheckBoxToggled);
|
||||
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(updateAsmOptionsFromVars()));
|
||||
updateAsmOptionsFromVars();
|
||||
}
|
||||
@ -75,6 +77,9 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
|
||||
ui->cmtcolSpinBox->blockSignals(false);
|
||||
ui->cmtcolSpinBox->setEnabled(cmtRightEnabled);
|
||||
|
||||
bool offsetsEnabled = Config()->getConfigBool("asm.offset") || Config()->getConfigBool("graph.offset");
|
||||
ui->relOffsetCheckBox->setEnabled(offsetsEnabled);
|
||||
|
||||
bool bytesEnabled = Config()->getConfigBool("asm.bytes");
|
||||
ui->bytespaceCheckBox->setEnabled(bytesEnabled);
|
||||
ui->lbytesCheckBox->setEnabled(bytesEnabled);
|
||||
@ -144,7 +149,6 @@ void AsmOptionsWidget::on_cmtcolSpinBox_valueChanged(int value)
|
||||
triggerAsmOptionsChanged();
|
||||
}
|
||||
|
||||
|
||||
void AsmOptionsWidget::on_bytesCheckBox_toggled(bool checked)
|
||||
{
|
||||
Config()->setConfig("asm.bytes", checked);
|
||||
@ -257,6 +261,11 @@ void AsmOptionsWidget::asmComboBoxChanged(int index)
|
||||
triggerAsmOptionsChanged();
|
||||
}
|
||||
|
||||
void AsmOptionsWidget::offsetCheckBoxToggled(bool checked)
|
||||
{
|
||||
ui->relOffsetCheckBox->setEnabled(checked || Config()->getConfigBool("graph.offset"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A generic signal to handle the simple cases where a checkbox is toggled
|
||||
* while it only responsible for a single independent boolean configuration eval.
|
||||
|
@ -37,7 +37,6 @@ private slots:
|
||||
|
||||
void updateAsmOptionsFromVars();
|
||||
|
||||
|
||||
void on_cmtcolSpinBox_valueChanged(int value);
|
||||
|
||||
void on_syntaxComboBox_currentIndexChanged(int index);
|
||||
@ -53,6 +52,7 @@ private slots:
|
||||
|
||||
void commentsComboBoxChanged(int index);
|
||||
void asmComboBoxChanged(int index);
|
||||
void offsetCheckBoxToggled(bool checked);
|
||||
void checkboxEnabler(QCheckBox *checkbox, QString config);
|
||||
};
|
||||
|
||||
|
@ -65,14 +65,14 @@
|
||||
<string>Disassembly</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="9" column="2">
|
||||
<item row="10" column="2">
|
||||
<widget class="QSpinBox" name="nbytesSpinBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QLabel" name="nbytesLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -85,7 +85,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QLabel" name="asmTabsOffLabel">
|
||||
<property name="text">
|
||||
<string>Tabs before assembly (asm.tabs.off):</string>
|
||||
@ -105,7 +105,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="2">
|
||||
<item row="14" column="2">
|
||||
<widget class="QSpinBox" name="asmTabsOffSpinBox">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
@ -115,21 +115,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="2">
|
||||
<item row="17" 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="14" column="1" colspan="2">
|
||||
<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="12" column="2">
|
||||
<item row="13" column="2">
|
||||
<widget class="QSpinBox" name="asmTabsSpinBox">
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
@ -139,7 +139,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QLabel" name="asmTabsLabel">
|
||||
<property name="text">
|
||||
<string>Tabs in assembly (asm.tabs):</string>
|
||||
@ -149,7 +149,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="2">
|
||||
<item row="16" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="lbytesCheckBox">
|
||||
<property name="text">
|
||||
<string>Align bytes to the left (asm.lbytes)</string>
|
||||
@ -210,7 +210,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="2">
|
||||
<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>
|
||||
@ -234,7 +234,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QCheckBox" name="bytesCheckBox">
|
||||
<property name="text">
|
||||
<string>Display the bytes of each instruction (asm.bytes)</string>
|
||||
@ -244,13 +244,20 @@
|
||||
<item row="4" column="2">
|
||||
<widget class="QComboBox" name="syntaxComboBox"/>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="realnameCheckBox">
|
||||
<property name="text">
|
||||
<string>Display flags' real name (asm.flags.real)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="relOffsetCheckBox">
|
||||
<property name="text">
|
||||
<string>Show offsets relative to a function (asm.reloff)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -52,6 +52,7 @@ void GraphOptionsWidget::on_maxColsSpinBox_valueChanged(int value)
|
||||
void GraphOptionsWidget::on_graphOffsetCheckBox_toggled(bool checked)
|
||||
{
|
||||
Config()->setConfig("graph.offset", checked);
|
||||
emit Core()->asmOptionsChanged();
|
||||
triggerOptionsChanged();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user