Mercurial > hg > svgui
comparison widgets/PluginParameterDialog.cpp @ 145:4d132a06db9b
* Add mono timestretch toggle button; some more work on getting blocksize etc
parameters through to plugins
author | Chris Cannam |
---|---|
date | Mon, 18 Sep 2006 16:43:17 +0000 |
parents | bcb6d71be63c |
children | a1f7d265ac79 |
comparison
equal
deleted
inserted
replaced
144:d1e5cd4574a0 | 145:4d132a06db9b |
---|---|
39 bool showFrequencyDomainOptions, | 39 bool showFrequencyDomainOptions, |
40 QWidget *parent) : | 40 QWidget *parent) : |
41 QDialog(parent), | 41 QDialog(parent), |
42 m_plugin(plugin), | 42 m_plugin(plugin), |
43 m_channel(defaultChannel), | 43 m_channel(defaultChannel), |
44 m_stepSize(0), | |
45 m_blockSize(0), | |
46 m_windowType(HanningWindow), | |
44 m_parameterBox(0) | 47 m_parameterBox(0) |
45 { | 48 { |
46 setWindowTitle(tr("Plugin Parameters")); | 49 setWindowTitle(tr("Plugin Parameters")); |
47 | 50 |
48 QGridLayout *grid = new QGridLayout; | 51 QGridLayout *grid = new QGridLayout; |
219 windowLayout->addWidget(new QLabel(tr("Audio frames per block:")), 0, 0); | 222 windowLayout->addWidget(new QLabel(tr("Audio frames per block:")), 0, 0); |
220 } | 223 } |
221 | 224 |
222 std::cerr << "size: " << size << ", increment: " << increment << std::endl; | 225 std::cerr << "size: " << size << ", increment: " << increment << std::endl; |
223 | 226 |
227 //!!! deal with block and step sizes (coming from the plugin's | |
228 // preferences) that don't fit into the default list | |
229 | |
224 QComboBox *blockSizeCombo = new QComboBox; | 230 QComboBox *blockSizeCombo = new QComboBox; |
225 blockSizeCombo->setEditable(true); | 231 blockSizeCombo->setEditable(true); |
226 for (int i = 0; i < 14; ++i) { | 232 for (int i = 0; i < 14; ++i) { |
227 int val = pow(2, i + 3); | 233 int val = pow(2, i + 3); |
228 blockSizeCombo->addItem(QString("%1").arg(val)); | 234 blockSizeCombo->addItem(QString("%1").arg(val)); |
229 if (val == size) blockSizeCombo->setCurrentIndex(i); | 235 if (val == size) blockSizeCombo->setCurrentIndex(i); |
230 } | 236 } |
231 blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); | 237 blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); |
238 connect(blockSizeCombo, SIGNAL(valueChanged(QString)), | |
239 this, SLOT(blockSizeComboChanged(QString))); | |
232 windowLayout->addWidget(blockSizeCombo, 0, 1); | 240 windowLayout->addWidget(blockSizeCombo, 0, 1); |
233 | 241 |
234 if (showFrequencyDomainOptions) { | 242 if (showFrequencyDomainOptions) { |
235 | 243 |
236 windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0); | 244 windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0); |
241 int val = pow(2, i + 3); | 249 int val = pow(2, i + 3); |
242 incrementCombo->addItem(QString("%1").arg(val)); | 250 incrementCombo->addItem(QString("%1").arg(val)); |
243 if (val == increment) incrementCombo->setCurrentIndex(i); | 251 if (val == increment) incrementCombo->setCurrentIndex(i); |
244 } | 252 } |
245 incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); | 253 incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); |
254 connect(incrementCombo, SIGNAL(valueChanged(QString)), | |
255 this, SLOT(incrementComboChanged(QString))); | |
246 windowLayout->addWidget(incrementCombo, 1, 1); | 256 windowLayout->addWidget(incrementCombo, 1, 1); |
247 | 257 |
248 windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0); | 258 windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0); |
249 WindowTypeSelector *windowTypeSelector = new WindowTypeSelector; | 259 WindowTypeSelector *windowTypeSelector = new WindowTypeSelector; |
260 connect(windowTypeSelector, SIGNAL(windowTypeChanged(WindowType type)), | |
261 this, SLOT(windowTypeChanged(type))); | |
250 windowLayout->addWidget(windowTypeSelector, 2, 1); | 262 windowLayout->addWidget(windowTypeSelector, 2, 1); |
251 } | 263 } |
252 } | 264 } |
253 | |
254 //!!! We lack a comfortable way of passing around the channel and | |
255 //blocksize data | |
256 | 265 |
257 QHBoxLayout *hbox = new QHBoxLayout; | 266 QHBoxLayout *hbox = new QHBoxLayout; |
258 grid->addLayout(hbox, 4, 0); | 267 grid->addLayout(hbox, 4, 0); |
259 | 268 |
260 bool advancedVisible = false; | 269 bool advancedVisible = false; |
292 PluginParameterDialog::~PluginParameterDialog() | 301 PluginParameterDialog::~PluginParameterDialog() |
293 { | 302 { |
294 } | 303 } |
295 | 304 |
296 void | 305 void |
306 PluginParameterDialog::getProcessingParameters(size_t &blockSize) const | |
307 { | |
308 blockSize = m_blockSize; | |
309 return; | |
310 } | |
311 | |
312 void | |
313 PluginParameterDialog::getProcessingParameters(size_t &stepSize, | |
314 size_t &blockSize, | |
315 WindowType &windowType) const | |
316 { | |
317 stepSize = m_stepSize; | |
318 blockSize = m_blockSize; | |
319 windowType = m_windowType; | |
320 } | |
321 | |
322 void | |
323 PluginParameterDialog::blockSizeComboChanged(QString text) | |
324 { | |
325 m_blockSize = text.toInt(); | |
326 } | |
327 | |
328 void | |
329 PluginParameterDialog::incrementComboChanged(QString text) | |
330 { | |
331 m_stepSize = text.toInt(); | |
332 } | |
333 | |
334 void | |
335 PluginParameterDialog::windowTypeChanged(WindowType type) | |
336 { | |
337 m_windowType = type; | |
338 } | |
339 | |
340 void | |
297 PluginParameterDialog::advancedToggled() | 341 PluginParameterDialog::advancedToggled() |
298 { | 342 { |
299 bool visible = !m_advanced->isVisible(); | 343 bool visible = !m_advanced->isVisible(); |
300 | 344 |
301 m_advanced->setVisible(visible); | 345 m_advanced->setVisible(visible); |