src/gui/widgets/CFGScene.cxx
src/gui/widgets/ScriptingDock.cxx
src/gui/dialogs/NewFunctionDialog.cxx
+ src/gui/dialogs/RenameFunctionDialog.cxx
src/disassembler/Disassembler.cxx
src/disassembler/llvm/LLVMDisassembler.cxx
)
src/gui/widgets/CFGScene.hxx
src/gui/widgets/ScriptingDock.hxx
src/gui/dialogs/NewFunctionDialog.hxx
+ src/gui/dialogs/RenameFunctionDialog.hxx
src/disassembler/llvm/LLVMDisassembler.hxx
src/disassembler/Disassembler.hxx
)
#include "widgets/CFGScene.hxx"
#include "dialogs/NewFunctionDialog.hxx"
+#include "dialogs/RenameFunctionDialog.hxx"
#include <sstream>
void Mainwindow::showListContextMenu(const QPoint& point) {
QListWidgetItem * item = listWidget->itemAt(point);
+ QMenu menu(this);
if (item) {
- LOG4CXX_DEBUG(logger, "WOHO " << item->text().toStdString());
+ QAction * act = menu.addAction("Rename Function");
+ connect(act, &QAction::triggered, [=]() {this->renameFunction(item);});
} else {
- QMenu menu(this);
QAction * act = menu.addAction("AddFunction");
connect(act, SIGNAL(triggered()), this, SLOT(requestNewFunction()));
-
- menu.exec(listWidget->mapToGlobal(point));
}
+ menu.exec(listWidget->mapToGlobal(point));
}
void Mainwindow::requestNewFunction() {
}
}
+void Mainwindow::renameFunction(QListWidgetItem * item) {
+ RenameFunctionDialog dialog;
+ int result = dialog.exec();
+ if (QDialog::Accepted == result) {
+ LOG4CXX_DEBUG(logger, "renaming Function" << item->text().toStdString()
+ << " to " << dialog.result().toStdString());
+ item->setText(dialog.result());
+ } else {
+ LOG4CXX_DEBUG(logger, "renameFunction aborted");
+ }
+}
+
void Mainwindow::addFunction(Function* fun) {
if (functions.find(fun) != functions.end())
return;
void switchMainPlane(int);
void showListContextMenu(const QPoint&);
void requestNewFunction();
+ void renameFunction(QListWidgetItem * item);
};
#endif /* INCLUDE__Mainwindow_hxx_ */
--- /dev/null
+#include "RenameFunctionDialog.hxx"
+
+RenameFunctionDialog::RenameFunctionDialog() {
+ QGridLayout * layout = new QGridLayout;
+
+ edit = new QLineEdit;
+ layout->addWidget(edit, 0, 0, 1, 2);
+
+ QPushButton * cancelButton = new QPushButton("Cancel");
+ QPushButton * okButton = new QPushButton("OK");
+ layout->addWidget(okButton, 1, 1, 1, 1);
+ connect(okButton, SIGNAL(clicked()),
+ this, SLOT(accept()));
+ layout->addWidget(cancelButton, 1, 0, 1, 1);
+ connect(cancelButton, SIGNAL(clicked()),
+ this, SLOT(reject()));
+
+ setLayout(layout);
+ setWindowTitle("Add function");
+}
+
+QString RenameFunctionDialog::result() {
+ bool ok;
+ QString result = edit->text();
+ return result;
+}
--- /dev/null
+#include "gui/qt.hxx"
+
+class RenameFunctionDialog : public QDialog {
+ Q_OBJECT
+public:
+ RenameFunctionDialog();
+
+ QString result();
+private:
+ QLineEdit * edit;
+};