comparison src/Analyser.cpp @ 446:abd0dea16584

When loading a session, do not import any layers for which the identified models can't be found
author Chris Cannam
date Tue, 31 Mar 2015 17:46:46 +0100
parents 692852208b6c
children 7665cc683dd1
comparison
equal deleted inserted replaced
445:394923a6455c 446:abd0dea16584
75 m_document = doc; 75 m_document = doc;
76 m_fileModel = model; 76 m_fileModel = model;
77 m_paneStack = paneStack; 77 m_paneStack = paneStack;
78 m_pane = pane; 78 m_pane = pane;
79 79
80 if (!m_fileModel) return "Internal error: Analyser::newFileLoaded() called with no model present";
81
80 connect(doc, SIGNAL(layerAboutToBeDeleted(Layer *)), 82 connect(doc, SIGNAL(layerAboutToBeDeleted(Layer *)),
81 this, SLOT(layerAboutToBeDeleted(Layer *))); 83 this, SLOT(layerAboutToBeDeleted(Layer *)));
82 84
83 QSettings settings; 85 QSettings settings;
84 settings.beginGroup("Analyser"); 86 settings.beginGroup("Analyser");
93 { 95 {
94 if (!m_document) return "Internal error: Analyser::analyseExistingFile() called with no document present"; 96 if (!m_document) return "Internal error: Analyser::analyseExistingFile() called with no document present";
95 97
96 if (!m_pane) return "Internal error: Analyser::analyseExistingFile() called with no pane present"; 98 if (!m_pane) return "Internal error: Analyser::analyseExistingFile() called with no pane present";
97 99
100 if (!m_fileModel) return "Internal error: Analyser::analyseExistingFile() called with no model present";
101
98 if (m_layers[PitchTrack]) { 102 if (m_layers[PitchTrack]) {
99 m_document->removeLayerFromView(m_pane, m_layers[PitchTrack]); 103 m_document->removeLayerFromView(m_pane, m_layers[PitchTrack]);
100 m_layers[PitchTrack] = 0; 104 m_layers[PitchTrack] = 0;
101 } 105 }
102 if (m_layers[Notes]) { 106 if (m_layers[Notes]) {
223 } 227 }
224 228
225 QString 229 QString
226 Analyser::addVisualisations() 230 Analyser::addVisualisations()
227 { 231 {
232 if (!m_fileModel) return "Internal error: Analyser::addVisualisations() called with no model present";
233
228 // A spectrogram, off by default. Must go at the back because it's 234 // A spectrogram, off by default. Must go at the back because it's
229 // opaque 235 // opaque
230 236
231 /* This is roughly what we'd do for a constant-Q spectrogram, but it 237 /* This is roughly what we'd do for a constant-Q spectrogram, but it
232 currently has issues with y-axis alignment 238 currently has issues with y-axis alignment