comparison data/model/Model.cpp @ 1761:ee7fd2c01d87 by-id

Work on management of alignment-related models
author Chris Cannam
date Fri, 12 Jul 2019 13:57:42 +0100
parents 83178b4bb698
children aa0b56d72f27
comparison
equal deleted inserted replaced
1760:9945ad04c174 1761:ee7fd2c01d87
23 //#define DEBUG_COMPLETION 1 23 //#define DEBUG_COMPLETION 1
24 24
25 Model::~Model() 25 Model::~Model()
26 { 26 {
27 SVDEBUG << "Model::~Model: " << this << " with id " << getId() << endl; 27 SVDEBUG << "Model::~Model: " << this << " with id " << getId() << endl;
28 //!!! see notes in header - sort this out
29 /*
30 if (!m_alignmentModel.isNone()) {
31 ModelById::release(m_alignmentModel);
32 }
33 */
34 } 28 }
35 29
36 void 30 void
37 Model::setSourceModel(ModelId modelId) 31 Model::setSourceModel(ModelId modelId)
38 { 32 {
48 void 42 void
49 Model::setAlignment(ModelId alignmentModel) 43 Model::setAlignment(ModelId alignmentModel)
50 { 44 {
51 SVDEBUG << "Model(" << this << "): accepting alignment model " 45 SVDEBUG << "Model(" << this << "): accepting alignment model "
52 << alignmentModel << endl; 46 << alignmentModel << endl;
53 47
54 if (!m_alignmentModel.isNone()) { 48 if (auto model = ModelById::get(m_alignmentModel)) {
55 ModelById::release(m_alignmentModel); 49 disconnect(model.get(), SIGNAL(completionChanged(ModelId)),
50 this, SIGNAL(alignmentCompletionChanged(ModelId)));
56 } 51 }
57 52
58 m_alignmentModel = alignmentModel; 53 m_alignmentModel = alignmentModel;
59 54
60 auto model = ModelById::get(m_alignmentModel); 55 if (auto model = ModelById::get(m_alignmentModel)) {
61 if (model) {
62 connect(model.get(), SIGNAL(completionChanged(ModelId)), 56 connect(model.get(), SIGNAL(completionChanged(ModelId)),
63 this, SIGNAL(alignmentCompletionChanged(ModelId))); 57 this, SIGNAL(alignmentCompletionChanged(ModelId)));
64 } 58 }
65 } 59 }
66 60