diff data/model/AlignmentModel.cpp @ 323:a71dec01c4d3

* Some tidying up to handling of alignment; add alignment status label to pane; ensure alignment when dragging with mouse as well as when playing
author Chris Cannam
date Thu, 25 Oct 2007 14:32:23 +0000
parents 29485aa03da4
children 1afaf98dbf11
line wrap: on
line diff
--- a/data/model/AlignmentModel.cpp	Thu Oct 25 14:30:32 2007 +0000
+++ b/data/model/AlignmentModel.cpp	Thu Oct 25 14:32:23 2007 +0000
@@ -26,6 +26,7 @@
     m_inputModel(inputModel),
     m_path(path),
     m_reversePath(0),
+    m_pathBegun(false),
     m_pathComplete(false)
 {
     connect(m_path, SIGNAL(modelChanged()),
@@ -89,6 +90,10 @@
 bool
 AlignmentModel::isReady(int *completion) const
 {
+    if (!m_pathBegun) {
+        completion = 0;
+        return false;
+    }
     return m_path->isReady(completion);
 }
 
@@ -140,18 +145,21 @@
 void
 AlignmentModel::pathCompletionChanged()
 {
+    m_pathBegun = true;
+
     if (!m_pathComplete) {
         int completion = 0;
         m_path->isReady(&completion);
         std::cerr << "AlignmentModel::pathCompletionChanged: completion = "
                   << completion << std::endl;
-        m_pathComplete = (completion == 100); //!!! a bit of a hack
+        m_pathComplete = (completion == 100);
         if (m_pathComplete) {
             constructReversePath();
             delete m_inputModel;
             m_inputModel = 0;
         }
     }
+
     emit completionChanged();
 }