diff widgets/CSVFormatDialog.cpp @ 865:de9472751d31

Add milliseconds as CSV import timing option
author Chris Cannam
date Fri, 03 Oct 2014 15:09:27 +0100
parents e4773943c9c1
children d854c72dcaa1
line wrap: on
line diff
--- a/widgets/CSVFormatDialog.cpp	Mon Sep 29 13:27:13 2014 +0100
+++ b/widgets/CSVFormatDialog.cpp	Fri Oct 03 15:09:27 2014 +0100
@@ -118,6 +118,7 @@
     
     m_timingTypeCombo = new QComboBox;
     m_timingTypeCombo->addItem(tr("Explicitly, in seconds"));
+    m_timingTypeCombo->addItem(tr("Explicitly, in milliseconds"));
     m_timingTypeCombo->addItem(tr("Explicitly, in audio sample frames"));
     m_timingTypeCombo->addItem(tr("Implicitly: rows are equally spaced in time"));
     layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2);
@@ -125,7 +126,7 @@
 	    this, SLOT(timingTypeChanged(int)));
     m_timingTypeCombo->setCurrentIndex
         (m_format.getTimingType() == CSVFormat::ExplicitTiming ?
-         m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 1 : 2);
+         m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 2 : 3);
 
     m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):"));
     layout->addWidget(m_sampleRateLabel, row, 0);
@@ -240,6 +241,15 @@
 
     case 1:
 	m_format.setTimingType(CSVFormat::ExplicitTiming);
+	m_format.setTimeUnits(CSVFormat::TimeMilliseconds);
+	m_sampleRateCombo->setEnabled(true);
+	m_sampleRateLabel->setEnabled(true);
+	m_windowSizeCombo->setEnabled(false);
+	m_windowSizeLabel->setEnabled(false);
+	break;
+
+    case 2:
+	m_format.setTimingType(CSVFormat::ExplicitTiming);
 	m_format.setTimeUnits(CSVFormat::TimeAudioFrames);
 	m_sampleRateCombo->setEnabled(true);
 	m_sampleRateLabel->setEnabled(true);
@@ -247,7 +257,7 @@
 	m_windowSizeLabel->setEnabled(false);
 	break;
 
-    case 2:
+    case 3:
 	m_format.setTimingType(CSVFormat::ImplicitTiming);
 	m_format.setTimeUnits(CSVFormat::TimeWindows);
 	m_sampleRateCombo->setEnabled(true);