comparison widgets/CSVFormatDialog.cpp @ 1266:a34a2a25907c

Untabify
author Chris Cannam
date Thu, 01 Mar 2018 18:02:22 +0000
parents e5d40d89b1ec
children fcc1f45f7bd5
comparison
equal deleted inserted replaced
1265:6e724c81f18f 1266:a34a2a25907c
47 QGridLayout *layout = new QGridLayout; 47 QGridLayout *layout = new QGridLayout;
48 48
49 int row = 0; 49 int row = 0;
50 50
51 layout->addWidget(new QLabel(tr("Please select the correct data format for this file.")), 51 layout->addWidget(new QLabel(tr("Please select the correct data format for this file.")),
52 row++, 0, 1, 4); 52 row++, 0, 1, 4);
53 53
54 QFrame *exampleFrame = new QFrame; 54 QFrame *exampleFrame = new QFrame;
55 exampleFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); 55 exampleFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
56 exampleFrame->setLineWidth(2); 56 exampleFrame->setLineWidth(2);
57 QGridLayout *exampleLayout = new QGridLayout; 57 QGridLayout *exampleLayout = new QGridLayout;
134 } 134 }
135 135
136 layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2); 136 layout->addWidget(m_timingTypeCombo, row++, 1, 1, 2);
137 137
138 connect(m_timingTypeCombo, SIGNAL(activated(int)), 138 connect(m_timingTypeCombo, SIGNAL(activated(int)),
139 this, SLOT(timingTypeChanged(int))); 139 this, SLOT(timingTypeChanged(int)));
140 140
141 m_initialTimingOption = TimingImplicit; 141 m_initialTimingOption = TimingImplicit;
142 if (m_format.getTimingType() == CSVFormat::ExplicitTiming) { 142 if (m_format.getTimingType() == CSVFormat::ExplicitTiming) {
143 switch (m_format.getTimeUnits()) { 143 switch (m_format.getTimeUnits()) {
144 case CSVFormat::TimeSeconds: 144 case CSVFormat::TimeSeconds:
155 155
156 m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):")); 156 m_sampleRateLabel = new QLabel(tr("Audio sample rate (Hz):"));
157 layout->addWidget(m_sampleRateLabel, row, 0); 157 layout->addWidget(m_sampleRateLabel, row, 0);
158 158
159 int sampleRates[] = { 159 int sampleRates[] = {
160 8000, 11025, 12000, 22050, 24000, 32000, 160 8000, 11025, 12000, 22050, 24000, 32000,
161 44100, 48000, 88200, 96000, 176400, 192000 161 44100, 48000, 88200, 96000, 176400, 192000
162 }; 162 };
163 163
164 m_sampleRateCombo = new QComboBox; 164 m_sampleRateCombo = new QComboBox;
165 for (int i = 0; i < int(sizeof(sampleRates) / sizeof(sampleRates[0])); ++i) { 165 for (int i = 0; i < int(sizeof(sampleRates) / sizeof(sampleRates[0])); ++i) {
166 m_sampleRateCombo->addItem(QString("%1").arg(sampleRates[i])); 166 m_sampleRateCombo->addItem(QString("%1").arg(sampleRates[i]));
167 if (sampleRates[i] == m_format.getSampleRate()) { 167 if (sampleRates[i] == m_format.getSampleRate()) {
168 m_sampleRateCombo->setCurrentIndex(i); 168 m_sampleRateCombo->setCurrentIndex(i);
169 } 169 }
170 } 170 }
171 m_sampleRateCombo->setEditable(true); 171 m_sampleRateCombo->setEditable(true);
172 172
173 layout->addWidget(m_sampleRateCombo, row++, 1); 173 layout->addWidget(m_sampleRateCombo, row++, 1);
174 connect(m_sampleRateCombo, SIGNAL(activated(QString)), 174 connect(m_sampleRateCombo, SIGNAL(activated(QString)),
175 this, SLOT(sampleRateChanged(QString))); 175 this, SLOT(sampleRateChanged(QString)));
176 connect(m_sampleRateCombo, SIGNAL(editTextChanged(QString)), 176 connect(m_sampleRateCombo, SIGNAL(editTextChanged(QString)),
177 this, SLOT(sampleRateChanged(QString))); 177 this, SLOT(sampleRateChanged(QString)));
178 178
179 m_windowSizeLabel = new QLabel(tr("Frame increment between rows:")); 179 m_windowSizeLabel = new QLabel(tr("Frame increment between rows:"));
180 layout->addWidget(m_windowSizeLabel, row, 0); 180 layout->addWidget(m_windowSizeLabel, row, 0);
181 181
182 m_windowSizeCombo = new QComboBox; 182 m_windowSizeCombo = new QComboBox;
183 for (int i = 0; i <= 16; ++i) { 183 for (int i = 0; i <= 16; ++i) {
184 int value = 1 << i; 184 int value = 1 << i;
185 m_windowSizeCombo->addItem(QString("%1").arg(value)); 185 m_windowSizeCombo->addItem(QString("%1").arg(value));
186 if (value == int(m_format.getWindowSize())) { 186 if (value == int(m_format.getWindowSize())) {
187 m_windowSizeCombo->setCurrentIndex(i); 187 m_windowSizeCombo->setCurrentIndex(i);
188 } 188 }
189 } 189 }
190 m_windowSizeCombo->setEditable(true); 190 m_windowSizeCombo->setEditable(true);
191 191
192 layout->addWidget(m_windowSizeCombo, row++, 1); 192 layout->addWidget(m_windowSizeCombo, row++, 1);
193 connect(m_windowSizeCombo, SIGNAL(activated(QString)), 193 connect(m_windowSizeCombo, SIGNAL(activated(QString)),
194 this, SLOT(windowSizeChanged(QString))); 194 this, SLOT(windowSizeChanged(QString)));
195 connect(m_windowSizeCombo, SIGNAL(editTextChanged(QString)), 195 connect(m_windowSizeCombo, SIGNAL(editTextChanged(QString)),
196 this, SLOT(windowSizeChanged(QString))); 196 this, SLOT(windowSizeChanged(QString)));
197 197
198 m_modelLabel = new QLabel; 198 m_modelLabel = new QLabel;
199 QFont f(m_modelLabel->font()); 199 QFont f(m_modelLabel->font());
200 f.setItalic(true); 200 f.setItalic(true);
201 m_modelLabel->setFont(f); 201 m_modelLabel->setFont(f);
417 CSVFormatDialog::updateFormatFromDialog() 417 CSVFormatDialog::updateFormatFromDialog()
418 { 418 {
419 switch (TimingOption(m_timingTypeCombo->currentIndex())) { 419 switch (TimingOption(m_timingTypeCombo->currentIndex())) {
420 420
421 case TimingExplicitSeconds: 421 case TimingExplicitSeconds:
422 m_format.setTimingType(CSVFormat::ExplicitTiming); 422 m_format.setTimingType(CSVFormat::ExplicitTiming);
423 m_format.setTimeUnits(CSVFormat::TimeSeconds); 423 m_format.setTimeUnits(CSVFormat::TimeSeconds);
424 break; 424 break;
425 425
426 case TimingExplicitMsec: 426 case TimingExplicitMsec:
427 m_format.setTimingType(CSVFormat::ExplicitTiming); 427 m_format.setTimingType(CSVFormat::ExplicitTiming);
428 m_format.setTimeUnits(CSVFormat::TimeMilliseconds); 428 m_format.setTimeUnits(CSVFormat::TimeMilliseconds);
429 break; 429 break;
430 430
431 case TimingExplicitSamples: 431 case TimingExplicitSamples:
432 m_format.setTimingType(CSVFormat::ExplicitTiming); 432 m_format.setTimingType(CSVFormat::ExplicitTiming);
433 m_format.setTimeUnits(CSVFormat::TimeAudioFrames); 433 m_format.setTimeUnits(CSVFormat::TimeAudioFrames);
434 break; 434 break;
435 435
436 case TimingImplicit: 436 case TimingImplicit:
437 m_format.setTimingType(CSVFormat::ImplicitTiming); 437 m_format.setTimingType(CSVFormat::ImplicitTiming);
438 m_format.setTimeUnits(CSVFormat::TimeWindows); 438 m_format.setTimeUnits(CSVFormat::TimeWindows);
439 break; 439 break;
440 } 440 }
441 441
442 bool haveStartTime = false; 442 bool haveStartTime = false;
443 bool haveDuration = false; 443 bool haveDuration = false;
444 bool havePitch = false; 444 bool havePitch = false;