X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2FMainwindow.cxx;h=b2f5b4da2b1e273e1e3a0ed7065bb1e9b2ba3996;hp=4d6e2c05c1b3b2dd5805131229cd6dd00b3847e1;hb=bb5959013f2daeff2c0639e868d6406500dc17fb;hpb=f149a5054a144793cc622512d9341b91a161bd1e diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 4d6e2c0..b2f5b4d 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -6,6 +6,7 @@ #include "core/InformationManager.hxx" #include "widgets/ScriptingDock.hxx" #include "widgets/CFGScene.hxx" +#include "widgets/FunctionWidget.hxx" #include "dialogs/NewFunctionDialog.hxx" #include "dialogs/SimpleStringDialog.hxx" @@ -76,7 +77,7 @@ void Mainwindow::setGlobalHotkeys() { 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()); }); } @@ -124,7 +125,7 @@ void Mainwindow::showListContextMenu(const QPoint& point) { 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())); @@ -148,25 +149,26 @@ void Mainwindow::requestNewFunctionByAddress(uint64_t address) { 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;