Remove unneeded menu (#720)

This commit is contained in:
fcasal 2018-09-26 13:43:37 +01:00 committed by xarkes
parent 96bf32b86a
commit ce54e4ea8f
2 changed files with 11 additions and 21 deletions

View File

@ -47,10 +47,13 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
initAction(&actionDeleteFlag, tr("Delete flag"), SLOT(on_actionDeleteFlag_triggered())); initAction(&actionDeleteFlag, tr("Delete flag"), SLOT(on_actionDeleteFlag_triggered()));
addAction(&actionDeleteFlag); addAction(&actionDeleteFlag);
initAction(&actionDeleteFunction, tr("Undefine function"), SLOT(on_actionDeleteFunction_triggered())); initAction(&actionDeleteFunction, tr("Undefine function"),
SLOT(on_actionDeleteFunction_triggered()));
addAction(&actionDeleteFunction); addAction(&actionDeleteFunction);
addAnalyzeMenu(); initAction(&actionAnalyzeFunction, tr("Define function here..."),
SLOT(on_actionAnalyzeFunction_triggered()));
addAction(&actionAnalyzeFunction);
addSetBaseMenu(); 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() void DisassemblyContextMenu::addSetBaseMenu()
{ {
setBaseMenu = addMenu(tr("Set Immediate Base to...")); setBaseMenu = addMenu(tr("Set Immediate Base to..."));
@ -363,8 +356,7 @@ void DisassemblyContextMenu::on_actionEditInstruction_triggered()
e->setInstruction(oldInstructionOpcode); e->setInstruction(oldInstructionOpcode);
if (e->exec()) if (e->exec()) {
{
QString userInstructionOpcode = e->getInstruction(); QString userInstructionOpcode = e->getInstruction();
if (userInstructionOpcode != oldInstructionOpcode) { if (userInstructionOpcode != oldInstructionOpcode) {
Core()->editInstruction(offset, userInstructionOpcode); Core()->editInstruction(offset, userInstructionOpcode);
@ -427,8 +419,7 @@ void DisassemblyContextMenu::on_actionEditBytes_triggered()
QString oldBytes = Core()->getInstructionBytes(offset); QString oldBytes = Core()->getInstructionBytes(offset);
e->setInstruction(oldBytes); e->setInstruction(oldBytes);
if (e->exec()) if (e->exec()) {
{
QString bytes = e->getInstruction(); QString bytes = e->getInstruction();
if (bytes != oldBytes) { if (bytes != oldBytes) {
Core()->editBytes(offset, bytes); Core()->editBytes(offset, bytes);
@ -453,7 +444,8 @@ void DisassemblyContextMenu::writeFailed()
msgBox.exec(); msgBox.exec();
if (msgBox.clickedButton() == reopenButton) { 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+"); Core()->cmd("oo+");
} }
} }
@ -513,7 +505,7 @@ void DisassemblyContextMenu::on_actionAnalyzeFunction_triggered()
{ {
RenameDialog *dialog = new RenameDialog(this); RenameDialog *dialog = new RenameDialog(this);
dialog->setWindowTitle(tr("Analyze function at %1").arg(RAddressString(offset))); dialog->setWindowTitle(tr("Analyze function at %1").arg(RAddressString(offset)));
dialog->setPlaceholderText(tr("Auto")); dialog->setPlaceholderText(tr("Function name"));
if (dialog->exec()) { if (dialog->exec()) {
QString function_name = dialog->getName(); QString function_name = dialog->getName();
Core()->createFunctionAt(offset, function_name); Core()->createFunctionAt(offset, function_name);

View File

@ -83,7 +83,6 @@ private:
QAction actionAddComment; QAction actionAddComment;
QAction actionAddFlag; QAction actionAddFlag;
QMenu *analyzeMenu;
QAction actionAnalyzeFunction; QAction actionAnalyzeFunction;
QAction actionRename; QAction actionRename;
QAction actionRenameUsedHere; QAction actionRenameUsedHere;
@ -134,7 +133,6 @@ private:
void setToData(int size, int repeat = 1); void setToData(int size, int repeat = 1);
void setBits(int bits); void setBits(int bits);
void addAnalyzeMenu();
void addSetBaseMenu(); void addSetBaseMenu();
void addSetBitsMenu(); void addSetBitsMenu();
void addSetToDataMenu(); void addSetToDataMenu();