Mercurial > hg > svapp
comparison framework/SVFileReader.cpp @ 447:da520a68595a tonioni
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 | 1c17a2c5e917 |
children | dc1a360f2b69 |
comparison
equal
deleted
inserted
replaced
446:1c17a2c5e917 | 447:da520a68595a |
---|---|
884 Model *model = m_models[modelId]; | 884 Model *model = m_models[modelId]; |
885 m_document->setModel(layer, model); | 885 m_document->setModel(layer, model); |
886 } else { | 886 } else { |
887 cerr << "WARNING: SV-XML: Unknown model id " << modelId | 887 cerr << "WARNING: SV-XML: Unknown model id " << modelId |
888 << " in layer definition" << endl; | 888 << " in layer definition" << endl; |
889 | |
890 // Don't add a layer with an unknown model id | |
891 m_document->deleteLayer(layer); | |
892 m_layers[id] = layer = 0; | |
893 return false; | |
889 } | 894 } |
890 } | 895 } |
891 | 896 |
892 layer->setProperties(attributes); | 897 if (layer) layer->setProperties(attributes); |
893 } | 898 } |
894 | 899 |
895 if (!m_inData && m_currentPane) { | 900 if (!m_inData && m_currentPane && layer) { |
896 | 901 |
897 QString visible = attributes.value("visible"); | 902 QString visible = attributes.value("visible"); |
898 bool dormant = (visible == "false"); | 903 bool dormant = (visible == "false"); |
899 | 904 |
900 // We need to do this both before and after adding the layer | 905 // We need to do this both before and after adding the layer |
910 | 915 |
911 layer->setLayerDormant(m_currentPane, dormant); | 916 layer->setLayerDormant(m_currentPane, dormant); |
912 } | 917 } |
913 | 918 |
914 m_currentLayer = layer; | 919 m_currentLayer = layer; |
915 m_inLayer = true; | 920 m_inLayer = (layer != 0); |
916 | 921 |
917 return true; | 922 return true; |
918 } | 923 } |
919 | 924 |
920 bool | 925 bool |