changeset 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 cf233ce425f6
children d7b724db4bd0
files main/MainWindow.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
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")