Chris@0: /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ Chris@0: Chris@0: /* Chris@0: A waveform viewer and audio annotation editor. Chris@2: Chris Cannam, Queen Mary University of London, 2005-2006 Chris@0: Chris@0: This is experimental software. Not for distribution. Chris@0: */ Chris@0: Chris@0: #include "Layer.h" Chris@0: #include "View.h" Chris@0: Chris@0: #include Chris@0: Chris@3: #include "layer/LayerFactory.h" //!!! shouldn't be including this here -- does that suggest we need to move this into layer/ ? Chris@3: Chris@0: Layer::Layer(View *w) Chris@0: { Chris@0: m_view = w; Chris@0: Chris@0: // Subclass must call this: Chris@0: // w->addLayer(this); Chris@0: } Chris@0: Chris@0: Layer::~Layer() Chris@0: { Chris@0: m_view->removeLayer(this); Chris@0: } Chris@0: Chris@0: void Chris@0: Layer::setObjectName(const QString &name) Chris@0: { Chris@0: QObject::setObjectName(name); Chris@0: emit layerNameChanged(); Chris@0: } Chris@0: Chris@3: QString Chris@3: Layer::toXmlString(QString indent, QString extraAttributes) const Chris@3: { Chris@3: QString s; Chris@3: Chris@3: s += indent; Chris@3: Chris@5: s += QString("\n") Chris@3: .arg(LayerFactory::instance()->getLayerTypeName Chris@3: (LayerFactory::instance()->getLayerType(this))) Chris@4: .arg(getObjectExportId(this)) Chris@3: .arg(objectName()) Chris@4: .arg(getObjectExportId(getModel())) Chris@3: .arg(extraAttributes); Chris@3: Chris@5: PropertyList properties = getProperties(); Chris@5: Chris@5: for (PropertyList::const_iterator i = properties.begin(); Chris@5: i != properties.end(); ++i) { Chris@5: Chris@5: int pv = getPropertyRangeAndValue(*i, 0, 0); Chris@5: s += indent + ""; Chris@5: s += QString("\n").arg(*i).arg(pv); Chris@5: } Chris@5: Chris@5: s += indent + "\n"; Chris@5: Chris@3: return s; Chris@3: } Chris@0: Chris@0: #ifdef INCLUDE_MOCFILES Chris@0: #include "Layer.moc.cpp" Chris@0: #endif Chris@0: