Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 213:eed79c69be61
Merge
author | Chris Cannam |
---|---|
date | Mon, 25 Oct 2010 11:11:33 +0200 |
parents | 84422236db20 143e1b56e81b |
children | b96d90975f7c |
comparison
equal
deleted
inserted
replaced
212:fe83e6e68683 | 213:eed79c69be61 |
---|---|
1043 return FileOpenFailed; | 1043 return FileOpenFailed; |
1044 } | 1044 } |
1045 } | 1045 } |
1046 | 1046 |
1047 MainWindowBase::FileOpenStatus | 1047 MainWindowBase::FileOpenStatus |
1048 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode) | 1048 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, QString templateName) |
1049 { | 1049 { |
1050 // std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl; | 1050 // std::cerr << "MainWindowBase::openAudio(" << source.getLocation().toStdString() << ")" << std::endl; |
1051 | 1051 |
1052 if (!source.isAvailable()) return FileOpenFailed; | 1052 if (!source.isAvailable()) return FileOpenFailed; |
1053 source.waitForData(); | 1053 source.waitForData(); |
1127 | 1127 |
1128 if (mode == CreateAdditionalModel && !getMainModel()) { | 1128 if (mode == CreateAdditionalModel && !getMainModel()) { |
1129 mode = ReplaceMainModel; | 1129 mode = ReplaceMainModel; |
1130 } | 1130 } |
1131 | 1131 |
1132 bool loadedTemplate = false; | |
1133 if ((mode == ReplaceMainModel) && (templateName.length() != 0)) { | |
1134 QString tplPath = "file::templates/" + templateName + ".xml"; | |
1135 std::cerr << "SV looking for template " << tplPath.toStdString() << std::endl; | |
1136 FileOpenStatus tplStatus = openSessionFile(tplPath); | |
1137 if(tplStatus != FileOpenFailed) { | |
1138 loadedTemplate = true; | |
1139 mode = ReplaceMainModel; | |
1140 } | |
1141 } | |
1142 | |
1132 emit activity(tr("Import audio file \"%1\"").arg(source.getLocation())); | 1143 emit activity(tr("Import audio file \"%1\"").arg(source.getLocation())); |
1133 | 1144 |
1134 if (mode == ReplaceMainModel) { | 1145 if (mode == ReplaceMainModel) { |
1135 | 1146 |
1136 Model *prevMain = getMainModel(); | 1147 Model *prevMain = getMainModel(); |
1142 | 1153 |
1143 m_document->setMainModel(newModel); | 1154 m_document->setMainModel(newModel); |
1144 | 1155 |
1145 setupMenus(); | 1156 setupMenus(); |
1146 | 1157 |
1147 if (m_sessionFile == "") { | 1158 if (loadedTemplate || (m_sessionFile == "")) { |
1148 //!!! shouldn't be dealing directly with title from here -- call a method | 1159 //!!! shouldn't be dealing directly with title from here -- call a method |
1149 setWindowTitle(tr("%1: %2") | 1160 setWindowTitle(tr("%1: %2") |
1150 .arg(QApplication::applicationName()) | 1161 .arg(QApplication::applicationName()) |
1151 .arg(source.getLocation())); | 1162 .arg(source.getLocation())); |
1152 CommandHistory::getInstance()->clear(); | 1163 CommandHistory::getInstance()->clear(); |