From 7b3c2fe7b1500f2fbca4569119f7d743164445d1 Mon Sep 17 00:00:00 2001 From: "Thomas (nezza-_-) Roth" Date: Thu, 14 Dec 2017 22:54:57 +0100 Subject: [PATCH] FunctionsWidget: Add undefine function action. (#217) --- src/menus/DisassemblyContextMenu.cpp | 2 +- src/widgets/DisassemblerGraphView.cpp | 2 ++ src/widgets/FunctionsWidget.cpp | 9 ++++++++- src/widgets/FunctionsWidget.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index 29c466aa..6e938e82 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -41,7 +41,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent) createAction(&actionDeleteComment, tr("Delete comment"), {}, SLOT(on_actionDeleteComment_triggered())); createAction(&actionDeleteFlag, tr("Delete flag"), {}, SLOT(on_actionDeleteFlag_triggered())); - createAction(&actionDeleteFunction, tr("Delete function"), {}, SLOT(on_actionDeleteFunction_triggered())); + createAction(&actionDeleteFunction, tr("Undefine function"), {}, SLOT(on_actionDeleteFunction_triggered())); setBaseMenu = new QMenu(tr("Set Immediate Base to..."), this); setBaseMenuAction = addMenu(setBaseMenu); diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 103d566e..fca70233 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -25,6 +25,7 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent) connect(Core(), SIGNAL(flagsChanged()), this, SLOT(refreshView())); connect(Core(), SIGNAL(varsChanged()), this, SLOT(refreshView())); connect(Core(), SIGNAL(instructionChanged(RVA)), this, SLOT(refreshView())); + connect(Core(), SIGNAL(functionsChanged()), this, SLOT(refreshView())); connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(colorsUpdatedSlot())); connect(Config(), SIGNAL(fontsUpdated()), this, SLOT(fontsUpdatedSlot())); @@ -597,6 +598,7 @@ void DisassemblerGraphView::blockClicked(GraphView::GraphBlock &block, QMouseEve void DisassemblerGraphView::blockDoubleClicked(GraphView::GraphBlock &block, QMouseEvent *event, QPoint pos) { + Q_UNUSED(event); RVA instr = getInstrForMouseEvent(block, &pos); if(instr == RVA_INVALID) { diff --git a/src/widgets/FunctionsWidget.cpp b/src/widgets/FunctionsWidget.cpp index cc41a527..56da363a 100644 --- a/src/widgets/FunctionsWidget.cpp +++ b/src/widgets/FunctionsWidget.cpp @@ -430,7 +430,7 @@ void FunctionsWidget::showFunctionsContextMenu(const QPoint &pt) menu->clear(); menu->addAction(ui->actionDisasAdd_comment); menu->addAction(ui->actionFunctionsRename); - //menu->addAction(ui->actionFunctionsUndefine); + menu->addAction(ui->actionFunctionsUndefine); menu->addSeparator(); menu->addAction(ui->action_References); @@ -492,6 +492,13 @@ void FunctionsWidget::on_actionFunctionsRename_triggered() } } +void FunctionsWidget::on_actionFunctionsUndefine_triggered() +{ + QTreeView *treeView = getCurrentTreeView(); + FunctionDescription function = treeView->selectionModel()->currentIndex().data(FunctionModel::FunctionDescriptionRole).value(); + Core()->delFunction(function.offset); +} + void FunctionsWidget::on_action_References_triggered() { // Get selected item in functions tree view diff --git a/src/widgets/FunctionsWidget.h b/src/widgets/FunctionsWidget.h index ca86be2c..af6c2f43 100644 --- a/src/widgets/FunctionsWidget.h +++ b/src/widgets/FunctionsWidget.h @@ -95,6 +95,7 @@ private slots: void on_actionDisasAdd_comment_triggered(); void on_actionFunctionsRename_triggered(); void on_action_References_triggered(); + void on_actionFunctionsUndefine_triggered(); void on_actionHorizontal_triggered(); void on_actionVertical_triggered();