annotate plugin/PluginScan.cpp @ 1178:bf05d9259dbc pluginscan

First cut running (but not yet using output of, or recovering from errors in) the plugin checker at startup
author Chris Cannam
date Thu, 14 Apr 2016 12:12:04 +0100
parents
children 6b1af0f05f06
rev   line source
Chris@1178 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@1178 2
Chris@1178 3 /*
Chris@1178 4 Sonic Visualiser
Chris@1178 5 An audio file viewer and annotation editor.
Chris@1178 6 Centre for Digital Music, Queen Mary, University of London.
Chris@1178 7
Chris@1178 8 This program is free software; you can redistribute it and/or
Chris@1178 9 modify it under the terms of the GNU General Public License as
Chris@1178 10 published by the Free Software Foundation; either version 2 of the
Chris@1178 11 License, or (at your option) any later version. See the file
Chris@1178 12 COPYING included with this distribution for more information.
Chris@1178 13 */
Chris@1178 14
Chris@1178 15 #include "PluginScan.h"
Chris@1178 16
Chris@1178 17 #include "base/Debug.h"
Chris@1178 18
Chris@1178 19 #include <QMutex>
Chris@1178 20
Chris@1178 21 using std::string;
Chris@1178 22
Chris@1178 23 PluginScan *PluginScan::getInstance() {
Chris@1178 24 static QMutex mutex;
Chris@1178 25 static PluginScan *m_instance = 0;
Chris@1178 26 mutex.lock();
Chris@1178 27 if (!m_instance) m_instance = new PluginScan();
Chris@1178 28 mutex.unlock();
Chris@1178 29 return m_instance;
Chris@1178 30 }
Chris@1178 31
Chris@1178 32 PluginScan::PluginScan() : m_kp(0) {
Chris@1178 33 }
Chris@1178 34
Chris@1178 35 PluginScan::~PluginScan() {
Chris@1178 36 delete m_kp;
Chris@1178 37 }
Chris@1178 38
Chris@1178 39 void
Chris@1178 40 PluginScan::log(string message)
Chris@1178 41 {
Chris@1178 42 SVDEBUG << "PluginScan: " << message;
Chris@1178 43 }
Chris@1178 44
Chris@1178 45 void
Chris@1178 46 PluginScan::scan()
Chris@1178 47 {
Chris@1178 48 delete m_kp;
Chris@1178 49 m_kp = new KnownPlugins("./helper", this); //!!!
Chris@1178 50 }
Chris@1178 51
Chris@1178 52 QStringList
Chris@1178 53 PluginScan::getCandidateVampLibraries() const
Chris@1178 54 {
Chris@1178 55 QStringList candidates;
Chris@1178 56 if (!m_kp) return candidates;
Chris@1178 57 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::VampPlugin);
Chris@1178 58 for (auto s: c) candidates.push_back(s.c_str());
Chris@1178 59 return candidates;
Chris@1178 60 }
Chris@1178 61
Chris@1178 62 QStringList
Chris@1178 63 PluginScan::getCandidateLADSPALibraries() const
Chris@1178 64 {
Chris@1178 65 QStringList candidates;
Chris@1178 66 if (!m_kp) return candidates;
Chris@1178 67 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::LADSPAPlugin);
Chris@1178 68 for (auto s: c) candidates.push_back(s.c_str());
Chris@1178 69 return candidates;
Chris@1178 70 }
Chris@1178 71
Chris@1178 72 QStringList
Chris@1178 73 PluginScan::getCandidateDSSILibraries() const
Chris@1178 74 {
Chris@1178 75 QStringList candidates;
Chris@1178 76 if (!m_kp) return candidates;
Chris@1178 77 auto c = m_kp->getCandidateLibrariesFor(KnownPlugins::DSSIPlugin);
Chris@1178 78 for (auto s: c) candidates.push_back(s.c_str());
Chris@1178 79 return candidates;
Chris@1178 80 }
Chris@1178 81
Chris@1178 82 QString
Chris@1178 83 PluginScan::getStartupFailureReport() const
Chris@1178 84 {
Chris@1178 85 if (!m_kp) return ""; //!!!???
Chris@1178 86 string report = m_kp->getFailureReport();
Chris@1178 87 return report.c_str(); //!!! wrap?
Chris@1178 88 }
Chris@1178 89