diff layer/Colour3DPlotExporter.cpp @ 1568:3943553b95b0 csv-export-dialog

Add CSV export dialog, + associated supporting changes
author Chris Cannam
date Tue, 14 Jan 2020 15:41:17 +0000
parents a6a31908bd13
children b33b0b06133e
line wrap: on
line diff
--- a/layer/Colour3DPlotExporter.cpp	Fri Jan 10 14:54:27 2020 +0000
+++ b/layer/Colour3DPlotExporter.cpp	Tue Jan 14 15:41:17 2020 +0000
@@ -47,7 +47,7 @@
 
 QString
 Colour3DPlotExporter::getDelimitedDataHeaderLine(QString delimiter,
-                                                 DataExportOptions) const
+                                                 DataExportOptions opts) const
 {
     auto model =
         ModelById::getAs<DenseThreeDimensionalModel>(m_sources.source);
@@ -76,15 +76,12 @@
 
     QStringList list;
 
-    switch (m_params.timestampFormat) {
-    case TimestampFormat::None:
-        break;
-    case TimestampFormat::Frames:
-        list << "FRAME";
-        break;
-    case TimestampFormat::Seconds:
-        list << "TIME";
-        break;
+    if (opts & DataExportAlwaysIncludeTimestamp) {
+        if (opts & DataExportWriteTimeInFrames) {
+            list << "FRAME";
+        } else {
+            list << "TIME";
+        }
     }
     
     if (m_params.binDisplay == BinDisplay::PeakFrequencies) {
@@ -123,7 +120,7 @@
 
 QString
 Colour3DPlotExporter::toDelimitedDataString(QString delimiter,
-                                            DataExportOptions,
+                                            DataExportOptions opts,
                                             sv_frame_t startFrame,
                                             sv_frame_t duration) const
 {
@@ -184,16 +181,13 @@
         
         QStringList list;
 
-        switch (m_params.timestampFormat) {
-        case TimestampFormat::None:
-            break;
-        case TimestampFormat::Frames:
-            list << QString("%1").arg(fr);
-            break;
-        case TimestampFormat::Seconds:
-            list << RealTime::frame2RealTime(fr, model->getSampleRate())
-                .toString().c_str();
-            break;
+        if (opts & DataExportAlwaysIncludeTimestamp) {
+            if (opts & DataExportWriteTimeInFrames) {
+                list << QString("%1").arg(fr);
+            } else {
+                list << RealTime::frame2RealTime(fr, model->getSampleRate())
+                    .toString().c_str();
+            }
         }
         
         if (binDisplay == BinDisplay::PeakFrequencies) {