comparison framework/Document.cpp @ 761:6429a164b7e1 pitch-align

Schedule alignments with a small delay to avoid too much UI unresponsiveness. Also overhaul error reporting to use signals throughout.
author Chris Cannam
date Wed, 06 May 2020 11:45:27 +0100
parents 36772d79cf44
children cf4e0f3c2406 1d6cca5a5621
comparison
equal deleted inserted replaced
757:f32df46d0c84 761:6429a164b7e1
55 this, 55 this,
56 SIGNAL(modelGenerationFailed(QString, QString))); 56 SIGNAL(modelGenerationFailed(QString, QString)));
57 57
58 connect(m_align, SIGNAL(alignmentComplete(ModelId)), 58 connect(m_align, SIGNAL(alignmentComplete(ModelId)),
59 this, SIGNAL(alignmentComplete(ModelId))); 59 this, SIGNAL(alignmentComplete(ModelId)));
60
61 connect(m_align, SIGNAL(alignmentFailed(ModelId, QString)),
62 this, SIGNAL(alignmentFailed(ModelId, QString)));
60 } 63 }
61 64
62 Document::~Document() 65 Document::~Document()
63 { 66 {
64 //!!! Document should really own the command history. atm we 67 //!!! Document should really own the command history. atm we
553 alignModel(rec.first); 556 alignModel(rec.first);
554 } 557 }
555 } 558 }
556 559
557 if (m_autoAlignment) { 560 if (m_autoAlignment) {
558 SVDEBUG << "Document::setMainModel: auto-alignment is on, aligning model if possible" << endl; 561 SVDEBUG << "Document::setMainModel: auto-alignment is on, aligning main model if applicable" << endl;
559 alignModel(m_mainModel); 562 alignModel(m_mainModel);
560 } else { 563 } else {
561 SVDEBUG << "Document::setMainModel: auto-alignment is off" << endl; 564 SVDEBUG << "Document::setMainModel: auto-alignment is off" << endl;
562 } 565 }
563 566
1143 SVDEBUG << "(Note: model " << rm << " is currently aligned to model " 1146 SVDEBUG << "(Note: model " << rm << " is currently aligned to model "
1144 << rm->getAlignmentReference() << "; this will replace that)" 1147 << rm->getAlignmentReference() << "; this will replace that)"
1145 << endl; 1148 << endl;
1146 } 1149 }
1147 1150
1148 QString err; 1151 m_align->scheduleAlignment(this, m_mainModel, modelId);
1149 if (!m_align->alignModel(this, m_mainModel, modelId, err)) {
1150 SVCERR << "Alignment failed: " << err << endl;
1151 emit alignmentFailed(err);
1152 }
1153 } 1152 }
1154 1153
1155 void 1154 void
1156 Document::performDeferredAlignment(ModelId modelId) 1155 Document::performDeferredAlignment(ModelId modelId)
1157 { 1156 {