comparison framework/MainWindowBase.cpp @ 386:105b4e237434

Debug out
author Chris Cannam
date Thu, 24 Jul 2014 17:43:49 +0100
parents ad33fdc4ad92
children 479f60cf85d8
comparison
equal deleted inserted replaced
385:d1abf593dfaf 386:105b4e237434
1218 1218
1219 MainWindowBase::FileOpenStatus 1219 MainWindowBase::FileOpenStatus
1220 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, 1220 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode,
1221 QString templateName) 1221 QString templateName)
1222 { 1222 {
1223 SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ")" << endl; 1223 SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ") with mode " << mode << " and template " << templateName << endl;
1224 1224
1225 if (templateName == "") { 1225 if (templateName == "") {
1226 templateName = getDefaultSessionTemplate(); 1226 templateName = getDefaultSessionTemplate();
1227 } 1227 }
1228 1228
1315 mode = CreateAdditionalModel; 1315 mode = CreateAdditionalModel;
1316 } 1316 }
1317 } 1317 }
1318 1318
1319 if (mode == CreateAdditionalModel && !getMainModel()) { 1319 if (mode == CreateAdditionalModel && !getMainModel()) {
1320 SVDEBUG << "Mode is CreateAdditionalModel but we have no main model, switching to ReplaceSession mode" << endl;
1320 mode = ReplaceSession; 1321 mode = ReplaceSession;
1321 } 1322 }
1322 1323
1323 bool loadedTemplate = false; 1324 bool loadedTemplate = false;
1324 1325
1325 if (mode == ReplaceSession) { 1326 if (mode == ReplaceSession) {
1326 1327
1327 if (!checkSaveModified()) return FileOpenCancelled; 1328 if (!checkSaveModified()) return FileOpenCancelled;
1328 1329
1329 cerr << "SV looking for template " << templateName << endl; 1330 SVDEBUG << "SV looking for template " << templateName << endl;
1330 if (templateName != "") { 1331 if (templateName != "") {
1331 FileOpenStatus tplStatus = openSessionTemplate(templateName); 1332 FileOpenStatus tplStatus = openSessionTemplate(templateName);
1332 if (tplStatus == FileOpenCancelled) { 1333 if (tplStatus == FileOpenCancelled) {
1333 cerr << "Template load cancelled" << endl; 1334 cerr << "Template load cancelled" << endl;
1334 return FileOpenCancelled; 1335 return FileOpenCancelled;
1338 loadedTemplate = true; 1339 loadedTemplate = true;
1339 } 1340 }
1340 } 1341 }
1341 1342
1342 if (!loadedTemplate) { 1343 if (!loadedTemplate) {
1344 SVDEBUG << "No template found: closing session, creating new empty document" << endl;
1343 closeSession(); 1345 closeSession();
1344 createDocument(); 1346 createDocument();
1345 } 1347 }
1346 1348
1349 SVDEBUG << "Now switching to ReplaceMainModel mode" << endl;
1347 mode = ReplaceMainModel; 1350 mode = ReplaceMainModel;
1348 } 1351 }
1349 1352
1350 emit activity(tr("Import audio file \"%1\"").arg(source.getLocation())); 1353 emit activity(tr("Import audio file \"%1\"").arg(source.getLocation()));
1351 1354