From 7e29974e4ee3e1402104e33333baf4f58e269d77 Mon Sep 17 00:00:00 2001 From: vlaomao Date: Tue, 3 Sep 2013 21:15:26 +0400 Subject: [PATCH] Debugger: Added host address overriding input to debug dialog. Task-number: QTCREATORBUG-8503 Change-Id: I385158bef63bff3a831342f090d939e4c6d7202c Reviewed-by: Orgad Shaneh --- src/plugins/debugger/debuggerdialogs.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 5cc5d89dcf3..cebc741a82a 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -73,6 +73,8 @@ class StartApplicationDialogPrivate public: KitChooser *kitChooser; QLabel *serverPortLabel; + QLabel *serverAddressLabel; + QLineEdit *serverAddressEdit; QSpinBox *serverPortSpinBox; PathChooser *localExecutablePathChooser; FancyLineEdit *arguments; @@ -144,6 +146,7 @@ public: Id kitId; uint serverPort; + QString serverAddress; QString localExecutable; QString processArgs; QString workingDirectory; @@ -168,7 +171,8 @@ bool StartApplicationParameters::equals(const StartApplicationParameters &rhs) c && runInTerminal == rhs.runInTerminal && serverStartScript == rhs.serverStartScript && kitId == rhs.kitId - && debugInfoLocation == rhs.debugInfoLocation; + && debugInfoLocation == rhs.debugInfoLocation + && serverAddress == rhs.serverAddress; } QString StartApplicationParameters::displayName() const @@ -194,6 +198,7 @@ void StartApplicationParameters::toSettings(QSettings *settings) const { settings->setValue(_("LastKitId"), kitId.toSetting()); settings->setValue(_("LastServerPort"), serverPort); + settings->setValue(_("LastServerAddress"), serverAddress); settings->setValue(_("LastExternalExecutable"), localExecutable); settings->setValue(_("LastExternalExecutableArguments"), processArgs); settings->setValue(_("LastExternalWorkingDirectory"), workingDirectory); @@ -207,6 +212,7 @@ void StartApplicationParameters::fromSettings(const QSettings *settings) { kitId = Id::fromSetting(settings->value(_("LastKitId"))); serverPort = settings->value(_("LastServerPort")).toUInt(); + serverAddress = settings->value(_("LastServerAddress")).toString(); localExecutable = settings->value(_("LastExternalExecutable")).toString(); processArgs = settings->value(_("LastExternalExecutableArguments")).toString(); workingDirectory = settings->value(_("LastExternalWorkingDirectory")).toString(); @@ -235,6 +241,9 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) d->serverPortSpinBox = new QSpinBox(this); 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->setExpectedKind(PathChooser::File); d->localExecutablePathChooser->setPromptDialogTitle(tr("Select Executable")); @@ -288,6 +297,7 @@ StartApplicationDialog::StartApplicationDialog(QWidget *parent) formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); formLayout->addRow(tr("&Kit:"), d->kitChooser); formLayout->addRow(d->serverPortLabel, d->serverPortSpinBox); + formLayout->addRow(d->serverAddressLabel, d->serverAddressEdit); formLayout->addRow(tr("Local &executable:"), d->localExecutablePathChooser); formLayout->addRow(tr("Command line &arguments:"), d->arguments); 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->serverPortSpinBox->setVisible(false); dialog.d->serverPortLabel->setVisible(false); + dialog.d->serverAddressLabel->setVisible(false); + dialog.d->serverAddressEdit->setVisible(false); } if (dialog.exec() != QDialog::Accepted) return false; @@ -396,7 +408,12 @@ bool StartApplicationDialog::run(QWidget *parent, DebuggerStartParameters *sp) QTC_ASSERT(kit && fillParameters(sp, kit), return false); 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->workingDirectory = newParameters.workingDirectory; sp->useTerminal = newParameters.runInTerminal; @@ -417,6 +434,7 @@ StartApplicationParameters StartApplicationDialog::parameters() const { StartApplicationParameters result; result.serverPort = d->serverPortSpinBox->value(); + result.serverAddress = d->serverAddressEdit->text(); result.localExecutable = d->localExecutablePathChooser->path(); result.serverStartScript = d->serverStartScriptPathChooser->path(); result.kitId = d->kitChooser->currentKitId(); @@ -432,6 +450,7 @@ void StartApplicationDialog::setParameters(const StartApplicationParameters &p) { d->kitChooser->setCurrentKitId(p.kitId); d->serverPortSpinBox->setValue(p.serverPort); + d->serverAddressEdit->setText(p.serverAddress); d->localExecutablePathChooser->setPath(p.localExecutable); d->serverStartScriptPathChooser->setPath(p.serverStartScript); d->debuginfoPathChooser->setPath(p.debugInfoLocation);