Mercurial > hg > svcore
changeset 1079:6ea7761a418b
Emit a signal if transform fails
author | Chris Cannam |
---|---|
date | Wed, 10 Jun 2015 13:11:45 +0100 |
parents | ce82bcdc95d0 |
children | f35c1f9bfaa2 |
files | transform/ModelTransformer.h transform/ModelTransformerFactory.cpp transform/ModelTransformerFactory.h |
diffstat | 3 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/transform/ModelTransformer.h Wed Jun 10 13:10:26 2015 +0100 +++ b/transform/ModelTransformer.h Wed Jun 10 13:11:45 2015 +0100 @@ -68,6 +68,12 @@ void abandon() { m_abandoned = true; } /** + * Return true if the processing thread is being or has been + * abandoned, i.e. if abandon() has been called. + */ + bool isAbandoned() const { return m_abandoned; } + + /** * Return the input model for the transform. */ Model *getInputModel() { return m_input.getModel(); }
--- a/transform/ModelTransformerFactory.cpp Wed Jun 10 13:10:26 2015 +0100 +++ b/transform/ModelTransformerFactory.cpp Wed Jun 10 13:11:45 2015 +0100 @@ -285,6 +285,12 @@ m_handlers.erase(transformer); } + if (transformer->isAbandoned()) { + if (transformer->getMessage() != "") { + emit transformFailed("", transformer->getMessage()); + } + } + transformer->wait(); // unnecessary but reassuring delete transformer; }
--- a/transform/ModelTransformerFactory.h Wed Jun 10 13:10:26 2015 +0100 +++ b/transform/ModelTransformerFactory.h Wed Jun 10 13:11:45 2015 +0100 @@ -145,6 +145,9 @@ QString &message, AdditionalModelHandler *handler = 0); +signals: + void transformFailed(QString transformName, QString message); + protected slots: void transformerFinished();