Mercurial > hg > svgui
comparison widgets/InteractiveFileFinder.cpp @ 706:97ea68f62c1f imaf_enc
Merge from default branch
author | Chris Cannam |
---|---|
date | Thu, 05 Dec 2013 09:47:02 +0000 |
parents | 1a0dfcbffaf1 |
children | 52e5f6fe31ad 282f4be8f058 |
comparison
equal
deleted
inserted
replaced
678:26c5f7fd4807 | 706:97ea68f62c1f |
---|---|
223 title = tr("Select a file to export to"); | 223 title = tr("Select a file to export to"); |
224 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()); | 224 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()); |
225 break; | 225 break; |
226 | 226 |
227 case SessionOrAudioFile: | 227 case SessionOrAudioFile: |
228 std::cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << std::endl; | 228 cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: SessionOrAudioFile cannot be used here" << endl; |
229 abort(); | 229 abort(); |
230 | 230 |
231 case ImageFile: | 231 case ImageFile: |
232 settingsKey = "saveimagepath"; | 232 settingsKey = "saveimagepath"; |
233 title = tr("Select a file to export to"); | 233 title = tr("Select a file to export to"); |
239 title = tr("Select a file to export to"); | 239 title = tr("Select a file to export to"); |
240 filter = tr("Comma-separated data files (*.csv)\nText files (*.txt)\nAll files (*.*)"); | 240 filter = tr("Comma-separated data files (*.csv)\nText files (*.txt)\nAll files (*.*)"); |
241 break; | 241 break; |
242 | 242 |
243 case AnyFile: | 243 case AnyFile: |
244 std::cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: AnyFile cannot be used here" << std::endl; | 244 cerr << "ERROR: Internal error: InteractiveFileFinder::getSaveFileName: AnyFile cannot be used here" << endl; |
245 abort(); | 245 abort(); |
246 }; | 246 }; |
247 | 247 |
248 if (lastPath == "") { | 248 if (lastPath == "") { |
249 char *home = getenv("HOME"); | 249 char *home = getenv("HOME"); |
295 if (files.empty()) break; | 295 if (files.empty()) break; |
296 path = *files.begin(); | 296 path = *files.begin(); |
297 | 297 |
298 QFileInfo fi(path); | 298 QFileInfo fi(path); |
299 | 299 |
300 std::cerr << "type = " << type << ", suffix = " << fi.suffix() << std::endl; | 300 cerr << "type = " << type << ", suffix = " << fi.suffix() << endl; |
301 | 301 |
302 if ((type == LayerFile || type == LayerFileNoMidi) | 302 if ((type == LayerFile || type == LayerFileNoMidi) |
303 && fi.suffix() == "") { | 303 && fi.suffix() == "") { |
304 QString expectedExtension; | 304 QString expectedExtension; |
305 QString selectedFilter = dialog.selectedNameFilter(); | 305 QString selectedFilter = dialog.selectedNameFilter(); |
312 } else if (selectedFilter.contains(".mid")) { | 312 } else if (selectedFilter.contains(".mid")) { |
313 expectedExtension = "mid"; | 313 expectedExtension = "mid"; |
314 } else if (selectedFilter.contains(".ttl")) { | 314 } else if (selectedFilter.contains(".ttl")) { |
315 expectedExtension = "ttl"; | 315 expectedExtension = "ttl"; |
316 } | 316 } |
317 std::cerr << "expected extension = " << expectedExtension << std::endl; | 317 cerr << "expected extension = " << expectedExtension << endl; |
318 if (expectedExtension != "") { | 318 if (expectedExtension != "") { |
319 path = QString("%1.%2").arg(path).arg(expectedExtension); | 319 path = QString("%1.%2").arg(path).arg(expectedExtension); |
320 fi = QFileInfo(path); | 320 fi = QFileInfo(path); |
321 } | 321 } |
322 } | 322 } |
442 } | 442 } |
443 | 443 |
444 if (FileSource::isRemote(relativeTo)) { | 444 if (FileSource::isRemote(relativeTo)) { |
445 resolved = QUrl(relativeTo).resolved(fileName).toString(); | 445 resolved = QUrl(relativeTo).resolved(fileName).toString(); |
446 if (!FileSource(resolved).isAvailable()) resolved = ""; | 446 if (!FileSource(resolved).isAvailable()) resolved = ""; |
447 std::cerr << "resolved: " << resolved << std::endl; | 447 cerr << "resolved: " << resolved << endl; |
448 } else { | 448 } else { |
449 if (QUrl(relativeTo).scheme() == "file") { | 449 if (QUrl(relativeTo).scheme() == "file") { |
450 relativeTo = QUrl(relativeTo).toLocalFile(); | 450 relativeTo = QUrl(relativeTo).toLocalFile(); |
451 } | 451 } |
452 resolved = QFileInfo(relativeTo).dir().filePath(fileName); | 452 resolved = QFileInfo(relativeTo).dir().filePath(fileName); |