Abort installation when a job fails

This commit is contained in:
Aurélien Gâteau 2014-07-10 14:46:08 +02:00
parent 7894bb9462
commit 165d28fc23
4 changed files with 45 additions and 4 deletions

View file

@ -46,7 +46,12 @@ public:
for( auto job : m_jobs )
{
emitProgress( current, total, job->prettyName() );
job->exec();
JobResult result = job->exec();
if ( !result )
{
emitFailed( result.message(), result.details() );
return;
}
++current;
}
emitProgress( total, total, QString() );
@ -64,6 +69,14 @@ private:
Q_ARG( QString, prettyName )
);
}
void emitFailed( const QString& message, const QString& details )
{
QMetaObject::invokeMethod( m_queue, "failed", Qt::QueuedConnection,
Q_ARG( QString, message ),
Q_ARG( QString, details )
);
}
};