Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 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 | bf0a885effb0 |
children |
comparison
equal
deleted
inserted
replaced
2592:617fe9b8c923 | 2593:bc882961a233 |
---|---|
1736 | 1736 |
1737 SVDEBUG << "MainWindow::TransformPopulater::run: scanning" << endl; | 1737 SVDEBUG << "MainWindow::TransformPopulater::run: scanning" << endl; |
1738 | 1738 |
1739 PluginScan::getInstance()->scan(); | 1739 PluginScan::getInstance()->scan(); |
1740 | 1740 |
1741 QString warning = PluginScan::getInstance()->getStartupFailureReport(); | |
1742 if (warning != "") { | |
1743 QTimer::singleShot(500, m_mw, SLOT(pluginPopulationWarning())); | |
1744 } | |
1745 | |
1746 SVDEBUG << "MainWindow::TransformPopulater::run: populating" << endl; | 1741 SVDEBUG << "MainWindow::TransformPopulater::run: populating" << endl; |
1747 | 1742 |
1748 (void)tf->haveTransform({}); // populate! | 1743 (void)tf->haveTransform({}); // populate! |
1749 | 1744 |
1750 SVDEBUG << "MainWindow::TransformPopulater::run: done" << endl; | 1745 SVDEBUG << "MainWindow::TransformPopulater::run: done" << endl; |
1770 } | 1765 } |
1771 | 1766 |
1772 TransformFactory *factory = TransformFactory::getInstance(); | 1767 TransformFactory *factory = TransformFactory::getInstance(); |
1773 | 1768 |
1774 TransformList transforms = factory->getAllTransformDescriptions(); | 1769 TransformList transforms = factory->getAllTransformDescriptions(); |
1775 | 1770 |
1776 if (factory->getStartupFailureReport() != "") { | 1771 // We have two possible sources of error here: plugin scan |
1777 pluginPopulationWarning(); | 1772 // warnings, and transform factory startup errors. |
1773 // | |
1774 // In the Piper world, a plugin scan warning is typically | |
1775 // non-fatal (it means a plugin is being ignored) but a transform | |
1776 // factory startup error is fatal (it means no plugins can be used | |
1777 // at all, or at least no feature extraction plugins, and probably | |
1778 // indicates an installation problem with SV itself rather than | |
1779 // with a plugin). | |
1780 // | |
1781 // If we have both types of error text, we should either show both | |
1782 // (which we don't do as we haven't designed a way to do that | |
1783 // tidily) or else only show the transform factory one. | |
1784 // | |
1785 QString warning = factory->getStartupFailureReport(); | |
1786 if (warning != "") { | |
1787 SVDEBUG << "MainWindow::populateTransformsMenu: Transform population yielded errors" << endl; | |
1788 pluginPopulationWarning(warning); | |
1789 } else { | |
1790 warning = PluginScan::getInstance()->getStartupFailureReport(); | |
1791 if (warning != "") { | |
1792 SVDEBUG << "MainWindow::populateTransformsMenu: Plugin scan yielded errors" << endl; | |
1793 pluginPopulationWarning(warning); | |
1794 } | |
1778 } | 1795 } |
1779 | 1796 |
1780 vector<TransformDescription::Type> types = factory->getAllTransformTypes(); | 1797 vector<TransformDescription::Type> types = factory->getAllTransformTypes(); |
1781 | 1798 |
1782 map<TransformDescription::Type, map<QString, SubdividingMenu *> > categoryMenus; | 1799 map<TransformDescription::Type, map<QString, SubdividingMenu *> > categoryMenus; |
4053 cdb->getColour(defaultColourName).name()).toString()); | 4070 cdb->getColour(defaultColourName).name()).toString()); |
4054 settings.endGroup(); | 4071 settings.endGroup(); |
4055 | 4072 |
4056 int index = cdb->getColourIndex(colour); | 4073 int index = cdb->getColourIndex(colour); |
4057 | 4074 |
4058 SVCERR << "MainWindow::coloursChanged: haveDarkBackground = " << haveDarkBackground << ", highlight = " << highlight.name() << ", nearestIndex = " << nearestIndex << ", defaultColourName = " << defaultColourName << ", colour = " << colour.name() << ", index = " << index << endl; | 4075 SVDEBUG << "MainWindow::coloursChanged: haveDarkBackground = " << haveDarkBackground << ", highlight = " << highlight.name() << ", nearestIndex = " << nearestIndex << ", defaultColourName = " << defaultColourName << ", colour = " << colour.name() << ", index = " << index << endl; |
4059 | 4076 |
4060 if (index >= 0) { | 4077 if (index >= 0) { |
4061 m_panLayer->setBaseColour(index); | 4078 m_panLayer->setBaseColour(index); |
4062 } | 4079 } |
4063 } | 4080 } |
4806 (this, tr("Beta release"), | 4823 (this, tr("Beta release"), |
4807 tr("<b>This is a beta release of %1</b><p>Please see the \"What's New\" option in the Help menu for a list of changes since the last proper release.</p>").arg(QApplication::applicationName())); | 4824 tr("<b>This is a beta release of %1</b><p>Please see the \"What's New\" option in the Help menu for a list of changes since the last proper release.</p>").arg(QApplication::applicationName())); |
4808 } | 4825 } |
4809 | 4826 |
4810 void | 4827 void |
4811 MainWindow::pluginPopulationWarning() | 4828 MainWindow::pluginPopulationWarning(QString warning) |
4812 { | 4829 { |
4813 QString scanWarning = PluginScan::getInstance()->getStartupFailureReport(); | 4830 emit hideSplash(); |
4814 QString factWarning = TransformFactory::getInstance()->getStartupFailureReport(); | 4831 QMessageBox box; |
4815 QString warning; | 4832 box.setWindowTitle(tr("Problems loading plugins")); |
4816 if (factWarning != "") { | 4833 box.setText(tr("<b>Failed to load plugins</b>")); |
4817 // The order of events on startup implies that, if scanWarning | 4834 box.setInformativeText(warning); |
4818 // and factWarning are both present, then we have already been | 4835 box.setIcon(QMessageBox::Warning); |
4819 // called once for scanWarning so don't want to report it again | 4836 box.setStandardButtons(QMessageBox::Ok); |
4820 warning = factWarning; | 4837 box.exec(); |
4821 } else if (scanWarning != "") { | |
4822 warning = scanWarning; | |
4823 } | |
4824 if (warning != "") { | |
4825 emit hideSplash(); | |
4826 QMessageBox box; | |
4827 box.setWindowTitle(tr("Problems loading plugins")); | |
4828 box.setText(tr("<b>Failed to load plugins</b>")); | |
4829 box.setInformativeText(warning); | |
4830 box.setIcon(QMessageBox::Warning); | |
4831 box.setStandardButtons(QMessageBox::Ok); | |
4832 box.exec(); | |
4833 } | |
4834 } | 4838 } |
4835 | 4839 |
4836 void | 4840 void |
4837 MainWindow::midiEventsAvailable() | 4841 MainWindow::midiEventsAvailable() |
4838 { | 4842 { |