Commit 09d0ec18 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

RemoteLinux: Add support for alternate remote command.

Sometimes, it is not the deployed binary that we want to call, but e.g.
some wrapper.

Change-Id: Ic8fe8f865cc29bf01e64b3781a92362b4521d8e4
Reviewed-on: http://codereview.qt-project.org/5642

Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent aafd4942
......@@ -60,6 +60,9 @@ const char ProFileKey[] = "Qt4ProjectManager.MaemoRunConfiguration.ProFile";
const char BaseEnvironmentBaseKey[] = "Qt4ProjectManager.MaemoRunConfiguration.BaseEnvironmentBase";
const char UserEnvironmentChangesKey[]
= "Qt4ProjectManager.MaemoRunConfiguration.UserEnvironmentChanges";
const char UseAlternateExeKey[] = "RemoteLinux.RunConfig.UseAlternateRemoteExecutable";
const char AlternateExeKey[] = "RemoteLinux.RunConfig.AlternateRemoteExecutable";
} // anonymous namespace
class RemoteLinuxRunConfigurationPrivate {
......@@ -68,7 +71,8 @@ public:
: proFilePath(proFilePath),
baseEnvironmentType(RemoteLinuxRunConfiguration::SystemBaseEnvironment),
validParse(target->qt4Project()->validParse(proFilePath)),
parseInProgress(target->qt4Project()->parseInProgress(proFilePath))
parseInProgress(target->qt4Project()->parseInProgress(proFilePath)),
useAlternateRemoteExecutable(false)
{
}
......@@ -78,7 +82,9 @@ public:
systemEnvironment(other->systemEnvironment),
userEnvironmentChanges(other->userEnvironmentChanges),
validParse(other->validParse),
parseInProgress(other->parseInProgress)
parseInProgress(other->parseInProgress),
useAlternateRemoteExecutable(other->useAlternateRemoteExecutable),
alternateRemoteExecutable(other->alternateRemoteExecutable)
{
}
......@@ -91,7 +97,10 @@ public:
bool validParse;
bool parseInProgress;
QString disabledReason;
bool useAlternateRemoteExecutable;
QString alternateRemoteExecutable;
};
} // namespace Internal
using namespace Internal;
......@@ -205,6 +214,8 @@ QVariantMap RemoteLinuxRunConfiguration::toMap() const
map.insert(QLatin1String(BaseEnvironmentBaseKey), d->baseEnvironmentType);
map.insert(QLatin1String(UserEnvironmentChangesKey),
Utils::EnvironmentItem::toStringList(d->userEnvironmentChanges));
map.insert(QLatin1String(UseAlternateExeKey), d->useAlternateRemoteExecutable);
map.insert(QLatin1String(AlternateExeKey), d->alternateRemoteExecutable);
return map;
}
......@@ -221,6 +232,8 @@ bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
.toStringList());
d->baseEnvironmentType = static_cast<BaseEnvironmentType>(map.value(QLatin1String(BaseEnvironmentBaseKey),
SystemBaseEnvironment).toInt());
d->useAlternateRemoteExecutable = map.value(QLatin1String(UseAlternateExeKey), false).toBool();
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
d->validParse = qt4Target()->qt4Project()->validParse(d->proFilePath);
d->parseInProgress = qt4Target()->qt4Project()->parseInProgress(d->proFilePath);
......@@ -286,13 +299,19 @@ QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
return QDir::cleanPath(ti.workingDir + QLatin1Char('/') + ti.target);
}
QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const
QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const
{
return deployConfig()
? deployConfig()->deploymentInfo()->remoteExecutableFilePath(localExecutableFilePath())
: QString();
}
QString RemoteLinuxRunConfiguration::remoteExecutableFilePath() const
{
return d->useAlternateRemoteExecutable
? alternateRemoteExecutable() : defaultRemoteExecutableFilePath();
}
PortList RemoteLinuxRunConfiguration::freePorts() const
{
const LinuxDeviceConfiguration::ConstPtr &devConf = deviceConfig();
......@@ -306,6 +325,26 @@ void RemoteLinuxRunConfiguration::setArguments(const QString &args)
d->arguments = args;
}
void RemoteLinuxRunConfiguration::setUseAlternateExecutable(bool useAlternate)
{
d->useAlternateRemoteExecutable = useAlternate;
}
bool RemoteLinuxRunConfiguration::useAlternateExecutable() const
{
return d->useAlternateRemoteExecutable;
}
void RemoteLinuxRunConfiguration::setAlternateRemoteExecutable(const QString &exe)
{
d->alternateRemoteExecutable = exe;
}
QString RemoteLinuxRunConfiguration::alternateRemoteExecutable() const
{
return d->alternateRemoteExecutable;
}
RemoteLinuxRunConfiguration::DebuggingType RemoteLinuxRunConfiguration::debuggingType() const
{
if (useCppDebugger()) {
......
......@@ -89,9 +89,14 @@ public:
virtual DebuggingType debuggingType() const;
QString localExecutableFilePath() const;
QString defaultRemoteExecutableFilePath() const;
QString remoteExecutableFilePath() const;
QString arguments() const;
void setArguments(const QString &args);
void setAlternateRemoteExecutable(const QString &exe);
QString alternateRemoteExecutable() const;
void setUseAlternateExecutable(bool useAlternate);
bool useAlternateExecutable() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfig() const;
QString gdbCmd() const;
......
......@@ -47,6 +47,7 @@
#include <QtGui/QButtonGroup>
#include <QtCore/QCoreApplication>
#include <QtCore/QDir>
#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QFormLayout>
#include <QtGui/QGroupBox>
......@@ -85,6 +86,8 @@ public:
QLineEdit argsLineEdit;
QLabel localExecutableLabel;
QLabel remoteExecutableLabel;
QCheckBox useAlternateCommandBox;
QLineEdit alternateCommand;
QLabel devConfLabel;
QLabel debuggingLanguagesLabel;
QRadioButton debugCppOnlyButton;
......@@ -177,6 +180,16 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
d->localExecutableLabel.setText(d->runConfiguration->localExecutableFilePath());
formLayout->addRow(tr("Executable on host:"), &d->localExecutableLabel);
formLayout->addRow(tr("Executable on device:"), &d->remoteExecutableLabel);
QWidget * const altRemoteExeWidget = new QWidget;
QHBoxLayout * const altRemoteExeLayout = new QHBoxLayout(altRemoteExeWidget);
altRemoteExeLayout->setContentsMargins(0, 0, 0, 0);
d->alternateCommand.setText(d->runConfiguration->alternateRemoteExecutable());
altRemoteExeLayout->addWidget(&d->alternateCommand);
d->useAlternateCommandBox.setText(tr("Use this command instead"));
d->useAlternateCommandBox.setChecked(d->runConfiguration->useAlternateExecutable());
altRemoteExeLayout->addWidget(&d->useAlternateCommandBox);
formLayout->addRow(tr("Alternate executable on device:"), altRemoteExeWidget);
d->argsLineEdit.setText(d->runConfiguration->arguments());
formLayout->addRow(tr("Arguments:"), &d->argsLineEdit);
......@@ -214,7 +227,12 @@ void RemoteLinuxRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayou
connect(d->runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(d->runConfiguration, SIGNAL(deploySpecsChanged()), SLOT(handleDeploySpecsChanged()));
connect(&d->useAlternateCommandBox, SIGNAL(toggled(bool)),
SLOT(handleUseAlternateCommandChanged()));
connect(&d->alternateCommand, SIGNAL(textEdited(QString)),
SLOT(handleAlternateCommandChanged()));
handleDeploySpecsChanged();
handleUseAlternateCommandChanged();
}
void RemoteLinuxRunConfigurationWidget::addEnvironmentWidgets(QVBoxLayout *mainLayout)
......@@ -267,7 +285,20 @@ void RemoteLinuxRunConfigurationWidget::updateTargetInformation()
void RemoteLinuxRunConfigurationWidget::handleDeploySpecsChanged()
{
d->remoteExecutableLabel.setText(d->runConfiguration->remoteExecutableFilePath());
d->remoteExecutableLabel.setText(d->runConfiguration->defaultRemoteExecutableFilePath());
}
void RemoteLinuxRunConfigurationWidget::handleUseAlternateCommandChanged()
{
const bool useAltExe = d->useAlternateCommandBox.isChecked();
d->remoteExecutableLabel.setEnabled(!useAltExe);
d->alternateCommand.setEnabled(useAltExe);
d->runConfiguration->setUseAlternateExecutable(useAltExe);
}
void RemoteLinuxRunConfigurationWidget::handleAlternateCommandChanged()
{
d->runConfiguration->setAlternateRemoteExecutable(d->alternateCommand.text().trimmed());
}
void RemoteLinuxRunConfigurationWidget::showDeviceConfigurationsDialog(const QString &link)
......
......@@ -77,6 +77,8 @@ private slots:
void userEnvironmentChangesChanged(const QList<Utils::EnvironmentItem> &userChanges);
void handleDebuggingTypeChanged();
void handleDeploySpecsChanged();
void handleUseAlternateCommandChanged();
void handleAlternateCommandChanged();
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