diff 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
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Jan 10 14:31:32 2020 +0000
+++ b/main/MainWindow.cpp	Fri Jan 10 14:31:42 2020 +0000
@@ -3020,10 +3020,18 @@
 
     if (path == "") return;
 
+    QString suffix = QFileInfo(path).suffix().toLower();
+    if (suffix == "") suffix = "svl"; // this is what exportLayerTo defaults to
+
+    bool canWriteSelection = ! (suffix == "xml" ||
+                                suffix == "svl" ||
+                                suffix == "n3" ||
+                                suffix == "ttl");
+    
     MultiSelection ms = m_viewManager->getSelection();
     MultiSelection *selectionToWrite = nullptr;
 
-    if (!ms.getSelections().empty()) {
+    if (canWriteSelection && !ms.getSelections().empty()) {
 
         QStringList items;
         items << tr("Export the content of the selected area")