Mercurial > hg > svapp
diff framework/Document.cpp @ 236:dd14baa45847
Merge from branch "templating"
author | Chris Cannam |
---|---|
date | Sun, 26 Jun 2011 19:53:34 +0100 |
parents | 8aace2d9f1c2 2c827ac7c8e7 |
children | ecbf3b75c562 |
line wrap: on
line diff
--- a/framework/Document.cpp Tue Jun 14 15:27:12 2011 +0100 +++ b/framework/Document.cpp Sun Jun 26 19:53:34 2011 +0100 @@ -1070,12 +1070,29 @@ void Document::toXml(QTextStream &out, QString indent, QString extraAttributes) const { + toXml(out, indent, extraAttributes, false); +} + +void +Document::toXmlAsTemplate(QTextStream &out, QString indent, QString extraAttributes) const +{ + toXml(out, indent, extraAttributes, true); +} + +void +Document::toXml(QTextStream &out, QString indent, QString extraAttributes, + bool asTemplate) const +{ out << indent + QString("<data%1%2>\n") .arg(extraAttributes == "" ? "" : " ").arg(extraAttributes); if (m_mainModel) { - m_mainModel->toXml(out, indent + " ", "mainModel=\"true\""); + if (asTemplate) { + writePlaceholderMainModel(out, indent + " "); + } else { + m_mainModel->toXml(out, indent + " ", "mainModel=\"true\""); + } PlayParameters *playParameters = PlayParameterRepository::getInstance()->getPlayParameters(m_mainModel); @@ -1187,6 +1204,15 @@ } void +Document::writePlaceholderMainModel(QTextStream &out, QString indent) const +{ + out << indent; + out << QString("<model id=\"%1\" name=\"placeholder\" sampleRate=\"%2\" type=\"wavefile\" file=\":samples/silent.wav\" mainModel=\"true\"/>\n") + .arg(getObjectExportId(m_mainModel)) + .arg(m_mainModel->getSampleRate()); +} + +void Document::writeBackwardCompatibleDerivation(QTextStream &out, QString indent, Model *targetModel, const ModelRecord &rec) const