comparison data/model/AlignmentModel.cpp @ 1016:13f53ecc8bb5

Make alignment using an external program asynchronous
author Chris Cannam
date Thu, 20 Nov 2014 15:46:19 +0000
parents cd42620e3f40
children cc27f35aa75c
comparison
equal deleted inserted replaced
1010:36f79bc5c3d7 1016:13f53ecc8bb5
110 { 110 {
111 if (!m_pathBegun && m_rawPath) { 111 if (!m_pathBegun && m_rawPath) {
112 if (completion) *completion = 0; 112 if (completion) *completion = 0;
113 return false; 113 return false;
114 } 114 }
115 if (m_pathComplete || !m_rawPath) { 115 if (m_pathComplete) {
116 if (completion) *completion = 100; 116 if (completion) *completion = 100;
117 return true; 117 return true;
118 }
119 if (!m_rawPath) {
120 // lack of raw path could mean path is complete (in which case
121 // m_pathComplete true above) or else no alignment has been
122 // set at all yet (this case)
123 if (completion) *completion = 0;
124 return false;
118 } 125 }
119 return m_rawPath->isReady(completion); 126 return m_rawPath->isReady(completion);
120 } 127 }
121 128
122 const ZoomConstraint * 129 const ZoomConstraint *
345 352
346 return resultFrame; 353 return resultFrame;
347 } 354 }
348 355
349 void 356 void
357 AlignmentModel::setPathFrom(SparseTimeValueModel *rawpath)
358 {
359 if (m_rawPath) m_rawPath->aboutToDelete();
360 delete m_rawPath;
361
362 m_rawPath = rawpath;
363
364 connect(m_rawPath, SIGNAL(modelChanged()),
365 this, SLOT(pathChanged()));
366
367 connect(m_rawPath, SIGNAL(modelChangedWithin(int, int)),
368 this, SLOT(pathChangedWithin(int, int)));
369
370 connect(m_rawPath, SIGNAL(completionChanged()),
371 this, SLOT(pathCompletionChanged()));
372
373 constructPath();
374 constructReversePath();
375
376 if (m_rawPath->isReady()) {
377 pathCompletionChanged();
378 }
379 }
380
381 void
350 AlignmentModel::setPath(PathModel *path) 382 AlignmentModel::setPath(PathModel *path)
351 { 383 {
352 if (m_path) m_path->aboutToDelete(); 384 if (m_path) m_path->aboutToDelete();
353 delete m_path; 385 delete m_path;
354 m_path = path; 386 m_path = path;