comparison framework/MainWindowBase.cpp @ 226:2c827ac7c8e7 templating

When saving a session as a template, use the silent.wav placeholder instead of the main model
author Chris Cannam
date Wed, 11 May 2011 12:23:55 +0100
parents 9d50c42d7ca0
children a6398a7400c1
comparison
equal deleted inserted replaced
225:9d50c42d7ca0 226:2c827ac7c8e7
1959 } 1959 }
1960 1960
1961 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 1961 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
1962 1962
1963 QTextStream out(&bzFile); 1963 QTextStream out(&bzFile);
1964 toXml(out); 1964 toXml(out, false);
1965 out.flush(); 1965 out.flush();
1966 1966
1967 QApplication::restoreOverrideCursor(); 1967 QApplication::restoreOverrideCursor();
1968 1968
1969 if (!bzFile.isOK()) { 1969 if (!bzFile.isOK()) {
2004 } 2004 }
2005 2005
2006 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 2006 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
2007 2007
2008 QTextStream out(&file); 2008 QTextStream out(&file);
2009 toXml(out); 2009 toXml(out, true);
2010 out.flush(); 2010 out.flush();
2011 2011
2012 QApplication::restoreOverrideCursor(); 2012 QApplication::restoreOverrideCursor();
2013 2013
2014 file.close(); 2014 file.close();
2023 return false; 2023 return false;
2024 } 2024 }
2025 } 2025 }
2026 2026
2027 void 2027 void
2028 MainWindowBase::toXml(QTextStream &out) 2028 MainWindowBase::toXml(QTextStream &out, bool asTemplate)
2029 { 2029 {
2030 QString indent(" "); 2030 QString indent(" ");
2031 2031
2032 out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 2032 out << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
2033 out << "<!DOCTYPE sonic-visualiser>\n"; 2033 out << "<!DOCTYPE sonic-visualiser>\n";
2034 out << "<sv>\n"; 2034 out << "<sv>\n";
2035 2035
2036 m_document->toXml(out, "", ""); 2036 if (asTemplate) {
2037 m_document->toXmlAsTemplate(out, "", "");
2038 } else {
2039 m_document->toXml(out, "", "");
2040 }
2037 2041
2038 out << "<display>\n"; 2042 out << "<display>\n";
2039 2043
2040 out << QString(" <window width=\"%1\" height=\"%2\"/>\n") 2044 out << QString(" <window width=\"%1\" height=\"%2\"/>\n")
2041 .arg(width()).arg(height()); 2045 .arg(width()).arg(height());