changeset 64:10bcd53ddc71

* Add icon for playback plugin edit button * Make playback plugins respond to parameter & program changes while their edit dialog is still visible
author Chris Cannam
date Thu, 23 Mar 2006 18:42:17 +0000
parents fb02fe13ff47
children 7f608ec9a061
files widgets/PluginParameterBox.cpp widgets/PluginParameterBox.h widgets/PluginParameterDialog.cpp widgets/PluginParameterDialog.h widgets/PropertyBox.cpp widgets/PropertyBox.h
diffstat 6 files changed, 38 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/PluginParameterBox.cpp	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PluginParameterBox.cpp	Thu Mar 23 18:42:17 2006 +0000
@@ -192,6 +192,8 @@
     }
 
     m_plugin->setParameter(name.toStdString(), newValue);
+
+    emit pluginConfigurationChanged(m_plugin->toXmlString());
 }
 
 void
@@ -209,6 +211,8 @@
 
     if (state) m_plugin->setParameter(name.toStdString(), 1.0);
     else m_plugin->setParameter(name.toStdString(), 0.0);
+
+    emit pluginConfigurationChanged(m_plugin->toXmlString());
 }
 
 void
@@ -253,6 +257,8 @@
     }
 
     m_plugin->setParameter(name.toStdString(), value);
+
+    emit pluginConfigurationChanged(m_plugin->toXmlString());
 }
 
 void
@@ -289,5 +295,7 @@
             i->second.dial->blockSignals(false);
         }
     }
+
+    emit pluginConfigurationChanged(m_plugin->toXmlString());
 }
 
--- a/widgets/PluginParameterBox.h	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PluginParameterBox.h	Thu Mar 23 18:42:17 2006 +0000
@@ -36,6 +36,9 @@
 
     PluginInstance *getPlugin() { return m_plugin; }
 
+signals:
+    void pluginConfigurationChanged(QString);
+
 protected slots:
     void dialChanged(int);
     void spinBoxChanged(double);
--- a/widgets/PluginParameterDialog.cpp	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PluginParameterDialog.cpp	Thu Mar 23 18:42:17 2006 +0000
@@ -88,6 +88,8 @@
     paramBox->setLayout(paramLayout);
 
     m_parameterBox = new PluginParameterBox(m_plugin);
+    connect(m_parameterBox, SIGNAL(pluginConfigurationChanged(QString)),
+            this,  SIGNAL(pluginConfigurationChanged(QString)));
     paramLayout->addWidget(m_parameterBox);
 
     QHBoxLayout *hbox = new QHBoxLayout;
--- a/widgets/PluginParameterDialog.h	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PluginParameterDialog.h	Thu Mar 23 18:42:17 2006 +0000
@@ -39,6 +39,9 @@
 
     PluginInstance *getPlugin() { return m_plugin; }
 
+signals:
+    void pluginConfigurationChanged(QString);
+
 protected:
     PluginInstance *m_plugin;
     PluginParameterBox *m_parameterBox;
--- a/widgets/PropertyBox.cpp	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PropertyBox.cpp	Thu Mar 23 18:42:17 2006 +0000
@@ -154,7 +154,9 @@
 	layout->insertStretch(-1, 10);
 
         if (params->getPlayPluginId() != "") {
-            QPushButton *pluginButton = new QPushButton("E");
+            QPushButton *pluginButton = new QPushButton(QIcon(":icons/faders.png"), "");
+            pluginButton->setFixedWidth(24);
+            pluginButton->setFixedHeight(24);
             layout->addWidget(pluginButton);
             connect(pluginButton, SIGNAL(clicked()),
                     this, SLOT(editPlugin()));
@@ -486,14 +488,32 @@
     instance->setParametersFromXml(configurationXml);
 
     PluginParameterDialog *dialog = new PluginParameterDialog(instance);
+    connect(dialog, SIGNAL(pluginConfigurationChanged(QString)),
+            this, SLOT(pluginConfigurationChanged(QString)));
+
     if (dialog->exec() == QDialog::Accepted) {
         params->setPlayPluginConfiguration(instance->toXmlString());
+    } else {
+        // restore in case we mucked about with the configuration
+        // as a consequence of signals from the dialog
+        params->setPlayPluginConfiguration(configurationXml);
     }
 
     delete dialog;
     delete instance;
 }
 
+void
+PropertyBox::pluginConfigurationChanged(QString configurationXml)
+{
+    PlayParameters *params = m_container->getPlayParameters();
+    if (!params) return;
+
+    params->setPlayPluginConfiguration(configurationXml);
+}    
+    
+    
+
 #ifdef INCLUDE_MOCFILES
 #include "PropertyBox.moc.cpp"
 #endif
--- a/widgets/PropertyBox.h	Thu Mar 23 15:49:41 2006 +0000
+++ b/widgets/PropertyBox.h	Thu Mar 23 18:42:17 2006 +0000
@@ -45,6 +45,7 @@
 
 public slots:
     void propertyContainerPropertyChanged(PropertyContainer *);
+    void pluginConfigurationChanged(QString);
 
 protected slots:
     void propertyControllerChanged(int);