comparison framework/Document.cpp @ 423:f32a64149602 alignment_view

Make alignment using an external program asynchronous
author Chris Cannam
date Thu, 20 Nov 2014 15:46:19 +0000
parents 33fae747db7e
children b23db4cef02f
comparison
equal deleted inserted replaced
422:33fae747db7e 423:f32a64149602
36 #include <QTextStream> 36 #include <QTextStream>
37 #include <QSettings> 37 #include <QSettings>
38 #include <iostream> 38 #include <iostream>
39 #include <typeinfo> 39 #include <typeinfo>
40 40
41 // For alignment:
42 #include "data/model/AggregateWaveModel.h"
43 #include "data/model/SparseTimeValueModel.h"
44 #include "data/model/AlignmentModel.h" 41 #include "data/model/AlignmentModel.h"
42 #include "Align.h"
45 43
46 using std::vector; 44 using std::vector;
47 45
48 //#define DEBUG_DOCUMENT 1 46 //#define DEBUG_DOCUMENT 1
49 47
50 //!!! still need to handle command history, documentRestored/documentModified 48 //!!! still need to handle command history, documentRestored/documentModified
51 49
52 Document::Document() : 50 Document::Document() :
53 m_mainModel(0), 51 m_mainModel(0),
54 m_autoAlignment(false) 52 m_autoAlignment(false),
53 m_align(new Align())
55 { 54 {
56 connect(this, SIGNAL(modelAboutToBeDeleted(Model *)), 55 connect(this, SIGNAL(modelAboutToBeDeleted(Model *)),
57 ModelTransformerFactory::getInstance(), 56 ModelTransformerFactory::getInstance(),
58 SLOT(modelAboutToBeDeleted(Model *))); 57 SLOT(modelAboutToBeDeleted(Model *)));
59 } 58 }
1084 SVDEBUG << "Document::alignModel(" << model << "): is main model, setting appropriately" << endl; 1083 SVDEBUG << "Document::alignModel(" << model << "): is main model, setting appropriately" << endl;
1085 rm->setAlignment(new AlignmentModel(model, model, 0, 0)); 1084 rm->setAlignment(new AlignmentModel(model, model, 0, 0));
1086 return; 1085 return;
1087 } 1086 }
1088 1087
1089 Align a; 1088 if (!m_align->alignModel(m_mainModel, rm)) {
1090 if (!a.alignModel(m_mainModel, rm)) { 1089 cerr << "Alignment failed: " << m_align->getError() << endl;
1091 cerr << "Alignment failed: " << a.getError() << endl; 1090 emit alignmentFailed(m_align->getError());
1092 emit alignmentFailed(a.getError());
1093 } 1091 }
1094 } 1092 }
1095 1093
1096 void 1094 void
1097 Document::alignModels() 1095 Document::alignModels()