comparison main/MainWindow.cpp @ 2446:0075f5b8f76c spectrogram-export

Only ask about writing a selection where the format supports it
author Chris Cannam
date Fri, 10 Jan 2020 14:31:42 +0000
parents b3330c31ea0e
children 729b96803ab1
comparison
equal deleted inserted replaced
2445:cf233ce425f6 2446:0075f5b8f76c
3018 if (ModelById::isa<NoteModel>(modelId)) type = FileFinder::LayerFile; 3018 if (ModelById::isa<NoteModel>(modelId)) type = FileFinder::LayerFile;
3019 QString path = getSaveFileName(type); 3019 QString path = getSaveFileName(type);
3020 3020
3021 if (path == "") return; 3021 if (path == "") return;
3022 3022
3023 QString suffix = QFileInfo(path).suffix().toLower();
3024 if (suffix == "") suffix = "svl"; // this is what exportLayerTo defaults to
3025
3026 bool canWriteSelection = ! (suffix == "xml" ||
3027 suffix == "svl" ||
3028 suffix == "n3" ||
3029 suffix == "ttl");
3030
3023 MultiSelection ms = m_viewManager->getSelection(); 3031 MultiSelection ms = m_viewManager->getSelection();
3024 MultiSelection *selectionToWrite = nullptr; 3032 MultiSelection *selectionToWrite = nullptr;
3025 3033
3026 if (!ms.getSelections().empty()) { 3034 if (canWriteSelection && !ms.getSelections().empty()) {
3027 3035
3028 QStringList items; 3036 QStringList items;
3029 items << tr("Export the content of the selected area") 3037 items << tr("Export the content of the selected area")
3030 << tr("Export the whole layer"); 3038 << tr("Export the whole layer");
3031 3039