Mercurial > hg > svgui
changeset 763:cdafb1a438e8
Make it possible to import CSV files directly into Note layers
author | Chris Cannam |
---|---|
date | Mon, 07 Apr 2014 10:47:15 +0100 |
parents | d7e8cefedbbc |
children | 65eb27ea08fd e93c6ae12526 |
files | widgets/CSVFormatDialog.cpp |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/widgets/CSVFormatDialog.cpp Tue Mar 11 17:29:02 2014 +0000 +++ b/widgets/CSVFormatDialog.cpp Mon Apr 07 10:47:15 2014 +0100 @@ -94,6 +94,7 @@ cpc->addItem(tr("End time")); // ColumnEndTime cpc->addItem(tr("Duration")); // ColumnDuration cpc->addItem(tr("Value")); // ColumnValue + cpc->addItem(tr("Pitch")); // ColumnPitch cpc->addItem(tr("Label")); // ColumnLabel cpc->setCurrentIndex(int(m_format.getColumnPurpose(i))); @@ -212,6 +213,9 @@ case CSVFormat::TwoDimensionalModelWithDuration: s = f->getLayerPresentationName(LayerFactory::Regions); break; + case CSVFormat::TwoDimensionalModelWithDurationAndPitch: + s = f->getLayerPresentationName(LayerFactory::Notes); + break; case CSVFormat::ThreeDimensionalModel: s = f->getLayerPresentationName(LayerFactory::Colour3DPlot); break; @@ -282,6 +286,7 @@ bool haveStartTime = false; bool haveDuration = false; + bool havePitch = false; int valueCount = 0; for (int i = 0; i < m_columnPurposeCombos.size(); ++i) { @@ -343,6 +348,9 @@ cp == CSVFormat::ColumnDuration) { haveDuration = true; } + if (cp == CSVFormat::ColumnPitch) { + havePitch = true; + } if (cp == CSVFormat::ColumnValue) { ++valueCount; } @@ -357,7 +365,11 @@ } if (haveStartTime && haveDuration) { - m_format.setModelType(CSVFormat::TwoDimensionalModelWithDuration); + if (havePitch) { + m_format.setModelType(CSVFormat::TwoDimensionalModelWithDurationAndPitch); + } else { + m_format.setModelType(CSVFormat::TwoDimensionalModelWithDuration); + } } else { if (valueCount > 1) { m_format.setModelType(CSVFormat::ThreeDimensionalModel);