]> git.sesse.net Git - kdenlive/blob - src/clipitem.h
More work on timeline widget
[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 "labelitem.h"
29 #include "definitions.h"
30 #include "kthumb.h"
31
32
33 class ClipItem : public QObject, public QGraphicsRectItem
34 {
35   Q_OBJECT
36
37   public:
38     ClipItem(QDomElement xml, int track, int startpos, const QRectF & rect, int duration = -1);
39     virtual void paint(QPainter *painter,
40                            const QStyleOptionGraphicsItem *option,
41                            QWidget *widget);
42     virtual int type () const;
43     void moveTo(double x, double scale, double offset, int newTrack);
44     OPERATIONTYPE operationMode(QPointF pos);
45     int clipProducer();
46     int clipType();
47     QString clipName();
48     int maxDuration();
49     int track();
50     void setTrack(int track);
51     int startPos();
52     int duration();
53     QDomElement xml() const;
54
55   protected:
56     virtual void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
57     virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
58     virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event );
59
60   private:
61     QDomElement m_xml;
62     LabelItem *m_label;
63     int m_textWidth;
64     OPERATIONTYPE m_resizeMode;
65     int m_grabPoint;
66     int m_producer;
67     int m_clipType;
68     QString m_clipName;
69     int m_maxDuration;
70     int m_cropStart;
71     int m_cropDuration;
72     int m_maxTrack;
73     int m_track;
74     int m_startPos;
75     QPixmap m_startPix;
76     QPixmap m_endPix;
77     KThumb *m_thumbProd;
78
79   private slots:
80     void slotThumbReady(int frame, QPixmap pix);
81     void slotFetchThumbs();
82
83   signals:
84     void getThumb(int, int, int, int);
85
86 };
87
88 #endif