Move default AsmOptions code to Configuration and shorten it (#415)

* Correct asm.cmtright to asm.cmt.right
* Add asm.flgoff to Disassembly Options
* Add Configuration::get/setConfig
This commit is contained in:
Florian Märkl 2018-03-22 09:42:54 +01:00 committed by xarkes
parent 0cc1f23826
commit adb311a122
8 changed files with 188 additions and 339 deletions

View File

@ -503,60 +503,6 @@ void CutterCore::triggerGraphOptionsChanged()
emit graphOptionsChanged();
}
void CutterCore::resetDefaultAsmOptions()
{
// TODO Merge with Configuration.cpp
setConfig("asm.esil", Config()->getAsmESIL());
setConfig("asm.pseudo", Config()->getAsmPseudo());
setConfig("asm.offset", Config()->getAsmOffset());
setConfig("asm.describe", Config()->getAsmDescribe());
setConfig("asm.stackptr", Config()->getAsmStackPointer());
setConfig("asm.slow", Config()->getAsmSlow());
setConfig("asm.lines", Config()->getAsmLines());
setConfig("asm.fcnlines", Config()->getAsmFcnLines());
setConfig("asm.emu", Config()->getAsmEmu());
setConfig("asm.cmt.right", Config()->getAsmCmtRight());
setConfig("asm.varsum", Config()->getAsmVarSum());
setConfig("asm.bytes", Config()->getAsmBytes());
setConfig("asm.size", Config()->getAsmSize());
setConfig("asm.bytespace", Config()->getAsmBytespace());
setConfig("asm.lbytes", Config()->getAsmLBytes());
setConfig("asm.nbytes", Config()->getAsmNBytes());
setConfig("asm.syntax", Config()->getAsmSyntax());
setConfig("asm.ucase", Config()->getAsmUppercase());
setConfig("asm.bbline", Config()->getAsmBBLine());
setConfig("asm.capitalize", Config()->getAsmCapitalize());
setConfig("asm.varsub", Config()->getAsmVarsub());
setConfig("asm.varsub_only", Config()->getAsmVarsubOnly());
}
void CutterCore::saveDefaultAsmOptions()
{
Config()->setAsmESIL(getConfigb("asm.esil"));
Config()->setAsmPseudo(getConfigb("asm.pseudo"));
Config()->setAsmOffset(getConfigb("asm.offset"));
Config()->setAsmDescribe(getConfigb("asm.describe"));
Config()->setAsmStackPointer(getConfigb("asm.stackptr"));
Config()->setAsmSlow(getConfigb("asm.slow"));
Config()->setAsmLines(getConfigb("asm.lines"));
Config()->setAsmFcnLines(getConfigb("asm.fcnlines"));
Config()->setAsmEmu(getConfigb("asm.emu"));
Config()->setAsmCmtRight(getConfigb("asm.cmt.right"));
Config()->setAsmVarSum(getConfigb("asm.varsum"));
Config()->setAsmBytes(getConfigb("asm.bytes"));
Config()->setAsmSize(getConfigb("asm.size"));
Config()->setAsmBytespace(getConfigb("asm.bytespace"));
Config()->setAsmLBytes(getConfigb("asm.lbytes"));
Config()->setAsmNBytes(getConfigi("asm.nbytes"));
Config()->setAsmSyntax(getConfig("asm.syntax"));
Config()->setAsmUppercase(getConfigb("asm.ucase"));
Config()->setAsmBBLine(getConfigb("asm.bbline"));
Config()->setAsmCapitalize(getConfigb("asm.capitalize"));
Config()->setAsmVarsub(getConfigb("asm.varsub"));
Config()->setAsmVarsubOnly(getConfigb("asm.varsub_only"));
Config()->setAsmTabs(getConfigi("asm.tabs"));
}
QString CutterCore::getConfig(const QString &k)
{
CORE_LOCK();
@ -564,6 +510,21 @@ QString CutterCore::getConfig(const QString &k)
return QString(r_config_get(core_->config, key.constData()));
}
void CutterCore::setConfig(const QString &k, const QVariant &v)
{
switch(v.type()) {
case QVariant::Type::Bool:
setConfig(k, v.toBool());
break;
case QVariant::Type::Int:
setConfig(k, v.toInt());
break;
default:
setConfig(k, v.toString());
break;
}
}
void CutterCore::setCPU(QString arch, QString cpu, int bits, bool temporary)
{
setConfig("asm.arch", arch);
@ -793,7 +754,6 @@ void CutterCore::setSettings()
setConfig("anal.hasnext", false);
setConfig("asm.lines.call", false);
setConfig("asm.flgoff", true);
setConfig("anal.autoname", true);
// Fucking pancake xD
@ -1584,7 +1544,6 @@ QJsonArray CutterCore::getOpenedFiles()
QJsonDocument files = cmdj("oj");
return files.array();
}
QList<QString> CutterCore::getColorThemes()
{
QList<QString> r;

View File

@ -343,10 +343,8 @@ public:
void setConfig(const QString &k, const QString &v);
void setConfig(const QString &k, int v);
void setConfig(const QString &k, bool v);
void setConfig(const QString &k, const char *v)
{
setConfig(k, QString(v));
}
void setConfig(const QString &k, const char *v) { setConfig(k, QString(v)); }
void setConfig(const QString &k, const QVariant &v);
int getConfigi(const QString &k);
bool getConfigb(const QString &k);
QString getConfig(const QString &k);
@ -437,9 +435,6 @@ public:
void triggerAsmOptionsChanged();
void triggerGraphOptionsChanged();
void resetDefaultAsmOptions();
void saveDefaultAsmOptions();
void loadScript(const QString &scriptname);
QString getVersionInformation();
QJsonArray getOpenedFiles();

View File

@ -226,9 +226,6 @@ void MainWindow::openNewFile(const QString &fn, int analLevel, QList<QString> ad
{
setFilename(fn);
/* Reset config */
core->resetDefaultAsmOptions();
/* Prompt to load filename.r2 script */
QString script = QString("%1.r2").arg(this->filename);
if (r_file_exists(script.toStdString().data())) {

View File

@ -24,8 +24,6 @@ AsmOptionsWidget::AsmOptionsWidget(PreferencesDialog */*dialog*/, QWidget *paren
connect(Core(), SIGNAL(asmOptionsChanged()), this, SLOT(updateAsmOptionsFromVars()));
ui->buttonBox->addButton(tr("Save as Defaults"), QDialogButtonBox::ButtonRole::ApplyRole);
//connect(dialog, SIGNAL(saveAsDefault()), this, SLOT(saveAsDefault()));
//connect(dialog, SIGNAL(resetToDefault()), this, SLOT(resetToDefault()));
}
@ -35,33 +33,34 @@ AsmOptionsWidget::~AsmOptionsWidget() {}
void AsmOptionsWidget::updateAsmOptionsFromVars()
{
qhelpers::setCheckedWithoutSignals(ui->esilCheckBox, Core()->getConfigb("asm.esil"));
qhelpers::setCheckedWithoutSignals(ui->pseudoCheckBox, Core()->getConfigb("asm.pseudo"));
qhelpers::setCheckedWithoutSignals(ui->offsetCheckBox, Core()->getConfigb("asm.offset"));
qhelpers::setCheckedWithoutSignals(ui->describeCheckBox, Core()->getConfigb("asm.describe"));
qhelpers::setCheckedWithoutSignals(ui->stackpointerCheckBox, Core()->getConfigb("asm.stackptr"));
qhelpers::setCheckedWithoutSignals(ui->slowCheckBox, Core()->getConfigb("asm.slow"));
qhelpers::setCheckedWithoutSignals(ui->linesCheckBox, Core()->getConfigb("asm.lines"));
qhelpers::setCheckedWithoutSignals(ui->fcnlinesCheckBox, Core()->getConfigb("asm.fcnlines"));
qhelpers::setCheckedWithoutSignals(ui->emuCheckBox, Core()->getConfigb("asm.emu"));
qhelpers::setCheckedWithoutSignals(ui->cmtrightCheckBox, Core()->getConfigb("asm.cmtright"));
qhelpers::setCheckedWithoutSignals(ui->varsumCheckBox, Core()->getConfigb("asm.varsum"));
qhelpers::setCheckedWithoutSignals(ui->sizeCheckBox, Core()->getConfigb("asm.size"));
qhelpers::setCheckedWithoutSignals(ui->esilCheckBox, Config()->getConfigBool("asm.esil"));
qhelpers::setCheckedWithoutSignals(ui->pseudoCheckBox, Config()->getConfigBool("asm.pseudo"));
qhelpers::setCheckedWithoutSignals(ui->offsetCheckBox, Config()->getConfigBool("asm.offset"));
qhelpers::setCheckedWithoutSignals(ui->describeCheckBox, Config()->getConfigBool("asm.describe"));
qhelpers::setCheckedWithoutSignals(ui->stackpointerCheckBox, Config()->getConfigBool("asm.stackptr"));
qhelpers::setCheckedWithoutSignals(ui->slowCheckBox, Config()->getConfigBool("asm.slow"));
qhelpers::setCheckedWithoutSignals(ui->linesCheckBox, Config()->getConfigBool("asm.lines"));
qhelpers::setCheckedWithoutSignals(ui->fcnlinesCheckBox, Config()->getConfigBool("asm.fcnlines"));
qhelpers::setCheckedWithoutSignals(ui->flgoffCheckBox, Config()->getConfigBool("asm.flgoff"));
qhelpers::setCheckedWithoutSignals(ui->emuCheckBox, Config()->getConfigBool("asm.emu"));
qhelpers::setCheckedWithoutSignals(ui->cmtrightCheckBox, Config()->getConfigBool("asm.cmt.right"));
qhelpers::setCheckedWithoutSignals(ui->varsumCheckBox, Config()->getConfigBool("asm.varsum"));
qhelpers::setCheckedWithoutSignals(ui->sizeCheckBox, Config()->getConfigBool("asm.size"));
bool bytesEnabled = Core()->getConfigb("asm.bytes");
bool bytesEnabled = Config()->getConfigBool("asm.bytes");
qhelpers::setCheckedWithoutSignals(ui->bytesCheckBox, bytesEnabled);
qhelpers::setCheckedWithoutSignals(ui->bytespaceCheckBox, Core()->getConfigb("asm.bytespace"));
qhelpers::setCheckedWithoutSignals(ui->bytespaceCheckBox, Config()->getConfigBool("asm.bytespace"));
ui->bytespaceCheckBox->setEnabled(bytesEnabled);
qhelpers::setCheckedWithoutSignals(ui->lbytesCheckBox, Core()->getConfigb("asm.lbytes"));
qhelpers::setCheckedWithoutSignals(ui->lbytesCheckBox, Config()->getConfigBool("asm.lbytes"));
ui->lbytesCheckBox->setEnabled(bytesEnabled);
ui->nbytesSpinBox->blockSignals(true);
ui->nbytesSpinBox->setValue(Core()->getConfigi("asm.nbytes"));
ui->nbytesSpinBox->setValue(Config()->getConfigInt("asm.nbytes"));
ui->nbytesSpinBox->blockSignals(false);
ui->nbytesLabel->setEnabled(bytesEnabled);
ui->nbytesSpinBox->setEnabled(bytesEnabled);
QString currentSyntax = Core()->getConfig("asm.syntax");
QString currentSyntax = Config()->getConfigString("asm.syntax");
for (int i = 0; i < ui->syntaxComboBox->count(); i++) {
if (ui->syntaxComboBox->itemData(i) == currentSyntax) {
ui->syntaxComboBox->blockSignals(true);
@ -72,9 +71,9 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
}
ui->caseComboBox->blockSignals(true);
if (Core()->getConfigb("asm.ucase")) {
if (Config()->getConfigBool("asm.ucase")) {
ui->caseComboBox->setCurrentIndex(1);
} else if (Core()->getConfigb("asm.capitalize")) {
} else if (Config()->getConfigBool("asm.capitalize")) {
ui->caseComboBox->setCurrentIndex(2);
} else {
ui->caseComboBox->setCurrentIndex(0);
@ -82,26 +81,20 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
ui->caseComboBox->blockSignals(false);
ui->asmTabsSpinBox->blockSignals(true);
ui->asmTabsSpinBox->setValue(Core()->getConfigi("asm.tabs"));
ui->asmTabsSpinBox->setValue(Config()->getConfigInt("asm.tabs"));
ui->asmTabsSpinBox->blockSignals(false);
qhelpers::setCheckedWithoutSignals(ui->bblineCheckBox, Core()->getConfigb("asm.bbline"));
qhelpers::setCheckedWithoutSignals(ui->bblineCheckBox, Config()->getConfigBool("asm.bbline"));
bool varsubEnabled = Core()->getConfigb("asm.varsub");
bool varsubEnabled = Config()->getConfigBool("asm.varsub");
qhelpers::setCheckedWithoutSignals(ui->varsubCheckBox, varsubEnabled);
qhelpers::setCheckedWithoutSignals(ui->varsubOnlyCheckBox, Core()->getConfigb("asm.varsub_only"));
qhelpers::setCheckedWithoutSignals(ui->varsubOnlyCheckBox, Config()->getConfigBool("asm.varsub_only"));
ui->varsubOnlyCheckBox->setEnabled(varsubEnabled);
}
void AsmOptionsWidget::saveAsDefault()
{
Core()->saveDefaultAsmOptions();
}
void AsmOptionsWidget::resetToDefault()
{
Core()->resetDefaultAsmOptions();
Config()->resetToDefaultAsmOptions();
updateAsmOptionsFromVars();
triggerAsmOptionsChanged();
}
@ -116,73 +109,79 @@ void AsmOptionsWidget::triggerAsmOptionsChanged()
void AsmOptionsWidget::on_esilCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.esil", checked);
Config()->setConfig("asm.esil", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_pseudoCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.pseudo", checked);
Config()->setConfig("asm.pseudo", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_offsetCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.offset", checked);
Config()->setConfig("asm.offset", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_describeCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.describe", checked);
Config()->setConfig("asm.describe", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_stackpointerCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.stackptr", checked);
Config()->setConfig("asm.stackptr", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_slowCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.slow", checked);
Config()->setConfig("asm.slow", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_linesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.lines", checked);
Config()->setConfig("asm.lines", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_fcnlinesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.fcnlines", checked);
Config()->setConfig("asm.fcnlines", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_flgoffCheckBox_toggled(bool checked)
{
Config()->setConfig("asm.flgoff", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_emuCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.emu", checked);
Config()->setConfig("asm.emu", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_cmtrightCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.cmtright", checked);
Config()->setConfig("asm.cmt.right", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_varsumCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.varsum", checked);
Config()->setConfig("asm.varsum", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bytesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.bytes", checked);
Config()->setConfig("asm.bytes", checked);
ui->bytespaceCheckBox->setEnabled(checked);
ui->lbytesCheckBox->setEnabled(checked);
ui->nbytesLabel->setEnabled(checked);
@ -192,31 +191,31 @@ void AsmOptionsWidget::on_bytesCheckBox_toggled(bool checked)
void AsmOptionsWidget::on_sizeCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.size", checked);
Config()->setConfig("asm.size", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bytespaceCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.bytespace", checked);
Config()->setConfig("asm.bytespace", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_lbytesCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.lbytes", checked);
Config()->setConfig("asm.lbytes", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_nbytesSpinBox_valueChanged(int value)
{
Core()->setConfig("asm.nbytes", value);
Config()->setConfig("asm.nbytes", value);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_syntaxComboBox_currentIndexChanged(int index)
{
Core()->setConfig("asm.syntax",
Config()->setConfig("asm.syntax",
ui->syntaxComboBox->itemData(index).toString().toUtf8().constData());
triggerAsmOptionsChanged();
}
@ -246,34 +245,34 @@ void AsmOptionsWidget::on_caseComboBox_currentIndexChanged(int index)
break;
}
Core()->setConfig("asm.ucase", ucase);
Core()->setConfig("asm.capitalize", capitalize);
Config()->setConfig("asm.ucase", ucase);
Config()->setConfig("asm.capitalize", capitalize);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_asmTabsSpinBox_valueChanged(int value)
{
Core()->setConfig("asm.tabs", value);
Config()->setConfig("asm.tabs", value);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_bblineCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.bbline", checked);
Config()->setConfig("asm.bbline", checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_varsubCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.varsub", checked);
Config()->setConfig("asm.varsub", checked);
ui->varsubOnlyCheckBox->setEnabled(checked);
triggerAsmOptionsChanged();
}
void AsmOptionsWidget::on_varsubOnlyCheckBox_toggled(bool checked)
{
Core()->setConfig("asm.varsub_only", checked);
Config()->setConfig("asm.varsub_only", checked);
triggerAsmOptionsChanged();
}
@ -281,9 +280,6 @@ void AsmOptionsWidget::on_varsubOnlyCheckBox_toggled(bool checked)
void AsmOptionsWidget::on_buttonBox_clicked(QAbstractButton *button)
{
switch (ui->buttonBox->buttonRole(button)) {
case QDialogButtonBox::ButtonRole::ApplyRole:
saveAsDefault();
break;
case QDialogButtonBox::ButtonRole::ResetRole:
resetToDefault();
break;

View File

@ -28,7 +28,6 @@ private:
void triggerAsmOptionsChanged();
private slots:
void saveAsDefault();
void resetToDefault();
void updateAsmOptionsFromVars();
@ -41,6 +40,7 @@ private slots:
void on_slowCheckBox_toggled(bool checked);
void on_linesCheckBox_toggled(bool checked);
void on_fcnlinesCheckBox_toggled(bool checked);
void on_flgoffCheckBox_toggled(bool checked);
void on_emuCheckBox_toggled(bool checked);
void on_cmtrightCheckBox_toggled(bool checked);
void on_varsumCheckBox_toggled(bool checked);

View File

@ -70,6 +70,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="flgoffCheckBox">
<property name="text">
<string>Show offset before flags (asm.flgoff)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="emuCheckBox">
<property name="text">
@ -80,7 +87,7 @@
<item>
<widget class="QCheckBox" name="cmtrightCheckBox">
<property name="text">
<string>Show comments at right of assembly (asm.cmtright)</string>
<string>Show comments at right of assembly (asm.cmt.right)</string>
</property>
</widget>
</item>

View File

@ -7,6 +7,37 @@
Configuration *Configuration::mPtr = nullptr;
/*!
* \brief All asm.* options saved as settings. Values are the default values.
*/
static const QHash<QString, QVariant> asmOptions = {
{ "asm.esil", false },
{ "asm.pseudo", false },
{ "asm.offset", true },
{ "asm.describe", false },
{ "asm.stackptr", false },
{ "asm.slow", true },
{ "asm.lines", true },
{ "asm.fcnlines", true },
{ "asm.flgoff", false },
{ "asm.emu", false },
{ "asm.cmt.right", true },
{ "asm.varsum", false },
{ "asm.bytes", false },
{ "asm.size", false },
{ "asm.bytespace", false },
{ "asm.lbytes", true },
{ "asm.nbytes", 10 },
{ "asm.syntax", "intel" },
{ "asm.ucase", false },
{ "asm.bbline", false },
{ "asm.capitalize", false },
{ "asm.varsub", true },
{ "asm.varsub_only", true },
{ "asm.tabs", 5 }
};
Configuration::Configuration() : QObject()
{
mPtr = this;
@ -24,13 +55,14 @@ void Configuration::loadInitial()
{
setDarkTheme(getDarkTheme());
setColorTheme(getCurrentTheme());
applySavedAsmOptions();
}
void Configuration::resetAll()
{
Core()->cmd("e-");
Core()->setSettings();
Core()->resetDefaultAsmOptions();
resetToDefaultAsmOptions();
// Delete the file so no extra configuration is in it.
QFile settingsFile(s.fileName());
settingsFile.remove();
@ -183,3 +215,58 @@ void Configuration::setColorTheme(QString theme)
}
emit colorsUpdated();
}
void Configuration::resetToDefaultAsmOptions()
{
for (auto it = asmOptions.begin(); it != asmOptions.end(); it++) {
setConfig(it.key(), it.value());
}
}
void Configuration::applySavedAsmOptions()
{
for (auto it = asmOptions.begin(); it != asmOptions.end(); it++) {
Core()->setConfig(it.key(), s.value(it.key(), it.value()));
}
}
QVariant Configuration::getConfigVar(const QString &key)
{
QHash<QString, QVariant>::const_iterator it = asmOptions.find(key);
if (it != asmOptions.end()) {
switch(it.value().type()) {
case QVariant::Type::Bool:
return Core()->getConfigb(key);
case QVariant::Type::Int:
return Core()->getConfigi(key);
default:
return Core()->getConfig(key);
}
}
return QVariant();
}
bool Configuration::getConfigBool(const QString &key)
{
return getConfigVar(key).toBool();
}
int Configuration::getConfigInt(const QString &key)
{
return getConfigVar(key).toInt();
}
QString Configuration::getConfigString(const QString &key)
{
return getConfigVar(key).toString();
}
void Configuration::setConfig(const QString &key, const QVariant &value)
{
if (asmOptions.contains(key)) {
s.setValue(key, value);
}
Core()->setConfig(key, value);
}

View File

@ -25,6 +25,9 @@ private:
// Images
QString logoFile;
// Asm Options
void applySavedAsmOptions();
public:
// Functions
Configuration();
@ -47,6 +50,9 @@ public:
// Images
QString getLogoFile();
// Asm Options
void resetToDefaultAsmOptions();
// Graph
int getGraphBlockMaxChars() const
{
@ -57,220 +63,22 @@ public:
s.setValue("graph.maxcols", ch);
}
// TODO Imho it's wrong doing it this way. Should find something else.
bool getAsmESIL() const
{
return s.value("asm.esil", false).toBool();
}
void setAsmESIL(bool v)
{
s.setValue("asm.esil", v);
}
bool getAsmPseudo() const
{
return s.value("asm.pseudo", false).toBool();
}
void setAsmPseudo(bool v)
{
s.setValue("asm.pseudo", v);
}
bool getAsmOffset() const
{
return s.value("asm.offset", true).toBool();
}
void setAsmOffset(bool v)
{
s.setValue("asm.offset", v);
}
bool getAsmDescribe() const
{
return s.value("asm.describe", false).toBool();
}
void setAsmDescribe(bool v)
{
s.setValue("asm.describe", v);
}
bool getAsmStackPointer() const
{
return s.value("asm.stackptr", false).toBool();
}
void setAsmStackPointer(bool v)
{
s.setValue("asm.stackptr", v);
}
bool getAsmSlow() const
{
return s.value("asm.slow", true).toBool();
}
void setAsmSlow(bool v)
{
s.setValue("asm.slow", v);
}
bool getAsmLines() const
{
return s.value("asm.lines", true).toBool();
}
void setAsmLines(bool v)
{
s.setValue("asm.lines", v);
}
bool getAsmFcnLines() const
{
return s.value("asm.fcnlines", true).toBool();
}
void setAsmFcnLines(bool v)
{
s.setValue("asm.fcnlines", v);
}
bool getAsmEmu() const
{
return s.value("asm.emu", false).toBool();
}
void setAsmEmu(bool v)
{
s.setValue("asm.emu", v);
}
bool getAsmCmtRight() const
{
return s.value("asm.cmt.right", true).toBool();
}
void setAsmCmtRight(bool v)
{
s.setValue("asm.cmt.right", v);
}
bool getAsmVarSum() const
{
return s.value("asm.varsum", false).toBool();
}
void setAsmVarSum(bool v)
{
s.setValue("asm.varsum", v);
}
bool getAsmBytes() const
{
return s.value("asm.bytes", false).toBool();
}
void setAsmBytes(bool v)
{
s.setValue("asm.bytes", v);
}
bool getAsmSize() const
{
return s.value("asm.size", false).toBool();
}
void setAsmSize(bool v)
{
s.setValue("asm.size", v);
}
bool getAsmBytespace() const
{
return s.value("asm.bytespace", false).toBool();
}
void setAsmBytespace(bool v)
{
s.setValue("asm.bytespace", v);
}
bool getAsmLBytes() const
{
return s.value("asm.lbytes", true).toBool();
}
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();
}
void setAsmSyntax(const QString &v)
{
s.setValue("asm.syntax", v);
}
bool getAsmUppercase() const
{
return s.value("asm.ucase", false).toBool();
}
void setAsmUppercase(bool v)
{
s.setValue("asm.ucase", v);
}
bool getAsmBBLine() const
{
return s.value("asm.bbline", false).toBool();
}
void setAsmBBLine(bool v)
{
s.setValue("asm.bbline", v);
}
bool getAsmCapitalize() const
{
return s.value("asm.capitalize", false).toBool();
}
void setAsmCapitalize(bool v)
{
s.setValue("asm.capitalize", v);
}
bool getAsmVarsub() const
{
return s.value("asm.varsub", true).toBool();
}
void setAsmVarsub(bool v)
{
s.setValue("asm.varsub", v);
}
bool getAsmVarsubOnly() const
{
return s.value("asm.varsub_only", true).toBool();
}
void setAsmVarsubOnly(bool v)
{
s.setValue("asm.varsub_only", v);
}
int getAsmTabs() const
{
return s.value("asm.tabs", 5).toInt();
}
void setAsmTabs(int v)
{
s.setValue("asm.tabs", v);
}
QString getCurrentTheme() const
{
return s.value("theme", "solarized").toString();
}
QString getCurrentTheme() const { return s.value("theme", "solarized").toString(); }
void setColorTheme(QString theme);
/*!
* \brief Get the value of a config var either from r2 or settings, depending on the key.
*/
QVariant getConfigVar(const QString &key);
bool getConfigBool(const QString &key);
int getConfigInt(const QString &key);
QString getConfigString(const QString &key);
/*!
* \brief Set the value of a config var either to r2 or settings, depending on the key.
*/
void setConfig(const QString &key, const QVariant &value);
signals:
void fontsUpdated();
void colorsUpdated();