comparison 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
comparison
equal deleted inserted replaced
864:3ca3b8fbbcee 865:de9472751d31
116 116
117 layout->addWidget(new QLabel(tr("Timing is specified:")), row, 0); 117 layout->addWidget(new QLabel(tr("Timing is specified:")), row, 0);
118 118
119 m_timingTypeCombo = new QComboBox; 119 m_timingTypeCombo = new QComboBox;
120 m_timingTypeCombo->addItem(tr("Explicitly, in seconds")); 120 m_timingTypeCombo->addItem(tr("Explicitly, in seconds"));
121 m_timingTypeCombo->addItem(tr("Explicitly, in milliseconds"));
121 m_timingTypeCombo->addItem(tr("Explicitly, in audio sample frames")); 122 m_timingTypeCombo->addItem(tr("Explicitly, in audio sample frames"));
122 m_timingTypeCombo->addItem(tr("Implicitly: rows are equally spaced in time")); 123 m_timingTypeCombo->addItem(tr("Implicitly: rows are equally spaced in time"));
123 layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2); 124 layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2);
124 connect(m_timingTypeCombo, SIGNAL(activated(int)), 125 connect(m_timingTypeCombo, SIGNAL(activated(int)),
125 this, SLOT(timingTypeChanged(int))); 126 this, SLOT(timingTypeChanged(int)));
126 m_timingTypeCombo->setCurrentIndex 127 m_timingTypeCombo->setCurrentIndex
127 (m_format.getTimingType() == CSVFormat::ExplicitTiming ? 128 (m_format.getTimingType() == CSVFormat::ExplicitTiming ?
128 m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 1 : 2); 129 m_format.getTimeUnits() == CSVFormat::TimeSeconds ? 0 : 2 : 3);
129 130
130 m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):")); 131 m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):"));
131 layout->addWidget(m_sampleRateLabel, row, 0); 132 layout->addWidget(m_sampleRateLabel, row, 0);
132 133
133 int sampleRates[] = { 134 int sampleRates[] = {
238 m_windowSizeLabel->setEnabled(false); 239 m_windowSizeLabel->setEnabled(false);
239 break; 240 break;
240 241
241 case 1: 242 case 1:
242 m_format.setTimingType(CSVFormat::ExplicitTiming); 243 m_format.setTimingType(CSVFormat::ExplicitTiming);
244 m_format.setTimeUnits(CSVFormat::TimeMilliseconds);
245 m_sampleRateCombo->setEnabled(true);
246 m_sampleRateLabel->setEnabled(true);
247 m_windowSizeCombo->setEnabled(false);
248 m_windowSizeLabel->setEnabled(false);
249 break;
250
251 case 2:
252 m_format.setTimingType(CSVFormat::ExplicitTiming);
243 m_format.setTimeUnits(CSVFormat::TimeAudioFrames); 253 m_format.setTimeUnits(CSVFormat::TimeAudioFrames);
244 m_sampleRateCombo->setEnabled(true); 254 m_sampleRateCombo->setEnabled(true);
245 m_sampleRateLabel->setEnabled(true); 255 m_sampleRateLabel->setEnabled(true);
246 m_windowSizeCombo->setEnabled(false); 256 m_windowSizeCombo->setEnabled(false);
247 m_windowSizeLabel->setEnabled(false); 257 m_windowSizeLabel->setEnabled(false);
248 break; 258 break;
249 259
250 case 2: 260 case 3:
251 m_format.setTimingType(CSVFormat::ImplicitTiming); 261 m_format.setTimingType(CSVFormat::ImplicitTiming);
252 m_format.setTimeUnits(CSVFormat::TimeWindows); 262 m_format.setTimeUnits(CSVFormat::TimeWindows);
253 m_sampleRateCombo->setEnabled(true); 263 m_sampleRateCombo->setEnabled(true);
254 m_sampleRateLabel->setEnabled(true); 264 m_sampleRateLabel->setEnabled(true);
255 m_windowSizeCombo->setEnabled(true); 265 m_windowSizeCombo->setEnabled(true);