From 48897c15baade413ba4f7278a8059be363c526b0 Mon Sep 17 00:00:00 2001 From: Hugo Teso Date: Thu, 30 Mar 2017 11:27:43 +0200 Subject: [PATCH] Pre-select arch and bytes on hexdump preview --- src/optionsdialog.cpp | 1 + src/widgets/memwidget/memorywidget.cpp | 16 ++++++++++++++++ src/widgets/memwidget/memorywidget.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/src/optionsdialog.cpp b/src/optionsdialog.cpp index 3b32f028..f08eb8d4 100644 --- a/src/optionsdialog.cpp +++ b/src/optionsdialog.cpp @@ -202,6 +202,7 @@ void OptionsDialog::anal_finished() this->w->updateFrames(); this->w->setFilename(this->filename); this->w->get_refs( this->w->core->cmd("?v entry0") ); + this->w->memoryDock->selectHexPreview(); // Restore project notes QString notes = this->core->cmd("Pn"); diff --git a/src/widgets/memwidget/memorywidget.cpp b/src/widgets/memwidget/memorywidget.cpp index b10f489a..399cc4a6 100644 --- a/src/widgets/memwidget/memorywidget.cpp +++ b/src/widgets/memwidget/memorywidget.cpp @@ -1671,3 +1671,19 @@ void MemoryWidget::on_opcodeDescButton_clicked() ui->opcodeDescButton->setArrowType(Qt::DownArrow); } } + +void MemoryWidget::selectHexPreview() { + // Pre-select arch and bits in the hexdump sidebar + QString arch = this->main->core->cmd("e asm.arch").trimmed(); + QString bits = this->main->core->cmd("e asm.bits").trimmed(); + + //int arch_index = ui->hexArchComboBox_2->findText(arch); + if (ui->hexArchComboBox_2->findText(arch) != -1) { + ui->hexArchComboBox_2->setCurrentIndex(ui->hexArchComboBox_2->findText(arch)); + } + + //int bits_index = ui->hexBitsComboBox_2->findText(bits); + if (ui->hexBitsComboBox_2->findText(bits) != -1) { + ui->hexBitsComboBox_2->setCurrentIndex(ui->hexBitsComboBox_2->findText(bits)); + } +} diff --git a/src/widgets/memwidget/memorywidget.h b/src/widgets/memwidget/memorywidget.h index 06434948..77a46af4 100644 --- a/src/widgets/memwidget/memorywidget.h +++ b/src/widgets/memwidget/memorywidget.h @@ -80,6 +80,8 @@ public slots: void highlightDisasms(); + void selectHexPreview(); + protected: bool eventFilter(QObject *obj, QEvent *event);