Mercurial > hg > svcore
changeset 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 | 7623ecfd5891 |
children | 9cdc7a4efde2 |
files | data/model/AlignmentModel.cpp data/model/AlignmentModel.h data/model/Model.cpp |
diffstat | 3 files changed, 13 insertions(+), 4 deletions(-) [+] |
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(); }
--- a/data/model/AlignmentModel.h Thu Oct 25 14:30:32 2007 +0000 +++ b/data/model/AlignmentModel.h Thu Oct 25 14:32:23 2007 +0000 @@ -62,6 +62,7 @@ Model *m_inputModel; // I own this SparseTimeValueModel *m_path; // I own this mutable SparseTimeValueModel *m_reversePath; // I own this + bool m_pathBegun; bool m_pathComplete; void constructReversePath() const;
--- a/data/model/Model.cpp Thu Oct 25 14:30:32 2007 +0000 +++ b/data/model/Model.cpp Thu Oct 25 14:32:23 2007 +0000 @@ -96,7 +96,7 @@ const Model * Model::getAlignmentReference() const { - if (!m_alignment) return 0; + if (!m_alignment) return this; return m_alignment->getReferenceModel(); } @@ -117,11 +117,11 @@ int Model::getAlignmentCompletion() const { - std::cerr << "Model::getAlignmentCompletion" << std::endl; +// std::cerr << "Model::getAlignmentCompletion" << std::endl; if (!m_alignment) return 100; int completion = 0; (void)m_alignment->isReady(&completion); - std::cerr << " -> " << completion << std::endl; +// std::cerr << " -> " << completion << std::endl; return completion; }