GraphicsMovieItem.h 3.42 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*****************************************************************************
 * GraphicsMovieItem.h: Represent a movie graphically in the timeline
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * Authors: Ludovic Fauvet <etix@l0cal.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#ifndef GRAPHICSMOVIEITEM_H
#define GRAPHICSMOVIEITEM_H

#include "AbstractGraphicsMediaItem.h"
27
#include "Clip.h"
28
#include "TracksView.h"
29

30
31
32
#define Z_SELECTED 4
#define Z_NOT_SELECTED 3

33
34
#define ROUNDED_RECT_RADIUS 5

35
36
37
/**
 * \brief Represents a video item.
 */
38
39
40
41
class GraphicsMovieItem : public AbstractGraphicsMediaItem
{
    Q_OBJECT
public:
42
43
44
    /**
     * \brief See http://doc.trolltech.com/4.5/qgraphicsitem.html#type
     */
45
    enum { Type = UserType + 1 };
46
    GraphicsMovieItem( Clip* clip );
47
48
49
50
51
52
    virtual ~GraphicsMovieItem();

    virtual int type() const { return Type; }
    virtual bool expandable() const { return false; }
    virtual bool moveable() const { return true; }
    virtual const QUuid& uuid() const { return m_clip->getUuid(); }
53
    virtual MainWorkflow::TrackType mediaType() const;
54
55
    virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0 );

56
    virtual Clip* clip() const;
57

58
protected:
59
60
61
62
63
    /**
     * \brief Paint the item's rectangle.
     * \param painter Pointer to a QPainter.
     * \param option Painting options.
     */
64
    void                paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option );
65
66
67
68
69
    /**
     * \brief Paint the item's title.
     * \param painter Pointer to a QPainter.
     * \param option Painting options.
     */
70
    void                paintTitle( QPainter* painter, const QStyleOptionGraphicsItem* option );
71
72
    virtual void        hoverEnterEvent( QGraphicsSceneHoverEvent* event );
    virtual void        hoverLeaveEvent( QGraphicsSceneHoverEvent* event );
Ludovic Fauvet's avatar
Ludovic Fauvet committed
73
    virtual void        hoverMoveEvent( QGraphicsSceneHoverEvent* event );
74
75
    virtual void        mousePressEvent( QGraphicsSceneMouseEvent* event );
    virtual void        mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
76
77

private:
78
79
80
81
    /**
     * \brief Check if the position given as parameter could be taken as a resize request.
     * \return Returns True if the point is in a resize zone.
     */
82
    bool                resizeZone( const QPointF& position );
83
    Clip*               m_clip;
84
85

signals:
86
87
88
89
90
    /**
     * \brief Emitted when the item detect a cut request.
     * \param self A pointer to the sender.
     * \param frame Frame's number where the cut takes place.
     */
91
    void                split( GraphicsMovieItem* self, qint64 frame );
92
93
94
};

#endif // GRAPHICSMOVIEITEM_H