# HG changeset patch # User Chris Cannam # Date 1166200457 0 # Node ID f4f52566e451834da31d45a1b2b47195af9e3dc7 # Parent c1318aac18d219680638978c43f9824264f17ed3 * Fixes to presentation and organisation of plugins (especially duplicates) diff -r c1318aac18d2 -r f4f52566e451 main/MainWindow.cpp --- a/main/MainWindow.cpp Fri Dec 08 18:17:29 2006 +0000 +++ b/main/MainWindow.cpp Fri Dec 15 16:34:17 2006 +0000 @@ -1065,6 +1065,8 @@ QString description = transforms[i].description; if (description == "") description = transforms[i].name; +// std::cerr << "Plugin Description: " << description.toStdString() << std::endl; + QString type = transforms[i].type; QString category = transforms[i].category; @@ -1098,7 +1100,7 @@ << description.toStdString() << "\" (maker = \"" << maker.toStdString() << "\")" << std::endl; } else { - makerMenus[type][maker]->addAction(pluginName, action); + makerMenus[type][maker]->addAction(action); } action = new QAction(tr("%1...").arg(output == "" ? pluginName : output), this); diff -r c1318aac18d2 -r f4f52566e451 transform/TransformFactory.cpp --- a/transform/TransformFactory.cpp Fri Dec 08 18:17:29 2006 +0000 +++ b/transform/TransformFactory.cpp Fri Dec 15 16:34:17 2006 +0000 @@ -149,17 +149,30 @@ populateFeatureExtractionPlugins(transforms); populateRealTimePlugins(transforms); - // disambiguate plugins with similar descriptions + // disambiguate plugins with similar names std::map descriptions; + std::map pluginSources; + std::map pluginMakers; for (TransformDescriptionMap::iterator i = transforms.begin(); i != transforms.end(); ++i) { TransformDesc desc = i->second; - ++descriptions[desc.description]; - ++descriptions[QString("%1 [%2]").arg(desc.description).arg(desc.maker)]; + QString td = desc.description; + QString tn = td.section(": ", 0, 0); + QString pn = desc.name.section(":", 1, 1); + + if (pluginSources.find(tn) != pluginSources.end()) { + if (pluginSources[tn] != pn && pluginMakers[tn] != desc.maker) { + ++descriptions[tn]; + } + } else { + ++descriptions[tn]; + pluginSources[tn] = pn; + pluginMakers[tn] = desc.maker; + } } std::map counts; @@ -170,18 +183,23 @@ TransformDesc desc = i->second; QString name = desc.name; - QString description = desc.description; QString maker = desc.maker; - if (descriptions[description] > 1) { - description = QString("%1 [%2]").arg(description).arg(maker); - if (descriptions[description] > 1) { - description = QString("%1 <%2>") - .arg(description).arg(++counts[description]); - } + QString td = desc.description; + QString tn = td.section(": ", 0, 0); + QString to = td.section(": ", 1); + + if (descriptions[tn] > 1) { + maker.replace(QRegExp(tr(" [\\(<].*$")), ""); + tn = QString("%1 [%2]").arg(tn).arg(maker); } - desc.description = description; + if (to != "") { + desc.description = QString("%1: %2").arg(tn).arg(to); + } else { + desc.description = tn; + } + m_transforms[name] = desc; } } diff -r c1318aac18d2 -r f4f52566e451 transform/TransformFactory.h --- a/transform/TransformFactory.h Fri Dec 08 18:17:29 2006 +0000 +++ b/transform/TransformFactory.h Fri Dec 15 16:34:17 2006 +0000 @@ -54,11 +54,11 @@ friendlyName(_friendlyName), maker(_maker), units(_units), configurable(_configurable) { } - QString type; - QString category; - TransformName name; - QString description; - QString friendlyName; + QString type; // e.g. feature extraction plugin + QString category; // e.g. time > onsets + TransformName name; // e.g. vamp:vamp-aubio:aubioonset + QString description; // plugin's desc if 1 output, else "desc: output" + QString friendlyName; // short text for layer name QString maker; QString units; bool configurable;