Commit 1b4cf42c authored by Christian Kandeler's avatar Christian Kandeler Committed by Kai Koehne
Browse files

RemoteLinux: Let the user set a working directory.



Change-Id: I316802d6f640e0dda44424134cdfd9f7aa22c528
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent 9902ed2b
......@@ -62,6 +62,7 @@ const char UserEnvironmentChangesKey[]
= "Qt4ProjectManager.MaemoRunConfiguration.UserEnvironmentChanges";
const char UseAlternateExeKey[] = "RemoteLinux.RunConfig.UseAlternateRemoteExecutable";
const char AlternateExeKey[] = "RemoteLinux.RunConfig.AlternateRemoteExecutable";
const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
} // anonymous namespace
......@@ -84,7 +85,8 @@ public:
validParse(other->validParse),
parseInProgress(other->parseInProgress),
useAlternateRemoteExecutable(other->useAlternateRemoteExecutable),
alternateRemoteExecutable(other->alternateRemoteExecutable)
alternateRemoteExecutable(other->alternateRemoteExecutable),
workingDirectory(other->workingDirectory)
{
}
......@@ -99,6 +101,7 @@ public:
QString disabledReason;
bool useAlternateRemoteExecutable;
QString alternateRemoteExecutable;
QString workingDirectory;
};
} // namespace Internal
......@@ -216,6 +219,7 @@ QVariantMap RemoteLinuxRunConfiguration::toMap() const
Utils::EnvironmentItem::toStringList(d->userEnvironmentChanges));
map.insert(QLatin1String(UseAlternateExeKey), d->useAlternateRemoteExecutable);
map.insert(QLatin1String(AlternateExeKey), d->alternateRemoteExecutable);
map.insert(QLatin1String(WorkingDirectoryKey), d->workingDirectory);
return map;
}
......@@ -234,6 +238,7 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
SystemBaseEnvironment).toInt());
d->useAlternateRemoteExecutable = map.value(QLatin1String(UseAlternateExeKey), false).toBool();
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
d->workingDirectory = map.value(QLatin1String(WorkingDirectoryKey)).toString();
d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath);
d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath);
......@@ -279,7 +284,10 @@ QString RemoteLinuxRunConfiguration::environmentPreparationCommand() const
<< QLatin1String("$HOME/.profile");
foreach (const QString &filePath, filesToSource)
command += QString::fromLocal8Bit("test -f %1 && source %1;").arg(filePath);
command.chop(1); // Trailing semicolon.
if (!workingDirectory().isEmpty())
command += QLatin1String("cd ") + workingDirectory();
else
command.chop(1); // Trailing semicolon.
return command;
}
......@@ -325,6 +333,16 @@ void RemoteLinuxRunConfiguration::setArguments(const QString &args)
d->arguments = args;
}
QString RemoteLinuxRunConfiguration::workingDirectory() const
{
return d->workingDirectory;
}
void RemoteLinuxRunConfiguration::setWorkingDirectory(const QString &wd)
{
d->workingDirectory = wd;
}
void RemoteLinuxRunConfiguration::setUseAlternateExecutable(bool useAlternate)
{
d->useAlternateRemoteExecutable = useAlternate;
......
......@@ -93,6 +93,8 @@ public:
QString remoteExecutableFilePath() const;
QString arguments() const;
void setArguments(const QString &args);
QString workingDirectory() const;
void setWorkingDirectory(const QString &wd);
void setAlternateRemoteExecutable(const QString &exe);
QString alternateRemoteExecutable() const;
void setUseAlternateExecutable(bool useAlternate);
......
......@@ -84,6 +84,7 @@ public:
QLabel disabledIcon;
QLabel disabledReason;
QLineEdit argsLineEdit;
QLineEdit workingDirLineEdit;
QLabel localExecutableLabel;
QLabel remoteExecutableLabel;
QCheckBox useAlternateCommandBox;
......@@ -198,6 +199,10 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
d->argsLineEdit.setText(d->runConfiguration->arguments());
d->genericWidgetsLayout.addRow(tr("Arguments:"), &d->argsLineEdit);
d->workingDirLineEdit.setPlaceholderText(tr("<default>"));
d->workingDirLineEdit.setText(d->runConfiguration->workingDirectory());
d->genericWidgetsLayout.addRow(tr("Working directory:"), &d->workingDirLineEdit);
QHBoxLayout * const debugButtonsLayout = new QHBoxLayout;
d->debugCppOnlyButton.setText(tr("C++ only"));
d->debugQmlOnlyButton.setText(tr("QML only"));
......@@ -236,6 +241,8 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
SLOT(handleUseAlternateCommandChanged()));
connect(&d->alternateCommand, SIGNAL(textEdited(QString)),
SLOT(handleAlternateCommandChanged()));
connect(&d->workingDirLineEdit, SIGNAL(textEdited(QString)),
SLOT(handleWorkingDirectoryChanged()));
handleDeploySpecsChanged();
handleUseAlternateCommandChanged();
}
......@@ -306,6 +313,11 @@ void RemoteLinuxRunConfigurationWidget::handleAlternateCommandChanged()
d->runConfiguration->setAlternateRemoteExecutable(d->alternateCommand.text().trimmed());
}
void RemoteLinuxRunConfigurationWidget::handleWorkingDirectoryChanged()
{
d->runConfiguration->setWorkingDirectory(d->workingDirLineEdit.text().trimmed());
}
void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link)
{
if (link == QLatin1String("deviceconfig")) {
......
......@@ -81,6 +81,7 @@ private slots:
void handleDeploySpecsChanged();
void handleUseAlternateCommandChanged();
void handleAlternateCommandChanged();
void handleWorkingDirectoryChanged();
private:
void addGenericWidgets(QVBoxLayout *mainLayout);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment