diff framework/MainWindowBase.cpp @ 213:eed79c69be61

Merge
author Chris Cannam
date Mon, 25 Oct 2010 11:11:33 +0200
parents 84422236db20 143e1b56e81b
children b96d90975f7c
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Sun Oct 24 22:09:42 2010 +0200
+++ b/framework/MainWindowBase.cpp	Mon Oct 25 11:11:33 2010 +0200
@@ -1045,7 +1045,7 @@
 }
 
 MainWindowBase::FileOpenStatus
-MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode)
+MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, QString templateName)
 {
 //    std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl;
 
@@ -1129,6 +1129,17 @@
         mode = ReplaceMainModel;
     }
 
+    bool loadedTemplate = false;
+    if ((mode == ReplaceMainModel) && (templateName.length() != 0)) {
+        QString tplPath = "file::templates/" + templateName + ".xml";
+        std::cerr << "SV looking for template " << tplPath.toStdString() << std::endl;
+        FileOpenStatus tplStatus = openSessionFile(tplPath);
+        if(tplStatus != FileOpenFailed) {
+            loadedTemplate = true;
+            mode = ReplaceMainModel;
+        }
+    }
+
     emit activity(tr("Import audio file \"%1\"").arg(source.getLocation()));
 
     if (mode == ReplaceMainModel) {
@@ -1144,7 +1155,7 @@
 
 	setupMenus();
 
-	if (m_sessionFile == "") {
+	if (loadedTemplate || (m_sessionFile == "")) {
             //!!! shouldn't be dealing directly with title from here -- call a method
 	    setWindowTitle(tr("%1: %2")
                            .arg(QApplication::applicationName())