# HG changeset patch
# User Chris Cannam
# Date 1579096985 0
# Node ID 9b5b4e02f691a1ab522589ca66192190358417fc
# Parent  d2c37d83f78d1997b6285645ce5073bfbfb81f09
More helpful error messages (+ actually provide one, for case of attempting to export spectrogram to non-CSV)

diff -r d2c37d83f78d -r 9b5b4e02f691 main/MainWindow.cpp
--- 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();