forked from qt-creator/qt-creator
SSH: Make API of SshRemoteProcess more similar to the one of QProcess.
In the end, we want to derive it from QIODevice as well. Change-Id: I30e7cb23ec8e5753c363d1f4457b650556860ac2 Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
@@ -218,8 +218,8 @@ void CallgrindController::getLocalDataFile()
|
||||
// if there are files like callgrind.out.PID.NUM, set it to the most recent one of those
|
||||
QString cmd = QString("ls -t %1* | head -n 1").arg(fileName);
|
||||
m_findRemoteFile = m_ssh->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_findRemoteFile.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
this, SLOT(foundRemoteFile(QByteArray)));
|
||||
connect(m_findRemoteFile.data(), SIGNAL(readyReadStandardOutput()), this,
|
||||
SLOT(foundRemoteFile()));
|
||||
m_findRemoteFile->start();
|
||||
} else {
|
||||
QDir dir(workingDir, QString("%1.*").arg(baseFileName), QDir::Time);
|
||||
@@ -232,9 +232,9 @@ void CallgrindController::getLocalDataFile()
|
||||
}
|
||||
}
|
||||
|
||||
void CallgrindController::foundRemoteFile(const QByteArray &file)
|
||||
void CallgrindController::foundRemoteFile()
|
||||
{
|
||||
m_remoteFile = file.trimmed();
|
||||
m_remoteFile = m_findRemoteFile->readAllStandardOutput().trimmed();
|
||||
|
||||
m_sftp = m_ssh->createSftpChannel();
|
||||
connect(m_sftp.data(), SIGNAL(finished(Utils::SftpJobId,QString)),
|
||||
|
||||
@@ -87,7 +87,7 @@ private Q_SLOTS:
|
||||
void processError(QProcess::ProcessError);
|
||||
void processFinished(int, QProcess::ExitStatus);
|
||||
|
||||
void foundRemoteFile(const QByteArray &file);
|
||||
void foundRemoteFile();
|
||||
void sftpInitialized();
|
||||
void sftpJobFinished(Utils::SftpJobId job, const QString &error);
|
||||
|
||||
|
||||
@@ -210,10 +210,8 @@ void RemoteValgrindProcess::connected()
|
||||
cmd += m_valgrindExe + ' ' + arguments;
|
||||
|
||||
m_process = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_process.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
this, SLOT(standardError(QByteArray)));
|
||||
connect(m_process.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
this, SLOT(standardOutput(QByteArray)));
|
||||
connect(m_process.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
|
||||
connect(m_process.data(), SIGNAL(readyReadStandardOutput()), this, SLOT(standardOutput()));
|
||||
connect(m_process.data(), SIGNAL(closed(int)),
|
||||
this, SLOT(closed(int)));
|
||||
connect(m_process.data(), SIGNAL(started()),
|
||||
@@ -250,17 +248,15 @@ void RemoteValgrindProcess::processStarted()
|
||||
).arg(proc, QFileInfo(m_debuggee).fileName());
|
||||
|
||||
m_findPID = m_connection->createRemoteProcess(cmd.toUtf8());
|
||||
connect(m_findPID.data(), SIGNAL(errorOutputAvailable(QByteArray)),
|
||||
this, SLOT(standardOutput(QByteArray)));
|
||||
connect(m_findPID.data(), SIGNAL(outputAvailable(QByteArray)),
|
||||
this, SLOT(findPIDOutputReceived(QByteArray)));
|
||||
connect(m_findPID.data(), SIGNAL(readyReadStandardError()), this, SLOT(standardError()));
|
||||
connect(m_findPID.data(), SIGNAL(readyReadStandardOutput()), SLOT(findPIDOutputReceived()));
|
||||
m_findPID->start();
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
|
||||
void RemoteValgrindProcess::findPIDOutputReceived()
|
||||
{
|
||||
bool ok;
|
||||
m_pid = output.trimmed().toLongLong(&ok);
|
||||
m_pid = m_findPID->readAllStandardOutput().trimmed().toLongLong(&ok);
|
||||
if (!ok) {
|
||||
m_pid = 0;
|
||||
m_errorString = tr("Could not determine remote PID.");
|
||||
@@ -272,14 +268,14 @@ void RemoteValgrindProcess::findPIDOutputReceived(const QByteArray &output)
|
||||
}
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::standardOutput(const QByteArray &output)
|
||||
void RemoteValgrindProcess::standardOutput()
|
||||
{
|
||||
emit processOutput(output, Utils::StdOutFormat);
|
||||
emit processOutput(m_process->readAllStandardOutput(), Utils::StdOutFormat);
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::standardError(const QByteArray &output)
|
||||
void RemoteValgrindProcess::standardError()
|
||||
{
|
||||
emit processOutput(output, Utils::StdErrFormat);
|
||||
emit processOutput(m_process->readAllStandardError(), Utils::StdErrFormat);
|
||||
}
|
||||
|
||||
void RemoteValgrindProcess::error(Utils::SshError error)
|
||||
|
||||
@@ -146,9 +146,9 @@ private slots:
|
||||
void connected();
|
||||
void error(Utils::SshError error);
|
||||
void processStarted();
|
||||
void findPIDOutputReceived(const QByteArray &output);
|
||||
void standardOutput(const QByteArray &output);
|
||||
void standardError(const QByteArray &output);
|
||||
void findPIDOutputReceived();
|
||||
void standardOutput();
|
||||
void standardError();
|
||||
|
||||
private:
|
||||
Utils::SshConnectionParameters m_params;
|
||||
|
||||
Reference in New Issue
Block a user