# HG changeset patch # User Chris Cannam # Date 1590161005 -3600 # Node ID 3072aa267248fdf55dd4ac2ea19c2886e531b23b # Parent 9219834e39a4f8e4259d176b13713da3d1ff01d1 Permit setting completion directly on the alignment model, if we aren't using a transform to populate the path source but are instead going to set the path directly after completion diff -r 9219834e39a4 -r 3072aa267248 data/model/AlignmentModel.cpp --- a/data/model/AlignmentModel.cpp Thu May 21 16:09:46 2020 +0100 +++ b/data/model/AlignmentModel.cpp Fri May 22 16:23:25 2020 +0100 @@ -29,7 +29,8 @@ m_reversePath(nullptr), m_pathBegun(false), m_pathComplete(false), - m_relativePitch(0) + m_relativePitch(0), + m_explicitlySetCompletion(-1) { setPathFrom(pathSource); @@ -105,6 +106,10 @@ bool AlignmentModel::isReady(int *completion) const { + if (m_explicitlySetCompletion != -1) { + if (completion) *completion = m_explicitlySetCompletion; + return (m_explicitlySetCompletion == 100); + } if (!m_pathBegun && !m_pathSource.isNone()) { if (completion) *completion = 0; #ifdef DEBUG_ALIGNMENT_MODEL @@ -156,6 +161,13 @@ return m_aligned; } +void +AlignmentModel::setCompletion(int completion) +{ + m_explicitlySetCompletion = completion; + emit completionChanged(getId()); +} + sv_frame_t AlignmentModel::toReference(sv_frame_t frame) const { diff -r 9219834e39a4 -r 3072aa267248 data/model/AlignmentModel.h --- a/data/model/AlignmentModel.h Thu May 21 16:09:46 2020 +0100 +++ b/data/model/AlignmentModel.h Fri May 22 16:23:25 2020 +0100 @@ -56,6 +56,8 @@ ModelId getReferenceModel() const; ModelId getAlignedModel() const; + void setCompletion(int completion); + sv_frame_t toReference(sv_frame_t frame) const; sv_frame_t fromReference(sv_frame_t frame) const; @@ -107,6 +109,7 @@ bool m_pathComplete; QString m_error; int m_relativePitch; + int m_explicitlySetCompletion; void constructPath() const; void constructReversePath() const;