Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
55:6befca60ab4e | 56:2157fa46c1e7 |
---|---|
27 public: | 27 public: |
28 virtual ~TransformFactory(); | 28 virtual ~TransformFactory(); |
29 | 29 |
30 static TransformFactory *instance(); | 30 static TransformFactory *instance(); |
31 | 31 |
32 // The name is intended to be computer-referencable, and unique | 32 // The name is intended to be computer-referenceable, and unique |
33 // within the application. The description is intended to be | 33 // within the application. The description is intended to be |
34 // human readable. In principle it doesn't have to be unique, but | 34 // human readable. In principle it doesn't have to be unique, but |
35 // the factory will add suffixes to ensure that it is, all the | 35 // the factory will add suffixes to ensure that it is, all the |
36 // same (just to avoid user confusion). | 36 // same (just to avoid user confusion). |
37 | 37 |
38 struct TransformDesc { | 38 struct TransformDesc { |
39 TransformDesc(TransformName _name, QString _description = "") : | 39 TransformDesc() { } |
40 name(_name), description(_description) { } | 40 TransformDesc(TransformName _name, QString _description, bool _configurable) : |
41 name(_name), description(_description), configurable(_configurable) { } | |
41 TransformName name; | 42 TransformName name; |
42 QString description; | 43 QString description; |
44 bool configurable; | |
43 }; | 45 }; |
44 typedef std::vector<TransformDesc> TransformList; | 46 typedef std::vector<TransformDesc> TransformList; |
45 | 47 |
46 TransformList getAllTransforms(); | 48 TransformList getAllTransforms(); |
49 | |
50 /** | |
51 * Get a configuration XML string for the given transform (by | |
52 * asking the user, most likely). Returns true if the transform | |
53 * is acceptable, false if the operation should be cancelled. | |
54 */ | |
55 bool getConfigurationForTransform(TransformName name, Model *inputModel, | |
56 QString &configurationXml); | |
47 | 57 |
48 /** | 58 /** |
49 * Return the output model resulting from applying the named | 59 * Return the output model resulting from applying the named |
50 * transform to the given input model. The transform may still be | 60 * transform to the given input model. The transform may still be |
51 * working in the background when the model is returned; check the | 61 * working in the background when the model is returned; check the |
56 * problem occurs, return 0. | 66 * problem occurs, return 0. |
57 * | 67 * |
58 * The returned model is owned by the caller and must be deleted | 68 * The returned model is owned by the caller and must be deleted |
59 * when no longer needed. | 69 * when no longer needed. |
60 */ | 70 */ |
61 Model *transform(TransformName name, Model *inputModel); | 71 Model *transform(TransformName name, Model *inputModel, |
72 QString configurationXml = ""); | |
62 | 73 |
63 /** | 74 /** |
64 * Full description of a transform, suitable for putting on a menu. | 75 * Full description of a transform, suitable for putting on a menu. |
65 */ | 76 */ |
66 QString getTransformDescription(TransformName name); | 77 QString getTransformDescription(TransformName name); |
80 | 91 |
81 protected slots: | 92 protected slots: |
82 void transformFinished(); | 93 void transformFinished(); |
83 | 94 |
84 protected: | 95 protected: |
85 Transform *createTransform(TransformName name, Model *inputModel); | |
86 Transform *createTransform(TransformName name, Model *inputModel, | 96 Transform *createTransform(TransformName name, Model *inputModel, |
87 bool start); | 97 QString configurationXml, bool start); |
88 | 98 |
89 typedef std::map<TransformName, QString> TransformMap; | 99 struct TransformIdent |
90 TransformMap m_transforms; | 100 { |
101 TransformName name; | |
102 QString configurationXml; | |
103 }; | |
104 | |
105 typedef std::map<TransformName, QString> TransformConfigurationMap; | |
106 TransformConfigurationMap m_lastConfigurations; | |
107 | |
108 typedef std::map<TransformName, TransformDesc> TransformDescriptionMap; | |
109 TransformDescriptionMap m_transforms; | |
110 | |
91 void populateTransforms(); | 111 void populateTransforms(); |
92 | 112 |
93 static TransformFactory *m_instance; | 113 static TransformFactory *m_instance; |
94 }; | 114 }; |
95 | 115 |