comparison data/fileio/FileFinder.cpp @ 250:40db5491bcf8 sv1-1.0pre2 sv1-1.0pre3

* Add basics of an Export Image File function
author Chris Cannam
date Mon, 12 Mar 2007 15:36:31 +0000
parents e2bbb58e6df6
children 20028c634494
comparison
equal deleted inserted replaced
249:d3ac9f953ebf 250:40db5491bcf8
78 78
79 case SessionOrAudioFile: 79 case SessionOrAudioFile:
80 settingsKey = "lastpath"; 80 settingsKey = "lastpath";
81 filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nAll files (*.*)") 81 filter = tr("All supported files (*.sv %1)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nAll files (*.*)")
82 .arg(AudioFileReaderFactory::getKnownExtensions()); 82 .arg(AudioFileReaderFactory::getKnownExtensions());
83 break;
84
85 case ImageFile:
86 settingsKey = "imagepath";
87 filter = tr("Portable Network Graphics files (*.png)\nAll files (*.*)");
83 break; 88 break;
84 89
85 case AnyFile: 90 case AnyFile:
86 settingsKey = "lastpath"; 91 settingsKey = "lastpath";
87 filter = tr("All supported files (*.sv %1 %2)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)") 92 filter = tr("All supported files (*.sv %1 %2)\nSonic Visualiser session files (*.sv)\nAudio files (%1)\nLayer files (%2)\nAll files (*.*)")
194 199
195 case SessionOrAudioFile: 200 case SessionOrAudioFile:
196 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << std::endl; 201 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << std::endl;
197 abort(); 202 abort();
198 203
204 case ImageFile:
205 settingsKey = "saveimagepath";
206 title = tr("Select a file to export to");
207 filter = tr("Portable Network Graphics files (*.png)\nAll files (*.*)");
208 break;
209
199 case AnyFile: 210 case AnyFile:
200 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: AnyFile cannot be used here" << std::endl; 211 std::cerr << "ERROR: Internal error: FileFinder::getSaveFileName: AnyFile cannot be used here" << std::endl;
201 abort(); 212 abort();
202 }; 213 };
203 214
231 242
232 if (type == SessionFile) { 243 if (type == SessionFile) {
233 dialog.setDefaultSuffix("sv"); 244 dialog.setDefaultSuffix("sv");
234 } else if (type == AudioFile) { 245 } else if (type == AudioFile) {
235 dialog.setDefaultSuffix("wav"); 246 dialog.setDefaultSuffix("wav");
247 } else if (type == ImageFile) {
248 dialog.setDefaultSuffix("png");
236 } 249 }
237 250
238 bool good = false; 251 bool good = false;
239 252
240 while (!good) { 253 while (!good) {
311 324
312 case SessionOrAudioFile: 325 case SessionOrAudioFile:
313 settingsKey = "lastpath"; 326 settingsKey = "lastpath";
314 break; 327 break;
315 328
329 case ImageFile:
330 settingsKey = "imagepath";
331 break;
332
316 case AnyFile: 333 case AnyFile:
317 settingsKey = "lastpath"; 334 settingsKey = "lastpath";
318 break; 335 break;
319 } 336 }
320 337