Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 706:97ea68f62c1f imaf_enc
Merge from default branch
author | Chris Cannam |
---|---|
date | Thu, 05 Dec 2013 09:47:02 +0000 |
parents | 692a8b9804fe |
children | 917039d333bb |
comparison
equal
deleted
inserted
replaced
678:26c5f7fd4807 | 706:97ea68f62c1f |
---|---|
462 QSettings settings; | 462 QSettings settings; |
463 settings.beginGroup("LayerDefaults"); | 463 settings.beginGroup("LayerDefaults"); |
464 QString defaults = settings.value(getLayerTypeName(type), "").toString(); | 464 QString defaults = settings.value(getLayerTypeName(type), "").toString(); |
465 if (defaults == "") return; | 465 if (defaults == "") return; |
466 | 466 |
467 // std::cerr << "defaults=\"" << defaults << "\"" << std::endl; | 467 // cerr << "defaults=\"" << defaults << "\"" << endl; |
468 | 468 |
469 QString xml = layer->toXmlString(); | 469 QString xml = layer->toXmlString(); |
470 QDomDocument docOld, docNew; | 470 QDomDocument docOld, docNew; |
471 | 471 |
472 if (docOld.setContent(xml, false) && | 472 if (docOld.setContent(xml, false) && |
478 QDomNamedNodeMap attrNodes = layerElt.attributes(); | 478 QDomNamedNodeMap attrNodes = layerElt.attributes(); |
479 | 479 |
480 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 480 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
481 QDomAttr attr = attrNodes.item(i).toAttr(); | 481 QDomAttr attr = attrNodes.item(i).toAttr(); |
482 if (attr.isNull()) continue; | 482 if (attr.isNull()) continue; |
483 // std::cerr << "append \"" << attr.name().toStdString() | 483 // cerr << "append \"" << attr.name() |
484 // << "\" -> \"" << attr.value() << "\"" | 484 // << "\" -> \"" << attr.value() << "\"" |
485 // << std::endl; | 485 // << endl; |
486 attrs.append(attr.name(), "", "", attr.value()); | 486 attrs.append(attr.name(), "", "", attr.value()); |
487 } | 487 } |
488 | 488 |
489 layerElt = docOld.firstChildElement("layer"); | 489 layerElt = docOld.firstChildElement("layer"); |
490 attrNodes = layerElt.attributes(); | 490 attrNodes = layerElt.attributes(); |
491 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 491 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
492 QDomAttr attr = attrNodes.item(i).toAttr(); | 492 QDomAttr attr = attrNodes.item(i).toAttr(); |
493 if (attr.isNull()) continue; | 493 if (attr.isNull()) continue; |
494 if (attrs.value(attr.name()) == "") { | 494 if (attrs.value(attr.name()) == "") { |
495 // std::cerr << "append \"" << attr.name().toStdString() | 495 // cerr << "append \"" << attr.name() |
496 // << "\" -> \"" << attr.value() << "\"" | 496 // << "\" -> \"" << attr.value() << "\"" |
497 // << std::endl; | 497 // << endl; |
498 attrs.append(attr.name(), "", "", attr.value()); | 498 attrs.append(attr.name(), "", "", attr.value()); |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 layer->setProperties(attrs); | 502 layer->setProperties(attrs); |