changeset 604:6cdf2afebfd7 import-audio-data

Toward importing audio from CSVs
author Chris Cannam
date Thu, 28 Jun 2018 15:29:26 +0100
parents d4c16eed673d
children 636a5908cf81
files framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 2 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Thu Jun 21 15:37:36 2018 +0100
+++ b/framework/MainWindowBase.cpp	Thu Jun 28 15:29:26 2018 +0100
@@ -1498,8 +1498,16 @@
         }
     }
 
-//    cerr << "mode = " << mode << endl;
-
+    return addOpenedAudioModel(source, newModel, mode, templateName, true);
+}
+
+MainWindowBase::FileOpenStatus
+MainWindowBase::addOpenedAudioModel(FileSource source,
+                                    WaveFileModel *newModel,
+                                    AudioFileOpenMode mode,
+                                    QString templateName,
+                                    bool registerSource)
+{
     if (mode == AskUser) {
         if (getMainModel()) {
 
@@ -1635,7 +1643,9 @@
             }
         }
 
-        if (!source.isRemote()) m_audioFile = source.getLocalFilename();
+        if (!source.isRemote() && registerSource) {
+            m_audioFile = source.getLocalFilename();
+        }
 
     } else if (mode == CreateAdditionalModel) {
 
@@ -1705,7 +1715,7 @@
 
     updateMenuStates();
     m_recentFiles.addFile(source.getLocation());
-    if (!source.isRemote()) {
+    if (!source.isRemote() && registerSource) {
         // for file dialog
         registerLastOpenedFilePath(FileFinder::AudioFile,
                                    source.getLocalFilename());
--- a/framework/MainWindowBase.h	Thu Jun 21 15:37:36 2018 +0100
+++ b/framework/MainWindowBase.h	Thu Jun 28 15:29:26 2018 +0100
@@ -396,6 +396,12 @@
     const WaveFileModel *getMainModel() const;
     void createDocument();
 
+    FileOpenStatus addOpenedAudioModel(FileSource source,
+                                       WaveFileModel *model,
+                                       AudioFileOpenMode mode,
+                                       QString templateName,
+                                       bool registerSource);
+    
     sv_frame_t getModelsStartFrame() const; // earliest across all views
     sv_frame_t getModelsEndFrame() const; // latest across all views