comparison framework/MainWindowBase.cpp @ 686:610fa108fbcc by-id

Update for changes to PlayParameters
author Chris Cannam
date Thu, 04 Jul 2019 18:04:59 +0100
parents 7540733f5480
children e0b0f3e163ca
comparison
equal deleted inserted replaced
685:7540733f5480 686:610fa108fbcc
61 #include "rdf/RDFImporter.h" 61 #include "rdf/RDFImporter.h"
62 #include "rdf/RDFExporter.h" 62 #include "rdf/RDFExporter.h"
63 63
64 #include "base/RecentFiles.h" 64 #include "base/RecentFiles.h"
65 65
66 #include "base/PlayParameterRepository.h"
67 #include "base/XmlExportable.h" 66 #include "base/XmlExportable.h"
68 #include "base/Profiler.h" 67 #include "base/Profiler.h"
69 #include "base/Preferences.h" 68 #include "base/Preferences.h"
70 #include "base/TempWriteFile.h" 69 #include "base/TempWriteFile.h"
71 #include "base/Exceptions.h" 70 #include "base/Exceptions.h"
1692 if (mode == ReplaceMainModel) { 1691 if (mode == ReplaceMainModel) {
1693 1692
1694 ModelId prevMain = getMainModelId(); 1693 ModelId prevMain = getMainModelId();
1695 if (!prevMain.isNone()) { 1694 if (!prevMain.isNone()) {
1696 m_playSource->removeModel(prevMain); 1695 m_playSource->removeModel(prevMain);
1697 //!!! shouldn't this stuff be handled by Document? 1696 }
1698 PlayParameterRepository::getInstance()->removePlayable
1699 (prevMain.untyped);
1700 }
1701 PlayParameterRepository::getInstance()->addPlayable(newModel.untyped);
1702 1697
1703 SVDEBUG << "SV about to call setMainModel(" << newModel << "): prevMain is " << prevMain << endl; 1698 SVDEBUG << "SV about to call setMainModel(" << newModel << "): prevMain is " << prevMain << endl;
1704 1699
1705 m_document->setMainModel(newModel); 1700 m_document->setMainModel(newModel);
1706 1701
3282 3277
3283 QString location = modelPtr->getLocation(); 3278 QString location = modelPtr->getLocation();
3284 3279
3285 auto modelId = modelPtr->getId(); 3280 auto modelId = modelPtr->getId();
3286 ModelById::add(std::shared_ptr<Model>(modelPtr)); 3281 ModelById::add(std::shared_ptr<Model>(modelPtr));
3287 PlayParameterRepository::getInstance()->addPlayable(modelId.untyped);
3288 3282
3289 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) { 3283 if (m_audioRecordMode == RecordReplaceSession || !getMainModel()) {
3290 3284
3291 //!!! duplication with openAudio here 3285 //!!! duplication with openAudio here
3292 3286
3297 FileOpenStatus tplStatus = openSessionTemplate(templateName); 3291 FileOpenStatus tplStatus = openSessionTemplate(templateName);
3298 if (tplStatus == FileOpenCancelled) { 3292 if (tplStatus == FileOpenCancelled) {
3299 SVCERR << "MainWindowBase::record: Session template open cancelled, stopping and suspending" << endl; 3293 SVCERR << "MainWindowBase::record: Session template open cancelled, stopping and suspending" << endl;
3300 m_recordTarget->stopRecording(); 3294 m_recordTarget->stopRecording();
3301 m_audioIO->suspend(); 3295 m_audioIO->suspend();
3302 PlayParameterRepository::getInstance()->removePlayable
3303 (modelId.untyped);
3304 ModelById::release(modelId); 3296 ModelById::release(modelId);
3305 return; 3297 return;
3306 } 3298 }
3307 if (tplStatus != FileOpenFailed) { 3299 if (tplStatus != FileOpenFailed) {
3308 loadedTemplate = true; 3300 loadedTemplate = true;
3315 } 3307 }
3316 3308
3317 ModelId prevMain = getMainModelId(); 3309 ModelId prevMain = getMainModelId();
3318 if (!prevMain.isNone()) { 3310 if (!prevMain.isNone()) {
3319 m_playSource->removeModel(prevMain); 3311 m_playSource->removeModel(prevMain);
3320 PlayParameterRepository::getInstance()->removePlayable
3321 (prevMain.untyped);
3322 } 3312 }
3323 3313
3324 m_document->setMainModel(modelId); 3314 m_document->setMainModel(modelId);
3325 setupMenus(); 3315 setupMenus();
3326 findTimeRulerLayer(); 3316 findTimeRulerLayer();