comparison data/model/AlignmentModel.cpp @ 1752:6d09d68165a4 by-id

Further review of ById: make IDs only available when adding a model to the ById store, not by querying the item directly. This means any id encountered in the wild must have been added to the store at some point (even if later released), which simplifies reasoning about lifecycles
author Chris Cannam
date Fri, 05 Jul 2019 15:28:07 +0100
parents 4abc0f08adf9
children 9945ad04c174
comparison
equal deleted inserted replaced
1751:77543124651b 1752:6d09d68165a4
192 192
193 return performAlignment(*m_reversePath, frame); 193 return performAlignment(*m_reversePath, frame);
194 } 194 }
195 195
196 void 196 void
197 AlignmentModel::pathSourceChangedWithin(sv_frame_t, sv_frame_t) 197 AlignmentModel::pathSourceChangedWithin(ModelId, sv_frame_t, sv_frame_t)
198 { 198 {
199 if (!m_pathComplete) return; 199 if (!m_pathComplete) return;
200 constructPath(); 200 constructPath();
201 constructReversePath(); 201 constructReversePath();
202 } 202 }
203 203
204 void 204 void
205 AlignmentModel::pathSourceCompletionChanged() 205 AlignmentModel::pathSourceCompletionChanged(ModelId)
206 { 206 {
207 auto pathSourceModel = 207 auto pathSourceModel =
208 ModelById::getAs<SparseTimeValueModel>(m_pathSource); 208 ModelById::getAs<SparseTimeValueModel>(m_pathSource);
209 if (!pathSourceModel) return; 209 if (!pathSourceModel) return;
210 210
231 SVCERR << "AlignmentModel: path complete" << endl; 231 SVCERR << "AlignmentModel: path complete" << endl;
232 #endif 232 #endif
233 } 233 }
234 } 234 }
235 235
236 emit completionChanged(); 236 emit completionChanged(getId());
237 } 237 }
238 238
239 void 239 void
240 AlignmentModel::constructPath() const 240 AlignmentModel::constructPath() const
241 { 241 {
390 ModelById::getAs<SparseTimeValueModel>(m_pathSource); 390 ModelById::getAs<SparseTimeValueModel>(m_pathSource);
391 391
392 if (pathSourceModel) { 392 if (pathSourceModel) {
393 393
394 connect(pathSourceModel.get(), 394 connect(pathSourceModel.get(),
395 SIGNAL(modelChangedWithin(sv_frame_t, sv_frame_t)), 395 SIGNAL(modelChangedWithin(ModelId, sv_frame_t, sv_frame_t)),
396 this, SLOT(pathSourceChangedWithin(sv_frame_t, sv_frame_t))); 396 this, SLOT(pathSourceChangedWithin(ModelId, sv_frame_t, sv_frame_t)));
397 397
398 connect(pathSourceModel.get(), SIGNAL(completionChanged()), 398 connect(pathSourceModel.get(), SIGNAL(completionChanged(ModelId)),
399 this, SLOT(pathSourceCompletionChanged())); 399 this, SLOT(pathSourceCompletionChanged(ModelId)));
400 400
401 constructPath(); 401 constructPath();
402 constructReversePath(); 402 constructReversePath();
403 403
404 if (pathSourceModel->isReady()) { 404 if (pathSourceModel->isReady()) {
405 pathSourceCompletionChanged(); 405 pathSourceCompletionChanged(m_pathSource);
406 } 406 }
407 } 407 }
408 } 408 }
409 409
410 void 410 void