]> git.siccegge.de Git - frida/frida.git/commitdiff
Support for Renaming Groups
authorChristoph Egger <Christoph.Egger@fau.de>
Wed, 4 Mar 2015 15:20:17 +0000 (16:20 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Wed, 4 Mar 2015 15:20:17 +0000 (16:20 +0100)
src/gui/Mainwindow.cxx
src/gui/Mainwindow.hxx

index 10046bab3ef862b090cbc3de77036608a00d575f..3b805d50a68db966cd4a3d7e922a562f2a9c8bc5 100644 (file)
@@ -139,8 +139,14 @@ void Mainwindow::showListContextMenu(const QPoint& point) {
        connect(act, &QAction::triggered, this, &Mainwindow::requestNewGroup);
 
        if (item) {
-               act = menu.addAction("Rename Function");
-               connect(act, &QAction::triggered, [=]() {this->renameFunction(objects_list[item]->getFunction());});
+               if (objects_list.find(item) != objects_list.end()) {
+                       act = menu.addAction("Rename Function");
+                       connect(act, &QAction::triggered, [=]() {this->renameFunction(objects_list[item]->getFunction());});
+               } else {
+                       act = menu.addAction("Rename Group");
+                       connect(act, &QAction::triggered, [=]() {renameGroup(item);});
+               }
+
 
                QMenu* submenu = menu.addMenu("Move to group");
 
@@ -198,6 +204,18 @@ void Mainwindow::renameFunction(Function* function) {
        }
 }
 
+void Mainwindow::renameGroup(QTreeWidgetItem* item) {
+       SimpleStringDialog dialog("New name");
+       int result = dialog.exec();
+       if (QDialog::Accepted == result) {
+               LOG4CXX_DEBUG(logger, "renaming group " << item->text(0).toStdString()
+                             << " to " << dialog.result().toStdString());
+               item->setText(0, dialog.result());
+       } else {
+               LOG4CXX_DEBUG(logger, "renameFunction aborted");
+       }
+}
+
 void Mainwindow::addFunction(Function* fun) {
        if (functions.find(fun->getStartAddress()) != functions.end())
                return;
index 7e9cb3a975b8fc3c92102b098975a8794272724d..3a2e10d3587de8980c0db8a843f3eaf5f7fc9be4 100644 (file)
@@ -65,6 +65,7 @@ private Q_SLOTS:
        void requestNewFunction();
        void requestNewGroup();
        void renameFunction(Function* function);
+       void renameGroup(QTreeWidgetItem* item);
 };
 
 #endif /* INCLUDE__Mainwindow_hxx_ */