Commit 636f3632 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Using Clip for video preview.

parent df95b82f
......@@ -120,8 +120,8 @@ void MainWindow::setupLibrary()
libraryWidget,
SLOT( mediaRemoved( const QUuid& ) ) );
connect( libraryWidget->getVideoListWidget(), SIGNAL( selectedMediaChanged(const Media*) ),
m_clipPreview->getGenericRenderer(), SLOT( setMedia(const Media*) ) );
connect( libraryWidget->getVideoListWidget(), SIGNAL( selectedClipChanged( Clip* ) ),
m_clipPreview->getGenericRenderer(), SLOT( setClip( Clip* ) ) );
connect( Library::getInstance(), SIGNAL( mediaRemoved( const QUuid& ) ),
m_clipPreview->getGenericRenderer(), SLOT( mediaUnloaded( QUuid ) ) );
connect( libraryWidget->getVideoListWidget(), SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
......
......@@ -66,7 +66,8 @@ void MediaListWidget::mousePressEvent( QMouseEvent* event )
if ( item->getMedia() != m_lastClicked )
{
m_lastClicked = item->getMedia();
emit selectedMediaChanged( m_lastClicked );
//TODO: change this piece of ....
emit selectedClipChanged( new Clip( m_lastClicked ) );
}
}
......
......@@ -31,7 +31,7 @@
#include <QApplication>
#include <QSvgRenderer>
#include "ListViewMediaItem.h"
#include "Media.h"
#include "Clip.h"
class MediaListWidget : public QListWidget
{
......@@ -48,10 +48,10 @@ private:
Media::FileType m_Type;
QPoint m_dragStartPos;
QSvgRenderer* m_svgRenderer;
const Media* m_lastClicked;
Media* m_lastClicked;
signals:
void selectedMediaChanged( const Media* newMedia );
void selectedClipChanged( Clip* newClip );
};
#endif // MEDIALISTWIDGET_H
......@@ -29,7 +29,7 @@ ClipRenderer::ClipRenderer() :
GenericRenderer(),
m_clipLoaded( false ),
m_vlcMedia( NULL ),
m_selectedMedia( NULL ),
m_selectedClip( NULL ),
m_mediaChanged( false )
{
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) );
......@@ -44,9 +44,9 @@ ClipRenderer::~ClipRenderer()
stop();
}
void ClipRenderer::setMedia( const Media* media )
void ClipRenderer::setClip( Clip* clip )
{
m_selectedMedia = media;
m_selectedClip = clip;
if ( m_isRendering == true )
m_mediaChanged = true;
else
......@@ -55,12 +55,12 @@ void ClipRenderer::setMedia( const Media* media )
void ClipRenderer::startPreview()
{
if ( m_selectedMedia == NULL )
if ( m_selectedClip == NULL )
return ;
//If an old media is found, we delete it, and disconnect
if ( m_vlcMedia != NULL )
delete m_vlcMedia;
m_vlcMedia = new LibVLCpp::Media( m_selectedMedia->getFileInfo()->absoluteFilePath() );
m_vlcMedia = new LibVLCpp::Media( m_selectedClip->getParent()->getFileInfo()->absoluteFilePath() );
m_mediaPlayer->setMedia( m_vlcMedia );
......@@ -135,12 +135,12 @@ void ClipRenderer::previousFrame()
void ClipRenderer::mediaUnloaded( const QUuid& uuid )
{
if ( m_selectedMedia != NULL && m_selectedMedia->getUuid() == uuid )
if ( m_selectedClip != NULL && m_selectedClip->getUuid() == uuid )
{
m_mediaPlayer->stop();
qDebug() << "Media unloaded";
m_clipLoaded = false;
m_selectedMedia = NULL;
m_selectedClip = NULL;
m_isRendering = false;
m_paused = false;
}
......
......@@ -27,7 +27,7 @@
#include <QObject>
#include "VLCMediaPlayer.h"
#include "Media.h"
#include "Clip.h"
#include "GenericRenderer.h"
//TODO: This should really share a common interface with RenderPreviewWorkflow
......@@ -52,7 +52,7 @@ private:
private:
bool m_clipLoaded;
LibVLCpp::Media* m_vlcMedia;
const Media* m_selectedMedia;
Clip* m_selectedClip;
/**
* \brief This flags is used to know if a new media has been selected in the
* library. If so, we must relaunch the render if the play button is clicked again.
......@@ -60,7 +60,7 @@ private:
bool m_mediaChanged;
public slots:
virtual void setMedia( const Media* media );
virtual void setClip( Clip* clip );
virtual void mediaUnloaded( const QUuid& );
void __positionChanged();
......
......@@ -26,7 +26,7 @@
#include <QObject>
#include <QWidget>
#include "Media.h"
#include "Clip.h"
#include "VLCMediaPlayer.h"
class GenericRenderer : public QObject
......@@ -84,7 +84,7 @@ public slots:
virtual void __videoPaused() = 0;
virtual void __videoPlaying() = 0;
virtual void __endReached() = 0;
virtual void setMedia( const Media* ) = 0;
virtual void setClip( Clip* ) = 0;
virtual void mediaUnloaded( const QUuid& ) = 0;
......
......@@ -84,7 +84,7 @@ class WorkflowRenderer : public GenericRenderer
bool m_pausedMediaPlayer;
public slots:
void setMedia( const Media* ){}
void setClip( Clip* ){}
void mediaUnloaded( const QUuid& ) {}
void mainWorkflowPaused();
......
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