changeset 80:f4f52566e451

* Fixes to presentation and organisation of plugins (especially duplicates)
author Chris Cannam
date Fri, 15 Dec 2006 16:34:17 +0000
parents c1318aac18d2
children 911c0bd745cd
files main/MainWindow.cpp transform/TransformFactory.cpp transform/TransformFactory.h
diffstat 3 files changed, 37 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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<QString, int> descriptions;
+    std::map<QString, QString> pluginSources;
+    std::map<QString, QString> 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<QString, int> 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;
     }	    
 }
--- 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;