Added asm.nbytes option (#308)

This commit is contained in:
Jubal 2018-02-01 04:01:09 -05:00 committed by xarkes
parent 4cc51a6a51
commit 195fd4a4b6
5 changed files with 48 additions and 5 deletions

View File

@ -515,6 +515,7 @@ void CutterCore::resetDefaultAsmOptions()
setConfig("asm.bytes", Config()->getAsmBytes()); setConfig("asm.bytes", Config()->getAsmBytes());
setConfig("asm.bytespace", Config()->getAsmBytespace()); setConfig("asm.bytespace", Config()->getAsmBytespace());
setConfig("asm.lbytes", Config()->getAsmLBytes()); setConfig("asm.lbytes", Config()->getAsmLBytes());
setConfig("asm.nbytes", Config()->getAsmNBytes());
setConfig("asm.syntax", Config()->getAsmSyntax()); setConfig("asm.syntax", Config()->getAsmSyntax());
setConfig("asm.ucase", Config()->getAsmUppercase()); setConfig("asm.ucase", Config()->getAsmUppercase());
setConfig("asm.bbline", Config()->getAsmBBLine()); setConfig("asm.bbline", Config()->getAsmBBLine());
@ -539,6 +540,7 @@ void CutterCore::saveDefaultAsmOptions()
Config()->setAsmBytes(getConfigb("asm.bytes")); Config()->setAsmBytes(getConfigb("asm.bytes"));
Config()->setAsmBytespace(getConfigb("asm.bytespace")); Config()->setAsmBytespace(getConfigb("asm.bytespace"));
Config()->setAsmLBytes(getConfigb("asm.lbytes")); Config()->setAsmLBytes(getConfigb("asm.lbytes"));
Config()->setAsmNBytes(getConfigi("asm.nbytes"));
Config()->setAsmSyntax(getConfig("asm.syntax")); Config()->setAsmSyntax(getConfig("asm.syntax"));
Config()->setAsmUppercase(getConfigb("asm.ucase")); Config()->setAsmUppercase(getConfigb("asm.ucase"));
Config()->setAsmBBLine(getConfigb("asm.bbline")); Config()->setAsmBBLine(getConfigb("asm.bbline"));
@ -784,7 +786,6 @@ void CutterCore::setSettings()
setConfig("asm.tabsonce", true); setConfig("asm.tabsonce", true);
setConfig("asm.tabsoff", 5); setConfig("asm.tabsoff", 5);
setConfig("asm.nbytes", 10);
setConfig("asm.midflags", 2); setConfig("asm.midflags", 2);
//setConfig("asm.bbline", "true"); //setConfig("asm.bbline", "true");

View File

@ -52,6 +52,12 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
ui->bytespaceCheckBox->setEnabled(bytesEnabled); ui->bytespaceCheckBox->setEnabled(bytesEnabled);
qhelpers::setCheckedWithoutSignals(ui->lbytesCheckBox, Core()->getConfigb("asm.lbytes")); qhelpers::setCheckedWithoutSignals(ui->lbytesCheckBox, Core()->getConfigb("asm.lbytes"));
ui->lbytesCheckBox->setEnabled(bytesEnabled); ui->lbytesCheckBox->setEnabled(bytesEnabled);
ui->nbytesSpinBox->blockSignals(true);
ui->nbytesSpinBox->setValue(Core()->getConfigi("asm.nbytes"));
ui->nbytesSpinBox->blockSignals(false);
ui->nbytesLabel->setEnabled(bytesEnabled);
ui->nbytesSpinBox->setEnabled(bytesEnabled);
QString currentSyntax = Core()->getConfig("asm.syntax"); QString currentSyntax = Core()->getConfig("asm.syntax");
for (int i = 0; i < ui->syntaxComboBox->count(); i++) for (int i = 0; i < ui->syntaxComboBox->count(); i++)
@ -178,6 +184,8 @@ void AsmOptionsWidget::on_bytesCheckBox_toggled(bool checked)
Core()->setConfig("asm.bytes", checked); Core()->setConfig("asm.bytes", checked);
ui->bytespaceCheckBox->setEnabled(checked); ui->bytespaceCheckBox->setEnabled(checked);
ui->lbytesCheckBox->setEnabled(checked); ui->lbytesCheckBox->setEnabled(checked);
ui->nbytesLabel->setEnabled(checked);
ui->nbytesSpinBox->setEnabled(checked);
triggerAsmOptionsChanged(); triggerAsmOptionsChanged();
} }
@ -193,6 +201,12 @@ void AsmOptionsWidget::on_lbytesCheckBox_toggled(bool checked)
triggerAsmOptionsChanged(); triggerAsmOptionsChanged();
} }
void AsmOptionsWidget::on_nbytesSpinBox_valueChanged(int value)
{
Core()->setConfig("asm.nbytes", value);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_syntaxComboBox_currentIndexChanged(int index) void AsmOptionsWidget::on_syntaxComboBox_currentIndexChanged(int index)
{ {
Core()->setConfig("asm.syntax", ui->syntaxComboBox->itemData(index).toString().toUtf8().constData()); Core()->setConfig("asm.syntax", ui->syntaxComboBox->itemData(index).toString().toUtf8().constData());

View File

@ -50,6 +50,7 @@ private slots:
void on_syntaxComboBox_currentIndexChanged(int index); void on_syntaxComboBox_currentIndexChanged(int index);
void on_caseComboBox_currentIndexChanged(int index); void on_caseComboBox_currentIndexChanged(int index);
void on_asmTabsSpinBox_valueChanged(int value); void on_asmTabsSpinBox_valueChanged(int value);
void on_nbytesSpinBox_valueChanged(int value);
void on_bblineCheckBox_toggled(bool checked); void on_bblineCheckBox_toggled(bool checked);
void on_varsubCheckBox_toggled(bool checked); void on_varsubCheckBox_toggled(bool checked);
void on_varsubOnlyCheckBox_toggled(bool checked); void on_varsubOnlyCheckBox_toggled(bool checked);

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>545</width> <width>545</width>
<height>638</height> <height>710</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -112,6 +112,30 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>16</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="nbytesLabel">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Number of bytes to display (asm.nbytes):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="nbytesSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1"> <item row="0" column="1">
@ -148,7 +172,7 @@
<item> <item>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label"> <widget class="QLabel" name="asmTabsLabel">
<property name="text"> <property name="text">
<string>Tabs in assembly (asm.tabs):</string> <string>Tabs in assembly (asm.tabs):</string>
</property> </property>

View File

@ -70,8 +70,8 @@ public:
bool getAsmCmtRight() const { return s.value("asm.cmtright", true).toBool(); } bool getAsmCmtRight() const { return s.value("asm.cmtright", true).toBool(); }
void setAsmCmtRight(bool v) { s.setValue("asm.cmtright", v); } void setAsmCmtRight(bool v) { s.setValue("asm.cmtright", v); }
bool getAsmVarSum() const { return s.value("asm.varsum", false).toBool(); } bool getAsmVarSum() const { return s.value("asm.varsum", false).toBool(); }
void setAsmVarSum(bool v) { s.setValue("asm.varsum", v); } void setAsmVarSum(bool v) { s.setValue("asm.varsum", v); }
bool getAsmBytes() const { return s.value("asm.bytes", false).toBool(); } bool getAsmBytes() const { return s.value("asm.bytes", false).toBool(); }
void setAsmBytes(bool v) { s.setValue("asm.bytes", v); } void setAsmBytes(bool v) { s.setValue("asm.bytes", v); }
@ -82,6 +82,9 @@ public:
bool getAsmLBytes() const { return s.value("asm.lbytes", true).toBool(); } bool getAsmLBytes() const { return s.value("asm.lbytes", true).toBool(); }
void setAsmLBytes(bool v) { s.setValue("asm.lbytes", v); } void setAsmLBytes(bool v) { s.setValue("asm.lbytes", v); }
int getAsmNBytes() const { return s.value("asm.nbytes", 10).toInt(); }
void setAsmNBytes(int v) { s.setValue("asm.nbytes", v); }
QString getAsmSyntax() const { return s.value("asm.syntax", "intel").toString(); } QString getAsmSyntax() const { return s.value("asm.syntax", "intel").toString(); }
void setAsmSyntax(const QString &v) { s.setValue("asm.syntax", v); } void setAsmSyntax(const QString &v) { s.setValue("asm.syntax", v); }