forked from qt-creator/qt-creator
BareMetal: Share HostWidget for all debug providers
Change-Id: Ie1db80987c8f3cacdae49daff3969228105c08ea Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -344,43 +344,5 @@ GdbServerProviderRunner::GdbServerProviderRunner(ProjectExplorer::RunControl *ru
|
||||
setStarter([this, runnable] { doStart(runnable, {}); });
|
||||
}
|
||||
|
||||
// HostWidget
|
||||
|
||||
HostWidget::HostWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_hostLineEdit = new QLineEdit(this);
|
||||
m_hostLineEdit->setToolTip(tr("Enter TCP/IP hostname of the GDB server provider, "
|
||||
"like \"localhost\" or \"192.0.2.1\"."));
|
||||
m_portSpinBox = new QSpinBox(this);
|
||||
m_portSpinBox->setRange(0, 65535);
|
||||
m_portSpinBox->setToolTip(tr("Enter TCP/IP port which will be listened by "
|
||||
"the GDB server provider."));
|
||||
const auto layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_hostLineEdit);
|
||||
layout->addWidget(m_portSpinBox);
|
||||
|
||||
connect(m_hostLineEdit, &QLineEdit::textChanged,
|
||||
this, &HostWidget::dataChanged);
|
||||
connect(m_portSpinBox, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, &HostWidget::dataChanged);
|
||||
}
|
||||
|
||||
void HostWidget::setChannel(const QUrl &channel)
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
m_hostLineEdit->setText(channel.host());
|
||||
m_portSpinBox->setValue(channel.port());
|
||||
}
|
||||
|
||||
QUrl HostWidget::channel() const
|
||||
{
|
||||
QUrl url;
|
||||
url.setHost(m_hostLineEdit->text());
|
||||
url.setPort(m_portSpinBox->value());
|
||||
return url;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
||||
|
@@ -33,7 +33,6 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QSpinBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace BareMetal {
|
||||
@@ -129,25 +128,5 @@ public:
|
||||
const ProjectExplorer::Runnable &runnable);
|
||||
};
|
||||
|
||||
// HostWidget
|
||||
|
||||
class HostWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HostWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setChannel(const QUrl &host);
|
||||
QUrl channel() const;
|
||||
|
||||
signals:
|
||||
void dataChanged();
|
||||
|
||||
protected:
|
||||
QLineEdit *m_hostLineEdit = nullptr;
|
||||
QSpinBox *m_portSpinBox = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QUuid>
|
||||
|
||||
namespace BareMetal {
|
||||
@@ -260,5 +261,43 @@ void IDebugServerProviderConfigWidget::setFromProvider()
|
||||
m_nameLineEdit->setText(m_provider->displayName());
|
||||
}
|
||||
|
||||
// HostWidget
|
||||
|
||||
HostWidget::HostWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_hostLineEdit = new QLineEdit(this);
|
||||
m_hostLineEdit->setToolTip(tr("Enter TCP/IP hostname of the GDB server provider, "
|
||||
"like \"localhost\" or \"192.0.2.1\"."));
|
||||
m_portSpinBox = new QSpinBox(this);
|
||||
m_portSpinBox->setRange(0, 65535);
|
||||
m_portSpinBox->setToolTip(tr("Enter TCP/IP port which will be listened by "
|
||||
"the GDB server provider."));
|
||||
const auto layout = new QHBoxLayout(this);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(m_hostLineEdit);
|
||||
layout->addWidget(m_portSpinBox);
|
||||
|
||||
connect(m_hostLineEdit, &QLineEdit::textChanged,
|
||||
this, &HostWidget::dataChanged);
|
||||
connect(m_portSpinBox, QOverload<int>::of(&QSpinBox::valueChanged),
|
||||
this, &HostWidget::dataChanged);
|
||||
}
|
||||
|
||||
void HostWidget::setChannel(const QUrl &channel)
|
||||
{
|
||||
const QSignalBlocker blocker(this);
|
||||
m_hostLineEdit->setText(channel.host());
|
||||
m_portSpinBox->setValue(channel.port());
|
||||
}
|
||||
|
||||
QUrl HostWidget::channel() const
|
||||
{
|
||||
QUrl url;
|
||||
url.setHost(m_hostLineEdit->text());
|
||||
url.setPort(m_portSpinBox->value());
|
||||
return url;
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
||||
|
@@ -38,6 +38,7 @@ QT_BEGIN_NAMESPACE
|
||||
class QFormLayout;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QSpinBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Debugger {
|
||||
@@ -162,5 +163,25 @@ protected:
|
||||
QLabel *m_errorLabel = nullptr;
|
||||
};
|
||||
|
||||
// HostWidget
|
||||
|
||||
class HostWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit HostWidget(QWidget *parent = nullptr);
|
||||
|
||||
void setChannel(const QUrl &host);
|
||||
QUrl channel() const;
|
||||
|
||||
signals:
|
||||
void dataChanged();
|
||||
|
||||
protected:
|
||||
QLineEdit *m_hostLineEdit = nullptr;
|
||||
QSpinBox *m_portSpinBox = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace BareMetal
|
||||
|
Reference in New Issue
Block a user