]> git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/ScriptingDock.hxx
Allow addition of new functions
[frida/frida.git] / src / gui / widgets / ScriptingDock.hxx
1 #ifndef INCLUDE__ScriptingDock_hxx
2 #define INCLUDE__ScriptingDock_hxx
3 #include "gui/qt.hxx"
4 #include <libguile.h>
5 #include <log4cxx/logger.h>
6
7 class ScriptingDock : public QDockWidget {
8 Q_OBJECT
9
10 public:
11 ScriptingDock(const QString& title, QWidget * parent = 0)
12 : QDockWidget(title, parent)
13 , logger(log4cxx::Logger::getLogger("ScriptingDock")) {
14 QTabWidget * tab = new QTabWidget;
15 QWidget * widget = new QWidget;
16 widget->setLayout(layout = new QGridLayout);
17 layout->addWidget(browser = new QTextBrowser, 0, 0, 1, 0);
18 layout->addWidget(line = new QLineEdit, 1, 0);
19 layout->addWidget(button = new QPushButton(tr("Evaluate")), 1, 1);
20 tab->addTab(widget, "GUILE");
21 ((QDockWidget*)this)->setWidget(tab);
22 connect(button, SIGNAL(released()), this, SLOT(doEvaluate()));
23 connect(line, SIGNAL(returnPressed()), this, SLOT(doEvaluate()));
24 scm_init_guile();
25 guile_output_port = scm_open_output_string();
26 guile_error_port = scm_open_output_string();
27 scm_set_current_output_port(guile_output_port);
28 scm_set_current_error_port(guile_error_port);
29 }
30 private:
31 log4cxx::LoggerPtr logger;
32
33 QTextBrowser * browser;
34 QGridLayout * layout;
35 QPushButton * button;
36 QLineEdit * line;
37
38 SCM guile_output_port;
39 SCM guile_error_port;
40 private Q_SLOTS:
41 void doEvaluate();
42 };
43
44 #endif