branches/kdevelop/3.4/languages/ruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Tue Jan 16 20:01:45 UTC 2007
SVN commit 624230 by rdale:
* Add a 'Run directory' configure option for ruby projects, and use that value
when invoking a ruby script or a the ruby debugger using the '-C' command
line option.
CCMAIL: kdevelop-devel at kdevelop.org
M +3 -1 debugger/debuggerpart.cpp
M +1 -1 debugger/rdbcontroller.cpp
M +6 -1 rubyconfigwidget.cpp
M +45 -26 rubyconfigwidgetbase.ui
M +8 -1 rubysupport_part.cpp
M +1 -0 rubysupport_part.h
--- branches/kdevelop/3.4/languages/ruby/debugger/debuggerpart.cpp #624229:624230
@@ -443,7 +443,9 @@
if (project()) {
build_dir = project()->buildDirectory();
- run_directory = project()->runDirectory();
+ run_directory = DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/globalcwd");
+ if (run_directory.isEmpty())
+ run_directory = project()->buildDirectory();
}
int runMainProgram = DomUtil::readIntEntry(*projectDom(), "/kdevrubysupport/run/runmainprogram");
--- branches/kdevelop/3.4/languages/ruby/debugger/rdbcontroller.cpp #624229:624230
@@ -1195,7 +1195,7 @@
socket_ = accept(masterSocket, &sockaddr, &fromlen);
if (fcntl(socket_, F_SETFL, O_NONBLOCK) == -1) {
- kdDebug(9012) << "RDBController::slotAcceptConnection can't set nonblocking socket" << errno << endl;
+ kdDebug(9012) << "RDBController::slotAcceptConnection can't set nonblocking socket " << errno << endl;
}
socketNotifier_ = new QSocketNotifier(socket_, QSocketNotifier::Read, 0);
--- branches/kdevelop/3.4/languages/ruby/rubyconfigwidget.cpp #624229:624230
@@ -7,7 +7,8 @@
#include <klineedit.h>
#include <qcheckbox.h>
#include <qbuttongroup.h>
-
+#include <kurlrequester.h>
+#include <kurlcompletion.h>
#include <kdebug.h>
RubyConfigWidget::RubyConfigWidget(QDomDocument &projectDom, QWidget* parent, const char* name)
@@ -29,6 +30,9 @@
enableFloatingToolBarBox->setChecked( DomUtil::readBoolEntry(dom, "/kdevrbdebugger/general/floatingtoolbar", false));
showConstants->setChecked( DomUtil::readBoolEntry(dom, "/kdevrbdebugger/general/showconstants", false));
traceIntoRuby->setChecked( DomUtil::readBoolEntry(dom, "/kdevrbdebugger/general/traceintoruby", false));
+ workingDir->completionObject()->setMode(KURLCompletion::DirCompletion);
+ workingDir->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly );
+ workingDir->setURL(DomUtil::readEntry(dom, "/kdevscriptproject/run/globalcwd", "") );
}
void RubyConfigWidget::accept() {
@@ -42,6 +46,7 @@
DomUtil::writeBoolEntry(dom, "/kdevrbdebugger/general/floatingtoolbar", enableFloatingToolBarBox->isChecked());
DomUtil::writeBoolEntry(dom, "/kdevrbdebugger/general/showconstants", showConstants->isChecked());
DomUtil::writeBoolEntry(dom, "/kdevrbdebugger/general/traceintoruby", traceIntoRuby->isChecked());
+ DomUtil::writeEntry(dom, "/kdevscriptproject/run/globalcwd", workingDir->url() );
}
#include "rubyconfigwidget.moc"
--- branches/kdevelop/3.4/languages/ruby/rubyconfigwidgetbase.ui #624229:624230
@@ -9,7 +9,7 @@
<x>0</x>
<y>0</y>
<width>485</width>
- <height>502</height>
+ <height>582</height>
</rect>
</property>
<vbox>
@@ -18,16 +18,26 @@
</property>
<widget class="QLayoutWidget">
<property name="name">
- <cstring>layout4</cstring>
+ <cstring>layout3</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
- <widget class="QLabel" row="3" column="0">
+ <widget class="KLineEdit" row="3" column="1">
<property name="name">
- <cstring>textLabel1_2_3_2</cstring>
+ <cstring>programArgsEdit</cstring>
</property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1">
+ <property name="name">
+ <cstring>mainProgramEdit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>textLabel1_2</cstring>
+ </property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
@@ -37,19 +47,25 @@
</sizepolicy>
</property>
<property name="text">
- <string>Program &arguments:</string>
+ <string>Ru&by shell:</string>
</property>
<property name="buddy" stdset="0">
- <cstring>programArgsEdit</cstring>
+ <cstring>mainProgramEdit</cstring>
</property>
<property name="whatsThis" stdset="0">
- <string>These are the arguments passed to the Ruby interpreter</string>
+ <string>This is the path (or just name, if in $PATH) to the Ruby shell. Defaults to "irb". Add this line to your .irbrc file:
+def cd(dir) Dir.chdir dir end</string>
</property>
</widget>
- <widget class="QLabel" row="2" column="0">
+ <widget class="KLineEdit" row="0" column="1">
<property name="name">
- <cstring>textLabel1_2_3</cstring>
+ <cstring>interpreterEdit</cstring>
</property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel1_2_3_2</cstring>
+ </property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
@@ -59,20 +75,15 @@
</sizepolicy>
</property>
<property name="text">
- <string>&Main program:</string>
+ <string>Program &arguments:</string>
</property>
<property name="buddy" stdset="0">
<cstring>programArgsEdit</cstring>
</property>
<property name="whatsThis" stdset="0">
- <string>This is the name of the main program source file</string>
+ <string>These are the arguments passed to the Ruby interpreter</string>
</property>
</widget>
- <widget class="KLineEdit" row="3" column="1">
- <property name="name">
- <cstring>programArgsEdit</cstring>
- </property>
- </widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
@@ -95,9 +106,9 @@
<string>This is the path (or just name, if in $PATH) to the Ruby interpreter. Defaults to "ruby"</string>
</property>
</widget>
- <widget class="QLabel" row="1" column="0">
+ <widget class="QLabel" row="2" column="0">
<property name="name">
- <cstring>textLabel1_2</cstring>
+ <cstring>textLabel1_2_3</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
@@ -108,14 +119,13 @@
</sizepolicy>
</property>
<property name="text">
- <string>Ru&by shell:</string>
+ <string>&Main program:</string>
</property>
<property name="buddy" stdset="0">
- <cstring>mainProgramEdit</cstring>
+ <cstring>programArgsEdit</cstring>
</property>
<property name="whatsThis" stdset="0">
- <string>This is the path (or just name, if in $PATH) to the Ruby shell. Defaults to "irb". Add this line to your .irbrc file:
-def cd(dir) Dir.chdir dir end</string>
+ <string>This is the name of the main program source file</string>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
@@ -123,14 +133,17 @@
<cstring>shellEdit</cstring>
</property>
</widget>
- <widget class="KLineEdit" row="2" column="1">
+ <widget class="QLabel" row="4" column="0">
<property name="name">
- <cstring>mainProgramEdit</cstring>
+ <cstring>textLabel1_3</cstring>
</property>
+ <property name="text">
+ <string>Working Directory:</string>
+ </property>
</widget>
- <widget class="KLineEdit" row="0" column="1">
+ <widget class="KURLRequester" row="4" column="1">
<property name="name">
- <cstring>interpreterEdit</cstring>
+ <cstring>workingDir</cstring>
</property>
</widget>
</grid>
@@ -340,5 +353,11 @@
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
<includehints>
<includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kurlrequester.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kpushbutton.h</includehint>
</includehints>
</UI>
--- branches/kdevelop/3.4/languages/ruby/rubysupport_part.cpp #624229:624230
@@ -502,8 +502,8 @@
QString cmd = QString("%1 -K%2 -C\"%3\" -I\"%4\" \"%5\" %6")
.arg(interpreter())
.arg(characterCoding())
+ .arg(runDirectory())
.arg(program.dirPath())
- .arg(program.dirPath())
.arg(program.fileName())
.arg(programArgs());
startApplication(cmd);
@@ -538,6 +538,13 @@
return prog;
}
+QString RubySupportPart::runDirectory() {
+ QString cwd = DomUtil::readEntry(*projectDom(), "/kdevscriptproject/run/globalcwd");
+ if (cwd.isEmpty())
+ cwd = project()->buildDirectory();
+ return cwd;
+}
+
QString RubySupportPart::programArgs() {
QString args = DomUtil::readEntry(*projectDom(), "/kdevrubysupport/run/programargs");
return args;
--- branches/kdevelop/3.4/languages/ruby/rubysupport_part.h #624229:624230
@@ -49,6 +49,7 @@
QString interpreter();
QString shell();
QString mainProgram();
+ QString runDirectory();
QString programArgs();
QString characterCoding();
More information about the KDevelop-devel
mailing list