]> git.sesse.net Git - kdenlive/blob - src/clipitem.h
ce44a7eec275b606c65061a5988d72b830824fce
[kdenlive] / src / clipitem.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef CLIPITEM_H
22 #define CLIPITEM_H
23
24 #include <QGraphicsRectItem>
25 #include <QDomElement>
26 #include <QGraphicsSceneMouseEvent>
27
28 #include "definitions.h"
29 #include "kthumb.h"
30
31
32 class ClipItem : public QObject, public QGraphicsRectItem
33 {
34   Q_OBJECT
35
36   public:
37     ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect, int duration = -1);
38     virtual ~ ClipItem();
39     virtual void paint(QPainter *painter,
40                            const QStyleOptionGraphicsItem *option,
41                            QWidget *widget);
42     virtual int type () const;
43     void moveTo(int x, double scale, double offset, int newTrack);
44     void resizeStart(int posx, double scale);
45     void resizeEnd(int posx, double scale);
46     OPERATIONTYPE operationMode(QPointF pos);
47     int clipProducer();
48     int clipType();
49     QString clipName();
50     int maxDuration();
51     int track();
52     void setTrack(int track);
53     int startPos();
54     int endPos();
55     int duration();
56     QDomElement xml() const;
57
58   protected:
59     virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
60     virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
61     virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
62
63   private:
64     QDomElement m_xml;
65     int m_textWidth;
66     OPERATIONTYPE m_resizeMode;
67     int m_grabPoint;
68     int m_producer;
69     CLIPTYPE m_clipType;
70     QString m_clipName;
71     int m_maxDuration;
72     int m_cropStart;
73     int m_cropDuration;
74     int m_maxTrack;
75     int m_track;
76     int m_startPos;
77     QPixmap m_startPix;
78     QPixmap m_endPix;
79     KThumb *m_thumbProd;
80     QTimer *startThumbTimer;
81     QTimer *endThumbTimer;
82
83   private slots:
84     void slotThumbReady(int frame, QPixmap pix);
85     void slotFetchThumbs();
86     void slotGetStartThumb();
87     void slotGetEndThumb();
88
89   signals:
90     void getThumb(int, int, int, int);
91
92 };
93
94 #endif