comparison transform/ModelTransformerFactory.cpp @ 849:418cd2064769 tonioni_multi_transform

More on multi-transform stuff
author Chris Cannam
date Mon, 02 Dec 2013 11:17:24 +0000
parents 539740f231fa
children dba8a02b0413
comparison
equal deleted inserted replaced
848:539740f231fa 849:418cd2064769
228 message = t->getMessage(); 228 message = t->getMessage();
229 229
230 return model; 230 return model;
231 } 231 }
232 232
233 vector<Model *>
234 ModelTransformerFactory::transformMultiple(const Transforms &transforms,
235 const ModelTransformer::Input &input,
236 QString &message)
237 {
238 SVDEBUG << "ModelTransformerFactory::transformMultiple: Constructing transformer with input model " << input.getModel() << endl;
239
240 ModelTransformer *t = createTransformer(transforms, input);
241 if (!t) return 0;
242
243 connect(t, SIGNAL(finished()), this, SLOT(transformerFinished()));
244
245 m_runningTransformers.insert(t);
246
247 t->start();
248 Model *model = t->detachOutputModel();
249
250 if (model) {
251 QString imn = input.getModel()->objectName();
252 QString trn =
253 TransformFactory::getInstance()->getTransformFriendlyName
254 (transform.getIdentifier());
255 if (imn != "") {
256 if (trn != "") {
257 model->setObjectName(tr("%1: %2").arg(imn).arg(trn));
258 } else {
259 model->setObjectName(imn);
260 }
261 } else if (trn != "") {
262 model->setObjectName(trn);
263 }
264 } else {
265 t->wait();
266 }
267
268 message = t->getMessage();
269
270 return model;
271 }
272
233 void 273 void
234 ModelTransformerFactory::transformerFinished() 274 ModelTransformerFactory::transformerFinished()
235 { 275 {
236 QObject *s = sender(); 276 QObject *s = sender();
237 ModelTransformer *transformer = dynamic_cast<ModelTransformer *>(s); 277 ModelTransformer *transformer = dynamic_cast<ModelTransformer *>(s);