]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/Mainwindow.cxx
Convert menu items to new style Qt Signal connects
[frida/frida.git] / src / gui / Mainwindow.cxx
index 10046bab3ef862b090cbc3de77036608a00d575f..625e7acad7d99ae890ee650615b4600f86032b51 100644 (file)
@@ -27,12 +27,12 @@ Mainwindow::Mainwindow(InformationManager* mgr)
        saveAction = new QAction(tr("&Save"), this);
        exitAction = new QAction(tr("E&xit"), this);
 
-       connect(openAction, SIGNAL(triggered()),
-               this, SLOT(open()));
-       connect(saveAction, SIGNAL(triggered()),
-               this, SLOT(save()));
-       connect(exitAction, SIGNAL(triggered()),
-               qApp, SLOT(quit()));
+       connect(openAction, &QAction::triggered,
+               this, &Mainwindow::open);
+       connect(saveAction, &QAction::triggered,
+               this, &Mainwindow::save);
+       connect(exitAction, &QAction::triggered,
+               qApp, &QApplication::quit);
 
        fileMenu = menuBar()->addMenu(tr("&File"));
        fileMenu->addAction(openAction);
@@ -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;