Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 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 | 2197ba438a3f |
comparison
equal
deleted
inserted
replaced
2454:d2c37d83f78d | 2455:9b5b4e02f691 |
---|---|
3030 | 3030 |
3031 bool useCSVDialog = | 3031 bool useCSVDialog = |
3032 ! (suffix == "xml" || suffix == "svl" || | 3032 ! (suffix == "xml" || suffix == "svl" || |
3033 suffix == "mid" || suffix == "midi" || | 3033 suffix == "mid" || suffix == "midi" || |
3034 suffix == "n3" || suffix == "ttl"); | 3034 suffix == "n3" || suffix == "ttl"); |
3035 | |
3036 if (!ModelById::isa<NoteModel>(modelId) && | |
3037 (suffix == "mid" || suffix == "midi")) { | |
3038 QMessageBox::critical | |
3039 (this, tr("Failed to export layer"), | |
3040 tr("Only note layers may be exported to MIDI files.")); | |
3041 return; | |
3042 } | |
3043 | |
3044 if (ModelById::isa<DenseTimeValueModel>(modelId) && | |
3045 !useCSVDialog) { | |
3046 // This is the case for spectrograms | |
3047 QMessageBox::critical | |
3048 (this, tr("Failed to export layer"), | |
3049 tr("Cannot export this layer to this file type. Only delimited column formats such as CSV are supported.")); | |
3050 return; | |
3051 } | |
3035 | 3052 |
3036 MultiSelection ms = m_viewManager->getSelection(); | 3053 MultiSelection ms = m_viewManager->getSelection(); |
3037 bool haveSelection = !ms.getSelections().empty(); | 3054 bool haveSelection = !ms.getSelections().empty(); |
3038 | 3055 |
3039 MultiSelection *selectionToWrite = nullptr; | 3056 MultiSelection *selectionToWrite = nullptr; |