comparison framework/MainWindowBase.cpp @ 764:4c91c95e146a

Merge
author Chris Cannam
date Wed, 13 May 2020 14:10:58 +0100
parents da57ab54f0e8 83ae68de4401
children cf4e0f3c2406
comparison
equal deleted inserted replaced
763:da57ab54f0e8 764:4c91c95e146a
57 #include "data/fileio/MIDIFileWriter.h" 57 #include "data/fileio/MIDIFileWriter.h"
58 #include "data/fileio/CSVFileWriter.h" 58 #include "data/fileio/CSVFileWriter.h"
59 #include "data/fileio/BZipFileDevice.h" 59 #include "data/fileio/BZipFileDevice.h"
60 #include "data/fileio/FileSource.h" 60 #include "data/fileio/FileSource.h"
61 #include "data/fileio/AudioFileReaderFactory.h" 61 #include "data/fileio/AudioFileReaderFactory.h"
62 #include "data/fileio/TextTest.h"
62 #include "rdf/RDFImporter.h" 63 #include "rdf/RDFImporter.h"
63 #include "rdf/RDFExporter.h" 64 #include "rdf/RDFExporter.h"
64 65
65 #include "transform/ModelTransformerFactory.h" 66 #include "transform/ModelTransformerFactory.h"
66 67
1514 } else if ((status = openSession(source)) != FileOpenFailed) { 1515 } else if ((status = openSession(source)) != FileOpenFailed) {
1515 return status; 1516 return status;
1516 } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) { 1517 } else if ((status = openPlaylist(source, mode)) != FileOpenFailed) {
1517 return status; 1518 return status;
1518 } else if (!canImportLayer) { 1519 } else if (!canImportLayer) {
1519 return FileOpenWrongMode; 1520 // We already checked whether the file is RDF: we know
1521 // it's not. But if it's another format that might be
1522 // supported as a layer, reply that we can't open a layer
1523 // here - otherwise assume it's an unknown file format
1524 if (ImageLayer::isImageFileSupported(source.getLocation())) {
1525 return FileOpenWrongMode;
1526 }
1527 if (extension == "mid" || extension == "midi") {
1528 return FileOpenWrongMode;
1529 }
1530 if (TextTest::isApparentTextDocument(source)) {
1531 return FileOpenWrongMode;
1532 }
1533 return FileOpenFailed;
1520 } else if ((status = openImage(source)) != FileOpenFailed) { 1534 } else if ((status = openImage(source)) != FileOpenFailed) {
1521 return status; 1535 return status;
1522 } else if ((status = openLayer(source)) != FileOpenFailed) { 1536 } else if ((status = openLayer(source)) != FileOpenFailed) {
1523 return status; 1537 return status;
1524 } else { 1538 } else {
2055 newLayer = true; 2069 newLayer = true;
2056 } 2070 }
2057 2071
2058 // We don't put the image file in Recent Files 2072 // We don't put the image file in Recent Files
2059 2073
2060 cerr << "openImage: trying location \"" << source.getLocation() << "\" in image layer" << endl; 2074 SVCERR << "openImage: trying location \"" << source.getLocation() << "\" in image layer" << endl;
2061 2075
2062 if (!il->addImage(m_viewManager->getGlobalCentreFrame(), source.getLocation())) { 2076 if (!il->addImage(m_viewManager->getGlobalCentreFrame(), source.getLocation())) {
2063 if (newLayer) { 2077 if (newLayer) {
2064 m_document->deleteLayer(il); // also releases its model 2078 m_document->deleteLayer(il); // also releases its model
2065 } 2079 }