]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/Mainwindow.cxx
PoC: Add menu item to load script
[frida/frida.git] / src / gui / Mainwindow.cxx
index dfcdc76fdae6d22a6d93599c83c2f7b3f3e73ab4..9d8e45f66e5f69749e06223d96e620e6be761bec 100644 (file)
@@ -1,5 +1,6 @@
 #include "Mainwindow.hxx"
 #include "qt.hxx"
+#include "bindings/Guile.hxx"
 #include "disassembler/llvm/LLVMDisassembler.hxx"
 #include "core/Function.hxx"
 #include "core/BasicBlock.hxx"
@@ -45,9 +46,23 @@ Mainwindow::Mainwindow(InformationManager* mgr)
        fileMenu->addSeparator();
        fileMenu->addAction(exitAction);
 
-       scripting = new ScriptingDock(tr("Scripting"), this);
+       QMenu* interpretermenu = menuBar()->addMenu(tr("&Interpreter"));
+
+       interpreter["GUILE"] = new GuileInterpreter;
+       scripting = new ScriptingDock(interpreter["GUILE"], tr("Scripting"), this);
        scripting->setAllowedAreas(Qt::BottomDockWidgetArea);
        addDockWidget(Qt::BottomDockWidgetArea, scripting);
+       QAction* guileLoad = new QAction(tr("&GUILE"), this);
+       interpretermenu->addAction(guileLoad);
+       connect(guileLoad, &QAction::triggered,
+               [&]() {
+                       QString fileName = QFileDialog::getOpenFileName(this, tr("Open Script"), "",
+                                                                       tr("Binaries") + " (*." +
+                                                                       interpreter["GUILE"]->fileExtension().c_str() + ")");
+                       std::stringstream a, b;
+                       std::string c;
+                       interpreter["GUILE"]->loadFile(fileName.toStdString(), a, b, c);
+               });
 
        listWidget = new QTreeWidget();
        listWidget->setColumnCount(1);