Mercurial > hg > svgui
comparison widgets/FileFinder.cpp @ 456:035d62c4cddf
* Permit viewing (though not editing) colour 3d plot layer data in
the spreadsheet data viewer dialog
* Add somewhat simplistic RDF export for layers
* Fix display of peak frequencies in spectrum layer
* Fix (I hope) sizing of plugin parameter dialog
author | Chris Cannam |
---|---|
date | Tue, 02 Dec 2008 17:17:25 +0000 |
parents | 33b7f5e54d60 |
children | e75f15c9ea11 |
comparison
equal
deleted
inserted
replaced
455:747a58d45d56 | 456:035d62c4cddf |
---|---|
16 #include "FileFinder.h" | 16 #include "FileFinder.h" |
17 #include "data/fileio/FileSource.h" | 17 #include "data/fileio/FileSource.h" |
18 #include "data/fileio/AudioFileReaderFactory.h" | 18 #include "data/fileio/AudioFileReaderFactory.h" |
19 #include "data/fileio/DataFileReaderFactory.h" | 19 #include "data/fileio/DataFileReaderFactory.h" |
20 #include "rdf/RDFImporter.h" | 20 #include "rdf/RDFImporter.h" |
21 #include "rdf/RDFExporter.h" | |
21 | 22 |
22 #include <QFileInfo> | 23 #include <QFileInfo> |
23 #include <QMessageBox> | 24 #include <QMessageBox> |
24 #include <QFileDialog> | 25 #include <QFileDialog> |
25 #include <QInputDialog> | 26 #include <QInputDialog> |
61 switch (type) { | 62 switch (type) { |
62 | 63 |
63 case SessionFile: | 64 case SessionFile: |
64 settingsKey = "sessionpath"; | 65 settingsKey = "sessionpath"; |
65 title = tr("Select a session file"); | 66 title = tr("Select a session file"); |
66 filter = tr("Sonic Visualiser session files (*.sv)\nAll files (*.*)"); | 67 filter = tr("Sonic Visualiser session files (*.sv)\nRDF files (%1)\nAll files (*.*)").arg(RDFImporter::getKnownExtensions()); |
67 break; | 68 break; |
68 | 69 |
69 case AudioFile: | 70 case AudioFile: |
70 settingsKey = "audiopath"; | 71 settingsKey = "audiopath"; |
71 title = "Select an audio file"; | 72 title = "Select an audio file"; |
73 .arg(AudioFileReaderFactory::getKnownExtensions()); | 74 .arg(AudioFileReaderFactory::getKnownExtensions()); |
74 break; | 75 break; |
75 | 76 |
76 case LayerFile: | 77 case LayerFile: |
77 settingsKey = "layerpath"; | 78 settingsKey = "layerpath"; |
78 filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); | 79 filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%2)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)") |
80 .arg(DataFileReaderFactory::getKnownExtensions()) | |
81 .arg(RDFImporter::getKnownExtensions()); | |
79 break; | 82 break; |
80 | 83 |
81 case LayerFileNoMidi: | 84 case LayerFileNoMidi: |
82 settingsKey = "layerpath"; | 85 settingsKey = "layerpath"; |
83 filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%3)\nText files (*.txt)\nAll files (*.*)").arg(DataFileReaderFactory::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()).arg(RDFImporter::getKnownExtensions()); | 86 filter = tr("All supported files (%1 %2)\nSonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nSpace-separated .lab files (*.lab)\nRDF files (%2)\nText files (*.txt)\nAll files (*.*)") |
87 .arg(DataFileReaderFactory::getKnownExtensions()) | |
88 .arg(RDFImporter::getKnownExtensions()); | |
84 break; | 89 break; |
85 | 90 |
86 case SessionOrAudioFile: | 91 case SessionOrAudioFile: |
87 settingsKey = "lastpath"; | 92 settingsKey = "lastpath"; |
88 filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nAll files (*.*)") | 93 filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nRDF files (%1)\nAudio files (%2)\nAll files (*.*)") |
94 .arg(RDFImporter::getKnownExtensions()) | |
89 .arg(AudioFileReaderFactory::getKnownExtensions()); | 95 .arg(AudioFileReaderFactory::getKnownExtensions()); |
90 break; | 96 break; |
91 | 97 |
92 case ImageFile: | 98 case ImageFile: |
93 settingsKey = "imagepath"; | 99 settingsKey = "imagepath"; |
103 } | 109 } |
104 break; | 110 break; |
105 | 111 |
106 case AnyFile: | 112 case AnyFile: |
107 settingsKey = "lastpath"; | 113 settingsKey = "lastpath"; |
108 filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)") | 114 filter = tr("All supported files (*.sv %1 %2 %3)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nRDF files (%3)\nAll files (*.*)") |
109 .arg(AudioFileReaderFactory::getKnownExtensions()) | 115 .arg(AudioFileReaderFactory::getKnownExtensions()) |
110 .arg(DataFileReaderFactory::getKnownExtensions()) | 116 .arg(DataFileReaderFactory::getKnownExtensions()) |
111 .arg(RDFImporter::getKnownExtensions()); | 117 .arg(RDFImporter::getKnownExtensions()); |
112 break; | 118 break; |
113 }; | 119 }; |
209 break; | 215 break; |
210 | 216 |
211 case LayerFile: | 217 case LayerFile: |
212 settingsKey = "savelayerpath"; | 218 settingsKey = "savelayerpath"; |
213 title = tr("Select a file to export to"); | 219 title = tr("Select a file to export to"); |
214 filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)"); | 220 filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nRDF/Turtle files (%1)\nMIDI files (*.mid)\nText files (*.txt)\nAll files (*.*)").arg(RDFExporter::getSupportedExtensions()); |
215 break; | 221 break; |
216 | 222 |
217 case LayerFileNoMidi: | 223 case LayerFileNoMidi: |
218 settingsKey = "savelayerpath"; | 224 settingsKey = "savelayerpath"; |
219 title = tr("Select a file to export to"); | 225 title = tr("Select a file to export to"); |
220 filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nText files (*.txt)\nAll files (*.*)"); | 226 filter = tr("Sonic Visualiser Layer XML files (*.svl)\nComma-separated data files (*.csv)\nRDF/Turtle files (%1)\nText files (*.txt)\nAll files (*.*)").arg(RDFExporter::getSupportedExtensions()); |
221 break; | 227 break; |
222 | 228 |
223 case SessionOrAudioFile: | 229 case SessionOrAudioFile: |
224 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << std::endl; | 230 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << std::endl; |
225 abort(); | 231 abort(); |
297 expectedExtension = "txt"; | 303 expectedExtension = "txt"; |
298 } else if (selectedFilter.contains(".csv")) { | 304 } else if (selectedFilter.contains(".csv")) { |
299 expectedExtension = "csv"; | 305 expectedExtension = "csv"; |
300 } else if (selectedFilter.contains(".mid")) { | 306 } else if (selectedFilter.contains(".mid")) { |
301 expectedExtension = "mid"; | 307 expectedExtension = "mid"; |
308 } else if (selectedFilter.contains(".ttl")) { | |
309 expectedExtension = "ttl"; | |
302 } | 310 } |
303 std::cerr << "expected extension = " << expectedExtension.toStdString() << std::endl; | 311 std::cerr << "expected extension = " << expectedExtension.toStdString() << std::endl; |
304 if (expectedExtension != "") { | 312 if (expectedExtension != "") { |
305 path = QString("%1.%2").arg(path).arg(expectedExtension); | 313 path = QString("%1.%2").arg(path).arg(expectedExtension); |
306 fi = QFileInfo(path); | 314 fi = QFileInfo(path); |