comparison widgets/PluginParameterDialog.cpp @ 282:4edaff85875d

* Add mouse actions to key and mouse reference dialog * Use QDialogButtonBox in all dialogs, for proper button ordering across platforms (requires Qt 4.2) * Fix #1733610 program does not exit if preferences dialog visible on close
author Chris Cannam
date Thu, 05 Jul 2007 11:07:01 +0000
parents 948a3b05798b
children 919740b20cc9
comparison
equal deleted inserted replaced
281:ac58acbd7482 282:4edaff85875d
29 #include <QScrollArea> 29 #include <QScrollArea>
30 #include <QPushButton> 30 #include <QPushButton>
31 #include <QMessageBox> 31 #include <QMessageBox>
32 #include <QComboBox> 32 #include <QComboBox>
33 #include <QSettings> 33 #include <QSettings>
34 #include <QDialogButtonBox>
34 35
35 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin, 36 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
36 QWidget *parent) : 37 QWidget *parent) :
37 QDialog(parent), 38 QDialog(parent),
38 m_plugin(plugin), 39 m_plugin(plugin),
222 m_advanced->setVisible(false); 223 m_advanced->setVisible(false);
223 224
224 hbox->addWidget(m_advancedButton); 225 hbox->addWidget(m_advancedButton);
225 m_advancedButton->hide(); 226 m_advancedButton->hide();
226 227
227 QPushButton *ok = new QPushButton(tr("OK")); 228 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok |
228 QPushButton *cancel = new QPushButton(tr("Cancel")); 229 QDialogButtonBox::Cancel);
229 ok->setDefault(true); 230 hbox->addWidget(bb);
230 hbox->addStretch(10); 231 connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
231 hbox->addWidget(ok); 232 connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
232 hbox->addWidget(cancel);
233 connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
234 connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
235 233
236 setAdvancedVisible(m_advancedVisible); 234 setAdvancedVisible(m_advancedVisible);
237 } 235 }
238 236
239 PluginParameterDialog::~PluginParameterDialog() 237 PluginParameterDialog::~PluginParameterDialog()
381 } 379 }
382 if (!found) { 380 if (!found) {
383 blockSizeCombo->addItem(QString("%1").arg(size)); 381 blockSizeCombo->addItem(QString("%1").arg(size));
384 blockSizeCombo->setCurrentIndex(blockSizeCombo->count() - 1); 382 blockSizeCombo->setCurrentIndex(blockSizeCombo->count() - 1);
385 } 383 }
386 blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); 384 blockSizeCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
387 connect(blockSizeCombo, SIGNAL(editTextChanged(const QString &)), 385 connect(blockSizeCombo, SIGNAL(editTextChanged(const QString &)),
388 this, SLOT(blockSizeComboChanged(const QString &))); 386 this, SLOT(blockSizeComboChanged(const QString &)));
389 windowLayout->addWidget(blockSizeCombo, 0, 1); 387 windowLayout->addWidget(blockSizeCombo, 0, 1);
390 388
391 windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0); 389 windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0);
403 } 401 }
404 if (!found) { 402 if (!found) {
405 incrementCombo->addItem(QString("%1").arg(increment)); 403 incrementCombo->addItem(QString("%1").arg(increment));
406 incrementCombo->setCurrentIndex(incrementCombo->count() - 1); 404 incrementCombo->setCurrentIndex(incrementCombo->count() - 1);
407 } 405 }
408 incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this)); 406 incrementCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
409 connect(incrementCombo, SIGNAL(editTextChanged(const QString &)), 407 connect(incrementCombo, SIGNAL(editTextChanged(const QString &)),
410 this, SLOT(incrementComboChanged(const QString &))); 408 this, SLOT(incrementComboChanged(const QString &)));
411 windowLayout->addWidget(incrementCombo, 1, 1); 409 windowLayout->addWidget(incrementCombo, 1, 1);
412 410
413 if (showFrequencyDomainOptions) { 411 if (showFrequencyDomainOptions) {