Mercurial > hg > svapp
changeset 213:eed79c69be61
Merge
author | Chris Cannam |
---|---|
date | Mon, 25 Oct 2010 11:11:33 +0200 |
parents | fe83e6e68683 (current diff) 143e1b56e81b (diff) |
children | 15057cf59da5 |
files | framework/MainWindowBase.cpp framework/MainWindowBase.h |
diffstat | 2 files changed, 14 insertions(+), 3 deletions(-) [+] |
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())
--- 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);