diff transform/TransformFactory.h @ 56:2157fa46c1e7

* 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 d397ea0a79f5
children 7439f1696314
line wrap: on
line diff
--- a/transform/TransformFactory.h	Wed Mar 22 13:23:50 2006 +0000
+++ b/transform/TransformFactory.h	Wed Mar 22 17:38:29 2006 +0000
@@ -29,23 +29,33 @@
 
     static TransformFactory *instance();
 
-    // The name is intended to be computer-referencable, and unique
+    // The name is intended to be computer-referenceable, and unique
     // within the application.  The description is intended to be
     // human readable.  In principle it doesn't have to be unique, but
     // the factory will add suffixes to ensure that it is, all the
     // same (just to avoid user confusion).
 
     struct TransformDesc {
-	TransformDesc(TransformName _name, QString _description = "") :
-	    name(_name), description(_description) { }
+        TransformDesc() { }
+	TransformDesc(TransformName _name, QString _description, bool _configurable) :
+	    name(_name), description(_description), configurable(_configurable) { }
 	TransformName name;
 	QString description;
+        bool configurable;
     };
     typedef std::vector<TransformDesc> TransformList;
 
     TransformList getAllTransforms();
 
     /**
+     * Get a configuration XML string for the given transform (by
+     * asking the user, most likely).  Returns true if the transform
+     * is acceptable, false if the operation should be cancelled.
+     */
+    bool getConfigurationForTransform(TransformName name, Model *inputModel,
+                                      QString &configurationXml);
+
+    /**
      * Return the output model resulting from applying the named
      * transform to the given input model.  The transform may still be
      * working in the background when the model is returned; check the
@@ -58,7 +68,8 @@
      * The returned model is owned by the caller and must be deleted
      * when no longer needed.
      */
-    Model *transform(TransformName name, Model *inputModel);
+    Model *transform(TransformName name, Model *inputModel,
+                     QString configurationXml = "");
 
     /**
      * Full description of a transform, suitable for putting on a menu.
@@ -82,12 +93,21 @@
     void transformFinished();
 
 protected:
-    Transform *createTransform(TransformName name, Model *inputModel);
     Transform *createTransform(TransformName name, Model *inputModel,
-			       bool start);
+                               QString configurationXml, bool start);
 
-    typedef std::map<TransformName, QString> TransformMap;
-    TransformMap m_transforms;
+    struct TransformIdent
+    {
+        TransformName name;
+        QString configurationXml;
+    };
+
+    typedef std::map<TransformName, QString> TransformConfigurationMap;
+    TransformConfigurationMap m_lastConfigurations;
+
+    typedef std::map<TransformName, TransformDesc> TransformDescriptionMap;
+    TransformDescriptionMap m_transforms;
+
     void populateTransforms();
 
     static TransformFactory *m_instance;