Mercurial > hg > svapp
comparison 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 |
comparison
equal
deleted
inserted
replaced
233:8aace2d9f1c2 | 236:dd14baa45847 |
---|---|
1068 } | 1068 } |
1069 | 1069 |
1070 void | 1070 void |
1071 Document::toXml(QTextStream &out, QString indent, QString extraAttributes) const | 1071 Document::toXml(QTextStream &out, QString indent, QString extraAttributes) const |
1072 { | 1072 { |
1073 toXml(out, indent, extraAttributes, false); | |
1074 } | |
1075 | |
1076 void | |
1077 Document::toXmlAsTemplate(QTextStream &out, QString indent, QString extraAttributes) const | |
1078 { | |
1079 toXml(out, indent, extraAttributes, true); | |
1080 } | |
1081 | |
1082 void | |
1083 Document::toXml(QTextStream &out, QString indent, QString extraAttributes, | |
1084 bool asTemplate) const | |
1085 { | |
1073 out << indent + QString("<data%1%2>\n") | 1086 out << indent + QString("<data%1%2>\n") |
1074 .arg(extraAttributes == "" ? "" : " ").arg(extraAttributes); | 1087 .arg(extraAttributes == "" ? "" : " ").arg(extraAttributes); |
1075 | 1088 |
1076 if (m_mainModel) { | 1089 if (m_mainModel) { |
1077 | 1090 |
1078 m_mainModel->toXml(out, indent + " ", "mainModel=\"true\""); | 1091 if (asTemplate) { |
1092 writePlaceholderMainModel(out, indent + " "); | |
1093 } else { | |
1094 m_mainModel->toXml(out, indent + " ", "mainModel=\"true\""); | |
1095 } | |
1079 | 1096 |
1080 PlayParameters *playParameters = | 1097 PlayParameters *playParameters = |
1081 PlayParameterRepository::getInstance()->getPlayParameters(m_mainModel); | 1098 PlayParameterRepository::getInstance()->getPlayParameters(m_mainModel); |
1082 if (playParameters) { | 1099 if (playParameters) { |
1083 playParameters->toXml | 1100 playParameters->toXml |
1182 | 1199 |
1183 (*i)->toXml(out, indent + " "); | 1200 (*i)->toXml(out, indent + " "); |
1184 } | 1201 } |
1185 | 1202 |
1186 out << indent + "</data>\n"; | 1203 out << indent + "</data>\n"; |
1204 } | |
1205 | |
1206 void | |
1207 Document::writePlaceholderMainModel(QTextStream &out, QString indent) const | |
1208 { | |
1209 out << indent; | |
1210 out << QString("<model id=\"%1\" name=\"placeholder\" sampleRate=\"%2\" type=\"wavefile\" file=\":samples/silent.wav\" mainModel=\"true\"/>\n") | |
1211 .arg(getObjectExportId(m_mainModel)) | |
1212 .arg(m_mainModel->getSampleRate()); | |
1187 } | 1213 } |
1188 | 1214 |
1189 void | 1215 void |
1190 Document::writeBackwardCompatibleDerivation(QTextStream &out, QString indent, | 1216 Document::writeBackwardCompatibleDerivation(QTextStream &out, QString indent, |
1191 Model *targetModel, | 1217 Model *targetModel, |