comparison framework/Document.cpp @ 68:cedeab01d4c8

* Attempt to fix finding of file:/// URLs * Fix incorrect reassignment of source model in layers that had no source model previously, when replacing a null main model
author Chris Cannam
date Thu, 29 Nov 2007 17:10:53 +0000
parents a8c8a9551a28
children 716e9d2f91c7
comparison
equal deleted inserted replaced
66:eeb48693db96 68:cedeab01d4c8
269 269
270 // std::cerr << "Document::setMainModel: inspecting model " 270 // std::cerr << "Document::setMainModel: inspecting model "
271 // << (model ? model->objectName().toStdString() : "(null)") << " in layer " 271 // << (model ? model->objectName().toStdString() : "(null)") << " in layer "
272 // << layer->objectName().toStdString() << std::endl; 272 // << layer->objectName().toStdString() << std::endl;
273 273
274 if (model == oldMainModel) { 274 if (model && (model == oldMainModel)) {
275 // std::cerr << "... it uses the old main model, replacing" << std::endl; 275 // std::cerr << "... it uses the old main model, replacing" << std::endl;
276 LayerFactory::getInstance()->setModel(layer, m_mainModel); 276 LayerFactory::getInstance()->setModel(layer, m_mainModel);
277 continue; 277 continue;
278 } 278 }
279 279
283 // get rid of this hideous degenerate 283 // get rid of this hideous degenerate
284 obsoleteLayers.push_back(layer); 284 obsoleteLayers.push_back(layer);
285 continue; 285 continue;
286 } 286 }
287 287
288 if (m_models[model].source == oldMainModel) { 288 if (m_models[model].source && (m_models[model].source == oldMainModel)) {
289 289
290 // std::cerr << "... it uses a model derived from the old main model, regenerating" << std::endl; 290 // std::cerr << "... it uses a model derived from the old main model, regenerating" << std::endl;
291 291
292 // This model was derived from the previous main 292 // This model was derived from the previous main
293 // model: regenerate it. 293 // model: regenerate it.
332 for (size_t k = 0; k < obsoleteLayers.size(); ++k) { 332 for (size_t k = 0; k < obsoleteLayers.size(); ++k) {
333 deleteLayer(obsoleteLayers[k], true); 333 deleteLayer(obsoleteLayers[k], true);
334 } 334 }
335 335
336 for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) { 336 for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
337 if (i->first->getAlignmentReference() == oldMainModel) { 337 if (oldMainModel &&
338 (i->first->getAlignmentReference() == oldMainModel)) {
338 alignModel(i->first); 339 alignModel(i->first);
339 } 340 }
340 } 341 }
341 342
342 emit mainModelChanged(m_mainModel); 343 emit mainModelChanged(m_mainModel);