RemoteLinux: Use remote path choosers for gdbserver and qml paths

Change-Id: Ibf65b08bc1cb9d92a6e7561bd1e97a3e13ea5a7d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-12-13 15:27:39 +01:00
parent eca7044361
commit bf060b426f
4 changed files with 25 additions and 12 deletions

View File

@@ -530,6 +530,16 @@ void PathChooser::setDefaultValue(const QString &defaultValue)
d->m_lineEdit->validate(); d->m_lineEdit->validate();
} }
void PathChooser::setPlaceholderText(const QString &placeholderText)
{
d->m_lineEdit->setPlaceholderText(placeholderText);
}
void PathChooser::setToolTip(const QString &toolTip)
{
d->m_lineEdit->setToolTip(toolTip);
}
FancyLineEdit::ValidationFunction PathChooser::defaultValidationFunction() const FancyLineEdit::ValidationFunction PathChooser::defaultValidationFunction() const
{ {
return std::bind(&PathChooser::validatePath, this, std::placeholders::_1, std::placeholders::_2); return std::bind(&PathChooser::validatePath, this, std::placeholders::_1, std::placeholders::_2);

View File

@@ -133,6 +133,8 @@ public:
// input value during validation if the real value is empty // input value during validation if the real value is empty
// setting an empty QString will disable this and clear the placeHolderText // setting an empty QString will disable this and clear the placeHolderText
void setDefaultValue(const QString &defaultValue); void setDefaultValue(const QString &defaultValue);
void setPlaceholderText(const QString &placeholderText);
void setToolTip(const QString &toolTip);
void setAllowPathFromDevice(bool allow); void setAllowPathFromDevice(bool allow);
bool allowPathFromDevice() const; bool allowPathFromDevice() const;

View File

@@ -63,18 +63,20 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget(
m_keyLabel = new QLabel(Tr::tr("Private key file:")); m_keyLabel = new QLabel(Tr::tr("Private key file:"));
m_keyFileLineEdit = new Utils::PathChooser(this); m_keyFileLineEdit = new PathChooser(this);
auto createKeyButton = new QPushButton(Tr::tr("Create New...")); auto createKeyButton = new QPushButton(Tr::tr("Create New..."));
m_machineTypeValueLabel = new QLabel(this); m_machineTypeValueLabel = new QLabel(this);
const QString hint = Tr::tr("Leave empty to look up executable in $PATH"); const QString hint = Tr::tr("Leave empty to look up executable in $PATH");
m_gdbServerLineEdit = new QLineEdit(this); m_gdbServerLineEdit = new PathChooser(this);
m_gdbServerLineEdit->setExpectedKind(PathChooser::ExistingCommand);
m_gdbServerLineEdit->setPlaceholderText(hint); m_gdbServerLineEdit->setPlaceholderText(hint);
m_gdbServerLineEdit->setToolTip(hint); m_gdbServerLineEdit->setToolTip(hint);
m_qmlRuntimeLineEdit = new QLineEdit(this); m_qmlRuntimeLineEdit = new PathChooser(this);
m_qmlRuntimeLineEdit->setExpectedKind(PathChooser::ExistingCommand);
m_qmlRuntimeLineEdit->setPlaceholderText(hint); m_qmlRuntimeLineEdit->setPlaceholderText(hint);
m_qmlRuntimeLineEdit->setToolTip(hint); m_qmlRuntimeLineEdit->setToolTip(hint);
@@ -116,9 +118,9 @@ GenericLinuxDeviceConfigurationWidget::GenericLinuxDeviceConfigurationWidget(
this, &GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged); this, &GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged);
connect(createKeyButton, &QAbstractButton::clicked, connect(createKeyButton, &QAbstractButton::clicked,
this, &GenericLinuxDeviceConfigurationWidget::createNewKey); this, &GenericLinuxDeviceConfigurationWidget::createNewKey);
connect(m_gdbServerLineEdit, &QLineEdit::editingFinished, connect(m_gdbServerLineEdit, &PathChooser::editingFinished,
this, &GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished); this, &GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished);
connect(m_qmlRuntimeLineEdit, &QLineEdit::editingFinished, connect(m_qmlRuntimeLineEdit, &PathChooser::editingFinished,
this, &GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished); this, &GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished);
connect(m_hostKeyCheckBox, &QCheckBox::toggled, connect(m_hostKeyCheckBox, &QCheckBox::toggled,
this, &GenericLinuxDeviceConfigurationWidget::hostKeyCheckingChanged); this, &GenericLinuxDeviceConfigurationWidget::hostKeyCheckingChanged);
@@ -177,12 +179,12 @@ void GenericLinuxDeviceConfigurationWidget::keyFileEditingFinished()
void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished() void GenericLinuxDeviceConfigurationWidget::gdbServerEditingFinished()
{ {
device()->setDebugServerPath(device()->filePath(m_gdbServerLineEdit->text())); device()->setDebugServerPath(m_gdbServerLineEdit->filePath());
} }
void GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished() void GenericLinuxDeviceConfigurationWidget::qmlRuntimeEditingFinished()
{ {
device()->setQmlRunCommand(device()->filePath(m_qmlRuntimeLineEdit->text())); device()->setQmlRunCommand(m_qmlRuntimeLineEdit->filePath());
} }
void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged() void GenericLinuxDeviceConfigurationWidget::handleFreePortsChanged()
@@ -265,9 +267,8 @@ void GenericLinuxDeviceConfigurationWidget::initGui()
m_timeoutSpinBox->setValue(sshParams.timeout); m_timeoutSpinBox->setValue(sshParams.timeout);
m_userLineEdit->setText(sshParams.userName()); m_userLineEdit->setText(sshParams.userName());
m_keyFileLineEdit->setFilePath(sshParams.privateKeyFile); m_keyFileLineEdit->setFilePath(sshParams.privateKeyFile);
// FIXME: Use a remote executable line edit m_gdbServerLineEdit->setFilePath(device()->debugServerPath());
m_gdbServerLineEdit->setText(device()->debugServerPath().path()); m_qmlRuntimeLineEdit->setFilePath(device()->qmlRunCommand());
m_qmlRuntimeLineEdit->setText(device()->qmlRunCommand().path());
updatePortsWarningLabel(); updatePortsWarningLabel();
} }

View File

@@ -59,8 +59,8 @@ private:
QSpinBox *m_timeoutSpinBox; QSpinBox *m_timeoutSpinBox;
Utils::PathChooser *m_keyFileLineEdit; Utils::PathChooser *m_keyFileLineEdit;
QLabel *m_machineTypeValueLabel; QLabel *m_machineTypeValueLabel;
QLineEdit *m_gdbServerLineEdit; Utils::PathChooser *m_gdbServerLineEdit;
QLineEdit *m_qmlRuntimeLineEdit; Utils::PathChooser *m_qmlRuntimeLineEdit;
}; };
} // RemoteLinux::Internal } // RemoteLinux::Internal