diff data/model/AlignmentModel.cpp @ 1862:3072aa267248

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
author Chris Cannam
date Fri, 22 May 2020 16:23:25 +0100
parents edc2d0e635dc
children
line wrap: on
line diff
--- 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
 {