SshRemoteProcessRunner: Unify API

Make the API more similar to QtcProcess API.
Rename signals to started() and finished().

Change-Id: I01f3a148749b666b8f145d8769222a234ccc9bce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-02-28 16:27:46 +01:00
parent b5cf3186a3
commit 53095f666f
11 changed files with 14 additions and 14 deletions

View File

@@ -139,7 +139,7 @@ void SshRemoteProcessRunner::handleProcessStarted()
QTC_ASSERT(d->m_state == Connected, return);
setState(ProcessRunning);
emit processStarted();
emit started();
}
void SshRemoteProcessRunner::handleProcessFinished()
@@ -148,7 +148,7 @@ void SshRemoteProcessRunner::handleProcessFinished()
d->m_exitCode = d->m_process->exitCode();
d->m_errorString = d->m_process->errorString();
setState(Inactive);
emit processClosed();
emit finished();
}
void SshRemoteProcessRunner::setState(int newState)

View File

@@ -54,10 +54,10 @@ public:
signals:
void connectionError();
void processStarted();
void started();
void finished();
void readyReadStandardOutput();
void readyReadStandardError();
void processClosed();
private:
void handleConnected();

View File

@@ -89,7 +89,7 @@ void QdbMakeDefaultAppService::handleProcessFinished()
void QdbMakeDefaultAppService::doDeploy()
{
d->processRunner = new QSsh::SshRemoteProcessRunner;
connect(d->processRunner, &QSsh::SshRemoteProcessRunner::processClosed,
connect(d->processRunner, &QSsh::SshRemoteProcessRunner::finished,
this, &QdbMakeDefaultAppService::handleProcessFinished);
connect(d->processRunner, &QSsh::SshRemoteProcessRunner::readyReadStandardError,
this, &QdbMakeDefaultAppService::handleStdErr);

View File

@@ -53,7 +53,7 @@ void SshDeviceProcessList::doUpdate()
{
connect(&d->process, &SshRemoteProcessRunner::connectionError,
this, &SshDeviceProcessList::handleConnectionError);
connect(&d->process, &SshRemoteProcessRunner::processClosed,
connect(&d->process, &SshRemoteProcessRunner::finished,
this, &SshDeviceProcessList::handleListProcessFinished);
d->process.run(listProcessesCommandLine(), device()->sshParameters());
}

View File

@@ -91,7 +91,7 @@ QnxDeployQtLibrariesDialog::QnxDeployQtLibrariesDialog(const IDevice::ConstPtr &
m_processRunner = new QSsh::SshRemoteProcessRunner(this);
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::connectionError,
this, &QnxDeployQtLibrariesDialog::handleRemoteProcessError);
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::processClosed,
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::finished,
this, &QnxDeployQtLibrariesDialog::handleRemoteProcessCompleted);
connect(m_ui->deployButton, &QAbstractButton::clicked,

View File

@@ -50,7 +50,7 @@ QnxDeviceTester::QnxDeviceTester(QObject *parent)
m_processRunner = new QSsh::SshRemoteProcessRunner(this);
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::connectionError,
this, &QnxDeviceTester::handleConnectionError);
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::processClosed,
connect(m_processRunner, &QSsh::SshRemoteProcessRunner::finished,
this, &QnxDeviceTester::handleProcessFinished);
m_commandsToTest << QLatin1String("awk")

View File

@@ -87,7 +87,7 @@ void RemoteLinuxCustomCommandDeployService::doDeploy()
this, &RemoteLinuxCustomCommandDeployService::handleStdout);
connect(d->runner, &SshRemoteProcessRunner::readyReadStandardError,
this, &RemoteLinuxCustomCommandDeployService::handleStderr);
connect(d->runner, &SshRemoteProcessRunner::processClosed,
connect(d->runner, &SshRemoteProcessRunner::finished,
this, &RemoteLinuxCustomCommandDeployService::handleProcessClosed);
emit progressMessage(tr("Starting remote command \"%1\"...").arg(d->commandLine));

View File

@@ -71,7 +71,7 @@ void AbstractRemoteLinuxPackageInstaller::installPackage(const IDevice::ConstPtr
this, &AbstractRemoteLinuxPackageInstaller::handleInstallerOutput);
connect(d->installer, &SshRemoteProcessRunner::readyReadStandardError,
this, &AbstractRemoteLinuxPackageInstaller::handleInstallerErrorOutput);
connect(d->installer, &SshRemoteProcessRunner::processClosed,
connect(d->installer, &SshRemoteProcessRunner::finished,
this, &AbstractRemoteLinuxPackageInstaller::handleInstallationFinished);
QString cmdLine = installCommandLine(packageFilePath);

View File

@@ -53,7 +53,7 @@ void RemoteLinuxSignalOperation::run(const QString &command)
{
QTC_ASSERT(!m_runner, return);
m_runner = new QSsh::SshRemoteProcessRunner();
connect(m_runner, &QSsh::SshRemoteProcessRunner::processClosed,
connect(m_runner, &QSsh::SshRemoteProcessRunner::finished,
this, &RemoteLinuxSignalOperation::runnerProcessFinished);
connect(m_runner, &QSsh::SshRemoteProcessRunner::connectionError,
this, &RemoteLinuxSignalOperation::runnerConnectionError);

View File

@@ -66,7 +66,7 @@ void SshKeyDeployer::deployPublicKey(const SshConnectionParameters &sshParams,
connect(&d->deployProcess, &SshRemoteProcessRunner::connectionError,
this, &SshKeyDeployer::handleConnectionFailure);
connect(&d->deployProcess, &SshRemoteProcessRunner::processClosed,
connect(&d->deployProcess, &SshRemoteProcessRunner::finished,
this, &SshKeyDeployer::handleKeyUploadFinished);
const QString command = "test -d .ssh "
"|| mkdir -p ~/.ssh && chmod 0700 .ssh && echo '"

View File

@@ -242,8 +242,8 @@ void tst_Ssh::remoteProcess()
SshRemoteProcessRunner runner;
QEventLoop loop;
connect(&runner, &SshRemoteProcessRunner::connectionError, &loop, &QEventLoop::quit);
connect(&runner, &SshRemoteProcessRunner::processStarted, &loop, &QEventLoop::quit);
connect(&runner, &SshRemoteProcessRunner::processClosed, &loop, &QEventLoop::quit);
connect(&runner, &SshRemoteProcessRunner::started, &loop, &QEventLoop::quit);
connect(&runner, &SshRemoteProcessRunner::finished, &loop, &QEventLoop::quit);
connect(&runner, &SshRemoteProcessRunner::readyReadStandardOutput,
[&remoteStdout, &runner] { remoteStdout += runner.readAllStandardOutput(); });
connect(&runner, &SshRemoteProcessRunner::readyReadStandardError,