Mercurial > hg > tony
diff src/Analyser.cpp @ 314:2a2fd6eb8fa8
If user asks to save before initial analysis is complete, wait for it
author | Chris Cannam |
---|---|
date | Fri, 13 Jun 2014 12:12:27 +0100 |
parents | 29005aa146e2 |
children | ef75afbe4c67 |
line wrap: on
line diff
--- a/src/Analyser.cpp Fri Jun 13 10:37:04 2014 +0100 +++ b/src/Analyser.cpp Fri Jun 13 12:12:27 2014 +0100 @@ -138,6 +138,31 @@ return true; } +int +Analyser::getInitialAnalysisCompletion() +{ + int completion = 0; + + if (m_layers[PitchTrack]) { + completion = m_layers[PitchTrack]->getCompletion(m_pane); + } + + if (m_layers[Notes]) { + int c = m_layers[Notes]->getCompletion(m_pane); + if (c < completion) completion = c; + } + + return completion; +} + +void +Analyser::layerCompletionChanged() +{ + if (getInitialAnalysisCompletion() == 100) { + emit initialAnalysisCompleted(); + } +} + QString Analyser::addVisualisations() { @@ -318,6 +343,8 @@ PlayParameters *params = pitchLayer->getPlayParameters(); if (params) params->setPlayPan(1); } + connect(pitchLayer, SIGNAL(modelCompletionChanged()), + this, SLOT(layerCompletionChanged())); FlexiNoteLayer *flexiNoteLayer = qobject_cast<FlexiNoteLayer *>(m_layers[Notes]); @@ -326,6 +353,8 @@ PlayParameters *params = flexiNoteLayer->getPlayParameters(); if (params) params->setPlayPan(1); } + connect(flexiNoteLayer, SIGNAL(modelCompletionChanged()), + this, SLOT(layerCompletionChanged())); return ""; }