From: Christoph Egger Date: Wed, 4 Mar 2015 15:20:17 +0000 (+0100) Subject: Support for Renaming Groups X-Git-Tag: v0.1~73 X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=commitdiff_plain;h=2b057d0cd0501832d789b31551192e7e4202f4ca Support for Renaming Groups --- diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 10046ba..3b805d5 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -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; diff --git a/src/gui/Mainwindow.hxx b/src/gui/Mainwindow.hxx index 7e9cb3a..3a2e10d 100644 --- a/src/gui/Mainwindow.hxx +++ b/src/gui/Mainwindow.hxx @@ -65,6 +65,7 @@ private Q_SLOTS: void requestNewFunction(); void requestNewGroup(); void renameFunction(Function* function); + void renameGroup(QTreeWidgetItem* item); }; #endif /* INCLUDE__Mainwindow_hxx_ */