comparison main/MainWindow.cpp @ 274:1da9d83fbde6

* More SelectableLabel and TransformFinder tweaking
author Chris Cannam
date Mon, 29 Sep 2008 15:06:43 +0000
parents 9070db6244a2
children 4c91b98b4ce1
comparison
equal deleted inserted replaced
273:9070db6244a2 274:1da9d83fbde6
1220 m_transformsMenu->setTearOffEnabled(true); 1220 m_transformsMenu->setTearOffEnabled(true);
1221 } 1221 }
1222 1222
1223 TransformList transforms = 1223 TransformList transforms =
1224 TransformFactory::getInstance()->getAllTransformDescriptions(); 1224 TransformFactory::getInstance()->getAllTransformDescriptions();
1225 /*!!! 1225
1226 std::cerr << "Testing transform search..." << std::endl;
1227 QStringList terms;
1228 terms << "onset";
1229 terms << "detector";
1230 TransformFactory::SearchResults results = TransformFactory::getInstance()->
1231 search(terms);
1232 std::cerr << results.size() << " result(s)..." << std::endl;
1233 int i = 0;
1234 std::set<TransformFactory::Match> sortedResults;
1235 for (TransformFactory::SearchResults::const_iterator j =
1236 results.begin();
1237 j != results.end(); ++j) {
1238 sortedResults.insert(j->second);
1239 }
1240 for (std::set<TransformFactory::Match>::const_iterator j =
1241 sortedResults.begin();
1242 j != sortedResults.end(); ++j) {
1243 std::cerr << i << ": " << j->transform.toStdString()
1244 << ": ";
1245 for (TransformFactory::Match::FragmentMap::const_iterator k =
1246 j->fragments.begin();
1247 k != j->fragments.end(); ++k) {
1248 std::cerr << k->first.toStdString() << ": "
1249 << k->second.toStdString() << " ";
1250 }
1251 std::cerr << "(" << j->score << ")" << std::endl;
1252 ++i;
1253 }
1254 */
1255 vector<QString> types = 1226 vector<QString> types =
1256 TransformFactory::getInstance()->getAllTransformTypes(); 1227 TransformFactory::getInstance()->getAllTransformTypes();
1257 1228
1258 map<QString, map<QString, SubdividingMenu *> > categoryMenus; 1229 map<QString, map<QString, SubdividingMenu *> > categoryMenus;
1259 map<QString, map<QString, SubdividingMenu *> > makerMenus; 1230 map<QString, map<QString, SubdividingMenu *> > makerMenus;
3024 // We always ask for configuration, even if the plugin isn't 2995 // We always ask for configuration, even if the plugin isn't
3025 // supposed to be configurable, because we need to let the user 2996 // supposed to be configurable, because we need to let the user
3026 // change the execution context (block size etc). 2997 // change the execution context (block size etc).
3027 2998
3028 QString transformId = i->second; 2999 QString transformId = i->second;
3000
3001 addLayer(transformId);
3002 }
3003
3004 void
3005 MainWindow::addLayer(QString transformId)
3006 {
3007 Pane *pane = m_paneStack->getCurrentPane();
3008 if (!pane) {
3009 std::cerr << "WARNING: MainWindow::addLayer: no current pane" << std::endl;
3010 return;
3011 }
3012
3029 Transform transform = TransformFactory::getInstance()-> 3013 Transform transform = TransformFactory::getInstance()->
3030 getDefaultTransformFor(transformId); 3014 getDefaultTransformFor(transformId);
3031 3015
3032 std::vector<Model *> candidateInputModels = 3016 std::vector<Model *> candidateInputModels =
3033 m_document->getTransformInputModels(); 3017 m_document->getTransformInputModels();
3102 } 3086 }
3103 3087
3104 void 3088 void
3105 MainWindow::findTransform() 3089 MainWindow::findTransform()
3106 { 3090 {
3107 TransformFinder finder(this); 3091 TransformFinder *finder = new TransformFinder(this);
3108 if (finder.exec()) { 3092 if (!finder->exec()) {
3109 std::cerr << "Yes! transform is " << finder.getTransform().toStdString() << std::endl; 3093 delete finder;
3110 } else { 3094 return;
3111 std::cerr << "No" << std::endl; 3095 }
3112 } 3096 TransformId transform = finder->getTransform();
3097 delete finder;
3098 addLayer(transform);
3113 } 3099 }
3114 3100
3115 void 3101 void
3116 MainWindow::playSoloToggled() 3102 MainWindow::playSoloToggled()
3117 { 3103 {