diff 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
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue Sep 04 11:32:49 2018 +0100
+++ b/framework/MainWindowBase.cpp	Wed Sep 12 15:58:35 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) {
 
@@ -1704,12 +1714,16 @@
     }
 
     updateMenuStates();
-    m_recentFiles.addFile(source.getLocation());
-    if (!source.isRemote()) {
+
+    if (registerSource) {
+        m_recentFiles.addFile(source.getLocation());
+    }
+    if (!source.isRemote() && registerSource) {
         // for file dialog
         registerLastOpenedFilePath(FileFinder::AudioFile,
                                    source.getLocalFilename());
     }
+    
     m_openingAudioFile = false;
 
     currentPaneChanged(m_paneStack->getCurrentPane());
@@ -1856,6 +1870,7 @@
                         (path, dialog->getFormat(),
                          getMainModel()->getSampleRate());
                 }
+                delete dialog;
             }
 
             if (model) {