Commit 934e3c8a authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Plugged play button with the render workflow

You can now play/pause the render preview
parent d3a6beaf
...@@ -49,8 +49,8 @@ PreviewWidget::PreviewWidget( MainWorkflow* mainWorkflow, QWidget *parent ) : ...@@ -49,8 +49,8 @@ PreviewWidget::PreviewWidget( MainWorkflow* mainWorkflow, QWidget *parent ) :
connect( m_ui->seekSlider, SIGNAL( sliderPosChanged(int) ), this, SLOT( seekSliderMoved(int) ) ); connect( m_ui->seekSlider, SIGNAL( sliderPosChanged(int) ), this, SLOT( seekSliderMoved(int) ) );
connect( m_ui->seekSlider, SIGNAL( sliderReleased() ), this, SLOT( seekSliderReleased() ) ); connect( m_ui->seekSlider, SIGNAL( sliderReleased() ), this, SLOT( seekSliderReleased() ) );
m_clipPreview = new ClipPreviewWidget( m_ui->clipPreviewRenderWidget ); initClipPreview();
m_renderPreview = new RenderPreviewWidget( mainWorkflow, m_ui->renderPreviewRenderWidget ); initRenderPreview( mainWorkflow );
m_currentMode = m_ui->tabWidget->currentIndex(); m_currentMode = m_ui->tabWidget->currentIndex();
m_currentPreviewRenderer = m_renderPreview; m_currentPreviewRenderer = m_renderPreview;
...@@ -64,7 +64,30 @@ PreviewWidget::~PreviewWidget() ...@@ -64,7 +64,30 @@ PreviewWidget::~PreviewWidget()
delete m_renderPreview; delete m_renderPreview;
} }
void PreviewWidget::changeEvent( QEvent *e ) void PreviewWidget::initClipPreview()
{
m_clipPreview = new ClipPreviewWidget( m_ui->clipPreviewRenderWidget );
connectPreview( m_clipPreview );
}
void PreviewWidget::initRenderPreview( MainWorkflow* mainWorkflow )
{
m_renderPreview = new RenderPreviewWidget( mainWorkflow, m_ui->renderPreviewRenderWidget );
connectPreview( m_renderPreview );
}
void PreviewWidget::connectPreview( GenericPreviewWidget* target )
{
//WARNING: the slots must NOT be virtual, since this is called from the constructor
// which would be unsafe... if not fatal...
connect( target, SIGNAL( stopped() ), this, SLOT( videoPaused() ) );
connect( target, SIGNAL( paused() ), this, SLOT( videoPaused() ) );
connect( target, SIGNAL( playing() ), this, SLOT( videoPlaying() ) );
connect( target, SIGNAL( positionChanged(float) ), this, SLOT( positionChanged(float) ) );
connect( target, SIGNAL( endReached() ), this, SLOT( endReached() ) );
}
void PreviewWidget::changeEvent( QEvent *e )
{ {
switch ( e->type() ) switch ( e->type() )
{ {
...@@ -104,12 +127,6 @@ void PreviewWidget::dropEvent( QDropEvent* event ) ...@@ -104,12 +127,6 @@ void PreviewWidget::dropEvent( QDropEvent* event )
if ( m_currentMode != PreviewWidget::clipPreviewMode ) if ( m_currentMode != PreviewWidget::clipPreviewMode )
m_ui->tabWidget->setCurrentIndex( PreviewWidget::clipPreviewMode ); m_ui->tabWidget->setCurrentIndex( PreviewWidget::clipPreviewMode );
connect( m_clipPreview, SIGNAL( stopped() ), this, SLOT( videoPaused() ) );
connect( m_clipPreview, SIGNAL( paused() ), this, SLOT( videoPaused() ) );
connect( m_clipPreview, SIGNAL( playing() ), this, SLOT( videoPlaying() ) );
connect( m_clipPreview, SIGNAL( positionChanged(float) ), this, SLOT( positionChanged(float) ) );
connect( m_clipPreview, SIGNAL( endReached() ), this, SLOT( endReached() ) );
m_clipPreview->startPreview( media ); m_clipPreview->startPreview( media );
event->acceptProposedAction(); event->acceptProposedAction();
m_previewStopped = false; m_previewStopped = false;
......
...@@ -42,6 +42,11 @@ public: ...@@ -42,6 +42,11 @@ public:
explicit PreviewWidget( MainWorkflow* mainWorkflow, QWidget* parent = NULL ); explicit PreviewWidget( MainWorkflow* mainWorkflow, QWidget* parent = NULL );
virtual ~PreviewWidget(); virtual ~PreviewWidget();
private:
void initRenderPreview( MainWorkflow* );
void initClipPreview();
void connectPreview( GenericPreviewWidget* target );
private: private:
Ui::PreviewWidget* m_ui; Ui::PreviewWidget* m_ui;
GenericPreviewWidget* m_clipPreview; GenericPreviewWidget* m_clipPreview;
...@@ -53,8 +58,6 @@ private: ...@@ -53,8 +58,6 @@ private:
static const int renderPreviewMode = 0; static const int renderPreviewMode = 0;
static const int clipPreviewMode = 1; static const int clipPreviewMode = 1;
private:
int m_sliderPosBackup; int m_sliderPosBackup;
protected: protected:
......
...@@ -47,6 +47,9 @@ RenderPreviewWidget::RenderPreviewWidget( MainWorkflow* mainWorkflow, QWidget* r ...@@ -47,6 +47,9 @@ RenderPreviewWidget::RenderPreviewWidget( MainWorkflow* mainWorkflow, QWidget* r
sprintf( buffer, ":invmem-data=%lld", (qint64)this ); sprintf( buffer, ":invmem-data=%lld", (qint64)this );
m_media->addOption( buffer ); m_media->addOption( buffer );
m_mediaPlayer->setMedia( m_media ); m_mediaPlayer->setMedia( m_media );
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( __videoPlaying() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( __videoPaused() ) );
} }
...@@ -79,6 +82,7 @@ void RenderPreviewWidget::startPreview( Media* ) ...@@ -79,6 +82,7 @@ void RenderPreviewWidget::startPreview( Media* )
qDebug() << "Starting render preview"; qDebug() << "Starting render preview";
m_mainWorkflow->startRender(); m_mainWorkflow->startRender();
m_mediaPlayer->play(); m_mediaPlayer->play();
m_isRendering = true;
} }
void RenderPreviewWidget::setPosition( float /*newPos*/ ) void RenderPreviewWidget::setPosition( float /*newPos*/ )
...@@ -87,7 +91,16 @@ void RenderPreviewWidget::setPosition( float /*newPos*/ ) ...@@ -87,7 +91,16 @@ void RenderPreviewWidget::setPosition( float /*newPos*/ )
void RenderPreviewWidget::togglePlayPause( bool /*forcePause*/ ) void RenderPreviewWidget::togglePlayPause( bool /*forcePause*/ )
{ {
startPreview( NULL ); if ( m_isRendering == false )
startPreview( NULL );
else
{
qDebug() << m_mediaPlayer->isPlaying();
if ( m_mediaPlayer->isPlaying() == false )
m_mediaPlayer->play();
else
m_mediaPlayer->pause();
}
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
...@@ -106,10 +119,10 @@ void RenderPreviewWidget::__positionChanged() ...@@ -106,10 +119,10 @@ void RenderPreviewWidget::__positionChanged()
void RenderPreviewWidget::__videoPaused() void RenderPreviewWidget::__videoPaused()
{ {
qDebug() << "RenderPreviewWidget::__videoPaused: Unimplemented"; emit paused();
} }
void RenderPreviewWidget::__videoPlaying() void RenderPreviewWidget::__videoPlaying()
{ {
qDebug() << "RenderPreviewWidget::__videoPlaying: Unimplemented"; emit playing();
} }
...@@ -50,6 +50,7 @@ class RenderPreviewWidget : public GenericPreviewWidget ...@@ -50,6 +50,7 @@ class RenderPreviewWidget : public GenericPreviewWidget
private: private:
MainWorkflow* m_mainWorkflow; MainWorkflow* m_mainWorkflow;
LibVLCpp::Media* m_media; LibVLCpp::Media* m_media;
bool m_isRendering;
public slots: public slots:
void __positionChanged(); void __positionChanged();
......
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