/***************************************************************************** * AbstractGraphicsMediaItem.h: Base class for media representation ***************************************************************************** * Copyright (C) 2008-2009 the VLMC team * * Authors: Ludovic Fauvet * * 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 #include #include #include "GraphicsTrack.hpp" class TracksView; class AbstractGraphicsMediaItem : public QObject, public QGraphicsItem { Q_OBJECT friend class TracksView; public: AbstractGraphicsMediaItem(); virtual ~AbstractGraphicsMediaItem() { } /// Return the Type of the MediaItem (see http://doc.trolltech.com/4.5/qgraphicsitem.html#type) virtual int type() const = 0; /// 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; /// Clip contained in the item virtual Clip* clip() const = 0; /// Return the type of the media virtual MainWorkflow::TrackType mediaType() const = 0; /// Group two items together void group( AbstractGraphicsMediaItem* item ); /// Ungroup two items void ungroup(); /// Return the current track of the item quint32 trackNumber(); /// 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(); protected: /** * Returns the current tracksView for the item, * or 0 if the item is not stored in a tracksView. */ TracksView* tracksView(); /** * Contains the old trackNumber */ unsigned int oldTrackNumber; /** * Contains the old position */ qint64 oldPosition; /** * Pointer to the linked item * or NULL if it isn't. */ AbstractGraphicsMediaItem* groupItem(); private: /// This pointer will be set when inserted in the tracksView. TracksView* m_tracksView; /// Pointer used to save the address of a linked item. AbstractGraphicsMediaItem* m_group; }; #endif // ABSTRACTGRAPHICSMEDIAITEM_H