comparison main/MainWindow.cpp @ 107:dd11619b73ba

* Update along with latest Vamp API change. This has not yet been tested.
author Chris Cannam
date Mon, 26 Feb 2007 18:13:07 +0000
parents 0581d552481d
children 58f21cf235c7
comparison
equal deleted inserted replaced
106:f8e362511b2f 107:dd11619b73ba
1217 } 1217 }
1218 } 1218 }
1219 1219
1220 for (unsigned int i = 0; i < transforms.size(); ++i) { 1220 for (unsigned int i = 0; i < transforms.size(); ++i) {
1221 1221
1222 QString description = transforms[i].description; 1222 QString name = transforms[i].name;
1223 if (description == "") description = transforms[i].name; 1223 if (name == "") name = transforms[i].identifier;
1224 1224
1225 // std::cerr << "Plugin Description: " << description.toStdString() << std::endl; 1225 // std::cerr << "Plugin Name: " << name.toStdString() << std::endl;
1226 1226
1227 QString type = transforms[i].type; 1227 QString type = transforms[i].type;
1228 1228
1229 QString category = transforms[i].category; 1229 QString category = transforms[i].category;
1230 if (category == "") category = tr("Unclassified"); 1230 if (category == "") category = tr("Unclassified");
1231 1231
1232 QString maker = transforms[i].maker; 1232 QString maker = transforms[i].maker;
1233 if (maker == "") maker = tr("Unknown"); 1233 if (maker == "") maker = tr("Unknown");
1234 maker.replace(QRegExp(tr(" [\\(<].*$")), ""); 1234 maker.replace(QRegExp(tr(" [\\(<].*$")), "");
1235 1235
1236 QString pluginName = description.section(": ", 0, 0); 1236 QString pluginName = name.section(": ", 0, 0);
1237 QString output = description.section(": ", 1); 1237 QString output = name.section(": ", 1);
1238 1238
1239 QAction *action = new QAction(tr("%1...").arg(description), this); 1239 QAction *action = new QAction(tr("%1...").arg(name), this);
1240 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); 1240 connect(action, SIGNAL(triggered()), this, SLOT(addLayer()));
1241 m_transformActions[action] = transforms[i].name; 1241 m_transformActions[action] = transforms[i].identifier;
1242 m_transformActionsReverse[transforms[i].name] = action; 1242 m_transformActionsReverse[transforms[i].identifier] = action;
1243 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); 1243 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool)));
1244 1244
1245 QString tip; 1245 QString tip;
1246 if (output == "") { 1246 if (output == "") {
1247 tip = tr("Transform with \"%1\" plugin (from %3)") 1247 tip = tr("Transform with \"%1\" plugin (from %3)")
1253 action->setStatusTip(tip); 1253 action->setStatusTip(tip);
1254 1254
1255 if (categoryMenus[type].find(category) == categoryMenus[type].end()) { 1255 if (categoryMenus[type].find(category) == categoryMenus[type].end()) {
1256 std::cerr << "WARNING: MainWindow::setupMenus: Internal error: " 1256 std::cerr << "WARNING: MainWindow::setupMenus: Internal error: "
1257 << "No category menu for transform \"" 1257 << "No category menu for transform \""
1258 << description.toStdString() << "\" (category = \"" 1258 << name.toStdString() << "\" (category = \""
1259 << category.toStdString() << "\")" << std::endl; 1259 << category.toStdString() << "\")" << std::endl;
1260 } else { 1260 } else {
1261 categoryMenus[type][category]->addAction(action); 1261 categoryMenus[type][category]->addAction(action);
1262 } 1262 }
1263 1263
1264 if (makerMenus[type].find(maker) == makerMenus[type].end()) { 1264 if (makerMenus[type].find(maker) == makerMenus[type].end()) {
1265 std::cerr << "WARNING: MainWindow::setupMenus: Internal error: " 1265 std::cerr << "WARNING: MainWindow::setupMenus: Internal error: "
1266 << "No maker menu for transform \"" 1266 << "No maker menu for transform \""
1267 << description.toStdString() << "\" (maker = \"" 1267 << name.toStdString() << "\" (maker = \""
1268 << maker.toStdString() << "\")" << std::endl; 1268 << maker.toStdString() << "\")" << std::endl;
1269 } else { 1269 } else {
1270 makerMenus[type][maker]->addAction(action); 1270 makerMenus[type][maker]->addAction(action);
1271 } 1271 }
1272 1272
1273 action = new QAction(tr("%1...").arg(output == "" ? pluginName : output), this); 1273 action = new QAction(tr("%1...").arg(output == "" ? pluginName : output), this);
1274 connect(action, SIGNAL(triggered()), this, SLOT(addLayer())); 1274 connect(action, SIGNAL(triggered()), this, SLOT(addLayer()));
1275 m_transformActions[action] = transforms[i].name; 1275 m_transformActions[action] = transforms[i].identifier;
1276 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool))); 1276 connect(this, SIGNAL(canAddLayer(bool)), action, SLOT(setEnabled(bool)));
1277 action->setStatusTip(tip); 1277 action->setStatusTip(tip);
1278 1278
1279 // cerr << "Transform: \"" << name.toStdString() << "\": plugin name \"" << pluginName.toStdString() << "\"" << endl; 1279 // cerr << "Transform: \"" << name.toStdString() << "\": plugin name \"" << pluginName.toStdString() << "\"" << endl;
1280 1280
3456 m_paneStack->setCurrentLayer(pane, newLayer); 3456 m_paneStack->setCurrentLayer(pane, newLayer);
3457 3457
3458 return; 3458 return;
3459 } 3459 }
3460 3460
3461 TransformName transform = i->second; 3461 TransformId transform = i->second;
3462 TransformFactory *factory = TransformFactory::getInstance(); 3462 TransformFactory *factory = TransformFactory::getInstance();
3463 3463
3464 QString configurationXml; 3464 QString configurationXml;
3465 3465
3466 int channel = -1; 3466 int channel = -1;
4261 if (getMainModel() && 4261 if (getMainModel() &&
4262 pane && 4262 pane &&
4263 message.getArgCount() == 1 && 4263 message.getArgCount() == 1 &&
4264 message.getArg(0).canConvert(QVariant::String)) { 4264 message.getArg(0).canConvert(QVariant::String)) {
4265 4265
4266 TransformName transform = message.getArg(0).toString(); 4266 TransformId transform = message.getArg(0).toString();
4267 4267
4268 Layer *newLayer = m_document->createDerivedLayer 4268 Layer *newLayer = m_document->createDerivedLayer
4269 (transform, 4269 (transform,
4270 getMainModel(), 4270 getMainModel(),
4271 TransformFactory::getInstance()->getDefaultContextForTransform 4271 TransformFactory::getInstance()->getDefaultContextForTransform