Mercurial > hg > tony
comparison src/MainWindow.cpp @ 72:081202998535
Regenerate analysis on main-model change, not on explicit user actions to load a file -- so that it works with files loaded from command line as well
author | Chris Cannam |
---|---|
date | Thu, 28 Nov 2013 15:13:56 +0000 |
parents | 5310637392f6 |
children | 3bab1fc3e877 |
comparison
equal
deleted
inserted
replaced
71:fc3b62262443 | 72:081202998535 |
---|---|
855 QMessageBox::critical(this, tr("Failed to open file"), | 855 QMessageBox::critical(this, tr("Failed to open file"), |
856 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path)); | 856 tr("<b>File open failed</b><p>File \"%1\" could not be opened").arg(path)); |
857 } else if (status == FileOpenWrongMode) { | 857 } else if (status == FileOpenWrongMode) { |
858 QMessageBox::critical(this, tr("Failed to open file"), | 858 QMessageBox::critical(this, tr("Failed to open file"), |
859 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 859 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
860 } else { | |
861 configureNewPane(m_paneStack->getCurrentPane()); | |
862 } | 860 } |
863 } | 861 } |
864 | 862 |
865 void | 863 void |
866 MainWindow::openLocation() | 864 MainWindow::openLocation() |
887 QMessageBox::critical(this, tr("Failed to open location"), | 885 QMessageBox::critical(this, tr("Failed to open location"), |
888 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text)); | 886 tr("<b>Open failed</b><p>URL \"%1\" could not be opened").arg(text)); |
889 } else if (status == FileOpenWrongMode) { | 887 } else if (status == FileOpenWrongMode) { |
890 QMessageBox::critical(this, tr("Failed to open location"), | 888 QMessageBox::critical(this, tr("Failed to open location"), |
891 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 889 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
892 } else { | |
893 configureNewPane(m_paneStack->getCurrentPane()); | |
894 } | 890 } |
895 } | 891 } |
896 | 892 |
897 void | 893 void |
898 MainWindow::openRecentFile() | 894 MainWindow::openRecentFile() |
915 QMessageBox::critical(this, tr("Failed to open location"), | 911 QMessageBox::critical(this, tr("Failed to open location"), |
916 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path)); | 912 tr("<b>Open failed</b><p>File or URL \"%1\" could not be opened").arg(path)); |
917 } else if (status == FileOpenWrongMode) { | 913 } else if (status == FileOpenWrongMode) { |
918 QMessageBox::critical(this, tr("Failed to open location"), | 914 QMessageBox::critical(this, tr("Failed to open location"), |
919 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 915 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
920 } else { | |
921 configureNewPane(m_paneStack->getCurrentPane()); | |
922 } | 916 } |
923 } | 917 } |
924 | 918 |
925 void | 919 void |
926 MainWindow::paneAdded(Pane *pane) | 920 MainWindow::paneAdded(Pane *pane) |
955 QMessageBox::critical(this, tr("Failed to open dropped URL"), | 949 QMessageBox::critical(this, tr("Failed to open dropped URL"), |
956 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i)); | 950 tr("<b>Open failed</b><p>Dropped URL \"%1\" could not be opened").arg(*i)); |
957 } else if (status == FileOpenWrongMode) { | 951 } else if (status == FileOpenWrongMode) { |
958 QMessageBox::critical(this, tr("Failed to open dropped URL"), | 952 QMessageBox::critical(this, tr("Failed to open dropped URL"), |
959 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); | 953 tr("<b>Audio required</b><p>Please load at least one audio file before importing annotation data")); |
960 } else { | |
961 configureNewPane(m_paneStack->getCurrentPane()); | |
962 } | 954 } |
963 } | 955 } |
964 } | 956 } |
965 | 957 |
966 void | 958 void |
978 return; | 970 return; |
979 } | 971 } |
980 | 972 |
981 //!!! open as text -- but by importing as if a CSV, or just adding | 973 //!!! open as text -- but by importing as if a CSV, or just adding |
982 //to a text layer? | 974 //to a text layer? |
983 } | |
984 | |
985 void | |
986 MainWindow::configureNewPane(Pane *pane) | |
987 { | |
988 cerr << "MainWindow::configureNewPane(" << pane << ")" << endl; | |
989 | |
990 if (!pane) { | |
991 pane = m_paneStack->addPane(); | |
992 } | |
993 | |
994 m_analyser->newFileLoaded(m_document, getMainModel(), m_paneStack, pane); | |
995 } | 975 } |
996 | 976 |
997 void | 977 void |
998 MainWindow::closeEvent(QCloseEvent *e) | 978 MainWindow::closeEvent(QCloseEvent *e) |
999 { | 979 { |
1461 | 1441 |
1462 if (m_playTarget) { | 1442 if (m_playTarget) { |
1463 connect(m_fader, SIGNAL(valueChanged(float)), | 1443 connect(m_fader, SIGNAL(valueChanged(float)), |
1464 m_playTarget, SLOT(setOutputGain(float))); | 1444 m_playTarget, SLOT(setOutputGain(float))); |
1465 } | 1445 } |
1446 | |
1447 if (model) { | |
1448 if (m_paneStack) { | |
1449 Pane *pane = m_paneStack->getCurrentPane(); | |
1450 if (!pane) { | |
1451 pane = m_paneStack->addPane(); | |
1452 } | |
1453 if (pane) { | |
1454 m_analyser->newFileLoaded | |
1455 (m_document, getMainModel(), m_paneStack, pane); | |
1456 } | |
1457 } | |
1458 } | |
1466 } | 1459 } |
1467 | 1460 |
1468 void | 1461 void |
1469 MainWindow::modelGenerationFailed(QString transformName, QString message) | 1462 MainWindow::modelGenerationFailed(QString transformName, QString message) |
1470 { | 1463 { |