comparison framework/Document.cpp @ 693:3c5dc95bea91 by-id

Tidy
author Chris Cannam
date Wed, 17 Jul 2019 13:28:37 +0100
parents ad5917362158
children bd6e2fc53377
comparison
equal deleted inserted replaced
692:ad5917362158 693:3c5dc95bea91
289 SVDEBUG << "AdditionalModelConverter::noMoreModelsAvailable" << endl; 289 SVDEBUG << "AdditionalModelConverter::noMoreModelsAvailable" << endl;
290 m_handler->layersCreated(this, m_primary, vector<Layer *>()); 290 m_handler->layersCreated(this, m_primary, vector<Layer *>());
291 delete this; 291 delete this;
292 } 292 }
293 293
294 void cancel() {
295 /*!!! todo: restore
296 foreach (Layer *layer, m_primary) {
297 ModelId model = layer->getModel();
298 //!!! todo: restore this behaviour
299 if (model) {
300 model->abandon();
301 }
302 }
303 */
304 }
305
306 private: 294 private:
307 Document *m_doc; 295 Document *m_doc;
308 vector<Layer *> m_primary; 296 vector<Layer *> m_primary;
309 Document::LayerCreationHandler *m_handler; //!!! how to handle destruction of this? 297 Document::LayerCreationHandler *m_handler; //!!! how to handle destruction of this?
310 }; 298 };
341 emit modelGenerationWarning(transforms[0].getIdentifier(), message); 329 emit modelGenerationWarning(transforms[0].getIdentifier(), message);
342 //!!! what to do with amc? 330 //!!! what to do with amc?
343 } 331 }
344 332
345 return amc; 333 return amc;
346 }
347
348 void
349 Document::cancelAsyncLayerCreation(Document::LayerCreationAsyncHandle h)
350 {
351 AdditionalModelConverter *conv = static_cast<AdditionalModelConverter *>(h);
352 conv->cancel();
353 } 334 }
354 335
355 vector<Layer *> 336 vector<Layer *>
356 Document::createLayersForDerivedModels(vector<ModelId> newModels, 337 Document::createLayersForDerivedModels(vector<ModelId> newModels,
357 QStringList names) 338 QStringList names)
1065 } 1046 }
1066 1047
1067 return models; 1048 return models;
1068 } 1049 }
1069 1050
1070 //!!! what is this used for?
1071 bool 1051 bool
1072 Document::isKnownModel(const ModelId modelId) const 1052 Document::isKnownModel(const ModelId modelId) const
1073 { 1053 {
1074 if (modelId == m_mainModel) return true; 1054 if (modelId == m_mainModel) return true;
1075 for (auto rec: m_models) { 1055 for (auto rec: m_models) {
1560 // as the transform element. In order that newer code knows it's 1540 // as the transform element. In order that newer code knows it's
1561 // dealing with a newer format, we will also write an attribute 1541 // dealing with a newer format, we will also write an attribute
1562 // 'type="transform"' in the derivation element. 1542 // 'type="transform"' in the derivation element.
1563 1543
1564 const Transform &transform = rec.transform; 1544 const Transform &transform = rec.transform;
1565
1566 //!!! in cases like these, where we think we have the model handle
1567 //!!! and nobody else should be releasing it, we probably ought to
1568 //!!! throw std::logic_error if !targetModel
1569 1545
1570 auto targetModel = ModelById::get(targetModelId); 1546 auto targetModel = ModelById::get(targetModelId);
1571 if (!targetModel) return; 1547 if (!targetModel) return;
1572 1548
1573 // Just for reference, this is what we would write if we didn't 1549 // Just for reference, this is what we would write if we didn't