# HG changeset patch # User Chris Cannam # Date 1417110681 0 # Node ID 9c00e7944bf271b39432a229a6304df3bca5f696 # Parent a73c44ae5acb0c2d06244b04952327abe3439399# Parent 4a2c150ecd679a637a0fdcdb262b232efa137ecd Merge diff -r a73c44ae5acb -r 9c00e7944bf2 data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Thu Nov 27 17:50:34 2014 +0000 +++ b/data/model/AlignmentModel.cpp Thu Nov 27 17:51:21 2014 +0000 @@ -112,10 +112,17 @@ if (completion) *completion = 0; return false; } - if (m_pathComplete || !m_rawPath) { + if (m_pathComplete) { if (completion) *completion = 100; return true; } + if (!m_rawPath) { + // lack of raw path could mean path is complete (in which case + // m_pathComplete true above) or else no alignment has been + // set at all yet (this case) + if (completion) *completion = 0; + return false; + } return m_rawPath->isReady(completion); } @@ -347,6 +354,31 @@ } void +AlignmentModel::setPathFrom(SparseTimeValueModel *rawpath) +{ + if (m_rawPath) m_rawPath->aboutToDelete(); + delete m_rawPath; + + m_rawPath = rawpath; + + connect(m_rawPath, SIGNAL(modelChanged()), + this, SLOT(pathChanged())); + + connect(m_rawPath, SIGNAL(modelChangedWithin(int, int)), + this, SLOT(pathChangedWithin(int, int))); + + connect(m_rawPath, SIGNAL(completionChanged()), + this, SLOT(pathCompletionChanged())); + + constructPath(); + constructReversePath(); + + if (m_rawPath->isReady()) { + pathCompletionChanged(); + } +} + +void AlignmentModel::setPath(PathModel *path) { if (m_path) m_path->aboutToDelete(); diff -r a73c44ae5acb -r 9c00e7944bf2 data/model/AlignmentModel.h --- a/data/model/AlignmentModel.h Thu Nov 27 17:50:34 2014 +0000 +++ b/data/model/AlignmentModel.h Thu Nov 27 17:51:21 2014 +0000 @@ -52,6 +52,7 @@ int toReference(int frame) const; int fromReference(int frame) const; + void setPathFrom(SparseTimeValueModel *rawpath); void setPath(PathModel *path); virtual void toXml(QTextStream &stream, diff -r a73c44ae5acb -r 9c00e7944bf2 data/model/Model.cpp --- a/data/model/Model.cpp Thu Nov 27 17:50:34 2014 +0000 +++ b/data/model/Model.cpp Thu Nov 27 17:51:21 2014 +0000 @@ -85,9 +85,13 @@ m_alignment->aboutToDelete(); delete m_alignment; } + m_alignment = alignment; - connect(m_alignment, SIGNAL(completionChanged()), - this, SIGNAL(alignmentCompletionChanged())); + + if (m_alignment) { + connect(m_alignment, SIGNAL(completionChanged()), + this, SIGNAL(alignmentCompletionChanged())); + } } const AlignmentModel *