Commit fcd46807 authored by ck's avatar ck
Browse files

Maemo: Improve progress reporting of remote process start and shutdown.

parent 1c746014
......@@ -90,6 +90,7 @@ void MaemoRemoteMounter::unmount()
m_mountSpecs.at(i).remoteMountPoint);
}
emit reportProgress(tr("Unmounting remote mount points..."));
m_umountStderr.clear();
m_unmountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
connect(m_unmountProcess.data(), SIGNAL(closed(int)), this,
......@@ -157,6 +158,7 @@ void MaemoRemoteMounter::stop()
void MaemoRemoteMounter::deployUtfsClient()
{
emit reportProgress(tr("Setting up SFTP connection..."));
m_utfsClientUploader = m_connection->createSftpChannel();
connect(m_utfsClientUploader.data(), SIGNAL(initialized()), this,
SLOT(handleUploaderInitialized()));
......@@ -178,14 +180,14 @@ void MaemoRemoteMounter::handleUploaderInitialized()
if (m_stop)
return;
emit reportProgress(tr("Uploading UTFS client..."));
connect(m_utfsClientUploader.data(),
SIGNAL(finished(Core::SftpJobId, QString)), this,
SLOT(handleUploadFinished(Core::SftpJobId, QString)));
const QString localFile
= m_toolChain->maddeRoot() + QLatin1String("/madlib/armel/utfs-client");
m_uploadJobId
= m_utfsClientUploader->uploadFile(localFile, utfsClientOnDevice(),
SftpOverwriteExisting);
m_uploadJobId = m_utfsClientUploader->uploadFile(localFile,
utfsClientOnDevice(), SftpOverwriteExisting);
if (m_uploadJobId == SftpInvalidJob)
emit error(tr("Could not upload UTFS client (%1).").arg(localFile));
}
......@@ -231,6 +233,7 @@ void MaemoRemoteMounter::startUtfsClients()
remoteCall += andOp + mkdir + andOp + chmod + andOp + utfsClient;
}
emit reportProgress(tr("Starting remote UTFS clients..."));
m_utfsClientStderr.clear();
m_mountProcess = m_connection->createRemoteProcess(remoteCall.toUtf8());
connect(m_mountProcess.data(), SIGNAL(started()), this,
......@@ -281,6 +284,7 @@ void MaemoRemoteMounter::handleUtfsClientsFinished(int exitStatus)
void MaemoRemoteMounter::startUtfsServers()
{
emit reportProgress(tr("Starting UTFS servers..."));
for (int i = 0; i < m_mountSpecs.count(); ++i) {
const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i);
const ProcPtr utfsServerProc(new QProcess);
......
......@@ -70,6 +70,7 @@ signals:
void mounted();
void unmounted();
void error(const QString &reason);
void reportProgress(const QString &progressOutput);
private slots:
void handleUploaderInitialized();
......
......@@ -72,7 +72,6 @@ void MaemoRunControl::start()
if (!m_devConfig.isValid()) {
handleError(tr("No device configuration set for run configuration."));
} else {
emit appendMessage(this, tr("Preparing remote side ..."), false);
m_running = true;
emit started();
disconnect(m_runner, 0, this, 0);
......@@ -88,6 +87,8 @@ void MaemoRunControl::start()
SLOT(handleRemoteProcessStarted()));
connect(m_runner, SIGNAL(remoteProcessFinished(int)), this,
SLOT(handleRemoteProcessFinished(int)));
connect(m_runner, SIGNAL(reportProgress(QString)), this,
SLOT(handleProgressReport(QString)));
m_runner->start();
}
}
......@@ -132,6 +133,11 @@ void MaemoRunControl::handleRemoteErrorOutput(const QByteArray &output)
emit addToOutputWindowInline(this, QString::fromUtf8(output), true);
}
void MaemoRunControl::handleProgressReport(const QString &progressString)
{
emit appendMessage(this, progressString, false);
}
bool MaemoRunControl::isRunning() const
{
return m_running;
......
......@@ -60,6 +60,7 @@ private slots:
void handleRemoteProcessFinished(int exitCode);
void handleRemoteOutput(const QByteArray &output);
void handleRemoteErrorOutput(const QByteArray &output);
void handleProgressReport(const QString &progressString);
private:
virtual void start();
......
......@@ -66,6 +66,8 @@ MaemoSshRunner::MaemoSshRunner(QObject *parent,
connect(m_mounter, SIGNAL(unmounted()), this, SLOT(handleUnmounted()));
connect(m_mounter, SIGNAL(error(QString)), this,
SLOT(handleMounterError(QString)));
connect(m_mounter, SIGNAL(reportProgress(QString)), this,
SIGNAL(reportProgress(QString)));
}
MaemoSshRunner::~MaemoSshRunner() {}
......@@ -96,10 +98,12 @@ void MaemoSshRunner::start()
SLOT(handleConnected()));
connect(m_connection.data(), SIGNAL(error(SshError)), this,
SLOT(handleConnectionFailure()));
if (reUse)
if (reUse) {
handleConnected();
else
} else {
emit reportProgress(tr("Connecting to device..."));
m_connection->connectToHost(m_devConfig.server);
}
}
void MaemoSshRunner::stop()
......@@ -131,6 +135,7 @@ void MaemoSshRunner::handleConnectionFailure()
void MaemoSshRunner::cleanup(bool initialCleanup)
{
emit reportProgress(tr("Killing remote process(es)..."));
m_shuttingDown = !initialCleanup;
QString niceKill;
QString brutalKill;
......
......@@ -73,6 +73,7 @@ signals:
void readyForExecution();
void remoteOutput(const QByteArray &output);
void remoteErrorOutput(const QByteArray &output);
void reportProgress(const QString &progressOutput);
void remoteProcessStarted();
void remoteProcessFinished(int exitCode);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment