Mercurial > hg > sonic-visualiser
comparison 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 |
comparison
equal
deleted
inserted
replaced
229:66dc07525671 | 230:1000222cd8f1 |
---|---|
1325 byMakerMenu->addMenu(makerMenus[*i][maker]); | 1325 byMakerMenu->addMenu(makerMenus[*i][maker]); |
1326 pendingMenus.insert(makerMenus[*i][maker]); | 1326 pendingMenus.insert(makerMenus[*i][maker]); |
1327 } | 1327 } |
1328 } | 1328 } |
1329 | 1329 |
1330 // Names should only be duplicated here if they have the same | |
1331 // plugin name, output name and maker but are in different library | |
1332 // .so names -- that won't happen often I hope | |
1333 std::map<QString, QString> idNameSonameMap; | |
1334 std::set<QString> seenNames, duplicateNames; | |
1335 for (unsigned int i = 0; i < transforms.size(); ++i) { | |
1336 QString name = transforms[i].name; | |
1337 if (seenNames.find(name) != seenNames.end()) { | |
1338 duplicateNames.insert(name); | |
1339 } else { | |
1340 seenNames.insert(name); | |
1341 } | |
1342 } | |
1343 | |
1330 for (unsigned int i = 0; i < transforms.size(); ++i) { | 1344 for (unsigned int i = 0; i < transforms.size(); ++i) { |
1331 | 1345 |
1332 QString name = transforms[i].name; | 1346 QString name = transforms[i].name; |
1333 if (name == "") name = transforms[i].identifier; | 1347 if (name == "") name = transforms[i].identifier; |
1334 | 1348 |
1343 if (maker == "") maker = tr("Unknown"); | 1357 if (maker == "") maker = tr("Unknown"); |
1344 maker.replace(QRegExp(tr(" [\\(<].*$")), ""); | 1358 maker.replace(QRegExp(tr(" [\\(<].*$")), ""); |
1345 | 1359 |
1346 QString pluginName = name.section(": ", 0, 0); | 1360 QString pluginName = name.section(": ", 0, 0); |
1347 QString output = name.section(": ", 1); | 1361 QString output = name.section(": ", 1); |
1362 | |
1363 if (duplicateNames.find(pluginName) != duplicateNames.end()) { | |
1364 pluginName = QString("%1 <%2>") | |
1365 .arg(pluginName) | |
1366 .arg(transforms[i].identifier.section(':', 1, 1)); | |
1367 if (output == "") name = pluginName; | |
1368 else name = QString("%1: %2") | |
1369 .arg(pluginName) | |
1370 .arg(output); | |
1371 } | |
1348 | 1372 |
1349 QAction *action = new QAction(tr("%1...").arg(name), this); | 1373 QAction *action = new QAction(tr("%1...").arg(name), this); |
1350 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); | 1374 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); |
1351 m_transformActions[action] = transforms[i].identifier; | 1375 m_transformActions[action] = transforms[i].identifier; |
1352 m_transformActionsReverse[transforms[i].identifier] = action; | 1376 m_transformActionsReverse[transforms[i].identifier] = action; |