comparison widgets/PluginParameterDialog.cpp @ 146:a1f7d265ac79

* More to do with passing around step/blocksize etc from plugin dialog to plugins. Still some puzzling unresolved details.
author Chris Cannam
date Tue, 19 Sep 2006 14:37:06 +0000
parents 4d132a06db9b
children e2ad3543c8a1
comparison
equal deleted inserted replaced
145:4d132a06db9b 146:a1f7d265ac79
63 63
64 QFont font(pluginBox->font()); 64 QFont font(pluginBox->font());
65 font.setBold(true); 65 font.setBold(true);
66 66
67 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str()); 67 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str());
68 nameLabel->setWordWrap(true);
68 nameLabel->setFont(font); 69 nameLabel->setFont(font);
69 70
70 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str()); 71 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
72 makerLabel->setWordWrap(true);
71 73
72 QLabel *outputLabel = 0; 74 QLabel *outputLabel = 0;
73 75
74 if (output != "") { 76 if (output != "") {
75 77
83 if (od.size() > 1) { 85 if (od.size() > 1) {
84 86
85 for (size_t i = 0; i < od.size(); ++i) { 87 for (size_t i = 0; i < od.size(); ++i) {
86 if (od[i].name == output.toStdString()) { 88 if (od[i].name == output.toStdString()) {
87 outputLabel = new QLabel(od[i].description.c_str()); 89 outputLabel = new QLabel(od[i].description.c_str());
90 outputLabel->setWordWrap(true);
88 break; 91 break;
89 } 92 }
90 } 93 }
91 } 94 }
95 } else {
96 std::cerr << "Plugin " << plugin << " is not a feature extraction plugin" << std::endl;//!!!
92 } 97 }
93 } 98 }
94 99
95 QLabel *versionLabel = new QLabel(QString("%1") 100 QLabel *versionLabel = new QLabel(QString("%1")
96 .arg(plugin->getPluginVersion())); 101 .arg(plugin->getPluginVersion()));
102 versionLabel->setWordWrap(true);
97 103
98 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str()); 104 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
105 copyrightLabel->setWordWrap(true);
99 106
100 QLabel *typeLabel = new QLabel(plugin->getType().c_str()); 107 QLabel *typeLabel = new QLabel(plugin->getType().c_str());
108 typeLabel->setWordWrap(true);
101 typeLabel->setFont(font); 109 typeLabel->setFont(font);
102 110
103 subgrid->addWidget(new QLabel(tr("Name:")), 0, 0); 111 subgrid->addWidget(new QLabel(tr("Name:")), 0, 0);
104 subgrid->addWidget(nameLabel, 0, 1); 112 subgrid->addWidget(nameLabel, 0, 1);
105 113
201 Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(plugin); 209 Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(plugin);
202 int size = 1024; 210 int size = 1024;
203 int increment = 1024; 211 int increment = 1024;
204 if (fePlugin) { 212 if (fePlugin) {
205 size = fePlugin->getPreferredBlockSize(); 213 size = fePlugin->getPreferredBlockSize();
214 std::cerr << "Feature extraction plugin \"" << fePlugin->getDescription() << "\" reports preferred block size as " << size << std::endl;
206 if (size == 0) size = 1024; 215 if (size == 0) size = 1024;
207 increment = fePlugin->getPreferredStepSize(); 216 increment = fePlugin->getPreferredStepSize();
208 if (increment == 0) increment = size; 217 if (increment == 0) {
218 if (fePlugin->getInputDomain() == Vamp::Plugin::TimeDomain) {
219 increment = size;
220 } else {
221 increment = size/2;
222 }
223 }
224 } else {
225 std::cerr << "Plugin " << plugin << " is not a feature extraction plugin" << std::endl;//!!!
209 } 226 }
210 227
211 QGroupBox *windowBox = new QGroupBox; 228 QGroupBox *windowBox = new QGroupBox;
212 windowBox->setTitle(tr("Processing")); 229 windowBox->setTitle(tr("Processing"));
213 advancedLayout->addWidget(windowBox); 230 advancedLayout->addWidget(windowBox);
233 int val = pow(2, i + 3); 250 int val = pow(2, i + 3);
234 blockSizeCombo->addItem(QString("%1").arg(val)); 251 blockSizeCombo->addItem(QString("%1").arg(val));
235 if (val == size) blockSizeCombo->setCurrentIndex(i); 252 if (val == size) blockSizeCombo->setCurrentIndex(i);
236 } 253 }
237 blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); 254 blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
238 connect(blockSizeCombo, SIGNAL(valueChanged(QString)), 255 connect(blockSizeCombo, SIGNAL(textChanged(QString)),
239 this, SLOT(blockSizeComboChanged(QString))); 256 this, SLOT(blockSizeComboChanged(QString)));
240 windowLayout->addWidget(blockSizeCombo, 0, 1); 257 windowLayout->addWidget(blockSizeCombo, 0, 1);
241 258
242 if (showFrequencyDomainOptions) { 259 if (showFrequencyDomainOptions) {
243 260
249 int val = pow(2, i + 3); 266 int val = pow(2, i + 3);
250 incrementCombo->addItem(QString("%1").arg(val)); 267 incrementCombo->addItem(QString("%1").arg(val));
251 if (val == increment) incrementCombo->setCurrentIndex(i); 268 if (val == increment) incrementCombo->setCurrentIndex(i);
252 } 269 }
253 incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); 270 incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
254 connect(incrementCombo, SIGNAL(valueChanged(QString)), 271 connect(incrementCombo, SIGNAL(textChanged(QString)),
255 this, SLOT(incrementComboChanged(QString))); 272 this, SLOT(incrementComboChanged(QString)));
256 windowLayout->addWidget(incrementCombo, 1, 1); 273 windowLayout->addWidget(incrementCombo, 1, 1);
257 274
258 windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0); 275 windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0);
259 WindowTypeSelector *windowTypeSelector = new WindowTypeSelector; 276 WindowTypeSelector *windowTypeSelector = new WindowTypeSelector;
315 WindowType &windowType) const 332 WindowType &windowType) const
316 { 333 {
317 stepSize = m_stepSize; 334 stepSize = m_stepSize;
318 blockSize = m_blockSize; 335 blockSize = m_blockSize;
319 windowType = m_windowType; 336 windowType = m_windowType;
337 return;
320 } 338 }
321 339
322 void 340 void
323 PluginParameterDialog::blockSizeComboChanged(QString text) 341 PluginParameterDialog::blockSizeComboChanged(QString text)
324 { 342 {
325 m_blockSize = text.toInt(); 343 m_blockSize = text.toInt();
344 std::cerr << "Block size changed to " << m_blockSize << std::endl;
326 } 345 }
327 346
328 void 347 void
329 PluginParameterDialog::incrementComboChanged(QString text) 348 PluginParameterDialog::incrementComboChanged(QString text)
330 { 349 {
331 m_stepSize = text.toInt(); 350 m_stepSize = text.toInt();
351 //!!! rename increment to step size throughout
352 std::cerr << "Increment changed to " << m_blockSize << std::endl;
332 } 353 }
333 354
334 void 355 void
335 PluginParameterDialog::windowTypeChanged(WindowType type) 356 PluginParameterDialog::windowTypeChanged(WindowType type)
336 { 357 {