changeset 1063:074d7c51e973 tonioni

Wire options into CSVFileWriter; omit levels from Tony note export
author Chris Cannam
date Tue, 31 Mar 2015 11:05:02 +0100
parents 1ec57a28e924
children c9fdd9921146
files data/fileio/CSVFileWriter.cpp data/fileio/CSVFileWriter.h
diffstat 2 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/CSVFileWriter.cpp	Tue Mar 31 10:39:54 2015 +0100
+++ b/data/fileio/CSVFileWriter.cpp	Tue Mar 31 11:05:02 2015 +0100
@@ -28,11 +28,15 @@
 #include <QFile>
 #include <QTextStream>
 
-CSVFileWriter::CSVFileWriter(QString path, Model *model, QString delimiter) :
+CSVFileWriter::CSVFileWriter(QString path,
+                             Model *model,
+                             QString delimiter,
+                             DataExportOptions options) :
     m_path(path),
     m_model(model),
     m_error(""),
-    m_delimiter(delimiter)
+    m_delimiter(delimiter),
+    m_options(options)
 {
 }
 
@@ -66,7 +70,8 @@
         }
     
         QTextStream out(&file);
-        out << m_model->toDelimitedDataString(m_delimiter);
+        out << m_model->toDelimitedDataStringWithOptions
+            (m_delimiter, m_options);
 
         file.close();
         temp.moveToTarget();
@@ -96,7 +101,8 @@
              i != selection->getSelections().end(); ++i) {
 	
             sv_frame_t f0(i->getStartFrame()), f1(i->getEndFrame());
-            out << m_model->toDelimitedDataStringSubset(m_delimiter, f0, f1);
+            out << m_model->toDelimitedDataStringSubsetWithOptions
+                (m_delimiter, m_options, f0, f1);
         }
 
         file.close();
--- a/data/fileio/CSVFileWriter.h	Tue Mar 31 10:39:54 2015 +0100
+++ b/data/fileio/CSVFileWriter.h	Tue Mar 31 11:05:02 2015 +0100
@@ -19,6 +19,8 @@
 #include <QObject>
 #include <QString>
 
+#include "base/DataExportOptions.h"
+
 class Model;
 class MultiSelection;
 
@@ -27,7 +29,10 @@
     Q_OBJECT
 
 public:
-    CSVFileWriter(QString path, Model *model, QString delimiter = ",");
+    CSVFileWriter(QString path,
+                  Model *model,
+                  QString delimiter = ",",
+                  DataExportOptions options = DataExportDefaults);
     virtual ~CSVFileWriter();
 
     virtual bool isOK() const;
@@ -41,6 +46,7 @@
     Model *m_model;
     QString m_error;
     QString m_delimiter;
+    DataExportOptions m_options;
 };
 
 #endif