X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=src%2Fgui%2FMainwindow.cxx;h=625e7acad7d99ae890ee650615b4600f86032b51;hb=fee24ac64935da3d0a11eaee8141cb2b7ef35ed6;hp=10046bab3ef862b090cbc3de77036608a00d575f;hpb=acc34914344962b8af7656c54cd442dad1341c92;p=frida%2Ffrida.git diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 10046ba..625e7ac 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -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;