Mercurial > hg > svcore
changeset 462:957e6a5c8495
* Add More Info URL to plugin finder
author | Chris Cannam |
---|---|
date | Thu, 23 Oct 2008 16:30:48 +0000 |
parents | 2019d89ebcf9 |
children | 93806ad9481e |
files | data/model/TabularModel.h rdf/PluginRDFDescription.cpp rdf/PluginRDFDescription.h transform/TransformDescription.h transform/TransformFactory.cpp |
diffstat | 5 files changed, 88 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/TabularModel.h Fri Oct 17 15:26:29 2008 +0000 +++ b/data/model/TabularModel.h Thu Oct 23 16:30:48 2008 +0000 @@ -34,6 +34,8 @@ class TabularModel { public: + virtual ~TabularModel() { } + virtual int getRowCount() const = 0; virtual int getColumnCount() const = 0;
--- a/rdf/PluginRDFDescription.cpp Fri Oct 17 15:26:29 2008 +0000 +++ b/rdf/PluginRDFDescription.cpp Thu Oct 23 16:30:48 2008 +0000 @@ -77,6 +77,12 @@ return m_pluginMaker; } +QString +PluginRDFDescription::getPluginInfoURL() const +{ + return m_pluginInfoURL; +} + QStringList PluginRDFDescription::getOutputIds() const { @@ -232,6 +238,52 @@ m_pluginMaker = v.value; } + // If we have a more-information URL for this plugin, then we take + // that. Otherwise, a more-inforomation URL for the plugin + // library would do nicely. Failing that, we could perhaps use + // any foaf:page URL at all that appears in the file -- but + // perhaps that would be unwise + + v = SimpleSPARQLQuery::singleResultQuery + (QString( + " PREFIX vamp: <http://purl.org/ontology/vamp/> " + " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " + " SELECT ?page from <%1> " + " WHERE { " + " ?plugin a vamp:Plugin ; " + " vamp:identifier \"%2\" ; " + " foaf:page ?page . " + " }") + .arg(url) + .arg(label), "page"); + + if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") { + + m_pluginInfoURL = v.value; + + } else { + + v = SimpleSPARQLQuery::singleResultQuery + (QString( + " PREFIX vamp: <http://purl.org/ontology/vamp/> " + " PREFIX foaf: <http://xmlns.com/foaf/0.1/> " + " SELECT ?page from <%1> " + " WHERE { " + " ?library a vamp:PluginLibrary ; " + " vamp:available_plugin ?plugin ; " + " foaf:page ?page . " + " ?plugin a vamp:Plugin ; " + " vamp:identifier \"%2\" . " + " }") + .arg(url) + .arg(label), "page"); + + if (v.type == SimpleSPARQLQuery::URIValue && v.value != "") { + + m_pluginInfoURL = v.value; + } + } + return true; }
--- a/rdf/PluginRDFDescription.h Fri Oct 17 15:26:29 2008 +0000 +++ b/rdf/PluginRDFDescription.h Thu Oct 23 16:30:48 2008 +0000 @@ -42,6 +42,7 @@ QString getPluginName() const; QString getPluginDescription() const; QString getPluginMaker() const; + QString getPluginInfoURL() const; QStringList getOutputIds() const; QString getOutputName(QString outputId) const; @@ -61,6 +62,7 @@ QString m_pluginName; QString m_pluginDescription; QString m_pluginMaker; + QString m_pluginInfoURL; OutputStringMap m_outputNames; OutputDispositionMap m_outputDispositions; OutputStringMap m_outputEventTypeURIMap;
--- a/transform/TransformDescription.h Fri Oct 17 15:26:29 2008 +0000 +++ b/transform/TransformDescription.h Thu Oct 23 16:30:48 2008 +0000 @@ -65,6 +65,7 @@ QString description; // sentence describing transform QString longDescription; // description "using" plugin name "by" maker QString maker; + QString infoUrl; QString units; bool configurable;
--- a/transform/TransformFactory.cpp Fri Oct 17 15:26:29 2008 +0000 +++ b/transform/TransformFactory.cpp Thu Oct 23 16:30:48 2008 +0000 @@ -551,6 +551,7 @@ QString description = desc.getPluginDescription(); QString maker = desc.getPluginMaker(); + QString infoUrl = desc.getPluginInfoURL(); QStringList oids = desc.getOutputIds(); @@ -581,14 +582,43 @@ td.name = tr("%1: %2").arg(name).arg(oname); } + QString longDescription = description; + //!!! basically duplicated from above + if (longDescription == "") { + if (oids.size() == 1) { + longDescription = tr("Extract features using \"%1\" plugin (from %2)") + .arg(name).arg(maker); + } else { + longDescription = tr("Extract features using \"%1\" output of \"%2\" plugin (from %3)") + .arg(oname).arg(name).arg(maker); + } + } else { + if (oids.size() == 1) { + longDescription = tr("%1 using \"%2\" plugin (from %3)") + .arg(longDescription).arg(name).arg(maker); + } else { + longDescription = tr("%1 using \"%2\" output of \"%3\" plugin (from %4)") + .arg(longDescription).arg(oname).arg(name).arg(maker); + } + } + td.friendlyName = name; //!!!??? td.description = description; - td.longDescription = ""; //!!! + td.longDescription = longDescription; td.maker = maker; + td.infoUrl = infoUrl; td.units = ""; td.configurable = false; m_uninstalledTransforms[tid] = td; + + if (td.infoUrl != "") { + if (m_transforms.find(tid) != m_transforms.end()) { + if (m_transforms[tid].infoUrl == "") { + m_transforms[tid].infoUrl = td.infoUrl; + } + } + } } }