# HG changeset patch # User Chris Cannam # Date 1453206750 0 # Node ID afed8be790321ebc805b2620bcddb91405886c8d # Parent 9cdb4206aceb57fa6eb9b69ba93977deb686f89e Show warning to the user when plugin population has problems diff -r 9cdb4206aceb -r afed8be79032 plugin/FeatureExtractionPluginFactory.cpp --- a/plugin/FeatureExtractionPluginFactory.cpp Mon Jan 11 14:18:56 2016 +0000 +++ b/plugin/FeatureExtractionPluginFactory.cpp Tue Jan 19 12:32:30 2016 +0000 @@ -136,7 +136,8 @@ } vector -FeatureExtractionPluginFactory::winnowPluginCandidates(vector candidates) +FeatureExtractionPluginFactory::winnowPluginCandidates(vector candidates, + QString &warningMessage) { vector good, bad; vector badStatuses; @@ -159,24 +160,26 @@ } if (!bad.empty()) { - QString warningMessage = "Failed to load plugins

Failed to load one or more plugin libraries:

    \n"; + warningMessage = + QObject::tr("Failed to load plugins" + "

    Failed to load one or more plugin libraries:

    \n"); + warningMessage += "
      "; for (int i = 0; i < bad.size(); ++i) { QString m; if (badStatuses[i] == PluginLoadFailedToLoadLibrary) { - m = "Failed to load library"; + m = QObject::tr("Failed to load library"); } else if (badStatuses[i] == PluginLoadFailedToFindDescriptor) { - m = "Failed to query plugins from library after loading"; + m = QObject::tr("Failed to query plugins from library after loading"); } else if (badStatuses[i] == PluginLoadFailedElsewhere) { - m = "Unknown failure"; + m = QObject::tr("Unknown failure"); } else { - m = "Success: internal error?"; + m = QObject::tr("Success: internal error?"); } warningMessage += QString("
    • %1 (%2)
    • \n") .arg(bad[i]) .arg(m); } warningMessage += "
    "; - cerr << warningMessage; //!!! for now! } return good; } @@ -187,7 +190,8 @@ Profiler profiler("FeatureExtractionPluginFactory::getPluginIdentifiers"); vector rv; - vector candidates = winnowPluginCandidates(getPluginCandidateFiles()); + vector candidates = winnowPluginCandidates(getPluginCandidateFiles(), + m_pluginScanError); for (QString soname : candidates) { @@ -236,7 +240,7 @@ << descriptor->identifier << "\" at indices " << known[descriptor->identifier] << " and " << index << endl; - SVDEBUG << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << endl; + cerr << "FeatureExtractionPluginFactory::getPluginIdentifiers: Avoiding this library (obsolete API?)" << endl; ok = false; break; } else { diff -r 9cdb4206aceb -r afed8be79032 plugin/FeatureExtractionPluginFactory.h --- a/plugin/FeatureExtractionPluginFactory.h Mon Jan 11 14:18:56 2016 +0000 +++ b/plugin/FeatureExtractionPluginFactory.h Tue Jan 19 12:32:30 2016 +0000 @@ -38,6 +38,14 @@ virtual std::vector getPluginIdentifiers(); + /** + * Return any error message arising from the initial plugin + * scan. The return value will either be an empty string (nothing + * to report) or an HTML string suitable for dropping into a + * dialog and showing the user. + */ + virtual QString getPluginPopulationWarning() { return m_pluginScanError; } + virtual QString findPluginFile(QString soname, QString inDir = ""); // We don't set blockSize or channels on this -- they're @@ -59,9 +67,12 @@ std::map m_handleMap; std::vector getPluginCandidateFiles(); - std::vector winnowPluginCandidates(std::vector candidates); + std::vector winnowPluginCandidates(std::vector candidates, + QString &warningMessage); void generateTaxonomy(); + + QString m_pluginScanError; }; #endif diff -r 9cdb4206aceb -r afed8be79032 system/System.cpp --- a/system/System.cpp Mon Jan 11 14:18:56 2016 +0000 +++ b/system/System.cpp Tue Jan 19 12:32:30 2016 +0000 @@ -358,6 +358,8 @@ exit(2); } +// cerr << "isPluginLibraryLoadable: Successfully loaded library \"" << soname << "\" and retrieved descriptor function" << endl; + exit(0); } else { // the parent process diff -r 9cdb4206aceb -r afed8be79032 transform/TransformFactory.cpp --- a/transform/TransformFactory.cpp Mon Jan 11 14:18:56 2016 +0000 +++ b/transform/TransformFactory.cpp Tue Jan 19 12:32:30 2016 +0000 @@ -399,6 +399,18 @@ m_transformsPopulated = true; } +QString +TransformFactory::getPluginPopulationWarning() +{ + FeatureExtractionPluginFactory *vfactory = + FeatureExtractionPluginFactory::instance("vamp"); + QString warningMessage; + if (vfactory) { + warningMessage = vfactory->getPluginPopulationWarning(); + } + return warningMessage; +} + void TransformFactory::populateFeatureExtractionPlugins(TransformDescriptionMap &transforms) { diff -r 9cdb4206aceb -r afed8be79032 transform/TransformFactory.h --- a/transform/TransformFactory.h Mon Jan 11 14:18:56 2016 +0000 +++ b/transform/TransformFactory.h Tue Jan 19 12:32:30 2016 +0000 @@ -196,6 +196,14 @@ void setParametersFromPluginConfigurationXml(Transform &transform, QString xml); + /** + * Return any error message arising from the initial plugin + * scan. The return value will either be an empty string (nothing + * to report) or an HTML string suitable for dropping into a + * dialog and showing the user. + */ + QString getPluginPopulationWarning(); + protected: typedef std::map TransformDescriptionMap;