From c6f7eaea592c1721cfaaa779cda61f8c9f30ea99 Mon Sep 17 00:00:00 2001 From: hjk <qthjk@ovi.com> Date: Wed, 25 Jul 2012 01:42:14 +0200 Subject: [PATCH] debugger: remove channel lineedit in StartRemote dialog The information can be retrieved from the Profile information nowadays. Change-Id: I964cb4a782bb746bb97edbdb03cc99d64153106c Reviewed-by: hjk <qthjk@ovi.com> --- src/plugins/debugger/debuggerdialogs.cpp | 28 +++++++++--------------- src/plugins/debugger/debuggerplugin.cpp | 7 ++++++ 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index c99c4fe4faa..ef14ff8af96 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -706,14 +706,12 @@ class StartRemoteParameters public: StartRemoteParameters(); bool equals(const StartRemoteParameters &rhs) const; - QString displayName() const { return remoteChannel; } - bool isValid() const { return !remoteChannel.isEmpty(); } + QString displayName() const; void toSettings(QSettings *) const; void fromSettings(const QSettings *settings); QString localExecutable; - QString remoteChannel; QString remoteArchitecture; QString overrideStartScript; bool useServerStartScript; @@ -747,7 +745,7 @@ StartRemoteParameters::StartRemoteParameters() : bool StartRemoteParameters::equals(const StartRemoteParameters &rhs) const { - return localExecutable == rhs.localExecutable && remoteChannel ==rhs.remoteChannel + return localExecutable == rhs.localExecutable && remoteArchitecture == rhs.remoteArchitecture && overrideStartScript == rhs.overrideStartScript && useServerStartScript == rhs.useServerStartScript @@ -756,9 +754,14 @@ bool StartRemoteParameters::equals(const StartRemoteParameters &rhs) const && debugInfoLocation == rhs.debugInfoLocation; } +QString StartRemoteParameters::displayName() const +{ + Profile *profile = ProfileManager::instance()->find(profileId); + return profile ? profile->displayName() : QString(); +} + void StartRemoteParameters::toSettings(QSettings *settings) const { - settings->setValue(_("LastRemoteChannel"), remoteChannel); settings->setValue(_("LastLocalExecutable"), localExecutable); settings->setValue(_("LastRemoteArchitecture"), remoteArchitecture); settings->setValue(_("LastServerStartScript"), serverStartScript); @@ -770,7 +773,6 @@ void StartRemoteParameters::toSettings(QSettings *settings) const void StartRemoteParameters::fromSettings(const QSettings *settings) { - remoteChannel = settings->value(_("LastRemoteChannel")).toString(); localExecutable = settings->value(_("LastLocalExecutable")).toString(); const QString profileIdString = settings->value(_("LastProfileId")).toString(); if (profileIdString.isEmpty()) { @@ -791,7 +793,6 @@ class StartRemoteDialogPrivate public: ProfileChooser *profileChooser; PathChooser *executablePathChooser; - QLineEdit *channelLineEdit; QComboBox *architectureComboBox; PathChooser *debuginfoPathChooser; PathChooser *overrideStartScriptPathChooser; @@ -815,9 +816,6 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript) d->executablePathChooser->setExpectedKind(PathChooser::File); d->executablePathChooser->setPromptDialogTitle(tr("Select Executable")); - d->channelLineEdit = new QLineEdit(this); - d->channelLineEdit->setText(QString::fromUtf8("localhost:5115")); - d->architectureComboBox = new QComboBox(this); d->architectureComboBox->setEditable(true); @@ -857,7 +855,6 @@ StartRemoteDialog::StartRemoteDialog(QWidget *parent, bool enableStartScript) formLayout->addRow(tr("Target:"), d->profileChooser); formLayout->addRow(tr("Local &executable:"), d->executablePathChooser); formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); - formLayout->addRow(tr("&Host and port:"), d->channelLineEdit); formLayout->addRow(tr("&Architecture:"), d->architectureComboBox); formLayout->addRow(tr("Location of debugging &information:"), d->debuginfoPathChooser); formLayout->addRow(tr("Override host GDB s&tart script:"), d->overrideStartScriptPathChooser); @@ -920,7 +917,6 @@ bool StartRemoteDialog::run(QWidget *parent, QSettings *settings, } fillParameters(sp, dialog.profileId()); - sp->remoteChannel = newParameters.remoteChannel; sp->remoteArchitecture = newParameters.remoteArchitecture; sp->executable = newParameters.localExecutable; sp->displayName = tr("Remote: \"%1\"").arg(sp->remoteChannel); @@ -934,7 +930,6 @@ bool StartRemoteDialog::run(QWidget *parent, QSettings *settings, StartRemoteParameters StartRemoteDialog::parameters() const { StartRemoteParameters result; - result.remoteChannel = d->channelLineEdit->text(); result.localExecutable = d->executablePathChooser->path(); result.remoteArchitecture = d->architectureComboBox->currentText(); result.overrideStartScript = d->overrideStartScriptPathChooser->path(); @@ -947,7 +942,6 @@ StartRemoteParameters StartRemoteDialog::parameters() const void StartRemoteDialog::setParameters(const StartRemoteParameters &p) { - d->channelLineEdit->setText(p.remoteChannel); d->executablePathChooser->setPath(p.localExecutable); const int index = d->architectureComboBox->findText(p.remoteArchitecture); if (index != -1) @@ -962,10 +956,8 @@ void StartRemoteDialog::setParameters(const StartRemoteParameters &p) void StartRemoteDialog::setHistory(const QList<StartRemoteParameters> &l) { d->historyComboBox->clear(); - for (int i = l.size() - 1; i >= 0; --i) - if (l.at(i).isValid()) - d->historyComboBox->addItem(l.at(i).displayName(), - QVariant::fromValue(l.at(i))); + for (int i = l.size(); --i >= 0; ) + d->historyComboBox->addItem(l.at(i).displayName(), QVariant::fromValue(l.at(i))); } void StartRemoteDialog::historyIndexChanged(int index) diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 3e9acd6409c..74745813820 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -550,9 +550,16 @@ void fillParameters(DebuggerStartParameters *sp, Id id) QTC_ASSERT(profile, return); sp->sysRoot = SysRootProfileInformation::sysRoot(profile).toString(); sp->debuggerCommand = DebuggerProfileInformation::debuggerCommand(profile).toString(); + ToolChain *tc = ToolChainProfileInformation::toolChain(profile); if (tc) sp->toolChainAbi = tc->targetAbi(); + + IDevice::ConstPtr device = DeviceProfileInformation::device(profile); + if (device) { + sp->connParams = device->sshParameters(); + sp->remoteChannel = QString("%1:%2").arg(sp->connParams.host).arg(sp->connParams.port); + } } static TextEditor::ITextEditor *currentTextEditor() -- GitLab