From ce54e4ea8fa86afaaaba1129120c25c14913335a Mon Sep 17 00:00:00 2001 From: fcasal Date: Wed, 26 Sep 2018 13:43:37 +0100 Subject: [PATCH] Remove unneeded menu (#720) --- src/menus/DisassemblyContextMenu.cpp | 30 ++++++++++------------------ src/menus/DisassemblyContextMenu.h | 2 -- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index a0710bae..8a72786d 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -47,10 +47,13 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent) initAction(&actionDeleteFlag, tr("Delete flag"), SLOT(on_actionDeleteFlag_triggered())); addAction(&actionDeleteFlag); - initAction(&actionDeleteFunction, tr("Undefine function"), SLOT(on_actionDeleteFunction_triggered())); + initAction(&actionDeleteFunction, tr("Undefine function"), + SLOT(on_actionDeleteFunction_triggered())); addAction(&actionDeleteFunction); - addAnalyzeMenu(); + initAction(&actionAnalyzeFunction, tr("Define function here..."), + SLOT(on_actionAnalyzeFunction_triggered())); + addAction(&actionAnalyzeFunction); addSetBaseMenu(); @@ -90,16 +93,6 @@ DisassemblyContextMenu::~DisassemblyContextMenu() } } -void DisassemblyContextMenu::addAnalyzeMenu() -{ - analyzeMenu = addMenu(tr("Analyze...")); - - initAction(&actionAnalyzeFunction, tr("Create Function")); - analyzeMenu->addAction(&actionAnalyzeFunction); - connect(&actionAnalyzeFunction, &QAction::triggered, this, - &DisassemblyContextMenu::on_actionAnalyzeFunction_triggered); -} - void DisassemblyContextMenu::addSetBaseMenu() { setBaseMenu = addMenu(tr("Set Immediate Base to...")); @@ -363,8 +356,7 @@ void DisassemblyContextMenu::on_actionEditInstruction_triggered() e->setInstruction(oldInstructionOpcode); - if (e->exec()) - { + if (e->exec()) { QString userInstructionOpcode = e->getInstruction(); if (userInstructionOpcode != oldInstructionOpcode) { Core()->editInstruction(offset, userInstructionOpcode); @@ -427,8 +419,7 @@ void DisassemblyContextMenu::on_actionEditBytes_triggered() QString oldBytes = Core()->getInstructionBytes(offset); e->setInstruction(oldBytes); - if (e->exec()) - { + if (e->exec()) { QString bytes = e->getInstruction(); if (bytes != oldBytes) { Core()->editBytes(offset, bytes); @@ -448,12 +439,13 @@ void DisassemblyContextMenu::writeFailed() msgBox.setWindowTitle(tr("Write error")); msgBox.setText(tr("Unable to complete write operation. Consider opening in write mode.")); msgBox.addButton(tr("OK"), QMessageBox::NoRole); - QAbstractButton* reopenButton = msgBox.addButton(tr("Reopen in write mode"), QMessageBox::YesRole); + QAbstractButton *reopenButton = msgBox.addButton(tr("Reopen in write mode"), QMessageBox::YesRole); msgBox.exec(); if (msgBox.clickedButton() == reopenButton) { - QMessageBox::warning(this, "File reopened in write mode", "WARNING: Any chages will now be commited to disk"); + QMessageBox::warning(this, "File reopened in write mode", + "WARNING: Any chages will now be commited to disk"); Core()->cmd("oo+"); } } @@ -513,7 +505,7 @@ void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered() { RenameDialog *dialog = new RenameDialog(this); dialog->setWindowTitle(tr("Analyze function at %1").arg(RAddressString(offset))); - dialog->setPlaceholderText(tr("Auto")); + dialog->setPlaceholderText(tr("Function name")); if (dialog->exec()) { QString function_name = dialog->getName(); Core()->createFunctionAt(offset, function_name); diff --git a/src/menus/DisassemblyContextMenu.h b/src/menus/DisassemblyContextMenu.h index bc72fb47..41b51d3a 100644 --- a/src/menus/DisassemblyContextMenu.h +++ b/src/menus/DisassemblyContextMenu.h @@ -83,7 +83,6 @@ private: QAction actionAddComment; QAction actionAddFlag; - QMenu *analyzeMenu; QAction actionAnalyzeFunction; QAction actionRename; QAction actionRenameUsedHere; @@ -134,7 +133,6 @@ private: void setToData(int size, int repeat = 1); void setBits(int bits); - void addAnalyzeMenu(); void addSetBaseMenu(); void addSetBitsMenu(); void addSetToDataMenu();