QString RubySupportPart::runDirectory() { QString cwd = DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/globalcwd"); if (cwd.isEmpty()) { QString mainProg = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/mainprogram"); KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart()); if (mainProg.isEmpty() && ro_part) cwd = ro_part->url().directory(); else cwd = project()->buildDirectory(); } return cwd; }
QString RubySupportPart::mainProgram() { QString prog; int runMainProgram = DomUtil::readIntEntry(*projectDom(), "/kdevrubysupport/run/runmainprogram"); if (runMainProgram == 0) { prog = project()->projectDirectory() + "/" + DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/mainprogram"); } else { KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart()); if (ro_part != 0) { prog = ro_part->url().path(); } } return prog; }
QString BashSupportPart::interpreter() { QString prog = DomUtil::readEntry(*projectDom(), "/kdevrbashsupport/run/interpreter"); if (prog.isEmpty()) prog = "bash"; return prog; }
void AntProjectPart::openProject(const QString &dirName, const QString &projectName) { m_projectDirectory = dirName; m_projectName = projectName; QDomDocument &dom = *projectDom(); // Set the default directory radio to "executable" /// \FIXME there is no kdevantproject so this will not work ! if (DomUtil::readEntry(dom, "/kdevantproject/run/directoryradio") == "" ) { DomUtil::writeEntry(dom, "/kdevantproject/run/directoryradio", "executable"); } /// @todo read alternative build file from properties m_antOptions.m_buildXML = "build.xml"; parseBuildXML(); fillMenu(); QFile f(dirName + "/" + projectName.lower() + ".kdevelop" + ".filelist"); if (f.open(IO_ReadOnly)) { QTextStream stream(&f); while (!stream.atEnd()) { QString s = stream.readLine(); if (!s.startsWith("#")) m_sourceFiles << s; } } else populateProject(); KDevProject::openProject( dirName, projectName ); }
QString PythonSupportPart::interpreter() { QString prog = DomUtil::readEntry(*projectDom(), "/kdevpythonsupport/run/interpreter"); if (prog.isEmpty()) prog = "python"; return prog; }
QString RubySupportPart::characterCoding() { int coding = DomUtil::readIntEntry(*projectDom(), "/kdevrubysupport/run/charactercoding"); QString code("A"); switch (coding) { case 0: code = "A"; break; case 1: code = "E"; break; case 2: code = "S"; break; case 3: code = "U"; break; } return code; }
/** Retuns the currently selected main program * The returned string can be: * if run/directoryradio == executable * The executable name * if run/directoryradio == build * The path to executable relative to build directory * if run/directoryradio == custom or relative == false * The absolute path to executable */ QString AntProjectPart::mainProgram() const { QDomDocument * dom = projectDom(); if ( !dom ) return QString(); QString DomMainProgram = DomUtil::readEntry( *dom, "/kdevantproject/run/mainprogram"); if ( DomMainProgram.isEmpty() ) return QString(); if ( DomMainProgram.startsWith("/") ) // assume absolute path { return DomMainProgram; } else // assume project relative path { return projectDirectory() + "/" + DomMainProgram; } return QString(); }
/** Retuns the currently selected run directory * The returned string can be: * if run/directoryradio == executable * The directory where the executable is * if run/directoryradio == build * The directory where the executable is relative to build directory * if run/directoryradio == custom * The custom directory absolute path */ QString AntProjectPart::runDirectory() const { return buildDirectory(); /// \FIXME put the code below into use! QDomDocument &dom = *projectDom(); /// \FIXME there is no kdevantproject so this will not work ! QString directoryRadioString = DomUtil::readEntry(dom, "/kdevantproject/run/directoryradio"); QString DomMainProgram = DomUtil::readEntry(dom, "/kdevantproject/run/mainprogram"); if ( directoryRadioString == "build" ) return buildDirectory(); if ( directoryRadioString == "custom" ) return DomUtil::readEntry(dom, "/kdevantproject/run/customdirectory"); int pos = DomMainProgram.findRev('/'); if (pos != -1) return buildDirectory() + "/" + DomMainProgram.left(pos); return buildDirectory() + "/" + DomMainProgram; }
QString RubySupportPart::programArgs() { QString args = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/programargs"); return args; }
QString RubySupportPart::shell() { QString shell = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/shell"); if (shell.isEmpty()) shell = "irb"; return shell; }
QString RubySupportPart::interpreter() { QString prog = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/interpreter"); if (prog.isEmpty()) prog = "ruby"; return prog; }
bool RubyDebuggerPart::startDebugger() { QString build_dir; // Currently selected build directory QString run_directory; // Directory from where the program should be run QString program; // Absolute path to application QString run_arguments; // Command line arguments to be passed to the application QString ruby_interpreter; // Absolute path to the ruby interpreter QString debuggee_path; // Absolute path to debuggee.rb debugger script bool show_constants; // Show constants in the debugger bool trace_into_ruby; // Trace into the ruby code installed under sitedir if (project()) { build_dir = project()->buildDirectory(); run_directory = DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/globalcwd"); if (run_directory.isEmpty()) run_directory = project()->buildDirectory(); } int runMainProgram = DomUtil::readIntEntry(*projectDom(), "/kdevrubysupport/run/runmainprogram"); if (runMainProgram == 0) { program = project()->projectDirectory() + "/" + DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/mainprogram"); } else { KParts::ReadOnlyPart *ro_part = dynamic_cast<KParts::ReadOnlyPart*>(partController()->activePart()); if (ro_part != 0) { program = ro_part->url().path(); } } run_arguments = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/programargs"); QString shell = DomUtil::readEntry(*projectDom(), "/kdevrbdebugger/general/dbgshell"); if( !shell.isEmpty() ) { QFileInfo info( shell ); if( info.isRelative() ) { shell = build_dir + "/" + shell; info.setFile( shell ); } if( !info.exists() ) { KMessageBox::error( mainWindow()->main(), i18n("Could not locate the debugging shell '%1'.").arg( shell ), i18n("Debugging Shell Not Found") ); return false; } } core()->running(this, true); stateChanged( QString("active") ); KActionCollection *ac = actionCollection(); ac->action("debug_run")->setText( i18n("&Continue") ); // ac->action("debug_run")->setIcon( "dbgrun" ); ac->action("debug_run")->setToolTip( i18n("Continues the application execution") ); ac->action("debug_run")->setWhatsThis( i18n("Continue application execution\n\n" "Continues the execution of your application in the " "debugger. This only takes effect when the application " "has been halted by the debugger (i.e. a breakpoint has " "been activated or the interrupt was pressed).") ); // mainWindow()->setViewAvailable(variableWidget, true); mainWindow()->setViewAvailable(framestackWidget, true); mainWindow()->setViewAvailable(rdbOutputWidget, true); // variableWidget->setEnabled(true); framestackWidget->setEnabled(true); rdbOutputWidget->clear(); rdbOutputWidget->setEnabled(true); if (DomUtil::readBoolEntry(*projectDom(), "/kdevrbdebugger/general/floatingtoolbar", false)) { floatingToolBar = new DbgToolBar(this, mainWindow()->main()); floatingToolBar->show(); } ruby_interpreter = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/interpreter"); int coding = DomUtil::readIntEntry(*projectDom(), "/kdevrubysupport/run/charactercoding"); QString character_coding("-K"); switch (coding) { case 0: character_coding.append("A"); break; case 1: character_coding.append("E"); break; case 2: character_coding.append("S"); break; case 3: character_coding.append("U"); break; } // ruby_interpreter.append(QString(" -K") + code); debuggee_path = ::locate("data", "kdevrbdebugger/debuggee.rb", instance()); show_constants = DomUtil::readBoolEntry(*projectDom(), "/kdevrbdebugger/general/showconstants"); trace_into_ruby = DomUtil::readBoolEntry(*projectDom(), "/kdevrbdebugger/general/traceintoruby"); controller->slotStart(ruby_interpreter, character_coding, run_directory, debuggee_path, program, run_arguments, show_constants, trace_into_ruby); return true; }
void RubyDebuggerPart::setupController() { VariableTree *variableTree = variableWidget->varTree(); controller = new RDBController(variableTree, framestackWidget, *projectDom()); // this -> controller connect( this, SIGNAL(rubyInspect(const QString&)), controller, SLOT(slotRubyInspect(const QString&))); // variableTree -> framestackWidget connect( variableTree, SIGNAL(selectFrame(int, int)), framestackWidget, SLOT(slotSelectFrame(int, int))); // framestackWidget -> variableTree connect( framestackWidget, SIGNAL(frameActive(int, int, const QString&)), variableTree, SLOT(slotFrameActive(int, int, const QString&))); // variableTree -> controller connect( variableTree, SIGNAL(expandItem(VarItem*, const QCString&)), controller, SLOT(slotExpandItem(VarItem*, const QCString&))); connect( variableTree, SIGNAL(fetchGlobals(bool)), controller, SLOT(slotFetchGlobals(bool))); connect( variableTree, SIGNAL(addWatchExpression(const QString&, bool)), controller, SLOT(slotAddWatchExpression(const QString&, bool))); connect( variableTree, SIGNAL(removeWatchExpression(int)), controller, SLOT(slotRemoveWatchExpression(int))); // framestackWidget -> controller connect( framestackWidget, SIGNAL(selectFrame(int,int,const QString&)), controller, SLOT(slotSelectFrame(int,int,const QString&))); // rdbBreakpointWidget -> controller connect( rdbBreakpointWidget, SIGNAL(clearAllBreakpoints()), controller, SLOT(slotClearAllBreakpoints())); connect( rdbBreakpointWidget, SIGNAL(publishBPState(const Breakpoint&)), controller, SLOT(slotBPState(const Breakpoint &))); // rdbOutputWidget -> controller connect( rdbOutputWidget, SIGNAL(userRDBCmd(const QString &)), controller, SLOT(slotUserRDBCmd(const QString&))); connect( rdbOutputWidget, SIGNAL(breakInto()), controller, SLOT(slotBreakInto())); // controller -> rdbBreakpointWidget connect( controller, SIGNAL(acceptPendingBPs()), rdbBreakpointWidget, SLOT(slotSetPendingBPs())); connect( controller, SIGNAL(unableToSetBPNow(int)), rdbBreakpointWidget, SLOT(slotUnableToSetBPNow(int))); connect( controller, SIGNAL(rawRDBBreakpointList (char*)), rdbBreakpointWidget, SLOT(slotParseRDBBrkptList(char*))); connect( controller, SIGNAL(rawRDBBreakpointSet(char*, int)), rdbBreakpointWidget, SLOT(slotParseRDBBreakpointSet(char*, int))); // controller -> this connect( controller, SIGNAL(dbgStatus(const QString&, int)), this, SLOT(slotStatus(const QString&, int))); connect( controller, SIGNAL(showStepInSource(const QString&, int, const QString&)), this, SLOT(slotShowStep(const QString&, int))); // controller -> procLineMaker connect( controller, SIGNAL(ttyStdout(const char*)), procLineMaker, SLOT(slotReceivedStdout(const char*))); connect( controller, SIGNAL(ttyStderr(const char*)), procLineMaker, SLOT(slotReceivedStderr(const char*))); // controller -> rdbOutputWidget connect( controller, SIGNAL(rdbStdout(const char*)), rdbOutputWidget, SLOT(slotReceivedStdout(const char*)) ); connect( controller, SIGNAL(rdbStderr(const char*)), rdbOutputWidget, SLOT(slotReceivedStderr(const char*)) ); connect( controller, SIGNAL(dbgStatus(const QString&, int)), rdbOutputWidget, SLOT(slotDbgStatus(const QString&, int))); }
/** Retuns a QString with the run command line arguments */ QString AntProjectPart::runArguments() const { /// \FIXME there is no kdevantproject so this will not work ! return DomUtil::readEntry(*projectDom(), "/kdevantproject/run/programargs"); }
/** Retuns a PairList with the run environment variables */ DomUtil::PairList AntProjectPart::runEnvironmentVars() const { /// \FIXME there is no kdevantproject so this will not work ! return DomUtil::readPairListEntry(*projectDom(), "/kdevantproject/run/envvars", "envvar", "name", "value"); }
void RubySupportPart::startApplication(const QString &program) { bool inTerminal = DomUtil::readBoolEntry(*projectDom(), "/kdevrubysupport/run/terminal"); if (KDevAppFrontend *appFrontend = extension<KDevAppFrontend>("KDevelop/AppFrontend")) appFrontend->startAppCommand(QString::QString(), program, inTerminal); }
void RubySupportPart::projectConfigWidget(KDialogBase *dlg) { QVBox *vbox = dlg->addVBoxPage(i18n("Ruby"), i18n("Ruby"), BarIcon("ruby_config.png", KIcon::SizeMedium, KIcon::DefaultState, RubySupportPart::instance())); RubyConfigWidget *w = new RubyConfigWidget(*projectDom(), (QWidget *)vbox, "ruby config widget"); connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); }
void PythonSupportPart::projectConfigWidget(KDialogBase *dlg) { QVBox *vbox = dlg->addVBoxPage(i18n("Python")); PythonConfigWidget *w = new PythonConfigWidget(*projectDom(), vbox, "python config widget"); connect( dlg, SIGNAL(okClicked()), w, SLOT(accept()) ); }