comparison framework/MainWindowBase.cpp @ 623:9e15607531b2

Merge from branch import-audio-data
author Chris Cannam
date Wed, 12 Sep 2018 15:58:35 +0100
parents 22e455beee3b
children 15a566f26114 51ecc3e2d71c
comparison
equal deleted inserted replaced
617:e98a42e94d90 623:9e15607531b2
1496 } else { 1496 } else {
1497 return FileOpenFailed; 1497 return FileOpenFailed;
1498 } 1498 }
1499 } 1499 }
1500 1500
1501 // cerr << "mode = " << mode << endl; 1501 return addOpenedAudioModel(source, newModel, mode, templateName, true);
1502 1502 }
1503
1504 MainWindowBase::FileOpenStatus
1505 MainWindowBase::addOpenedAudioModel(FileSource source,
1506 WaveFileModel *newModel,
1507 AudioFileOpenMode mode,
1508 QString templateName,
1509 bool registerSource)
1510 {
1503 if (mode == AskUser) { 1511 if (mode == AskUser) {
1504 if (getMainModel()) { 1512 if (getMainModel()) {
1505 1513
1506 QSettings settings; 1514 QSettings settings;
1507 settings.beginGroup("MainWindow"); 1515 settings.beginGroup("MainWindow");
1633 m_documentModified = false; 1641 m_documentModified = false;
1634 documentModified(); // so as to restore "(modified)" window title 1642 documentModified(); // so as to restore "(modified)" window title
1635 } 1643 }
1636 } 1644 }
1637 1645
1638 if (!source.isRemote()) m_audioFile = source.getLocalFilename(); 1646 if (!source.isRemote() && registerSource) {
1647 m_audioFile = source.getLocalFilename();
1648 }
1639 1649
1640 } else if (mode == CreateAdditionalModel) { 1650 } else if (mode == CreateAdditionalModel) {
1641 1651
1642 SVCERR << "Mode is CreateAdditionalModel" << endl; 1652 SVCERR << "Mode is CreateAdditionalModel" << endl;
1643 1653
1702 1712
1703 CommandHistory::getInstance()->endCompoundOperation(); 1713 CommandHistory::getInstance()->endCompoundOperation();
1704 } 1714 }
1705 1715
1706 updateMenuStates(); 1716 updateMenuStates();
1707 m_recentFiles.addFile(source.getLocation()); 1717
1708 if (!source.isRemote()) { 1718 if (registerSource) {
1719 m_recentFiles.addFile(source.getLocation());
1720 }
1721 if (!source.isRemote() && registerSource) {
1709 // for file dialog 1722 // for file dialog
1710 registerLastOpenedFilePath(FileFinder::AudioFile, 1723 registerLastOpenedFilePath(FileFinder::AudioFile,
1711 source.getLocalFilename()); 1724 source.getLocalFilename());
1712 } 1725 }
1726
1713 m_openingAudioFile = false; 1727 m_openingAudioFile = false;
1714 1728
1715 currentPaneChanged(m_paneStack->getCurrentPane()); 1729 currentPaneChanged(m_paneStack->getCurrentPane());
1716 1730
1717 emit audioFileLoaded(); 1731 emit audioFileLoaded();
1854 if (dialog->exec() == QDialog::Accepted) { 1868 if (dialog->exec() == QDialog::Accepted) {
1855 model = DataFileReaderFactory::loadCSV 1869 model = DataFileReaderFactory::loadCSV
1856 (path, dialog->getFormat(), 1870 (path, dialog->getFormat(),
1857 getMainModel()->getSampleRate()); 1871 getMainModel()->getSampleRate());
1858 } 1872 }
1873 delete dialog;
1859 } 1874 }
1860 1875
1861 if (model) { 1876 if (model) {
1862 1877
1863 SVDEBUG << "MainWindowBase::openLayer: Have model" << endl; 1878 SVDEBUG << "MainWindowBase::openLayer: Have model" << endl;