Commit 8892561b authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen
Browse files

Media: Base clip can't be const.

Ho and please, don't clone an objet to get over its constness.
parent 9f6df32d
...@@ -133,15 +133,14 @@ void MediaCellView::mouseMoveEvent( QMouseEvent* event ) ...@@ -133,15 +133,14 @@ void MediaCellView::mouseMoveEvent( QMouseEvent* event )
QDrag* drag = new QDrag( this ); QDrag* drag = new QDrag( this );
drag->setMimeData( mimeData ); drag->setMimeData( mimeData );
//FIXME : change the way the library handles Clips //FIXME : change the way the library handles Clips
Clip* clip = Library::getInstance()->clip( m_uuid ); const Clip* clip = Library::getInstance()->clip( m_uuid );
if ( 0 == clip ) if ( 0 == clip )
return ; return ;
//getting the media from the current Clip //getting the media from the current Clip
Media* parent = Library::getInstance()->clip( m_uuid )->getParent(); const Media* parent = Library::getInstance()->clip( m_uuid )->getParent();
if ( 0 == parent ) if ( 0 == parent )
return ; return ;
drag->setPixmap( Library::getInstance()->clip( m_uuid )->getParent()-> drag->setPixmap( parent->snapshot().scaled( 100, 100, Qt::KeepAspectRatio ) );
snapshot().scaled( 100, 100, Qt::KeepAspectRatio ) );
drag->exec( Qt::CopyAction | Qt::MoveAction, Qt::CopyAction ); drag->exec( Qt::CopyAction | Qt::MoveAction, Qt::CopyAction );
} }
......
...@@ -61,8 +61,7 @@ Library::clip( const QUuid& uuid ) ...@@ -61,8 +61,7 @@ Library::clip( const QUuid& uuid )
Media* media = m_medias.value( uuid ); Media* media = m_medias.value( uuid );
if ( media->baseClip() == NULL ) if ( media->baseClip() == NULL )
return NULL; return NULL;
Clip* clip = new Clip( media->baseClip() ); return media->baseClip();
return clip;
} }
QUuid mediaUuid; QUuid mediaUuid;
...@@ -83,7 +82,7 @@ Library::clip( const QUuid& mediaUuid, const QUuid& clipUuid ) ...@@ -83,7 +82,7 @@ Library::clip( const QUuid& mediaUuid, const QUuid& clipUuid )
if ( m_medias.value( mediaUuid )->clips().contains( clipUuid ) ) if ( m_medias.value( mediaUuid )->clips().contains( clipUuid ) )
return m_medias.value( mediaUuid )->clip( clipUuid ); return m_medias.value( mediaUuid )->clip( clipUuid );
else else
return new Clip( m_medias.value( mediaUuid )->baseClip() ); m_medias.value( mediaUuid )->baseClip();
} }
return NULL; return NULL;
} }
......
...@@ -69,7 +69,6 @@ class Clip : public QObject ...@@ -69,7 +69,6 @@ class Clip : public QObject
/** /**
\return Returns the Media that the clip was basep uppon. \return Returns the Media that the clip was basep uppon.
*/ */
Media* getParent(); Media* getParent();
......
...@@ -148,7 +148,7 @@ public: ...@@ -148,7 +148,7 @@ public:
QList<int>* audioValues() { return m_audioValueList; } QList<int>* audioValues() { return m_audioValueList; }
const Clip* baseClip() const { return m_baseClip; } Clip* baseClip() { return m_baseClip; }
private: private:
void setFileType(); void setFileType();
......
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