Mercurial > hg > svapp
comparison framework/MainWindowBase.cpp @ 233:8aace2d9f1c2
Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author | Chris Cannam |
---|---|
date | Tue, 14 Jun 2011 15:27:12 +0100 |
parents | 8c13e8219903 |
children | dd14baa45847 |
comparison
equal
deleted
inserted
replaced
232:025065fd5b49 | 233:8aace2d9f1c2 |
---|---|
232 } | 232 } |
233 } | 233 } |
234 | 234 |
235 MainWindowBase::~MainWindowBase() | 235 MainWindowBase::~MainWindowBase() |
236 { | 236 { |
237 DEBUG << "MainWindowBase::~MainWindowBase" << endl; | 237 SVDEBUG << "MainWindowBase::~MainWindowBase" << endl; |
238 if (m_playTarget) m_playTarget->shutdown(); | 238 if (m_playTarget) m_playTarget->shutdown(); |
239 // delete m_playTarget; | 239 // delete m_playTarget; |
240 delete m_playSource; | 240 delete m_playSource; |
241 delete m_viewManager; | 241 delete m_viewManager; |
242 delete m_oscQueue; | 242 delete m_oscQueue; |
425 } | 425 } |
426 | 426 |
427 void | 427 void |
428 MainWindowBase::documentModified() | 428 MainWindowBase::documentModified() |
429 { | 429 { |
430 // DEBUG << "MainWindowBase::documentModified" << endl; | 430 // SVDEBUG << "MainWindowBase::documentModified" << endl; |
431 | 431 |
432 if (!m_documentModified) { | 432 if (!m_documentModified) { |
433 //!!! this in subclass implementation? | 433 //!!! this in subclass implementation? |
434 setWindowTitle(tr("%1 (modified)").arg(windowTitle())); | 434 setWindowTitle(tr("%1 (modified)").arg(windowTitle())); |
435 } | 435 } |
439 } | 439 } |
440 | 440 |
441 void | 441 void |
442 MainWindowBase::documentRestored() | 442 MainWindowBase::documentRestored() |
443 { | 443 { |
444 // DEBUG << "MainWindowBase::documentRestored" << endl; | 444 // SVDEBUG << "MainWindowBase::documentRestored" << endl; |
445 | 445 |
446 if (m_documentModified) { | 446 if (m_documentModified) { |
447 //!!! this in subclass implementation? | 447 //!!! this in subclass implementation? |
448 QString wt(windowTitle()); | 448 QString wt(windowTitle()); |
449 wt.replace(tr(" (modified)"), ""); | 449 wt.replace(tr(" (modified)"), ""); |
1071 } | 1071 } |
1072 | 1072 |
1073 MainWindowBase::FileOpenStatus | 1073 MainWindowBase::FileOpenStatus |
1074 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, QString templateName) | 1074 MainWindowBase::openAudio(FileSource source, AudioFileOpenMode mode, QString templateName) |
1075 { | 1075 { |
1076 // DEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ")" << endl; | 1076 // SVDEBUG << "MainWindowBase::openAudio(" << source.getLocation() << ")" << endl; |
1077 | 1077 |
1078 if (!source.isAvailable()) return FileOpenFailed; | 1078 if (!source.isAvailable()) return FileOpenFailed; |
1079 source.waitForData(); | 1079 source.waitForData(); |
1080 | 1080 |
1081 m_openingAudioFile = true; | 1081 m_openingAudioFile = true; |
1278 } | 1278 } |
1279 | 1279 |
1280 MainWindowBase::FileOpenStatus | 1280 MainWindowBase::FileOpenStatus |
1281 MainWindowBase::openPlaylist(FileSource source, AudioFileOpenMode mode) | 1281 MainWindowBase::openPlaylist(FileSource source, AudioFileOpenMode mode) |
1282 { | 1282 { |
1283 DEBUG << "MainWindowBase::openPlaylist(" << source.getLocation() << ")" << endl; | 1283 SVDEBUG << "MainWindowBase::openPlaylist(" << source.getLocation() << ")" << endl; |
1284 | 1284 |
1285 std::set<QString> extensions; | 1285 std::set<QString> extensions; |
1286 PlaylistFileReader::getSupportedExtensions(extensions); | 1286 PlaylistFileReader::getSupportedExtensions(extensions); |
1287 QString extension = source.getExtension().toLower(); | 1287 QString extension = source.getExtension().toLower(); |
1288 if (extensions.find(extension) == extensions.end()) return FileOpenFailed; | 1288 if (extensions.find(extension) == extensions.end()) return FileOpenFailed; |
1319 } | 1319 } |
1320 | 1320 |
1321 MainWindowBase::FileOpenStatus | 1321 MainWindowBase::FileOpenStatus |
1322 MainWindowBase::openLayer(FileSource source) | 1322 MainWindowBase::openLayer(FileSource source) |
1323 { | 1323 { |
1324 DEBUG << "MainWindowBase::openLayer(" << source.getLocation() << ")" << endl; | 1324 SVDEBUG << "MainWindowBase::openLayer(" << source.getLocation() << ")" << endl; |
1325 | 1325 |
1326 Pane *pane = m_paneStack->getCurrentPane(); | 1326 Pane *pane = m_paneStack->getCurrentPane(); |
1327 | 1327 |
1328 if (!pane) { | 1328 if (!pane) { |
1329 // shouldn't happen, as the menu action should have been disabled | 1329 // shouldn't happen, as the menu action should have been disabled |
1416 } | 1416 } |
1417 } | 1417 } |
1418 | 1418 |
1419 if (model) { | 1419 if (model) { |
1420 | 1420 |
1421 DEBUG << "MainWindowBase::openLayer: Have model" << endl; | 1421 SVDEBUG << "MainWindowBase::openLayer: Have model" << endl; |
1422 | 1422 |
1423 emit activity(tr("Import MIDI file \"%1\"").arg(source.getLocation())); | 1423 emit activity(tr("Import MIDI file \"%1\"").arg(source.getLocation())); |
1424 | 1424 |
1425 Layer *newLayer = m_document->createImportedLayer(model); | 1425 Layer *newLayer = m_document->createImportedLayer(model); |
1426 | 1426 |
1451 } | 1451 } |
1452 | 1452 |
1453 MainWindowBase::FileOpenStatus | 1453 MainWindowBase::FileOpenStatus |
1454 MainWindowBase::openImage(FileSource source) | 1454 MainWindowBase::openImage(FileSource source) |
1455 { | 1455 { |
1456 DEBUG << "MainWindowBase::openImage(" << source.getLocation() << ")" << endl; | 1456 SVDEBUG << "MainWindowBase::openImage(" << source.getLocation() << ")" << endl; |
1457 | 1457 |
1458 Pane *pane = m_paneStack->getCurrentPane(); | 1458 Pane *pane = m_paneStack->getCurrentPane(); |
1459 | 1459 |
1460 if (!pane) { | 1460 if (!pane) { |
1461 // shouldn't happen, as the menu action should have been disabled | 1461 // shouldn't happen, as the menu action should have been disabled |
1511 } | 1511 } |
1512 | 1512 |
1513 MainWindowBase::FileOpenStatus | 1513 MainWindowBase::FileOpenStatus |
1514 MainWindowBase::openSession(FileSource source) | 1514 MainWindowBase::openSession(FileSource source) |
1515 { | 1515 { |
1516 DEBUG << "MainWindowBase::openSession(" << source.getLocation() << ")" << endl; | 1516 SVDEBUG << "MainWindowBase::openSession(" << source.getLocation() << ")" << endl; |
1517 | 1517 |
1518 if (!source.isAvailable()) return FileOpenFailed; | 1518 if (!source.isAvailable()) return FileOpenFailed; |
1519 source.waitForData(); | 1519 source.waitForData(); |
1520 | 1520 |
1521 if (source.getExtension().toLower() != "sv") { | 1521 if (source.getExtension().toLower() != "sv") { |
1631 } | 1631 } |
1632 | 1632 |
1633 MainWindowBase::FileOpenStatus | 1633 MainWindowBase::FileOpenStatus |
1634 MainWindowBase::openSessionFromRDF(FileSource source) | 1634 MainWindowBase::openSessionFromRDF(FileSource source) |
1635 { | 1635 { |
1636 DEBUG << "MainWindowBase::openSessionFromRDF(" << source.getLocation() << ")" << endl; | 1636 SVDEBUG << "MainWindowBase::openSessionFromRDF(" << source.getLocation() << ")" << endl; |
1637 | 1637 |
1638 if (!source.isAvailable()) return FileOpenFailed; | 1638 if (!source.isAvailable()) return FileOpenFailed; |
1639 source.waitForData(); | 1639 source.waitForData(); |
1640 | 1640 |
1641 if (!checkSaveModified()) { | 1641 if (!checkSaveModified()) { |
1662 MainWindowBase::FileOpenStatus | 1662 MainWindowBase::FileOpenStatus |
1663 MainWindowBase::openLayersFromRDF(FileSource source) | 1663 MainWindowBase::openLayersFromRDF(FileSource source) |
1664 { | 1664 { |
1665 size_t rate = 0; | 1665 size_t rate = 0; |
1666 | 1666 |
1667 DEBUG << "MainWindowBase::openLayersFromRDF" << endl; | 1667 SVDEBUG << "MainWindowBase::openLayersFromRDF" << endl; |
1668 | 1668 |
1669 ProgressDialog dialog(tr("Importing from RDF..."), true, 2000, this); | 1669 ProgressDialog dialog(tr("Importing from RDF..."), true, 2000, this); |
1670 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); | 1670 connect(&dialog, SIGNAL(showing()), this, SIGNAL(hideSplash())); |
1671 | 1671 |
1672 if (getMainModel()) { | 1672 if (getMainModel()) { |
2585 TabularModel *tabular = dynamic_cast<TabularModel *>(model); | 2585 TabularModel *tabular = dynamic_cast<TabularModel *>(model); |
2586 if (!tabular) { | 2586 if (!tabular) { |
2587 //!!! how to prevent this function from being active if not | 2587 //!!! how to prevent this function from being active if not |
2588 //appropriate model type? or will we ultimately support | 2588 //appropriate model type? or will we ultimately support |
2589 //tabular display for all editable models? | 2589 //tabular display for all editable models? |
2590 DEBUG << "NOTE: Not a tabular model" << endl; | 2590 SVDEBUG << "NOTE: Not a tabular model" << endl; |
2591 return; | 2591 return; |
2592 } | 2592 } |
2593 | 2593 |
2594 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { | 2594 if (m_layerDataDialogMap.find(layer) != m_layerDataDialogMap.end()) { |
2595 if (!m_layerDataDialogMap[layer].isNull()) { | 2595 if (!m_layerDataDialogMap[layer].isNull()) { |
2767 } | 2767 } |
2768 | 2768 |
2769 void | 2769 void |
2770 MainWindowBase::viewCentreFrameChanged(View *v, unsigned long frame) | 2770 MainWindowBase::viewCentreFrameChanged(View *v, unsigned long frame) |
2771 { | 2771 { |
2772 // DEBUG << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << endl; | 2772 // SVDEBUG << "MainWindowBase::viewCentreFrameChanged(" << v << "," << frame << ")" << endl; |
2773 | 2773 |
2774 if (m_viewDataDialogMap.find(v) != m_viewDataDialogMap.end()) { | 2774 if (m_viewDataDialogMap.find(v) != m_viewDataDialogMap.end()) { |
2775 for (DataDialogSet::iterator i = m_viewDataDialogMap[v].begin(); | 2775 for (DataDialogSet::iterator i = m_viewDataDialogMap[v].begin(); |
2776 i != m_viewDataDialogMap[v].end(); ++i) { | 2776 i != m_viewDataDialogMap[v].end(); ++i) { |
2777 (*i)->userScrolledToFrame(frame); | 2777 (*i)->userScrolledToFrame(frame); |
2793 } | 2793 } |
2794 | 2794 |
2795 void | 2795 void |
2796 MainWindowBase::layerAdded(Layer *) | 2796 MainWindowBase::layerAdded(Layer *) |
2797 { | 2797 { |
2798 // DEBUG << "MainWindowBase::layerAdded(" << layer << ")" << endl; | 2798 // SVDEBUG << "MainWindowBase::layerAdded(" << layer << ")" << endl; |
2799 updateMenuStates(); | 2799 updateMenuStates(); |
2800 } | 2800 } |
2801 | 2801 |
2802 void | 2802 void |
2803 MainWindowBase::layerRemoved(Layer *) | 2803 MainWindowBase::layerRemoved(Layer *) |
2804 { | 2804 { |
2805 // DEBUG << "MainWindowBase::layerRemoved(" << layer << ")" << endl; | 2805 // SVDEBUG << "MainWindowBase::layerRemoved(" << layer << ")" << endl; |
2806 updateMenuStates(); | 2806 updateMenuStates(); |
2807 } | 2807 } |
2808 | 2808 |
2809 void | 2809 void |
2810 MainWindowBase::layerAboutToBeDeleted(Layer *layer) | 2810 MainWindowBase::layerAboutToBeDeleted(Layer *layer) |
2811 { | 2811 { |
2812 // DEBUG << "MainWindowBase::layerAboutToBeDeleted(" << layer << ")" << endl; | 2812 // SVDEBUG << "MainWindowBase::layerAboutToBeDeleted(" << layer << ")" << endl; |
2813 | 2813 |
2814 removeLayerEditDialog(layer); | 2814 removeLayerEditDialog(layer); |
2815 | 2815 |
2816 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { | 2816 if (m_timeRulerLayer && (layer == m_timeRulerLayer)) { |
2817 // std::cerr << "(this is the time ruler layer)" << std::endl; | 2817 // std::cerr << "(this is the time ruler layer)" << std::endl; |
2820 } | 2820 } |
2821 | 2821 |
2822 void | 2822 void |
2823 MainWindowBase::layerInAView(Layer *layer, bool inAView) | 2823 MainWindowBase::layerInAView(Layer *layer, bool inAView) |
2824 { | 2824 { |
2825 // DEBUG << "MainWindowBase::layerInAView(" << layer << "," << inAView << ")" << endl; | 2825 // SVDEBUG << "MainWindowBase::layerInAView(" << layer << "," << inAView << ")" << endl; |
2826 | 2826 |
2827 if (!inAView) removeLayerEditDialog(layer); | 2827 if (!inAView) removeLayerEditDialog(layer); |
2828 | 2828 |
2829 // Check whether we need to add or remove model from play source | 2829 // Check whether we need to add or remove model from play source |
2830 Model *model = layer->getModel(); | 2830 Model *model = layer->getModel(); |
2874 } | 2874 } |
2875 | 2875 |
2876 void | 2876 void |
2877 MainWindowBase::modelAdded(Model *model) | 2877 MainWindowBase::modelAdded(Model *model) |
2878 { | 2878 { |
2879 // DEBUG << "MainWindowBase::modelAdded(" << model << ")" << endl; | 2879 // SVDEBUG << "MainWindowBase::modelAdded(" << model << ")" << endl; |
2880 m_playSource->addModel(model); | 2880 m_playSource->addModel(model); |
2881 } | 2881 } |
2882 | 2882 |
2883 void | 2883 void |
2884 MainWindowBase::mainModelChanged(WaveFileModel *model) | 2884 MainWindowBase::mainModelChanged(WaveFileModel *model) |
2885 { | 2885 { |
2886 // DEBUG << "MainWindowBase::mainModelChanged(" << model << ")" << endl; | 2886 // SVDEBUG << "MainWindowBase::mainModelChanged(" << model << ")" << endl; |
2887 updateDescriptionLabel(); | 2887 updateDescriptionLabel(); |
2888 if (model) m_viewManager->setMainModelSampleRate(model->getSampleRate()); | 2888 if (model) m_viewManager->setMainModelSampleRate(model->getSampleRate()); |
2889 if (model && !m_playTarget && m_audioOutput) createPlayTarget(); | 2889 if (model && !m_playTarget && m_audioOutput) createPlayTarget(); |
2890 } | 2890 } |
2891 | 2891 |
2892 void | 2892 void |
2893 MainWindowBase::modelAboutToBeDeleted(Model *model) | 2893 MainWindowBase::modelAboutToBeDeleted(Model *model) |
2894 { | 2894 { |
2895 // DEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; | 2895 // SVDEBUG << "MainWindowBase::modelAboutToBeDeleted(" << model << ")" << endl; |
2896 if (model == m_viewManager->getPlaybackModel()) { | 2896 if (model == m_viewManager->getPlaybackModel()) { |
2897 m_viewManager->setPlaybackModel(0); | 2897 m_viewManager->setPlaybackModel(0); |
2898 } | 2898 } |
2899 m_playSource->removeModel(model); | 2899 m_playSource->removeModel(model); |
2900 FFTDataServer::modelAboutToBeDeleted(model); | 2900 FFTDataServer::modelAboutToBeDeleted(model); |
2909 found = true; | 2909 found = true; |
2910 break; | 2910 break; |
2911 } | 2911 } |
2912 } | 2912 } |
2913 if (!found) { | 2913 if (!found) { |
2914 DEBUG << "MainWindowBase::paneDeleteButtonClicked: Unknown pane " | 2914 SVDEBUG << "MainWindowBase::paneDeleteButtonClicked: Unknown pane " |
2915 << pane << endl; | 2915 << pane << endl; |
2916 return; | 2916 return; |
2917 } | 2917 } |
2918 | 2918 |
2919 CommandHistory::getInstance()->startCompoundOperation | 2919 CommandHistory::getInstance()->startCompoundOperation |
2938 | 2938 |
2939 void | 2939 void |
2940 MainWindowBase::pollOSC() | 2940 MainWindowBase::pollOSC() |
2941 { | 2941 { |
2942 if (!m_oscQueue || m_oscQueue->isEmpty()) return; | 2942 if (!m_oscQueue || m_oscQueue->isEmpty()) return; |
2943 DEBUG << "MainWindowBase::pollOSC: have " << m_oscQueue->getMessagesAvailable() << " messages" << endl; | 2943 SVDEBUG << "MainWindowBase::pollOSC: have " << m_oscQueue->getMessagesAvailable() << " messages" << endl; |
2944 | 2944 |
2945 if (m_openingAudioFile) return; | 2945 if (m_openingAudioFile) return; |
2946 | 2946 |
2947 OSCMessage message = m_oscQueue->readMessage(); | 2947 OSCMessage message = m_oscQueue->readMessage(); |
2948 | 2948 |