Mercurial > hg > sonic-visualiser
changeset 2593:bc882961a233
Update and tweak the plugin population warning dialog, which was not properly being shown in async-transform-population-world
author | Chris Cannam |
---|---|
date | Fri, 14 Aug 2020 10:39:02 +0100 |
parents | 617fe9b8c923 |
children | 2de306979a2a |
files | main/MainWindow.cpp main/MainWindow.h |
diffstat | 2 files changed, 36 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu Aug 13 15:28:22 2020 +0100 +++ b/main/MainWindow.cpp Fri Aug 14 10:39:02 2020 +0100 @@ -1738,11 +1738,6 @@ PluginScan::getInstance()->scan(); - QString warning = PluginScan::getInstance()->getStartupFailureReport(); - if (warning != "") { - QTimer::singleShot(500, m_mw, SLOT(pluginPopulationWarning())); - } - SVDEBUG << "MainWindow::TransformPopulater::run: populating" << endl; (void)tf->haveTransform({}); // populate! @@ -1772,9 +1767,31 @@ TransformFactory *factory = TransformFactory::getInstance(); TransformList transforms = factory->getAllTransformDescriptions(); - - if (factory->getStartupFailureReport() != "") { - pluginPopulationWarning(); + + // We have two possible sources of error here: plugin scan + // warnings, and transform factory startup errors. + // + // In the Piper world, a plugin scan warning is typically + // non-fatal (it means a plugin is being ignored) but a transform + // factory startup error is fatal (it means no plugins can be used + // at all, or at least no feature extraction plugins, and probably + // indicates an installation problem with SV itself rather than + // with a plugin). + // + // If we have both types of error text, we should either show both + // (which we don't do as we haven't designed a way to do that + // tidily) or else only show the transform factory one. + // + QString warning = factory->getStartupFailureReport(); + if (warning != "") { + SVDEBUG << "MainWindow::populateTransformsMenu: Transform population yielded errors" << endl; + pluginPopulationWarning(warning); + } else { + warning = PluginScan::getInstance()->getStartupFailureReport(); + if (warning != "") { + SVDEBUG << "MainWindow::populateTransformsMenu: Plugin scan yielded errors" << endl; + pluginPopulationWarning(warning); + } } vector<TransformDescription::Type> types = factory->getAllTransformTypes(); @@ -4055,7 +4072,7 @@ int index = cdb->getColourIndex(colour); - SVCERR << "MainWindow::coloursChanged: haveDarkBackground = " << haveDarkBackground << ", highlight = " << highlight.name() << ", nearestIndex = " << nearestIndex << ", defaultColourName = " << defaultColourName << ", colour = " << colour.name() << ", index = " << index << endl; + SVDEBUG << "MainWindow::coloursChanged: haveDarkBackground = " << haveDarkBackground << ", highlight = " << highlight.name() << ", nearestIndex = " << nearestIndex << ", defaultColourName = " << defaultColourName << ", colour = " << colour.name() << ", index = " << index << endl; if (index >= 0) { m_panLayer->setBaseColour(index); @@ -4808,29 +4825,16 @@ } void -MainWindow::pluginPopulationWarning() +MainWindow::pluginPopulationWarning(QString warning) { - QString scanWarning = PluginScan::getInstance()->getStartupFailureReport(); - QString factWarning = TransformFactory::getInstance()->getStartupFailureReport(); - QString warning; - if (factWarning != "") { - // The order of events on startup implies that, if scanWarning - // and factWarning are both present, then we have already been - // called once for scanWarning so don't want to report it again - warning = factWarning; - } else if (scanWarning != "") { - warning = scanWarning; - } - if (warning != "") { - emit hideSplash(); - QMessageBox box; - box.setWindowTitle(tr("Problems loading plugins")); - box.setText(tr("<b>Failed to load plugins</b>")); - box.setInformativeText(warning); - box.setIcon(QMessageBox::Warning); - box.setStandardButtons(QMessageBox::Ok); - box.exec(); - } + emit hideSplash(); + QMessageBox box; + box.setWindowTitle(tr("Problems loading plugins")); + box.setText(tr("<b>Failed to load plugins</b>")); + box.setInformativeText(warning); + box.setIcon(QMessageBox::Warning); + box.setStandardButtons(QMessageBox::Ok); + box.exec(); } void
--- a/main/MainWindow.h Thu Aug 13 15:28:22 2020 +0100 +++ b/main/MainWindow.h Fri Aug 14 10:39:02 2020 +0100 @@ -159,7 +159,7 @@ void populateTransformsMenu(); virtual void betaReleaseWarning(); - virtual void pluginPopulationWarning(); + virtual void pluginPopulationWarning(QString text); virtual void saveSessionAsTemplate(); virtual void manageSavedTemplates();