# HG changeset patch # User Chris Cannam # Date 1578396011 0 # Node ID b06b18c15fd4aae339fff371705998b8875256ae # Parent 453029d6e9bfa63318fa3a9a1f444f1387f1b2c5 Permit exporting spectrogram; also provide progress dialog diff -r 453029d6e9bf -r b06b18c15fd4 framework/MainWindowBase.cpp --- a/framework/MainWindowBase.cpp Mon Jan 06 14:47:12 2020 +0000 +++ b/framework/MainWindowBase.cpp Tue Jan 07 11:20:11 2020 +0000 @@ -37,6 +37,7 @@ #include "layer/NoteLayer.h" #include "layer/FlexiNoteLayer.h" #include "layer/RegionLayer.h" +#include "layer/SpectrogramLayer.h" #include "widgets/ListInputDialog.h" #include "widgets/CommandHistory.h" @@ -686,6 +687,9 @@ bool haveCurrentColour3DPlot = (haveCurrentLayer && dynamic_cast(currentLayer)); + bool haveCurrentSpectrogram = + (haveCurrentLayer && + dynamic_cast(currentLayer)); bool haveClipboardContents = (m_viewManager && !m_viewManager->getClipboard().empty()); @@ -704,7 +708,9 @@ emit canExportAudio(haveMainModel); emit canChangeSessionTemplate(haveMainModel); emit canExportLayer(haveMainModel && - (haveCurrentEditableLayer || haveCurrentColour3DPlot)); + (haveCurrentEditableLayer || + haveCurrentColour3DPlot || + haveCurrentSpectrogram)); emit canExportImage(haveMainModel && haveCurrentPane); emit canDeleteCurrentLayer(haveCurrentLayer); emit canRenameLayer(haveCurrentLayer); @@ -2862,12 +2868,20 @@ } else { - CSVFileWriter writer(path, model.get(), + ProgressDialog dialog { + QObject::tr("Exporting layer..."), true, 500, this, + Qt::ApplicationModal + }; + + CSVFileWriter writer(path, model.get(), &dialog, ((suffix == "csv") ? "," : "\t")); writer.write(); if (!writer.isOK()) { error = writer.getError(); + if (error == "") { + error = tr("Failed to export layer for an unknown reason"); + } } }