void ScProcess::startLanguage (void) { if (state() != QProcess::NotRunning) { statusMessage(tr("Interpreter is already running.")); return; } Settings::Manager *settings = Main::settings(); settings->beginGroup("IDE/interpreter"); QString workingDirectory = settings->value("runtimeDir").toString(); QString configFile = settings->value("configFile").toString(); settings->endGroup(); QString sclangCommand; #ifdef Q_OS_MAC sclangCommand = standardDirectory(ScResourceDir) + "/../MacOS/sclang"; #else sclangCommand = "sclang"; #endif QStringList sclangArguments; if(!configFile.isEmpty()) sclangArguments << "-l" << configFile; sclangArguments << "-i" << "scqt"; if(!workingDirectory.isEmpty()) setWorkingDirectory(workingDirectory); QProcess::start(sclangCommand, sclangArguments); bool processStarted = QProcess::waitForStarted(); if (!processStarted) emit statusMessage(tr("Failed to start interpreter!")); }
void MainWindow::createMenus() { Settings::Manager *s = mMain->settings(); s->beginGroup("IDE/shortcuts"); new QShortcut( s->shortcut("cmdLineFocus"), this, SLOT(toggleComandLineFocus()) ); QAction *act; // File mActions[Quit] = act = new QAction( QIcon::fromTheme("application-exit"), tr("&Quit..."), this); act->setShortcut(s->shortcut("quit")); act->setStatusTip(tr("Quit SuperCollider IDE")); QObject::connect( act, SIGNAL(triggered()), this, SLOT(onQuit()) ); // View mActions[ShowDocList] = act = new QAction(tr("&Documents"), this); act->setStatusTip(tr("Show/Hide the Documents dock")); act->setCheckable(true); connect(act, SIGNAL(triggered(bool)), mDocListDock, SLOT(setVisible(bool))); connect(mDocListDock, SIGNAL(visibilityChanged(bool)), act, SLOT(setChecked(bool))); // Language mActions[EvaluateCurrentFile] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("Evaluate &File"), this); act->setStatusTip(tr("Evaluate current File")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateCurrentFile())); mActions[EvaluateSelection] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("&Evaluate Selection"), this); act->setShortcut(s->shortcut("evaluateSelection")); act->setStatusTip(tr("Evaluate selection or current line")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateSelection())); mActions[EvaluateRegion] = act = new QAction( QIcon::fromTheme("media-playback-start"), tr("&Evaluate Region"), this); act->setShortcut(s->shortcut("evaluateRegion")); act->setStatusTip(tr("Evaluate current region")); connect(act, SIGNAL(triggered()), this, SLOT(evaluateRegion())); mMain->scProcess()->action(ScIDE::SCProcess::StopMain) ->setShortcut(s->shortcut("stopMain")); // Settings mActions[ShowSettings] = act = new QAction(tr("&Configure IDE..."), this); act->setStatusTip(tr("Show configuration dialog")); connect(act, SIGNAL(triggered()), this, SLOT(showSettings())); // Help mActions[BrowseHelp] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Browse Help"), this); act->setStatusTip(tr("Open help browser on the Browse page.")); //connect(act, SIGNAL(triggered()), this, SLOT(browseHelp())); mCodeEvalMapper.setMapping(act, "HelpBrowser.openBrowsePage"); connect(act, SIGNAL(triggered()), &mCodeEvalMapper, SLOT(map())); mActions[SearchHelp] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Search Help"), this); act->setStatusTip(tr("Open help browser on the Search page.")); //connect(act, SIGNAL(triggered()), this, SLOT(searchHelp())); mCodeEvalMapper.setMapping(act, "HelpBrowser.openSearchPage"); connect(act, SIGNAL(triggered()), &mCodeEvalMapper, SLOT(map())); mActions[HelpForSelection] = act = new QAction( QIcon::fromTheme("system-help"), tr("&Help for Selection"), this); act->setShortcut(s->shortcut("helpForSelection")); act->setStatusTip(tr("Find help for selected text")); connect(act, SIGNAL(triggered()), this, SLOT(helpForSelection())); s->endGroup(); // IDE/shortcuts; QMenu *menu; QMenu *submenu; menu = new QMenu(tr("&File"), this); menu->addAction( mEditors->action(MultiEditor::DocNew) ); menu->addAction( mEditors->action(MultiEditor::DocOpen) ); menu->addAction( mEditors->action(MultiEditor::DocSave) ); menu->addAction( mEditors->action(MultiEditor::DocSaveAs) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::DocClose) ); menu->addSeparator(); menu->addAction( mActions[Quit] ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Edit"), this); menu->addAction( mEditors->action(MultiEditor::Undo) ); menu->addAction( mEditors->action(MultiEditor::Redo) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::Cut) ); menu->addAction( mEditors->action(MultiEditor::Copy) ); menu->addAction( mEditors->action(MultiEditor::Paste) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::Find) ); menu->addAction( mEditors->action(MultiEditor::Replace) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::IndentMore) ); menu->addAction( mEditors->action(MultiEditor::IndentLess) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::OpenClassDefinition) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&View"), this); submenu = new QMenu(tr("&Docks"), this); submenu->addAction( mActions[ShowDocList] ); menu->addMenu(submenu); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::EnlargeFont) ); menu->addAction( mEditors->action(MultiEditor::ShrinkFont) ); menu->addSeparator(); menu->addAction( mEditors->action(MultiEditor::ShowWhitespace) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Language"), this); menu->addAction( mMain->scProcess()->action(SCProcess::StartSCLang) ); menu->addAction( mMain->scProcess()->action(SCProcess::RecompileClassLibrary) ); menu->addAction( mMain->scProcess()->action(SCProcess::StopSCLang) ); menu->addSeparator(); menu->addAction( mActions[EvaluateCurrentFile] ); menu->addAction( mActions[EvaluateRegion] ); menu->addAction( mActions[EvaluateSelection] ); menu->addSeparator(); menu->addAction( mMain->scProcess()->action(ScIDE::SCProcess::RunMain) ); menu->addAction( mMain->scProcess()->action(ScIDE::SCProcess::StopMain) ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Settings"), this); menu->addAction( mActions[ShowSettings] ); menuBar()->addMenu(menu); menu = new QMenu(tr("&Help"), this); menu->addAction( mActions[BrowseHelp] ); menu->addAction( mActions[SearchHelp] ); menu->addAction( mActions[HelpForSelection] ); menuBar()->addMenu(menu); }