]> git.sesse.net Git - kdenlive/blobdiff - src/clipitem.h
Fix location of audiothumbs
[kdenlive] / src / clipitem.h
index 9f548a000fc2237089d8346ee62fbd8022d41235..46252e108261cf7903a66a7d6ffdef13de79a2f4 100644 (file)
 #define CLIPITEM_H
 
 #include <QGraphicsRectItem>
+#include <QDomElement>
 #include <QGraphicsSceneMouseEvent>
 
-#include "labelitem.h"
 #include "definitions.h"
+#include "gentime.h"
+#include "effectslist.h"
+#include "docclipbase.h"
+#include "kthumb.h"
 
-class ClipItem : public QGraphicsRectItem
+
+class ClipItem : public QObject, public QGraphicsRectItem
 {
-  
+  Q_OBJECT
+
   public:
-    ClipItem(int clipType, QString name, int producer, int maxDuration, const QRectF & rect);
+    ClipItem(DocClipBase *clip, int track, int startpos, const QRectF & rect, int duration);
+    virtual ~ ClipItem();
     virtual void paint(QPainter *painter,
                            const QStyleOptionGraphicsItem *option,
                            QWidget *widget);
     virtual int type () const;
-    void moveTo(double x, double offset);
-    OPERATIONTYPE operationMode(QPointF pos);
+    void moveTo(int x, double scale, double offset, int newTrack);
+    void resizeStart(int posx, double scale);
+    void resizeEnd(int posx, double scale);
+    OPERATIONTYPE operationMode(QPointF pos, double scale);
     int clipProducer();
     int clipType();
+    DocClipBase *baseClip();
     QString clipName();
     int maxDuration();
+    int track();
+    void setTrack(int track);
+    int startPos();
+    int cropStart();
+    int endPos();
+    int duration();
+    QDomElement xml() const;
+    int fadeIn() const;
+    int fadeOut() const;
+    void setFadeOut(int pos, double scale);
+    void setFadeIn(int pos, double scale);
+    /** Give a string list of the clip's effect names */
+    QStringList effectNames();
+    /** Add an effect to the clip and return the parameters that will be passed to Mlt */
+    QMap <QString, QString> addEffect(QDomElement effect);
+    /** Get the effect parameters that will be passed to Mlt */
+    QMap <QString, QString> getEffectArgs(QDomElement effect);
+    /** Delete effect with id index */
+    void deleteEffect(QString index);
+    /** return the number of effects in that clip */
+    int effectsCount();
+    /** return a unique effect id */
+    int effectsCounter();
+    /** return the xml of effect at index ix in stack */
+    QDomElement effectAt(int ix);
+    /** Replace effect at pos ix with given value */
+    void setEffectAt(int ix, QDomElement effect);
 
   protected:
     virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
@@ -49,17 +86,42 @@ class ClipItem : public QGraphicsRectItem
     virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
 
   private:
-    LabelItem *m_label;
+    QDomElement m_xml;
+    DocClipBase *m_clip;
     int m_textWidth;
     OPERATIONTYPE m_resizeMode;
     int m_grabPoint;
     int m_producer;
-    int m_clipType;
+    CLIPTYPE m_clipType;
     QString m_clipName;
     int m_maxDuration;
     int m_cropStart;
     int m_cropDuration;
     int m_maxTrack;
+    int m_track;
+    int m_startPos;
+    QPixmap m_startPix;
+    QPixmap m_endPix;
+    bool m_hasThumbs;
+    QTimer *startThumbTimer;
+    QTimer *endThumbTimer;
+    uint m_startFade;
+    uint m_endFade;
+    /** counter used to provide a unique id to each effect */
+    int m_effectsCounter;
+    
+    EffectsList m_effectList;
+
+  private slots:
+    void slotThumbReady(int frame, QPixmap pix);
+    void slotFetchThumbs();
+    void slotGetStartThumb();
+    void slotGetEndThumb();
+    void slotGotAudioData();
+
+  signals:
+    void getThumb(int, int);
+
 };
 
 #endif