Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 143:9ef382913c17
* Add ability to export a transform structure as RDF -- for use
when exporting data from runner, so as to refer back to the generating
transform from the audio features rdf
* some improvements to pane & layer management when importing rdf, but
it's all still a big hack here
author | Chris Cannam |
---|---|
date | Tue, 25 Nov 2008 17:46:02 +0000 |
parents | 8b31cdd7e005 |
children | 675443abbc05 |
comparison
equal
deleted
inserted
replaced
142:8b31cdd7e005 | 143:9ef382913c17 |
---|---|
1146 } | 1146 } |
1147 | 1147 |
1148 for (int i = 0; i < models.size(); ++i) { | 1148 for (int i = 0; i < models.size(); ++i) { |
1149 Layer *newLayer = m_document->createImportedLayer(models[i]); | 1149 Layer *newLayer = m_document->createImportedLayer(models[i]); |
1150 if (newLayer) { | 1150 if (newLayer) { |
1151 if (newLayer->isLayerOpaque() || | |
1152 dynamic_cast<Colour3DPlotLayer *>(newLayer)) { | |
1153 //!!! general garbage. we should be using | |
1154 // a separate loader class that uses callbacks | |
1155 // and directly calls on the document, much | |
1156 // more like SVFileReader | |
1157 AddPaneCommand *command = new AddPaneCommand(this); | |
1158 CommandHistory::getInstance()->addCommand(command); | |
1159 pane = command->getPane(); | |
1160 } | |
1151 m_document->addLayerToView(pane, newLayer); | 1161 m_document->addLayerToView(pane, newLayer); |
1152 } | 1162 } |
1153 } | 1163 } |
1154 | 1164 |
1155 m_recentFiles.addFile(source.getLocation()); | 1165 m_recentFiles.addFile(source.getLocation()); |
1444 | 1454 |
1445 if (Preferences::getInstance()->getResampleOnLoad()) { | 1455 if (Preferences::getInstance()->getResampleOnLoad()) { |
1446 rate = m_playSource->getSourceSampleRate(); | 1456 rate = m_playSource->getSourceSampleRate(); |
1447 } | 1457 } |
1448 | 1458 |
1449 WaveFileModel *newModel = new WaveFileModel(audioUrl, rate); | 1459 { |
1450 | 1460 ProgressDialog dialog(tr("Importing from RDF..."), true, 2000, this); |
1451 if (!newModel->isOK()) { | 1461 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
1452 delete newModel; | 1462 |
1453 std::cerr << "MainWindowBase::openSessionFromRDF: Cannot open audio URL \"" << audioUrl.toStdString() << "\" referred to in RDF, can't open a session without audio" << std::endl; | 1463 FileSource audioSource(audioUrl, &dialog); |
1454 return FileOpenFailed; | 1464 if (!audioSource.isAvailable()) { |
1455 } | 1465 std::cerr << "MainWindowBase::openSessionFromRDF: Cannot open audio URL \"" << audioUrl.toStdString() << "\" referred to in RDF, can't open a session without audio" << std::endl; |
1456 | 1466 return FileOpenFailed; |
1457 if (!checkSaveModified()) { | 1467 } |
1458 delete newModel; | 1468 |
1459 return FileOpenCancelled; | 1469 if (!checkSaveModified()) { |
1460 } | 1470 return FileOpenCancelled; |
1461 | 1471 } |
1462 closeSession(); | 1472 |
1463 createDocument(); | 1473 closeSession(); |
1464 | 1474 createDocument(); |
1465 m_viewManager->clearSelections(); | 1475 |
1466 | 1476 audioSource.waitForData(); |
1467 AddPaneCommand *command = new AddPaneCommand(this); | 1477 |
1468 CommandHistory::getInstance()->addCommand(command); | 1478 WaveFileModel *newModel = new WaveFileModel(audioSource); |
1479 | |
1480 m_viewManager->clearSelections(); | |
1469 | 1481 |
1470 Pane *pane = command->getPane(); | 1482 AddPaneCommand *command = new AddPaneCommand(this); |
1471 | 1483 CommandHistory::getInstance()->addCommand(command); |
1472 if (m_timeRulerLayer) { | |
1473 m_document->addLayerToView(pane, m_timeRulerLayer); | |
1474 } | |
1475 | 1484 |
1476 Layer *newLayer = m_document->createMainModelLayer(LayerFactory::Waveform); | 1485 Pane *pane = command->getPane(); |
1477 m_document->addLayerToView(pane, newLayer); | 1486 |
1478 | 1487 if (m_timeRulerLayer) { |
1479 m_document->setMainModel(newModel); | 1488 m_document->addLayerToView(pane, m_timeRulerLayer); |
1489 } | |
1490 | |
1491 Layer *newLayer = m_document->createMainModelLayer(LayerFactory::Waveform); | |
1492 m_document->addLayerToView(pane, newLayer); | |
1493 | |
1494 m_document->setMainModel(newModel); | |
1495 } | |
1480 | 1496 |
1481 FileOpenStatus layerStatus = openLayer(source); | 1497 FileOpenStatus layerStatus = openLayer(source); |
1482 | 1498 |
1483 setupMenus(); | 1499 setupMenus(); |
1484 | 1500 |