comparison data/fileio/CSVFileWriter.cpp @ 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 cc27f35aa75c
children e22bfe8ca248
comparison
equal deleted inserted replaced
1062:1ec57a28e924 1063:074d7c51e973
26 #include "base/Selection.h" 26 #include "base/Selection.h"
27 27
28 #include <QFile> 28 #include <QFile>
29 #include <QTextStream> 29 #include <QTextStream>
30 30
31 CSVFileWriter::CSVFileWriter(QString path, Model *model, QString delimiter) : 31 CSVFileWriter::CSVFileWriter(QString path,
32 Model *model,
33 QString delimiter,
34 DataExportOptions options) :
32 m_path(path), 35 m_path(path),
33 m_model(model), 36 m_model(model),
34 m_error(""), 37 m_error(""),
35 m_delimiter(delimiter) 38 m_delimiter(delimiter),
39 m_options(options)
36 { 40 {
37 } 41 }
38 42
39 CSVFileWriter::~CSVFileWriter() 43 CSVFileWriter::~CSVFileWriter()
40 { 44 {
64 .arg(temp.getTemporaryFilename()); 68 .arg(temp.getTemporaryFilename());
65 return; 69 return;
66 } 70 }
67 71
68 QTextStream out(&file); 72 QTextStream out(&file);
69 out << m_model->toDelimitedDataString(m_delimiter); 73 out << m_model->toDelimitedDataStringWithOptions
74 (m_delimiter, m_options);
70 75
71 file.close(); 76 file.close();
72 temp.moveToTarget(); 77 temp.moveToTarget();
73 78
74 } catch (FileOperationFailed &f) { 79 } catch (FileOperationFailed &f) {
94 for (MultiSelection::SelectionList::iterator i = 99 for (MultiSelection::SelectionList::iterator i =
95 selection->getSelections().begin(); 100 selection->getSelections().begin();
96 i != selection->getSelections().end(); ++i) { 101 i != selection->getSelections().end(); ++i) {
97 102
98 sv_frame_t f0(i->getStartFrame()), f1(i->getEndFrame()); 103 sv_frame_t f0(i->getStartFrame()), f1(i->getEndFrame());
99 out << m_model->toDelimitedDataStringSubset(m_delimiter, f0, f1); 104 out << m_model->toDelimitedDataStringSubsetWithOptions
105 (m_delimiter, m_options, f0, f1);
100 } 106 }
101 107
102 file.close(); 108 file.close();
103 temp.moveToTarget(); 109 temp.moveToTarget();
104 110