Make Application component async

We're not using it for concatenating process calls, so it doesn't make
sense to make it block.

Reviewed by David Edmundson
This commit is contained in:
Aleix Pol 2014-06-23 15:37:21 +02:00
parent e09a2eb44a
commit ce5d182510
2 changed files with 11 additions and 5 deletions

View File

@ -23,6 +23,7 @@
#include "utils/d_ptr_implementation.h"
#include <QDebug>
#include <QCoreApplication>
Application::Private::Private(Application *parent)
: q(parent)
@ -31,6 +32,10 @@ Application::Private::Private(Application *parent)
&process, SIGNAL(stateChanged(QProcess::ProcessState)),
this, SLOT(stateChanged(QProcess::ProcessState))
);
connect(
&process, SIGNAL(error(QProcess::ProcessError)),
this, SLOT(errorFound(QProcess::ProcessError))
);
process.setProcessChannelMode(QProcess::MergedChannels);
}
@ -40,6 +45,11 @@ void Application::Private::stateChanged(QProcess::ProcessState newState)
//q->runningChanged(running);
}
void Application::Private::errorFound(QProcess::ProcessError err)
{
qWarning() << "Error" << process.error() << "while starting" << application;
}
Application::Application(QObject *parent)
: QObject(parent), d(this)
{
@ -101,11 +111,6 @@ void Application::start()
}
d->process.start(d->application);
if (!d->process.waitForStarted()) {
qWarning() << "Error" << d->process.error() << "while starting" << d->application;
}
}
void Application::terminate()

View File

@ -36,6 +36,7 @@ public:
private Q_SLOTS:
void stateChanged(QProcess::ProcessState newState);
void errorFound(QProcess::ProcessError error);
private:
Application *const q;