comparison layer/LayerFactory.cpp @ 584:1fe7951a61e8 debug-output

Remove most toStdString calls (no longer needed, with debug header)
author Chris Cannam
date Thu, 12 May 2011 17:31:43 +0100
parents 96e4d7b9e165
children f4960f8ce798
comparison
equal deleted inserted replaced
583:4c484636d5ec 584:1fe7951a61e8
444 if (!layer) { 444 if (!layer) {
445 std::cerr << "LayerFactory::createLayer: Unknown layer type " 445 std::cerr << "LayerFactory::createLayer: Unknown layer type "
446 << type << std::endl; 446 << type << std::endl;
447 } else { 447 } else {
448 // std::cerr << "LayerFactory::createLayer: Setting object name " 448 // std::cerr << "LayerFactory::createLayer: Setting object name "
449 // << getLayerPresentationName(type).toStdString() << " on " << layer << std::endl; 449 // << getLayerPresentationName(type) << " on " << layer << std::endl;
450 layer->setObjectName(getLayerPresentationName(type)); 450 layer->setObjectName(getLayerPresentationName(type));
451 setLayerDefaultProperties(type, layer); 451 setLayerDefaultProperties(type, layer);
452 } 452 }
453 453
454 return layer; 454 return layer;
455 } 455 }
456 456
457 void 457 void
458 LayerFactory::setLayerDefaultProperties(LayerType type, Layer *layer) 458 LayerFactory::setLayerDefaultProperties(LayerType type, Layer *layer)
459 { 459 {
460 // std::cerr << "LayerFactory::setLayerDefaultProperties: type " << type << " (name \"" << getLayerTypeName(type).toStdString() << "\")" << std::endl; 460 // std::cerr << "LayerFactory::setLayerDefaultProperties: type " << type << " (name \"" << getLayerTypeName(type) << "\")" << std::endl;
461 461
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.toStdString() << "\"" << std::endl; 467 // std::cerr << "defaults=\"" << defaults << "\"" << std::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) &&
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 // std::cerr << "append \"" << attr.name().toStdString()
484 // << "\" -> \"" << attr.value().toStdString() << "\"" 484 // << "\" -> \"" << attr.value() << "\""
485 // << std::endl; 485 // << std::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");
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 // std::cerr << "append \"" << attr.name().toStdString()
496 // << "\" -> \"" << attr.value().toStdString() << "\"" 496 // << "\" -> \"" << attr.value() << "\""
497 // << std::endl; 497 // << std::endl;
498 attrs.append(attr.name(), "", "", attr.value()); 498 attrs.append(attr.name(), "", "", attr.value());
499 } 499 }
500 } 500 }
501 501