# HG changeset patch # User Chris Cannam # Date 1287997893 -7200 # Node ID eed79c69be61687e8cb00b7aa73fae56e935959a # Parent fe83e6e686831db84ee3e97330bc9778652fd8a7# Parent 143e1b56e81b885d045fd7b51ff5204fc0ee996e Merge diff -r fe83e6e68683 -r eed79c69be61 framework/MainWindowBase.cpp --- 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()) diff -r fe83e6e68683 -r eed79c69be61 framework/MainWindowBase.h --- a/framework/MainWindowBase.h Sun Oct 24 22:09:42 2010 +0200 +++ b/framework/MainWindowBase.h Mon Oct 25 11:11:33 2010 +0200 @@ -95,7 +95,7 @@ virtual FileOpenStatus open(QString fileOrUrl, AudioFileOpenMode = AskUser); virtual FileOpenStatus open(FileSource source, AudioFileOpenMode = AskUser); - virtual FileOpenStatus openAudio(FileSource source, AudioFileOpenMode = AskUser); + virtual FileOpenStatus openAudio(FileSource source, AudioFileOpenMode = AskUser, QString templateName = ""); virtual FileOpenStatus openPlaylist(FileSource source, AudioFileOpenMode = AskUser); virtual FileOpenStatus openLayer(FileSource source); virtual FileOpenStatus openImage(FileSource source);