Mercurial > hg > svapp
diff framework/MainWindowBase.cpp @ 722:b06b18c15fd4 spectrogram-export
Permit exporting spectrogram; also provide progress dialog
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2020 11:20:11 +0000 |
parents | 453029d6e9bf |
children | cd1e8c731095 |
line wrap: on
line diff
--- 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<Colour3DPlotLayer *>(currentLayer)); + bool haveCurrentSpectrogram = + (haveCurrentLayer && + dynamic_cast<SpectrogramLayer *>(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"); + } } }