mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-07 15:32:13 +00:00
Added a checkbox in the preferences dialog for asm.indent (#1175)
* Added a checkbox in the preferences dialog for asm.indent * Fixed styling * Made description more accurate
This commit is contained in:
parent
1a132ecf83
commit
49b27ba241
@ -24,6 +24,7 @@ static const QHash<QString, QVariant> asmOptions = {
|
|||||||
{ "asm.pseudo", false },
|
{ "asm.pseudo", false },
|
||||||
{ "asm.offset", true },
|
{ "asm.offset", true },
|
||||||
{ "asm.xrefs", false },
|
{ "asm.xrefs", false },
|
||||||
|
{ "asm.indent", false },
|
||||||
{ "asm.describe", false },
|
{ "asm.describe", false },
|
||||||
{ "asm.stackptr", false },
|
{ "asm.stackptr", false },
|
||||||
{ "asm.slow", true },
|
{ "asm.slow", true },
|
||||||
@ -58,10 +59,10 @@ Configuration::Configuration() : QObject()
|
|||||||
mPtr = this;
|
mPtr = this;
|
||||||
if (!s.isWritable()) {
|
if (!s.isWritable()) {
|
||||||
QMessageBox::critical(nullptr,
|
QMessageBox::critical(nullptr,
|
||||||
tr("Critical!"),
|
tr("Critical!"),
|
||||||
tr("!!! Settings are not writable! Make sure you have a write access to \"%1\"")
|
tr("!!! Settings are not writable! Make sure you have a write access to \"%1\"")
|
||||||
.arg(s.fileName())
|
.arg(s.fileName())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
loadInitial();
|
loadInitial();
|
||||||
}
|
}
|
||||||
@ -162,7 +163,7 @@ void Configuration::setLocale(const QLocale &l)
|
|||||||
bool Configuration::setLocaleByName(const QString &language)
|
bool Configuration::setLocaleByName(const QString &language)
|
||||||
{
|
{
|
||||||
const auto &allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
|
const auto &allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript,
|
||||||
QLocale::AnyCountry);
|
QLocale::AnyCountry);
|
||||||
|
|
||||||
for (auto &it : allLocales) {
|
for (auto &it : allLocales) {
|
||||||
if (QString::compare(it.nativeLanguageName(), language, Qt::CaseInsensitive) == 0) {
|
if (QString::compare(it.nativeLanguageName(), language, Qt::CaseInsensitive) == 0) {
|
||||||
@ -216,8 +217,7 @@ void Configuration::loadNativeTheme()
|
|||||||
{
|
{
|
||||||
loadBaseThemeNative();
|
loadBaseThemeNative();
|
||||||
|
|
||||||
if (windowColorIsDark())
|
if (windowColorIsDark()) {
|
||||||
{
|
|
||||||
setColor("gui.border", QColor(0, 0, 0));
|
setColor("gui.border", QColor(0, 0, 0));
|
||||||
setColor("gui.background", QColor(30, 30, 30));
|
setColor("gui.background", QColor(30, 30, 30));
|
||||||
setColor("gui.alt_background", QColor(42, 42, 42));
|
setColor("gui.alt_background", QColor(42, 42, 42));
|
||||||
@ -225,9 +225,7 @@ void Configuration::loadNativeTheme()
|
|||||||
setColor("highlight", QColor(255, 255, 255, 15));
|
setColor("highlight", QColor(255, 255, 255, 15));
|
||||||
setColor("highlightWord", QColor(20, 20, 20, 255));
|
setColor("highlightWord", QColor(20, 20, 20, 255));
|
||||||
setColor("highlightPC", QColor(87, 26, 7));
|
setColor("highlightPC", QColor(87, 26, 7));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
setColor("gui.border", QColor(0, 0, 0));
|
setColor("gui.border", QColor(0, 0, 0));
|
||||||
setColor("gui.background", QColor(255, 255, 255));
|
setColor("gui.background", QColor(255, 255, 255));
|
||||||
setColor("gui.alt_background", QColor(245, 250, 255));
|
setColor("gui.alt_background", QColor(245, 250, 255));
|
||||||
@ -322,7 +320,7 @@ QString Configuration::getLastThemeOf(const CutterQtTheme &currQtTheme) const
|
|||||||
void Configuration::setTheme(int theme)
|
void Configuration::setTheme(int theme)
|
||||||
{
|
{
|
||||||
if (theme >= kCutterQtThemesList.size() ||
|
if (theme >= kCutterQtThemesList.size() ||
|
||||||
theme < 0) {
|
theme < 0) {
|
||||||
theme = 0;
|
theme = 0;
|
||||||
}
|
}
|
||||||
s.setValue("ColorPalette", theme);
|
s.setValue("ColorPalette", theme);
|
||||||
@ -352,8 +350,8 @@ const CutterQtTheme *Configuration::getCurrentTheme()
|
|||||||
QString Configuration::getLogoFile()
|
QString Configuration::getLogoFile()
|
||||||
{
|
{
|
||||||
return windowColorIsDark()
|
return windowColorIsDark()
|
||||||
? QString(":/img/cutter_white_plain.svg")
|
? QString(":/img/cutter_white_plain.svg")
|
||||||
: QString(":/img/cutter_plain.svg");
|
: QString(":/img/cutter_plain.svg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -489,7 +487,7 @@ QStringList Configuration::getAvailableTranslations()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const QStringList &currTrFileNames = dir.entryList(QStringList("cutter_*.qm"), QDir::Files,
|
const QStringList &currTrFileNames = dir.entryList(QStringList("cutter_*.qm"), QDir::Files,
|
||||||
QDir::Name);
|
QDir::Name);
|
||||||
for (const auto &trFile : currTrFileNames) {
|
for (const auto &trFile : currTrFileNames) {
|
||||||
fileNamesSet << trFile;
|
fileNamesSet << trFile;
|
||||||
}
|
}
|
||||||
@ -534,8 +532,9 @@ bool Configuration::isFirstExecution()
|
|||||||
|
|
||||||
QStringList Configuration::getTranslationsDirectories() const
|
QStringList Configuration::getTranslationsDirectories() const
|
||||||
{
|
{
|
||||||
static const QString cutterTranslationPath = QCoreApplication::applicationDirPath() + QDir::separator()
|
static const QString cutterTranslationPath = QCoreApplication::applicationDirPath() +
|
||||||
+ QLatin1String("translations");
|
QDir::separator()
|
||||||
|
+ QLatin1String("translations");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
cutterTranslationPath,
|
cutterTranslationPath,
|
||||||
|
@ -36,8 +36,10 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
|
|||||||
qhelpers::setCheckedWithoutSignals(ui->pseudoCheckBox, Config()->getConfigBool("asm.pseudo"));
|
qhelpers::setCheckedWithoutSignals(ui->pseudoCheckBox, Config()->getConfigBool("asm.pseudo"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->offsetCheckBox, Config()->getConfigBool("asm.offset"));
|
qhelpers::setCheckedWithoutSignals(ui->offsetCheckBox, Config()->getConfigBool("asm.offset"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->xrefCheckBox, Config()->getConfigBool("asm.xrefs"));
|
qhelpers::setCheckedWithoutSignals(ui->xrefCheckBox, Config()->getConfigBool("asm.xrefs"));
|
||||||
|
qhelpers::setCheckedWithoutSignals(ui->indentCheckBox, Config()->getConfigBool("asm.indent"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->describeCheckBox, Config()->getConfigBool("asm.describe"));
|
qhelpers::setCheckedWithoutSignals(ui->describeCheckBox, Config()->getConfigBool("asm.describe"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->stackpointerCheckBox, Config()->getConfigBool("asm.stackptr"));
|
qhelpers::setCheckedWithoutSignals(ui->stackpointerCheckBox,
|
||||||
|
Config()->getConfigBool("asm.stackptr"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->slowCheckBox, Config()->getConfigBool("asm.slow"));
|
qhelpers::setCheckedWithoutSignals(ui->slowCheckBox, Config()->getConfigBool("asm.slow"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->linesCheckBox, Config()->getConfigBool("asm.lines"));
|
qhelpers::setCheckedWithoutSignals(ui->linesCheckBox, Config()->getConfigBool("asm.lines"));
|
||||||
qhelpers::setCheckedWithoutSignals(ui->fcnlinesCheckBox, Config()->getConfigBool("asm.lines.fcn"));
|
qhelpers::setCheckedWithoutSignals(ui->fcnlinesCheckBox, Config()->getConfigBool("asm.lines.fcn"));
|
||||||
@ -98,7 +100,8 @@ void AsmOptionsWidget::updateAsmOptionsFromVars()
|
|||||||
|
|
||||||
bool varsubEnabled = Config()->getConfigBool("asm.var.sub");
|
bool varsubEnabled = Config()->getConfigBool("asm.var.sub");
|
||||||
qhelpers::setCheckedWithoutSignals(ui->varsubCheckBox, varsubEnabled);
|
qhelpers::setCheckedWithoutSignals(ui->varsubCheckBox, varsubEnabled);
|
||||||
qhelpers::setCheckedWithoutSignals(ui->varsubOnlyCheckBox, Config()->getConfigBool("asm.var.subonly"));
|
qhelpers::setCheckedWithoutSignals(ui->varsubOnlyCheckBox,
|
||||||
|
Config()->getConfigBool("asm.var.subonly"));
|
||||||
ui->varsubOnlyCheckBox->setEnabled(varsubEnabled);
|
ui->varsubOnlyCheckBox->setEnabled(varsubEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +144,12 @@ void AsmOptionsWidget::on_xrefCheckBox_toggled(bool checked)
|
|||||||
triggerAsmOptionsChanged();
|
triggerAsmOptionsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsmOptionsWidget::on_indentCheckBox_toggled(bool checked)
|
||||||
|
{
|
||||||
|
Config()->setConfig("asm.indent", checked);
|
||||||
|
triggerAsmOptionsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void AsmOptionsWidget::on_describeCheckBox_toggled(bool checked)
|
void AsmOptionsWidget::on_describeCheckBox_toggled(bool checked)
|
||||||
{
|
{
|
||||||
Config()->setConfig("asm.describe", checked);
|
Config()->setConfig("asm.describe", checked);
|
||||||
@ -239,7 +248,7 @@ void AsmOptionsWidget::on_nbytesSpinBox_valueChanged(int value)
|
|||||||
void AsmOptionsWidget::on_syntaxComboBox_currentIndexChanged(int index)
|
void AsmOptionsWidget::on_syntaxComboBox_currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
Config()->setConfig("asm.syntax",
|
Config()->setConfig("asm.syntax",
|
||||||
ui->syntaxComboBox->itemData(index).toString().toUtf8().constData());
|
ui->syntaxComboBox->itemData(index).toString().toUtf8().constData());
|
||||||
triggerAsmOptionsChanged();
|
triggerAsmOptionsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ private slots:
|
|||||||
void on_pseudoCheckBox_toggled(bool checked);
|
void on_pseudoCheckBox_toggled(bool checked);
|
||||||
void on_offsetCheckBox_toggled(bool checked);
|
void on_offsetCheckBox_toggled(bool checked);
|
||||||
void on_xrefCheckBox_toggled(bool checked);
|
void on_xrefCheckBox_toggled(bool checked);
|
||||||
|
void on_indentCheckBox_toggled(bool checked);
|
||||||
void on_describeCheckBox_toggled(bool checked);
|
void on_describeCheckBox_toggled(bool checked);
|
||||||
void on_stackpointerCheckBox_toggled(bool checked);
|
void on_stackpointerCheckBox_toggled(bool checked);
|
||||||
void on_slowCheckBox_toggled(bool checked);
|
void on_slowCheckBox_toggled(bool checked);
|
||||||
|
@ -52,6 +52,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="indentCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Indent disassembly based on reflines depth (asm.indent)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="describeCheckBox">
|
<widget class="QCheckBox" name="describeCheckBox">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
Loading…
Reference in New Issue
Block a user