Commit 24d11dc9 authored by Ludovic Fauvet's avatar Ludovic Fauvet

TracksView pointer access from a a GraphicsItem.

parent 98511605
/*****************************************************************************
* 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.
*****************************************************************************/
#include "AbstractGraphicsMediaItem.h"
AbstractGraphicsMediaItem::AbstractGraphicsMediaItem() : m_tracksView( NULL )
{
}
TracksView* AbstractGraphicsMediaItem::tracksView()
{
return m_tracksView;
}
......@@ -25,11 +25,14 @@
#include <QGraphicsItem>
#include <QUuid>
#include "TracksView.h"
class AbstractGraphicsMediaItem : public QObject, public QGraphicsItem
{
Q_OBJECT
friend class TracksView;
public:
AbstractGraphicsMediaItem();
virtual ~AbstractGraphicsMediaItem() { }
/// The item length can be expanded or shrinked by the user.
......@@ -40,6 +43,18 @@ public:
/// Should return the unique uid of the contained media.
virtual const QUuid& uuid() const = 0;
protected:
/**
* Returns the current tracksView for the item,
* or 0 if the item is not stored in a tracksView.
*/
TracksView* tracksView();
private:
/// This pointer will be set when inserted in the tracksView.
TracksView* m_tracksView;
};
#endif // ABSTRACTGRAPHICSMEDIAITEM_H
......@@ -21,8 +21,9 @@
*****************************************************************************/
#include "GraphicsMovieItem.h"
#include "TracksView.h"
GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip )
GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip ), m_tracksView( NULL )
{
}
......@@ -33,5 +34,6 @@ GraphicsMovieItem::~GraphicsMovieItem()
int GraphicsMovieItem::tracksHeight()
{
//TODO Get this value from the TracksView
if ( !m_tracksView ) return 0;
return m_tracksView->tracksHeight();
}
......@@ -25,6 +25,7 @@
#include "AbstractGraphicsMediaItem.h"
#include "Clip.h"
#include "TracksView.h"
class GraphicsMovieItem : public AbstractGraphicsMediaItem
{
......@@ -42,6 +43,7 @@ protected:
private:
Clip* m_clip;
TracksView* m_tracksView;
};
#endif // GRAPHICSMOVIEITEM_H
......@@ -33,7 +33,8 @@ SOURCES += src/main.cpp \
src/MetaDataManager.cpp \
src/LibVLCpp/VLCMediaList.cpp \
src/Library.cpp \
src/gui/GraphicsMovieItem.cpp
src/gui/GraphicsMovieItem.cpp \
src/gui/AbstractGraphicsMediaItem.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment