AbstractGraphicsMediaItem.h 3.12 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 27
/*****************************************************************************
 * AbstractGraphicsMediaItem.h: Base class for media representation
 *****************************************************************************
 * 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 ABSTRACTGRAPHICSMEDIAITEM_H
#define ABSTRACTGRAPHICSMEDIAITEM_H

#include <QGraphicsItem>
#include <QUuid>
28 29 30 31
#include <QCursor>
#include "GraphicsTrack.hpp"

class TracksView;
32 33 34 35

class AbstractGraphicsMediaItem : public QObject, public QGraphicsItem
{
    Q_OBJECT
36
    friend class TracksView;
37
public:
38
    AbstractGraphicsMediaItem();
39 40
    virtual ~AbstractGraphicsMediaItem() { }

41 42 43
    /// Return the Type of the MediaItem (see http://doc.trolltech.com/4.5/qgraphicsitem.html#type)
    virtual int type() const = 0;

44 45 46 47 48 49 50 51
    /// The item length can be expanded or shrinked by the user.
    virtual bool expandable() const = 0;

    /// The item can be moved by the user.
    virtual bool moveable() const = 0;

    /// Should return the unique uid of the contained media.
    virtual const QUuid& uuid() const = 0;
52

53 54 55
    /// Clip contained in the item
    virtual Clip* clip() const = 0;

56 57 58
    /// Return the type of the media
    virtual MainWorkflow::TrackType mediaType() const = 0;

59 60 61 62 63 64
    /// Group two items together
    void group( AbstractGraphicsMediaItem* item );

    /// Ungroup two items
    void ungroup();

65
    /// Return the current track of the item
66
    quint32 trackNumber();
67

68 69 70 71 72 73
    /// Set the position of the item (in frames) for the x-axis.
    void setStartPos( qint64 position );

    /// Return the position of the item (in frames) for the x-axis.
    qint64 startPos();

74 75 76 77 78 79 80
protected:
    /**
     * Returns the current tracksView for the item,
     * or 0 if the item is not stored in a tracksView.
     */
    TracksView* tracksView();

81 82 83
    /**
     * Contains the old trackNumber
     */
84
    unsigned int oldTrackNumber;
85 86 87 88
    /**
     * Contains the old position
     */
    qint64 oldPosition;
89

90 91 92 93 94 95
    /**
     * Pointer to the linked item
     * or NULL if it isn't.
     */
    AbstractGraphicsMediaItem* groupItem();

96 97 98 99
private:
    /// This pointer will be set when inserted in the tracksView.
    TracksView* m_tracksView;

100 101 102
    /// Pointer used to save the address of a linked item.
    AbstractGraphicsMediaItem* m_group;

103 104 105
};

#endif // ABSTRACTGRAPHICSMEDIAITEM_H