# HG changeset patch # User Chris Cannam # Date 1597397942 -3600 # Node ID bc882961a233309e95a77930c4b7eeed8f23421d # Parent 617fe9b8c9234a8670c5a51bcf2efc2160a49cc6 Update and tweak the plugin population warning dialog, which was not properly being shown in async-transform-population-world diff -r 617fe9b8c923 -r bc882961a233 main/MainWindow.cpp --- 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 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("Failed to load plugins")); - 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("Failed to load plugins")); + box.setInformativeText(warning); + box.setIcon(QMessageBox::Warning); + box.setStandardButtons(QMessageBox::Ok); + box.exec(); } void diff -r 617fe9b8c923 -r bc882961a233 main/MainWindow.h --- 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();