Mercurial > hg > sonic-visualiser
diff main/MainWindow.cpp @ 230:1000222cd8f1
* better handling of cases with more than one copy of the same plugin in
different libraries -- a bit mad, but it happened to me
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2008 17:09:44 +0000 |
parents | 66dc07525671 |
children | e8a7a935128e |
line wrap: on
line diff
--- a/main/MainWindow.cpp Thu Dec 13 17:14:33 2007 +0000 +++ b/main/MainWindow.cpp Wed Jan 09 17:09:44 2008 +0000 @@ -1327,6 +1327,20 @@ } } + // Names should only be duplicated here if they have the same + // plugin name, output name and maker but are in different library + // .so names -- that won't happen often I hope + std::map<QString, QString> idNameSonameMap; + std::set<QString> seenNames, duplicateNames; + for (unsigned int i = 0; i < transforms.size(); ++i) { + QString name = transforms[i].name; + if (seenNames.find(name) != seenNames.end()) { + duplicateNames.insert(name); + } else { + seenNames.insert(name); + } + } + for (unsigned int i = 0; i < transforms.size(); ++i) { QString name = transforms[i].name; @@ -1346,6 +1360,16 @@ QString pluginName = name.section(": ", 0, 0); QString output = name.section(": ", 1); + if (duplicateNames.find(pluginName) != duplicateNames.end()) { + pluginName = QString("%1 <%2>") + .arg(pluginName) + .arg(transforms[i].identifier.section(':', 1, 1)); + if (output == "") name = pluginName; + else name = QString("%1: %2") + .arg(pluginName) + .arg(output); + } + QAction *action = new QAction(tr("%1...").arg(name), this); connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); m_transformActions[action] = transforms[i].identifier;