# HG changeset patch # User Chris Cannam # Date 1396864035 -3600 # Node ID cdafb1a438e8cb3d185baea54585fb3c833b8e4f # Parent d7e8cefedbbcb7bc6a54e3c1bfcc10ac21c208ff Make it possible to import CSV files directly into Note layers diff -r d7e8cefedbbc -r cdafb1a438e8 widgets/CSVFormatDialog.cpp --- 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);