comparison layer/LayerFactory.cpp @ 805:1d526ba11a24 warnfix_no_size_t

Remove size_t's and fix warnings in layer/
author Chris Cannam
date Tue, 17 Jun 2014 15:18:06 +0100
parents ddae586bc47b
children b12cd1c2dad5
comparison
equal deleted inserted replaced
782:ddae586bc47b 805:1d526ba11a24
91 91
92 case PeakFrequencySpectrogram: 92 case PeakFrequencySpectrogram:
93 // likewise 93 // likewise
94 return Layer::tr("Spectrogram"); 94 return Layer::tr("Spectrogram");
95 95
96 default: break; 96 case UnknownLayer:
97 } 97 default:
98 98 cerr << "WARNING: LayerFactory::getLayerPresentationName passed unknown layer" << endl;
99 return Layer::tr("Layer"); 99 return Layer::tr("Unknown Layer");
100 }
100 } 101 }
101 102
102 bool 103 bool
103 LayerFactory::isLayerSliceable(const Layer *layer) 104 LayerFactory::isLayerSliceable(const Layer *layer)
104 { 105 {
242 case Colour3DPlot: return "colour3d"; 243 case Colour3DPlot: return "colour3d";
243 case Spectrum: return "spectrum"; 244 case Spectrum: return "spectrum";
244 case Slice: return "spectrum"; 245 case Slice: return "spectrum";
245 case MelodicRangeSpectrogram: return "spectrogram"; 246 case MelodicRangeSpectrogram: return "spectrogram";
246 case PeakFrequencySpectrogram: return "spectrogram"; 247 case PeakFrequencySpectrogram: return "spectrogram";
247 default: return "unknown"; 248 case UnknownLayer:
249 default:
250 cerr << "WARNING: LayerFactory::getLayerIconName passed unknown layer" << endl;
251 return "unknown";
248 } 252 }
249 } 253 }
250 254
251 QString 255 QString
252 LayerFactory::getLayerTypeName(LayerType type) 256 LayerFactory::getLayerTypeName(LayerType type)
265 case Colour3DPlot: return "colour3dplot"; 269 case Colour3DPlot: return "colour3dplot";
266 case Spectrum: return "spectrum"; 270 case Spectrum: return "spectrum";
267 case Slice: return "slice"; 271 case Slice: return "slice";
268 case MelodicRangeSpectrogram: return "melodicrange"; 272 case MelodicRangeSpectrogram: return "melodicrange";
269 case PeakFrequencySpectrogram: return "peakfrequency"; 273 case PeakFrequencySpectrogram: return "peakfrequency";
270 default: return "unknown"; 274 case UnknownLayer:
275 default:
276 cerr << "WARNING: LayerFactory::getLayerTypeName passed unknown layer" << endl;
277 return "unknown";
271 } 278 }
272 } 279 }
273 280
274 LayerFactory::LayerType 281 LayerFactory::LayerType
275 LayerFactory::getLayerTypeForName(QString name) 282 LayerFactory::getLayerTypeForName(QString name)
458 465
459 case PeakFrequencySpectrogram: 466 case PeakFrequencySpectrogram:
460 layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks); 467 layer = new SpectrogramLayer(SpectrogramLayer::MelodicPeaks);
461 break; 468 break;
462 469
463 default: break; 470 case UnknownLayer:
471 default:
472 cerr << "WARNING: LayerFactory::createLayer passed unknown layer" << endl;
473 break;
464 } 474 }
465 475
466 if (!layer) { 476 if (!layer) {
467 SVDEBUG << "LayerFactory::createLayer: Unknown layer type " 477 cerr << "LayerFactory::createLayer: Unknown layer type "
468 << type << endl; 478 << type << endl;
469 } else { 479 } else {
470 // SVDEBUG << "LayerFactory::createLayer: Setting object name " 480 // SVDEBUG << "LayerFactory::createLayer: Setting object name "
471 // << getLayerPresentationName(type) << " on " << layer << endl; 481 // << getLayerPresentationName(type) << " on " << layer << endl;
472 layer->setObjectName(getLayerPresentationName(type)); 482 layer->setObjectName(getLayerPresentationName(type));
497 QXmlAttributes attrs; 507 QXmlAttributes attrs;
498 508
499 QDomElement layerElt = docNew.firstChildElement("layer"); 509 QDomElement layerElt = docNew.firstChildElement("layer");
500 QDomNamedNodeMap attrNodes = layerElt.attributes(); 510 QDomNamedNodeMap attrNodes = layerElt.attributes();
501 511
502 for (unsigned int i = 0; i < attrNodes.length(); ++i) { 512 for (int i = 0; i < attrNodes.length(); ++i) {
503 QDomAttr attr = attrNodes.item(i).toAttr(); 513 QDomAttr attr = attrNodes.item(i).toAttr();
504 if (attr.isNull()) continue; 514 if (attr.isNull()) continue;
505 // cerr << "append \"" << attr.name() 515 // cerr << "append \"" << attr.name()
506 // << "\" -> \"" << attr.value() << "\"" 516 // << "\" -> \"" << attr.value() << "\""
507 // << endl; 517 // << endl;
508 attrs.append(attr.name(), "", "", attr.value()); 518 attrs.append(attr.name(), "", "", attr.value());
509 } 519 }
510 520
511 layerElt = docOld.firstChildElement("layer"); 521 layerElt = docOld.firstChildElement("layer");
512 attrNodes = layerElt.attributes(); 522 attrNodes = layerElt.attributes();
513 for (unsigned int i = 0; i < attrNodes.length(); ++i) { 523 for (int i = 0; i < attrNodes.length(); ++i) {
514 QDomAttr attr = attrNodes.item(i).toAttr(); 524 QDomAttr attr = attrNodes.item(i).toAttr();
515 if (attr.isNull()) continue; 525 if (attr.isNull()) continue;
516 if (attrs.value(attr.name()) == "") { 526 if (attrs.value(attr.name()) == "") {
517 // cerr << "append \"" << attr.name() 527 // cerr << "append \"" << attr.name()
518 // << "\" -> \"" << attr.value() << "\"" 528 // << "\" -> \"" << attr.value() << "\""