1 /***************************************************************************
2 * Copyright (C) 2008 by Marco Gittler (g.marco@freenet.de) *
3 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
19 ***************************************************************************/
21 #ifndef ABSTRACTCLIPITEM
22 #define ABSTRACTCLIPITEM
24 #include <QGraphicsRectItem>
25 #include <QGraphicsWidget>
27 #if QT_VERSION >= 0x040600
28 #include <QPropertyAnimation>
31 #include "definitions.h"
34 class CustomTrackScene;
35 class QGraphicsSceneMouseEvent;
37 class AbstractClipItem : public QObject, public QGraphicsRectItem
40 #if QT_VERSION >= 0x040600
41 Q_PROPERTY(QRectF rect READ rect WRITE setRect)
45 AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
46 virtual ~ AbstractClipItem();
47 void updateSelectedKeyFrame();
48 void updateKeyFramePos(const GenTime pos, const double value);
49 void addKeyFrame(const GenTime pos, const double value);
50 bool hasKeyFrames() const;
51 int selectedKeyFramePos() const;
52 double selectedKeyFrameValue() const;
53 double keyFrameFactor() const;
54 ItemInfo info() const;
55 CustomTrackScene* projectScene();
56 void updateRectGeometry();
58 void setItemLocked(bool locked);
59 bool isItemLocked() const;
60 void closeAnimation();
62 virtual OPERATIONTYPE operationMode(QPointF pos) = 0;
63 virtual GenTime startPos() const ;
64 virtual void setTrack(int track);
65 virtual GenTime endPos() const ;
66 virtual int defaultZValue() const ;
67 virtual int track() const ;
68 virtual GenTime cropStart() const ;
69 virtual GenTime cropDuration() const ;
70 virtual void resizeStart(int posx);
71 virtual void resizeEnd(int posx);
72 virtual double fps() const;
73 virtual void updateFps(double fps);
74 virtual GenTime maxDuration() const;
75 virtual void setCropStart(GenTime pos);
81 int m_selectedKeyframe;
82 /* GenTime m_cropStart;
83 GenTime m_cropDuration;
85 GenTime m_maxDuration;
86 QMap <int, int> m_keyframes;
87 double m_keyframeFactor;
88 double m_keyframeDefault;
90 //QRect visibleRect();
91 void drawKeyFrames(QPainter *painter, QRectF exposedRect);
92 int mouseOverKeyFrames(QPointF pos, double maxOffset);
93 virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
96 #if QT_VERSION >= 0x040600
97 QPropertyAnimation *m_closeAnimation;