comparison main/MainWindow.cpp @ 198:24ac2e4010c5

* RemoteFile -> FileSource now it's used all over the place for local files as well.
author Chris Cannam
date Thu, 18 Oct 2007 16:20:26 +0000
parents c08c312b2399
children 6e1d4d500092
comparison
equal deleted inserted replaced
197:c08c312b2399 198:24ac2e4010c5
55 #include "data/fileio/PlaylistFileReader.h" 55 #include "data/fileio/PlaylistFileReader.h"
56 #include "data/fileio/WavFileWriter.h" 56 #include "data/fileio/WavFileWriter.h"
57 #include "data/fileio/CSVFileWriter.h" 57 #include "data/fileio/CSVFileWriter.h"
58 #include "data/fileio/MIDIFileWriter.h" 58 #include "data/fileio/MIDIFileWriter.h"
59 #include "data/fileio/BZipFileDevice.h" 59 #include "data/fileio/BZipFileDevice.h"
60 #include "data/fileio/RemoteFile.h" 60 #include "data/fileio/FileSource.h"
61 #include "data/fft/FFTDataServer.h" 61 #include "data/fft/FFTDataServer.h"
62 #include "base/RecentFiles.h" 62 #include "base/RecentFiles.h"
63 #include "transform/TransformFactory.h" 63 #include "transform/TransformFactory.h"
64 #include "base/PlayParameterRepository.h" 64 #include "base/PlayParameterRepository.h"
65 #include "base/XmlExportable.h" 65 #include "base/XmlExportable.h"
2858 } 2858 }
2859 2859
2860 MainWindow::FileOpenStatus 2860 MainWindow::FileOpenStatus
2861 MainWindow::open(QString fileOrUrl, AudioFileOpenMode mode) 2861 MainWindow::open(QString fileOrUrl, AudioFileOpenMode mode)
2862 { 2862 {
2863 return open(RemoteFile(fileOrUrl), mode); 2863 return open(FileSource(fileOrUrl), mode);
2864 } 2864 }
2865 2865
2866 MainWindow::FileOpenStatus 2866 MainWindow::FileOpenStatus
2867 MainWindow::open(RemoteFile source, AudioFileOpenMode mode) 2867 MainWindow::open(FileSource source, AudioFileOpenMode mode)
2868 { 2868 {
2869 FileOpenStatus status; 2869 FileOpenStatus status;
2870 2870
2871 if (!source.isAvailable()) return FileOpenFailed; 2871 if (!source.isAvailable()) return FileOpenFailed;
2872 source.waitForData(); 2872 source.waitForData();
2891 return FileOpenFailed; 2891 return FileOpenFailed;
2892 } 2892 }
2893 } 2893 }
2894 2894
2895 MainWindow::FileOpenStatus 2895 MainWindow::FileOpenStatus
2896 MainWindow::openAudio(RemoteFile source, AudioFileOpenMode mode) 2896 MainWindow::openAudio(FileSource source, AudioFileOpenMode mode)
2897 { 2897 {
2898 std::cerr << "MainWindow::openAudio(" << source.getLocation().toStdString() << ")" << std::endl; 2898 std::cerr << "MainWindow::openAudio(" << source.getLocation().toStdString() << ")" << std::endl;
2899 2899
2900 if (!source.isAvailable()) return FileOpenFailed; 2900 if (!source.isAvailable()) return FileOpenFailed;
2901 source.waitForData(); 2901 source.waitForData();
3079 3079
3080 return FileOpenSucceeded; 3080 return FileOpenSucceeded;
3081 } 3081 }
3082 3082
3083 MainWindow::FileOpenStatus 3083 MainWindow::FileOpenStatus
3084 MainWindow::openPlaylist(RemoteFile source, AudioFileOpenMode mode) 3084 MainWindow::openPlaylist(FileSource source, AudioFileOpenMode mode)
3085 { 3085 {
3086 std::set<QString> extensions; 3086 std::set<QString> extensions;
3087 PlaylistFileReader::getSupportedExtensions(extensions); 3087 PlaylistFileReader::getSupportedExtensions(extensions);
3088 QString extension = source.getExtension(); 3088 QString extension = source.getExtension();
3089 if (extensions.find(extension) == extensions.end()) return FileOpenFailed; 3089 if (extensions.find(extension) == extensions.end()) return FileOpenFailed;
3116 if (someSuccess) return FileOpenSucceeded; 3116 if (someSuccess) return FileOpenSucceeded;
3117 else return FileOpenFailed; 3117 else return FileOpenFailed;
3118 } 3118 }
3119 3119
3120 MainWindow::FileOpenStatus 3120 MainWindow::FileOpenStatus
3121 MainWindow::openLayer(RemoteFile source) 3121 MainWindow::openLayer(FileSource source)
3122 { 3122 {
3123 Pane *pane = m_paneStack->getCurrentPane(); 3123 Pane *pane = m_paneStack->getCurrentPane();
3124 3124
3125 if (!pane) { 3125 if (!pane) {
3126 // shouldn't happen, as the menu action should have been disabled 3126 // shouldn't happen, as the menu action should have been disabled
3206 source.setLeaveLocalFile(true); 3206 source.setLeaveLocalFile(true);
3207 return FileOpenFailed; 3207 return FileOpenFailed;
3208 } 3208 }
3209 3209
3210 MainWindow::FileOpenStatus 3210 MainWindow::FileOpenStatus
3211 MainWindow::openImage(RemoteFile source) 3211 MainWindow::openImage(FileSource source)
3212 { 3212 {
3213 Pane *pane = m_paneStack->getCurrentPane(); 3213 Pane *pane = m_paneStack->getCurrentPane();
3214 3214
3215 if (!pane) { 3215 if (!pane) {
3216 // shouldn't happen, as the menu action should have been disabled 3216 // shouldn't happen, as the menu action should have been disabled
3257 3257
3258 return FileOpenSucceeded; 3258 return FileOpenSucceeded;
3259 } 3259 }
3260 3260
3261 MainWindow::FileOpenStatus 3261 MainWindow::FileOpenStatus
3262 MainWindow::openSession(RemoteFile source) 3262 MainWindow::openSession(FileSource source)
3263 { 3263 {
3264 if (!source.isAvailable()) return FileOpenFailed; 3264 if (!source.isAvailable()) return FileOpenFailed;
3265 if (source.getExtension() != "sv") return FileOpenFailed; 3265 if (source.getExtension() != "sv") return FileOpenFailed;
3266 source.waitForData(); 3266 source.waitForData();
3267 3267