diff 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
line wrap: on
line diff
--- a/widgets/PluginParameterDialog.cpp	Fri Sep 15 16:36:04 2006 +0000
+++ b/widgets/PluginParameterDialog.cpp	Mon Sep 18 16:43:17 2006 +0000
@@ -41,6 +41,9 @@
     QDialog(parent),
     m_plugin(plugin),
     m_channel(defaultChannel),
+    m_stepSize(0),
+    m_blockSize(0),
+    m_windowType(HanningWindow),
     m_parameterBox(0)
 {
     setWindowTitle(tr("Plugin Parameters"));
@@ -221,6 +224,9 @@
 
         std::cerr << "size: " << size << ", increment: " << increment << std::endl;
 
+        //!!! deal with block and step sizes (coming from the plugin's
+        // preferences) that don't fit into the default list
+
         QComboBox *blockSizeCombo = new QComboBox;
         blockSizeCombo->setEditable(true);
         for (int i = 0; i < 14; ++i) {
@@ -229,6 +235,8 @@
             if (val == size) blockSizeCombo->setCurrentIndex(i);
         }
         blockSizeCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
+        connect(blockSizeCombo, SIGNAL(valueChanged(QString)),
+                this, SLOT(blockSizeComboChanged(QString)));
         windowLayout->addWidget(blockSizeCombo, 0, 1);
 
         if (showFrequencyDomainOptions) {
@@ -243,17 +251,18 @@
                 if (val == increment) incrementCombo->setCurrentIndex(i);
             }
             incrementCombo->setValidator(new QIntValidator(1, pow(2, 18), this));
+            connect(incrementCombo, SIGNAL(valueChanged(QString)),
+                    this, SLOT(incrementComboChanged(QString)));
             windowLayout->addWidget(incrementCombo, 1, 1);
             
             windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0);
             WindowTypeSelector *windowTypeSelector = new WindowTypeSelector;
+            connect(windowTypeSelector, SIGNAL(windowTypeChanged(WindowType type)),
+                    this, SLOT(windowTypeChanged(type)));
             windowLayout->addWidget(windowTypeSelector, 2, 1);
         }
     }
 
-    //!!! We lack a comfortable way of passing around the channel and
-    //blocksize data
-
     QHBoxLayout *hbox = new QHBoxLayout;
     grid->addLayout(hbox, 4, 0);
 
@@ -294,6 +303,41 @@
 }
 
 void
+PluginParameterDialog::getProcessingParameters(size_t &blockSize) const
+{
+    blockSize = m_blockSize;
+    return;
+}
+
+void
+PluginParameterDialog::getProcessingParameters(size_t &stepSize,
+                                               size_t &blockSize,
+                                               WindowType &windowType) const
+{
+    stepSize = m_stepSize;
+    blockSize = m_blockSize;
+    windowType = m_windowType;
+}
+
+void
+PluginParameterDialog::blockSizeComboChanged(QString text)
+{
+    m_blockSize = text.toInt();
+}
+
+void
+PluginParameterDialog::incrementComboChanged(QString text)
+{
+    m_stepSize = text.toInt();
+}
+
+void
+PluginParameterDialog::windowTypeChanged(WindowType type)
+{
+    m_windowType = type;
+}
+
+void
 PluginParameterDialog::advancedToggled()
 {
     bool visible = !m_advanced->isVisible();