comparison view/View.cpp @ 1476:c268fe2ad597 by-id

Couple more updates
author Chris Cannam
date Tue, 02 Jul 2019 15:38:37 +0100
parents 84c4ddb38415
children 9bf8aa2916e9
comparison
equal deleted inserted replaced
1475:84c4ddb38415 1476:c268fe2ad597
1748 for (ProgressMap::iterator i = m_progressBars.begin(); 1748 for (ProgressMap::iterator i = m_progressBars.begin();
1749 i != m_progressBars.end(); ++i) { 1749 i != m_progressBars.end(); ++i) {
1750 1750
1751 if (i->second.cancel == cancel) { 1751 if (i->second.cancel == cancel) {
1752 1752
1753 /*!!!
1753 Layer *layer = i->first; 1754 Layer *layer = i->first;
1754 /*!!! Model *model = layer->getModel(); 1755 Model *model = layer->getModel();
1755 1756
1756 //!!! todo: restore this behaviour 1757 //!!! todo: restore this behaviour
1757 if (model) model->abandon(); 1758 if (model) model->abandon();
1758 */ 1759 */
1759 } 1760 }
1817 if (error != "" && error != m_lastError) { 1818 if (error != "" && error != m_lastError) {
1818 QMessageBox::critical(this, tr("Layer rendering error"), error); 1819 QMessageBox::critical(this, tr("Layer rendering error"), error);
1819 m_lastError = error; 1820 m_lastError = error;
1820 } 1821 }
1821 1822
1822 Model *model = i->first->getModel(); 1823 ModelId modelId = i->first->getModel();
1823 RangeSummarisableTimeValueModel *wfm = 1824
1824 dynamic_cast<RangeSummarisableTimeValueModel *>(model); 1825 auto model = ModelById::get(modelId);
1826 auto wfm = std::dynamic_pointer_cast
1827 <RangeSummarisableTimeValueModel>(model);
1825 1828
1826 if (completion > 0) { 1829 if (completion > 0) {
1827 pb->setMaximum(100); // was 0, for indeterminate start 1830 pb->setMaximum(100); // was 0, for indeterminate start
1828 } 1831 }
1829 1832
1830 if (completion >= 100) { 1833 if (completion >= 100) {
1831 1834
1832 //!!!
1833 if (wfm || 1835 if (wfm ||
1834 (model && 1836 (model &&
1835 (wfm = dynamic_cast<RangeSummarisableTimeValueModel *> 1837 (wfm = ModelById::getAs<RangeSummarisableTimeValueModel>
1836 (model->getSourceModel())))) { 1838 (model->getSourceModel())))) {
1837 completion = wfm->getAlignmentCompletion(); 1839 completion = wfm->getAlignmentCompletion();
1838 1840
1839 #ifdef DEBUG_PROGRESS_STUFF 1841 #ifdef DEBUG_PROGRESS_STUFF
1840 SVCERR << "View[" << this << "]::checkProgress(" << object << "): " 1842 SVCERR << "View[" << this << "]::checkProgress(" << object << "): "
2364 .arg(QString::fromStdString 2366 .arg(QString::fromStdString
2365 (RealTime::frame2RealTime 2367 (RealTime::frame2RealTime
2366 (i->getEndFrame() - i->getStartFrame(), sampleRate) 2368 (i->getEndFrame() - i->getStartFrame(), sampleRate)
2367 .toText(true))) 2369 .toText(true)))
2368 .arg(i->getEndFrame() - i->getStartFrame()); 2370 .arg(i->getEndFrame() - i->getStartFrame());
2371
2372 // Qt 5.13 deprecates QFontMetrics::width(), but its suggested
2373 // replacement (horizontalAdvance) was only added in Qt 5.11
2374 // which is too new for us
2375 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
2369 2376
2370 int sw = metrics.width(startText), 2377 int sw = metrics.width(startText),
2371 ew = metrics.width(endText), 2378 ew = metrics.width(endText),
2372 dw = metrics.width(durationText); 2379 dw = metrics.width(durationText);
2373 2380