+Mainwindow::Mainwindow(InformationManager* mgr)
+ : manager(mgr)
+ , logger(log4cxx::Logger::getLogger("Mainwindow")) {
+ openAction = new QAction(tr("&Open"), this);
+ loadAction = new QAction(tr("&Load"), this);
+ saveAction = new QAction(tr("&Save"), this);
+ exitAction = new QAction(tr("E&xit"), this);
+
+ connect(openAction, &QAction::triggered,
+ this, &Mainwindow::open);
+ connect(loadAction, &QAction::triggered,
+ this, &Mainwindow::load);
+ connect(saveAction, &QAction::triggered,
+ this, &Mainwindow::save);
+ connect(exitAction, &QAction::triggered,
+ qApp, &QApplication::quit);
+
+ fileMenu = menuBar()->addMenu(tr("&File"));
+ fileMenu->addAction(openAction);
+ fileMenu->addAction(loadAction);
+ fileMenu->addAction(saveAction);
+ fileMenu->addSeparator();
+ fileMenu->addAction(exitAction);
+
+ 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);
+ });