Mercurial > hg > svcore
comparison transform/TransformFactory.h @ 0:da6937383da8
initial import
author | Chris Cannam |
---|---|
date | Tue, 10 Jan 2006 16:33:16 +0000 |
parents | |
children | d86891498eef |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:da6937383da8 |
---|---|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 A waveform viewer and audio annotation editor. | |
5 Chris Cannam, Queen Mary University of London, 2005 | |
6 | |
7 This is experimental software. Not for distribution. | |
8 */ | |
9 | |
10 #ifndef _TRANSFORM_FACTORY_H_ | |
11 #define _TRANSFORM_FACTORY_H_ | |
12 | |
13 #include "Transform.h" | |
14 | |
15 class TransformFactory : public QObject | |
16 { | |
17 Q_OBJECT | |
18 | |
19 public: | |
20 virtual ~TransformFactory(); | |
21 | |
22 static TransformFactory *instance(); | |
23 | |
24 // The name is intended to be computer-referencable, and unique | |
25 // within the application. The description should be | |
26 // human-readable, and does not have to be unique. | |
27 | |
28 struct TransformDesc { | |
29 TransformDesc(TransformName _name, QString _description = "") : | |
30 name(_name), description(_description) { } | |
31 TransformName name; | |
32 QString description; | |
33 }; | |
34 typedef std::vector<TransformDesc> TransformList; | |
35 | |
36 TransformList getAllTransforms(); | |
37 | |
38 /** | |
39 * Return the output model resulting from applying the named | |
40 * transform to the given input model. The transform may still be | |
41 * working in the background when the model is returned; check the | |
42 * output model's isReady completion status for more details. | |
43 * | |
44 * If the transform is unknown or the input model is not an | |
45 * appropriate type for the given transform, or if some other | |
46 * problem occurs, return 0. | |
47 * | |
48 * The returned model is owned by the caller and must be deleted | |
49 * when no longer needed. | |
50 */ | |
51 Model *transform(TransformName name, Model *inputModel); | |
52 | |
53 //!!! Need some way to indicate that the input model has changed / | |
54 //been deleted so as not to blow up backgrounded transform! -- Or | |
55 //indeed, if the output model has been deleted -- could equally | |
56 //well happen! | |
57 | |
58 //!!! Need transform category! | |
59 | |
60 protected slots: | |
61 void transformFinished(); | |
62 | |
63 protected: | |
64 Transform *createTransform(TransformName name, Model *inputModel); | |
65 Transform *createTransform(TransformName name, Model *inputModel, | |
66 bool start); | |
67 | |
68 static TransformFactory *m_instance; | |
69 }; | |
70 | |
71 | |
72 #endif |