Debugger: Added host address overriding input to debug dialog.

Task-number: QTCREATORBUG-8503
Change-Id: I385158bef63bff3a831342f090d939e4c6d7202c
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
vlaomao
2013-09-03 21:15:26 +04:00
committed by hjk
parent 698144e32e
commit 7e29974e4e

View File

@@ -73,6 +73,8 @@ class StartApplicationDialogPrivate
public: public:
KitChooser *kitChooser; KitChooser *kitChooser;
QLabel *serverPortLabel; QLabel *serverPortLabel;
QLabel *serverAddressLabel;
QLineEdit *serverAddressEdit;
QSpinBox *serverPortSpinBox; QSpinBox *serverPortSpinBox;
PathChooser *localExecutablePathChooser; PathChooser *localExecutablePathChooser;
FancyLineEdit *arguments; FancyLineEdit *arguments;
@@ -144,6 +146,7 @@ public:
Id kitId; Id kitId;
uint serverPort; uint serverPort;
QString serverAddress;
QString localExecutable; QString localExecutable;
QString processArgs; QString processArgs;
QString workingDirectory; QString workingDirectory;
@@ -168,7 +171,8 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c
&& runInTerminal == rhs.runInTerminal && runInTerminal == rhs.runInTerminal
&& serverStartScript == rhs.serverStartScript && serverStartScript == rhs.serverStartScript
&& kitId == rhs.kitId && kitId == rhs.kitId
&& debugInfoLocation == rhs.debugInfoLocation; && debugInfoLocation == rhs.debugInfoLocation
&& serverAddress == rhs.serverAddress;
} }
QString StartApplicationParameters::displayName() const QString StartApplicationParameters::displayName() const
@@ -194,6 +198,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const
{ {
settings->setValue(_("LastKitId"), kitId.toSetting()); settings->setValue(_("LastKitId"), kitId.toSetting());
settings->setValue(_("LastServerPort"), serverPort); settings->setValue(_("LastServerPort"), serverPort);
settings->setValue(_("LastServerAddress"), serverAddress);
settings->setValue(_("LastExternalExecutable"), localExecutable); settings->setValue(_("LastExternalExecutable"), localExecutable);
settings->setValue(_("LastExternalExecutableArguments"), processArgs); settings->setValue(_("LastExternalExecutableArguments"), processArgs);
settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory); settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory);
@@ -207,6 +212,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings)
{ {
kitId = Id::fromSetting(settings->value(_("LastKitId"))); kitId = Id::fromSetting(settings->value(_("LastKitId")));
serverPort = settings->value(_("LastServerPort")).toUInt(); serverPort = settings->value(_("LastServerPort")).toUInt();
serverAddress = settings->value(_("LastServerAddress")).toString();
localExecutable = settings->value(_("LastExternalExecutable")).toString(); localExecutable = settings->value(_("LastExternalExecutable")).toString();
processArgs = settings->value(_("LastExternalExecutableArguments")).toString(); processArgs = settings->value(_("LastExternalExecutableArguments")).toString();
workingDirectory = settings->value(_("LastExternalWorkingDirectory")).toString(); workingDirectory = settings->value(_("LastExternalWorkingDirectory")).toString();
@@ -235,6 +241,9 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
d->serverPortSpinBox = new QSpinBox(this); d->serverPortSpinBox = new QSpinBox(this);
d->serverPortSpinBox->setRange(1, 65535); d->serverPortSpinBox->setRange(1, 65535);
d->serverAddressLabel = new QLabel(tr("Override server address"), this);
d->serverAddressEdit = new QLineEdit(this);
d->localExecutablePathChooser = new PathChooser(this); d->localExecutablePathChooser = new PathChooser(this);
d->localExecutablePathChooser->setExpectedKind(PathChooser::File); d->localExecutablePathChooser->setExpectedKind(PathChooser::File);
d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable")); d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable"));
@@ -288,6 +297,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent)
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
formLayout->addRow(tr("&Kit:"), d->kitChooser); formLayout->addRow(tr("&Kit:"), d->kitChooser);
formLayout->addRow(d->serverPortLabel, d->serverPortSpinBox); formLayout->addRow(d->serverPortLabel, d->serverPortSpinBox);
formLayout->addRow(d->serverAddressLabel, d->serverAddressEdit);
formLayout->addRow(tr("Local &executable:"), d->localExecutablePathChooser); formLayout->addRow(tr("Local &executable:"), d->localExecutablePathChooser);
formLayout->addRow(tr("Command line &arguments:"), d->arguments); formLayout->addRow(tr("Command line &arguments:"), d->arguments);
formLayout->addRow(tr("&Working directory:"), d->workingDirectory); formLayout->addRow(tr("&Working directory:"), d->workingDirectory);
@@ -373,6 +383,8 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp)
dialog.d->serverStartScriptLabel->setVisible(false); dialog.d->serverStartScriptLabel->setVisible(false);
dialog.d->serverPortSpinBox->setVisible(false); dialog.d->serverPortSpinBox->setVisible(false);
dialog.d->serverPortLabel->setVisible(false); dialog.d->serverPortLabel->setVisible(false);
dialog.d->serverAddressLabel->setVisible(false);
dialog.d->serverAddressEdit->setVisible(false);
} }
if (dialog.exec() != QDialog::Accepted) if (dialog.exec() != QDialog::Accepted)
return false; return false;
@@ -396,7 +408,12 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp)
QTC_ASSERT(kit && fillParameters(sp, kit), return false); QTC_ASSERT(kit && fillParameters(sp, kit), return false);
sp->executable = newParameters.localExecutable; sp->executable = newParameters.localExecutable;
sp->remoteChannel = sp->connParams.host + QLatin1Char(':') + QString::number(newParameters.serverPort); const QString inputAddress = dialog.d->serverAddressEdit->text();
if (!inputAddress.isEmpty())
sp->remoteChannel = inputAddress;
else
sp->remoteChannel = sp->connParams.host;
sp->remoteChannel += QLatin1Char(':') + QString::number(newParameters.serverPort);
sp->displayName = newParameters.displayName(); sp->displayName = newParameters.displayName();
sp->workingDirectory = newParameters.workingDirectory; sp->workingDirectory = newParameters.workingDirectory;
sp->useTerminal = newParameters.runInTerminal; sp->useTerminal = newParameters.runInTerminal;
@@ -417,6 +434,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const
{ {
StartApplicationParameters result; StartApplicationParameters result;
result.serverPort = d->serverPortSpinBox->value(); result.serverPort = d->serverPortSpinBox->value();
result.serverAddress = d->serverAddressEdit->text();
result.localExecutable = d->localExecutablePathChooser->path(); result.localExecutable = d->localExecutablePathChooser->path();
result.serverStartScript = d->serverStartScriptPathChooser->path(); result.serverStartScript = d->serverStartScriptPathChooser->path();
result.kitId = d->kitChooser->currentKitId(); result.kitId = d->kitChooser->currentKitId();
@@ -432,6 +450,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p)
{ {
d->kitChooser->setCurrentKitId(p.kitId); d->kitChooser->setCurrentKitId(p.kitId);
d->serverPortSpinBox->setValue(p.serverPort); d->serverPortSpinBox->setValue(p.serverPort);
d->serverAddressEdit->setText(p.serverAddress);
d->localExecutablePathChooser->setPath(p.localExecutable); d->localExecutablePathChooser->setPath(p.localExecutable);
d->serverStartScriptPathChooser->setPath(p.serverStartScript); d->serverStartScriptPathChooser->setPath(p.serverStartScript);
d->debuginfoPathChooser->setPath(p.debugInfoLocation); d->debuginfoPathChooser->setPath(p.debugInfoLocation);