Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 684:917039d333bb tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Tue, 26 Nov 2013 14:38:48 +0000 |
parents | 7256926d3af1 692a8b9804fe |
children | 6a8d922f991d |
comparison
equal
deleted
inserted
replaced
680:ced5f158eda7 | 684:917039d333bb |
---|---|
484 QSettings settings; | 484 QSettings settings; |
485 settings.beginGroup("LayerDefaults"); | 485 settings.beginGroup("LayerDefaults"); |
486 QString defaults = settings.value(getLayerTypeName(type), "").toString(); | 486 QString defaults = settings.value(getLayerTypeName(type), "").toString(); |
487 if (defaults == "") return; | 487 if (defaults == "") return; |
488 | 488 |
489 // std::cerr << "defaults=\"" << defaults << "\"" << std::endl; | 489 // cerr << "defaults=\"" << defaults << "\"" << endl; |
490 | 490 |
491 QString xml = layer->toXmlString(); | 491 QString xml = layer->toXmlString(); |
492 QDomDocument docOld, docNew; | 492 QDomDocument docOld, docNew; |
493 | 493 |
494 if (docOld.setContent(xml, false) && | 494 if (docOld.setContent(xml, false) && |
500 QDomNamedNodeMap attrNodes = layerElt.attributes(); | 500 QDomNamedNodeMap attrNodes = layerElt.attributes(); |
501 | 501 |
502 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 502 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
503 QDomAttr attr = attrNodes.item(i).toAttr(); | 503 QDomAttr attr = attrNodes.item(i).toAttr(); |
504 if (attr.isNull()) continue; | 504 if (attr.isNull()) continue; |
505 // std::cerr << "append \"" << attr.name().toStdString() | 505 // cerr << "append \"" << attr.name() |
506 // << "\" -> \"" << attr.value() << "\"" | 506 // << "\" -> \"" << attr.value() << "\"" |
507 // << std::endl; | 507 // << endl; |
508 attrs.append(attr.name(), "", "", attr.value()); | 508 attrs.append(attr.name(), "", "", attr.value()); |
509 } | 509 } |
510 | 510 |
511 layerElt = docOld.firstChildElement("layer"); | 511 layerElt = docOld.firstChildElement("layer"); |
512 attrNodes = layerElt.attributes(); | 512 attrNodes = layerElt.attributes(); |
513 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 513 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
514 QDomAttr attr = attrNodes.item(i).toAttr(); | 514 QDomAttr attr = attrNodes.item(i).toAttr(); |
515 if (attr.isNull()) continue; | 515 if (attr.isNull()) continue; |
516 if (attrs.value(attr.name()) == "") { | 516 if (attrs.value(attr.name()) == "") { |
517 // std::cerr << "append \"" << attr.name().toStdString() | 517 // cerr << "append \"" << attr.name() |
518 // << "\" -> \"" << attr.value() << "\"" | 518 // << "\" -> \"" << attr.value() << "\"" |
519 // << std::endl; | 519 // << endl; |
520 attrs.append(attr.name(), "", "", attr.value()); | 520 attrs.append(attr.name(), "", "", attr.value()); |
521 } | 521 } |
522 } | 522 } |
523 | 523 |
524 layer->setProperties(attrs); | 524 layer->setProperties(attrs); |