Mercurial > hg > sonic-visualiser
changeset 173:102317ae3970
* Better abbreviation modes for layer names in pane (and input model combo
of plugin parameter dialog)
* Avoid crash when loading SV file containing model derived from nonexistent
model (shouldn't happen of course, but see bug #1771769)
* Remember last-used input model in plugin parameter dialog
* Don't override a layer colour loaded from a session file with the generated
default colour when attaching it to a view
author | Chris Cannam |
---|---|
date | Fri, 10 Aug 2007 16:36:50 +0000 |
parents | c1980ed39d2e |
children | aaf806ce329a |
files | document/SVFileReader.cpp document/SVFileReader.h |
diffstat | 2 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/document/SVFileReader.cpp Thu Aug 09 14:40:03 2007 +0000 +++ b/document/SVFileReader.cpp Fri Aug 10 16:36:50 2007 +0000 @@ -253,7 +253,8 @@ for (std::map<int, int>::iterator i = m_awaitingDatasets.begin(); i != m_awaitingDatasets.end(); ++i) { - if (m_models[i->second] == m_currentDataset) { + if (haveModel(i->second) && + m_models[i->second] == m_currentDataset) { m_awaitingDatasets.erase(i); foundInAwaiting = true; break; @@ -278,7 +279,7 @@ if (m_currentDerivedModel < 0) { std::cerr << "WARNING: SV-XML: Bad derivation output model id " << m_currentDerivedModelId << std::endl; - } else if (m_models[m_currentDerivedModelId]) { + } else if (haveModel(m_currentDerivedModelId)) { std::cerr << "WARNING: SV-XML: Derivation has existing model " << m_currentDerivedModelId << " as target, not regenerating" << std::endl; @@ -388,7 +389,7 @@ READ_MANDATORY(int, id, toInt); - if (m_models.find(id) != m_models.end()) { + if (haveModel(id)) { std::cerr << "WARNING: SV-XML: Ignoring duplicate model id " << id << std::endl; return false; @@ -712,7 +713,7 @@ modelId = attributes.value("model").trimmed().toInt(&modelOk); if (modelOk) { - if (m_models.find(modelId) != m_models.end()) { + if (haveModel(modelId)) { Model *model = m_models[modelId]; m_document->setModel(layer, model); } else { @@ -765,7 +766,7 @@ int modelId = m_awaitingDatasets[id]; Model *model = 0; - if (m_models.find(modelId) != m_models.end()) { + if (haveModel(modelId)) { model = m_models[modelId]; } else { std::cerr << "WARNING: SV-XML: Internal error: Unknown model " << modelId @@ -965,7 +966,7 @@ QString transform = attributes.value("transform"); - if (m_models.find(modelId) != m_models.end()) { + if (haveModel(modelId)) { m_currentDerivedModel = m_models[modelId]; } else { // we'll regenerate the model when the derivation element ends @@ -978,7 +979,7 @@ bool sourceOk = false; sourceId = attributes.value("source").trimmed().toInt(&sourceOk); - if (sourceOk && m_models[sourceId]) { + if (sourceOk && haveModel(sourceId)) { m_currentTransformSource = m_models[sourceId]; } else { m_currentTransformSource = m_document->getMainModel(); @@ -1022,7 +1023,7 @@ return false; } - if (m_models.find(modelId) != m_models.end()) { + if (haveModel(modelId)) { bool ok = false;
--- a/document/SVFileReader.h Thu Aug 09 14:40:03 2007 +0000 +++ b/document/SVFileReader.h Fri Aug 10 16:36:50 2007 +0000 @@ -199,6 +199,10 @@ bool readMeasurement(const QXmlAttributes &); void addUnaddedModels(); + bool haveModel(int id) { + return (m_models.find(id) != m_models.end()) && m_models[id]; + } + Document *m_document; SVFileReaderPaneCallback &m_paneCallback; QString m_location;