changeset 2455:9b5b4e02f691

More helpful error messages (+ actually provide one, for case of attempting to export spectrogram to non-CSV)
author Chris Cannam
date Wed, 15 Jan 2020 14:03:05 +0000
parents d2c37d83f78d
children 2508e661e544
files main/MainWindow.cpp
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Jan 15 14:02:37 2020 +0000
+++ b/main/MainWindow.cpp	Wed Jan 15 14:03:05 2020 +0000
@@ -3032,6 +3032,23 @@
         ! (suffix == "xml" || suffix == "svl" ||
            suffix == "mid" || suffix == "midi" ||
            suffix == "n3" || suffix == "ttl");
+
+    if (!ModelById::isa<NoteModel>(modelId) &&
+        (suffix == "mid" || suffix == "midi")) {
+        QMessageBox::critical
+            (this, tr("Failed to export layer"),
+             tr("Only note layers may be exported to MIDI files."));
+        return;
+    }
+
+    if (ModelById::isa<DenseTimeValueModel>(modelId) &&
+        !useCSVDialog) {
+        // This is the case for spectrograms
+        QMessageBox::critical
+            (this, tr("Failed to export layer"),
+             tr("Cannot export this layer to this file type. Only delimited column formats such as CSV are supported."));
+        return;
+    }
     
     MultiSelection ms = m_viewManager->getSelection();
     bool haveSelection = !ms.getSelections().empty();