Mercurial > hg > svgui
comparison layer/LayerFactory.cpp @ 327:29fcf125f98b
* Pass StorageAdviser::Criteria into FFTModel constructor etc
author | Chris Cannam |
---|---|
date | Sun, 11 Nov 2007 20:31:12 +0000 |
parents | 4f4f38a11cd2 |
children | 4a542ba875c2 64e84e5efb76 |
comparison
equal
deleted
inserted
replaced
326:4f4f38a11cd2 | 327:29fcf125f98b |
---|---|
416 | 416 |
417 if (!layer) { | 417 if (!layer) { |
418 std::cerr << "LayerFactory::createLayer: Unknown layer type " | 418 std::cerr << "LayerFactory::createLayer: Unknown layer type " |
419 << type << std::endl; | 419 << type << std::endl; |
420 } else { | 420 } else { |
421 // std::cerr << "LayerFactory::createLayer: Setting object name " | 421 std::cerr << "LayerFactory::createLayer: Setting object name " |
422 // << getLayerPresentationName(type).toStdString() << " on " << layer << std::endl; | 422 << getLayerPresentationName(type).toStdString() << " on " << layer << std::endl; |
423 layer->setObjectName(getLayerPresentationName(type)); | 423 layer->setObjectName(getLayerPresentationName(type)); |
424 setLayerDefaultProperties(type, layer); | 424 setLayerDefaultProperties(type, layer); |
425 } | 425 } |
426 | 426 |
427 return layer; | 427 return layer; |
428 } | 428 } |
429 | 429 |
430 void | 430 void |
431 LayerFactory::setLayerDefaultProperties(LayerType type, Layer *layer) | 431 LayerFactory::setLayerDefaultProperties(LayerType type, Layer *layer) |
432 { | 432 { |
433 std::cerr << "LayerFactory::setLayerDefaultProperties: type " << type << " (name \"" << getLayerTypeName(type).toStdString() << "\"" << std::endl; | |
434 | |
433 QSettings settings; | 435 QSettings settings; |
434 settings.beginGroup("LayerDefaults"); | 436 settings.beginGroup("LayerDefaults"); |
435 QString defaults = settings.value(getLayerTypeName(type), "").toString(); | 437 QString defaults = settings.value(getLayerTypeName(type), "").toString(); |
436 if (defaults == "") return; | 438 if (defaults == "") return; |
439 | |
440 std::cerr << "defaults=\"" << defaults.toStdString() << "\"" << std::endl; | |
437 | 441 |
438 QString xml = layer->toXmlString(); | 442 QString xml = layer->toXmlString(); |
439 QDomDocument docOld, docNew; | 443 QDomDocument docOld, docNew; |
440 | 444 |
441 if (docOld.setContent(xml, false) && | 445 if (docOld.setContent(xml, false) && |
447 QDomNamedNodeMap attrNodes = layerElt.attributes(); | 451 QDomNamedNodeMap attrNodes = layerElt.attributes(); |
448 | 452 |
449 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 453 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
450 QDomAttr attr = attrNodes.item(i).toAttr(); | 454 QDomAttr attr = attrNodes.item(i).toAttr(); |
451 if (attr.isNull()) continue; | 455 if (attr.isNull()) continue; |
456 std::cerr << "append \"" << attr.name().toStdString() | |
457 << "\" -> \"" << attr.value().toStdString() << "\"" | |
458 << std::endl; | |
452 attrs.append(attr.name(), "", "", attr.value()); | 459 attrs.append(attr.name(), "", "", attr.value()); |
453 } | 460 } |
454 | 461 |
455 layerElt = docOld.firstChildElement("layer"); | 462 layerElt = docOld.firstChildElement("layer"); |
456 attrNodes = layerElt.attributes(); | 463 attrNodes = layerElt.attributes(); |
457 for (unsigned int i = 0; i < attrNodes.length(); ++i) { | 464 for (unsigned int i = 0; i < attrNodes.length(); ++i) { |
458 QDomAttr attr = attrNodes.item(i).toAttr(); | 465 QDomAttr attr = attrNodes.item(i).toAttr(); |
459 if (attr.isNull()) continue; | 466 if (attr.isNull()) continue; |
460 if (attrs.value(attr.name()) == "") { | 467 if (attrs.value(attr.name()) == "") { |
468 std::cerr << "append \"" << attr.name().toStdString() | |
469 << "\" -> \"" << attr.value().toStdString() << "\"" | |
470 << std::endl; | |
461 attrs.append(attr.name(), "", "", attr.value()); | 471 attrs.append(attr.name(), "", "", attr.value()); |
462 } | 472 } |
463 } | 473 } |
464 | 474 |
465 layer->setProperties(attrs); | 475 layer->setProperties(attrs); |