diff widgets/PluginParameterBox.cpp @ 62:50429a56680f

* Add plugin parameter dialog, and use it to set up parameters for feature extraction plugins via a semi-opaque (translucent?) configurationXml string which is associated with a given transform instance. This is not yet saved to and restored from the SV file properly. * Remove no-longer-relevant BeatDetect and BeatDetectionFunction transforms (replaced a long time ago with the beat detector plugin).
author Chris Cannam
date Wed, 22 Mar 2006 17:38:29 +0000
parents 4df1a479bf10
children fb02fe13ff47
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp	Mon Mar 20 18:42:42 2006 +0000
+++ b/widgets/PluginParameterBox.cpp	Wed Mar 22 17:38:29 2006 +0000
@@ -25,7 +25,8 @@
 #include <iostream>
 #include <string>
 
-PluginParameterBox::PluginParameterBox(PluginInstance *plugin) :
+PluginParameterBox::PluginParameterBox(PluginInstance *plugin, QWidget *parent) :
+    QFrame(parent),
     m_plugin(plugin)
 {
     m_layout = new QGridLayout;
@@ -44,6 +45,12 @@
 
     m_params.clear();
 
+    if (params.empty()) {
+        m_layout->addWidget
+            (new QLabel(tr("This plugin has no adjustable parameters.")),
+             0, 0);
+    }
+
     for (size_t i = 0; i < params.size(); ++i) {
 
         QString name = params[i].name.c_str();
@@ -53,6 +60,7 @@
         float min = params[i].minValue;
         float max = params[i].maxValue;
         float deft = params[i].defaultValue;
+        float value = m_plugin->getParameter(params[i].name);
 
         float qtz = 0.0;
         if (params[i].isQuantized) qtz = params[i].quantizeStep;
@@ -80,6 +88,9 @@
         dial->setPageStep(1);
         dial->setNotchesVisible((imax - imin) <= 12);
         dial->setDefaultValue(int((deft - min) / qtz));
+        dial->setValue(int((value - min) / qtz));
+	dial->setFixedWidth(32);
+	dial->setFixedHeight(32);
         connect(dial, SIGNAL(valueChanged(int)),
                 this, SLOT(dialChanged(int)));
         m_layout->addWidget(dial, i, 1);
@@ -88,9 +99,9 @@
         spinbox->setObjectName(name);
         spinbox->setMinimum(min);
         spinbox->setMaximum(max);
-        spinbox->setSuffix(unit);
+        spinbox->setSuffix(QString(" %1").arg(unit));
         spinbox->setSingleStep(qtz);
-        spinbox->setValue(deft);
+        spinbox->setValue(value);
         connect(spinbox, SIGNAL(valueChanged(double)),
                 this, SLOT(spinBoxChanged(double)));
         m_layout->addWidget(spinbox, i, 2);