Valgrind: Simplify device setup and handling

Make isLocal() less intrusively used and correct.  Use the stored device
more often, also handle errors more quickly.

Change-Id: I146d1f5788ea79d0a9d7b058c81908d451cf00d0
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
This commit is contained in:
hjk
2016-01-30 01:38:58 +01:00
parent d14257736e
commit dcfb622126
13 changed files with 41 additions and 96 deletions

View File

@@ -37,12 +37,11 @@ using namespace ProjectExplorer;
namespace Valgrind {
ValgrindProcess::ValgrindProcess(const QSsh::SshConnectionParameters &sshParams,
QSsh::SshConnection *connection, QObject *parent)
: QObject(parent)
ValgrindProcess::ValgrindProcess(const IDevice::ConstPtr &device,
QObject *parent)
: QObject(parent), m_device(device)
{
m_params = sshParams;
m_remote.m_connection = connection;
m_remote.m_connection = 0;
m_remote.m_error = QProcess::UnknownError;
m_pid = 0;
}
@@ -126,8 +125,9 @@ void ValgrindProcess::run()
} else {
// connect to host and wait for connection
// FIXME: Use aquireConnection() instead.
if (!m_remote.m_connection)
m_remote.m_connection = new QSsh::SshConnection(m_params, this);
m_remote.m_connection = new QSsh::SshConnection(m_device->sshParameters(), this);
if (m_remote.m_connection->state() != QSsh::SshConnection::Connected) {
connect(m_remote.m_connection, &QSsh::SshConnection::connected,
@@ -227,7 +227,7 @@ QSsh::SshConnection *ValgrindProcess::connection() const
bool ValgrindProcess::isLocal() const
{
return m_params.host.isEmpty();
return m_device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
}
void ValgrindProcess::localProcessStarted()