annotate transform/TransformFactory.h @ 16:cc98d496d52b

* Add command history class, and basic undo/redo menus. No actual commands to undo/redo yet. Selecting the placeholders sometimes seems to cause a crash, so this looks a little uncertain so far. * Add Rename Layer * Remove models from playback when their layers are removed (and ref counts hit zero) * Don't hang around waiting so much when there's work to be done in the audio buffer fill thread * Put more sensible names on layers generated from transforms * Add basic editing to time-value layer like existing editing in time-instants layer, and make both of them snap to the appropriate resolution during drag
author Chris Cannam
date Mon, 30 Jan 2006 17:51:56 +0000
parents d86891498eef
children 4563a72c1d8b
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@2 5 Chris Cannam, Queen Mary University of London, 2005-2006
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef _TRANSFORM_FACTORY_H_
Chris@0 11 #define _TRANSFORM_FACTORY_H_
Chris@0 12
Chris@0 13 #include "Transform.h"
Chris@0 14
Chris@16 15 #include <map>
Chris@16 16
Chris@0 17 class TransformFactory : public QObject
Chris@0 18 {
Chris@0 19 Q_OBJECT
Chris@0 20
Chris@0 21 public:
Chris@0 22 virtual ~TransformFactory();
Chris@0 23
Chris@0 24 static TransformFactory *instance();
Chris@0 25
Chris@0 26 // The name is intended to be computer-referencable, and unique
Chris@0 27 // within the application. The description should be
Chris@0 28 // human-readable, and does not have to be unique.
Chris@0 29
Chris@0 30 struct TransformDesc {
Chris@0 31 TransformDesc(TransformName _name, QString _description = "") :
Chris@0 32 name(_name), description(_description) { }
Chris@0 33 TransformName name;
Chris@0 34 QString description;
Chris@0 35 };
Chris@0 36 typedef std::vector<TransformDesc> TransformList;
Chris@0 37
Chris@0 38 TransformList getAllTransforms();
Chris@0 39
Chris@0 40 /**
Chris@0 41 * Return the output model resulting from applying the named
Chris@0 42 * transform to the given input model. The transform may still be
Chris@0 43 * working in the background when the model is returned; check the
Chris@0 44 * output model's isReady completion status for more details.
Chris@0 45 *
Chris@0 46 * If the transform is unknown or the input model is not an
Chris@0 47 * appropriate type for the given transform, or if some other
Chris@0 48 * problem occurs, return 0.
Chris@0 49 *
Chris@0 50 * The returned model is owned by the caller and must be deleted
Chris@0 51 * when no longer needed.
Chris@0 52 */
Chris@0 53 Model *transform(TransformName name, Model *inputModel);
Chris@0 54
Chris@16 55 QString getTransformDescription(TransformName name);
Chris@16 56
Chris@0 57 //!!! Need some way to indicate that the input model has changed /
Chris@0 58 //been deleted so as not to blow up backgrounded transform! -- Or
Chris@0 59 //indeed, if the output model has been deleted -- could equally
Chris@0 60 //well happen!
Chris@0 61
Chris@0 62 //!!! Need transform category!
Chris@0 63
Chris@0 64 protected slots:
Chris@0 65 void transformFinished();
Chris@0 66
Chris@0 67 protected:
Chris@0 68 Transform *createTransform(TransformName name, Model *inputModel);
Chris@0 69 Transform *createTransform(TransformName name, Model *inputModel,
Chris@0 70 bool start);
Chris@0 71
Chris@16 72 typedef std::map<TransformName, QString> TransformMap;
Chris@16 73 TransformMap m_transforms;
Chris@16 74 void populateTransforms();
Chris@16 75
Chris@0 76 static TransformFactory *m_instance;
Chris@0 77 };
Chris@0 78
Chris@0 79
Chris@0 80 #endif