Mercurial > hg > sonic-visualiser
diff transform/TransformFactory.cpp @ 33:544ab25d2372
* Add support for plugin classification using category files.
Add separate menus listing plugins by category, maker, and plugin name.
author | Chris Cannam |
---|---|
date | Thu, 21 Sep 2006 16:43:50 +0000 |
parents | b5f55ea61bb8 |
children | 8ad306d8a568 |
line wrap: on
line diff
--- a/transform/TransformFactory.cpp Thu Sep 21 11:17:19 2006 +0000 +++ b/transform/TransformFactory.cpp Thu Sep 21 16:43:50 2006 +0000 @@ -79,6 +79,60 @@ return rv; } +std::vector<QString> +TransformFactory::getTransformCategories(QString transformType) +{ + if (m_transforms.empty()) populateTransforms(); + + std::set<QString> categories; + for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); + i != m_transforms.end(); ++i) { + if (i->second.type == transformType) { + categories.insert(i->second.category); + } + } + + bool haveEmpty = false; + + std::vector<QString> rv; + for (std::set<QString>::iterator i = categories.begin(); + i != categories.end(); ++i) { + if (*i != "") rv.push_back(*i); + else haveEmpty = true; + } + + if (haveEmpty) rv.push_back(""); // make sure empty category sorts last + + return rv; +} + +std::vector<QString> +TransformFactory::getTransformMakers(QString transformType) +{ + if (m_transforms.empty()) populateTransforms(); + + std::set<QString> makers; + for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); + i != m_transforms.end(); ++i) { + if (i->second.type == transformType) { + makers.insert(i->second.maker); + } + } + + bool haveEmpty = false; + + std::vector<QString> rv; + for (std::set<QString>::iterator i = makers.begin(); + i != makers.end(); ++i) { + if (*i != "") rv.push_back(*i); + else haveEmpty = true; + } + + if (haveEmpty) rv.push_back(""); // make sure empty category sorts last + + return rv; +} + void TransformFactory::populateTransforms() { @@ -151,6 +205,8 @@ } QString pluginDescription = plugin->getDescription().c_str(); + QString category = factory->getPluginCategory(pluginId); + Vamp::Plugin::OutputList outputs = plugin->getOutputDescriptors(); @@ -178,6 +234,7 @@ transforms[transformName] = TransformDesc(tr("Analysis Plugins"), + category, transformName, userDescription, friendlyName, @@ -222,6 +279,7 @@ // std::cout << "TransformFactory::populateRealTimePlugins: plugin " << pluginId.toStdString() << " has " << descriptor->controlOutputPortCount << " output ports" << std::endl; QString pluginDescription = descriptor->name.c_str(); + QString category = factory->getPluginCategory(pluginId); for (size_t j = 0; j < descriptor->controlOutputPortCount; ++j) { @@ -258,6 +316,7 @@ transforms[transformName] = TransformDesc(tr("Other Plugins"), + category, transformName, userDescription, userDescription,