src/gui/widgets/BasicBlockWidget.cxx
src/gui/widgets/CFGScene.cxx
src/gui/widgets/ScriptingDock.cxx
+ src/gui/widgets/FunctionWidget.cxx
src/gui/dialogs/NewFunctionDialog.cxx
src/gui/dialogs/SimpleStringDialog.cxx
src/disassembler/Disassembler.cxx
src/gui/widgets/BasicBlockWidget.hxx
src/gui/widgets/CFGScene.hxx
src/gui/widgets/ScriptingDock.hxx
+ src/gui/widgets/FunctionWidget.hxx
src/gui/dialogs/NewFunctionDialog.hxx
src/gui/dialogs/SimpleStringDialog.hxx
src/disassembler/llvm/LLVMDisassembler.hxx
#include "core/InformationManager.hxx"
#include "widgets/ScriptingDock.hxx"
#include "widgets/CFGScene.hxx"
+#include "widgets/FunctionWidget.hxx"
#include "dialogs/NewFunctionDialog.hxx"
#include "dialogs/SimpleStringDialog.hxx"
shortcut = new QShortcut(QKeySequence("r"), listWidget);
connect(shortcut, &QShortcut::activated, [=]() {
QListWidgetItem * item = listWidget->currentItem();
- if (item) renameFunction(item);
+ if (item) renameFunction(objects_list[item]->getFunction());
});
}
QMenu menu(this);
if (item) {
QAction * act = menu.addAction("Rename Function");
- connect(act, &QAction::triggered, [=]() {this->renameFunction(item);});
+ connect(act, &QAction::triggered, [=]() {this->renameFunction(objects_list[item]->getFunction());});
} else {
QAction * act = menu.addAction("AddFunction");
connect(act, SIGNAL(triggered()), this, SLOT(requestNewFunction()));
switchMainPlaneToAddress(address);
}
-void Mainwindow::renameFunction(QListWidgetItem * item) {
+void Mainwindow::renameFunction(Function* function) {
SimpleStringDialog dialog("New name");
int result = dialog.exec();
if (QDialog::Accepted == result) {
- LOG4CXX_DEBUG(logger, "renaming Function " << item->text().toStdString()
+ LOG4CXX_DEBUG(logger, "renaming Function " << function->getName()
<< " to " << dialog.result().toStdString());
- item->setText(dialog.result());
+ function->setName(dialog.result().toStdString());
+ objects_list_by_address[function->getStartAddress()]->setText(dialog.result());
} else {
LOG4CXX_DEBUG(logger, "renameFunction aborted");
}
}
void Mainwindow::addFunction(Function* fun) {
- if (functions.find(fun) != functions.end())
+ if (functions.find(fun->getStartAddress()) != functions.end())
return;
- functions.insert(fun);
+ functions.insert(std::make_pair(fun->getStartAddress(), fun));
- QTabWidget * w = new QTabWidget();
+ FunctionWidget * w = new FunctionWidget(fun);
// CFG
CFGScene * scene = new CFGScene;
#include <memory>
#include <map>
-#include <set>
#include <QTextEdit>
#include <QPushButton>
class Disassembler;
class Function;
class InformationManager;
+class FunctionWidget;
class BasicBlockWidget;
class ScriptingDock;
QAction *saveAction;
std::map<uint64_t, BasicBlockWidget*> blocks;
- std::map<QListWidgetItem*, QWidget*> objects_list;
+ std::map<uint64_t, Function*> functions;
+ std::map<QListWidgetItem*, FunctionWidget*> objects_list;
std::map<uint64_t, QListWidgetItem*> objects_list_by_address;
- std::set<Function*> functions;
- InformationManager* manager;
+ InformationManager* manager;
log4cxx::LoggerPtr logger;
private Q_SLOTS:
void switchMainPlane(int);
void showListContextMenu(const QPoint&);
void requestNewFunction();
- void renameFunction(QListWidgetItem * item);
+ void renameFunction(Function* function);
};
#endif /* INCLUDE__Mainwindow_hxx_ */