Commit 075d4367 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Corrected behaviour for pause/stop/play again in ClipPreviewWidget

parent 9054c492
...@@ -42,7 +42,7 @@ void ClipPreviewWidget::startPreview( Media* media ) ...@@ -42,7 +42,7 @@ void ClipPreviewWidget::startPreview( Media* media )
m_mediaPlayer->setMedia( m_vlcMedia ); m_mediaPlayer->setMedia( m_vlcMedia );
connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoPaused() ) ); connect( m_mediaPlayer, SIGNAL( stopped() ), this, SLOT( __videoStopped() ) );
connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( __videoPaused() ) ); connect( m_mediaPlayer, SIGNAL( paused() ), this, SLOT( __videoPaused() ) );
connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( __videoPlaying() ) ); connect( m_mediaPlayer, SIGNAL( playing() ), this, SLOT( __videoPlaying() ) );
connect( m_mediaPlayer, SIGNAL( positionChanged() ), this, SLOT( __positionChanged() ) ); connect( m_mediaPlayer, SIGNAL( positionChanged() ), this, SLOT( __positionChanged() ) );
...@@ -75,16 +75,16 @@ void ClipPreviewWidget::togglePlayPause( bool forcePause ) ...@@ -75,16 +75,16 @@ void ClipPreviewWidget::togglePlayPause( bool forcePause )
{ {
if ( m_clipLoaded == false) if ( m_clipLoaded == false)
return ; return ;
if ( m_isRendering == false )
m_isRendering = true;
if ( m_paused == false ) if ( m_paused == false && m_isRendering == true )
{ {
m_mediaPlayer->pause(); m_mediaPlayer->pause();
m_paused = true; m_paused = true;
} }
else if ( forcePause == false ) else if ( forcePause == false )
{ {
if ( m_isRendering == false )
m_isRendering = true;
m_mediaPlayer->play(); m_mediaPlayer->play();
m_paused = false; m_paused = false;
} }
...@@ -116,6 +116,11 @@ void ClipPreviewWidget::__videoPaused() ...@@ -116,6 +116,11 @@ void ClipPreviewWidget::__videoPaused()
emit paused(); emit paused();
} }
void ClipPreviewWidget::__videoStopped()
{
emit stopped();
}
void ClipPreviewWidget::__videoPlaying() void ClipPreviewWidget::__videoPlaying()
{ {
emit playing(); emit playing();
......
...@@ -56,6 +56,7 @@ public slots: ...@@ -56,6 +56,7 @@ public slots:
void __videoPaused(); void __videoPaused();
void __videoPlaying(); void __videoPlaying();
void __endReached(); void __endReached();
void __videoStopped();
}; };
#endif // CLIPPREVIEWWIDGET_H #endif // CLIPPREVIEWWIDGET_H
...@@ -81,7 +81,7 @@ void PreviewWidget::connectPreview( GenericPreviewWidget* target ) ...@@ -81,7 +81,7 @@ void PreviewWidget::connectPreview( GenericPreviewWidget* target )
{ {
//WARNING: the slots must NOT be virtual, since this is called from the constructor //WARNING: the slots must NOT be virtual, since this is called from the constructor
// which would be unsafe... if not fatal... // which would be unsafe... if not fatal...
connect( target, SIGNAL( stopped() ), this, SLOT( videoPaused() ) ); connect( target, SIGNAL( stopped() ), this, SLOT( videoStopped() ) );
connect( target, SIGNAL( paused() ), this, SLOT( videoPaused() ) ); connect( target, SIGNAL( paused() ), this, SLOT( videoPaused() ) );
connect( target, SIGNAL( playing() ), this, SLOT( videoPlaying() ) ); connect( target, SIGNAL( playing() ), this, SLOT( videoPlaying() ) );
connect( target, SIGNAL( positionChanged(float) ), this, SLOT( positionChanged(float) ) ); connect( target, SIGNAL( positionChanged(float) ), this, SLOT( positionChanged(float) ) );
...@@ -195,12 +195,18 @@ void PreviewWidget::on_pushButtonPlay_clicked() ...@@ -195,12 +195,18 @@ void PreviewWidget::on_pushButtonPlay_clicked()
m_currentPreviewRenderer->togglePlayPause(); m_currentPreviewRenderer->togglePlayPause();
} }
void PreviewWidget::videoPaused() void PreviewWidget::videoPaused()
{ {
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) ); m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
} }
void PreviewWidget::videoPlaying() void PreviewWidget::videoStopped()
{
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
m_ui->seekSlider->setValue( 0 );
}
void PreviewWidget::videoPlaying()
{ {
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) ); m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) );
} }
......
...@@ -75,6 +75,7 @@ private slots: ...@@ -75,6 +75,7 @@ private slots:
void seekSliderReleased(); void seekSliderReleased();
void videoPaused(); void videoPaused();
void videoPlaying(); void videoPlaying();
void videoStopped();
void endReached(); void endReached();
void changedTab( int ); void changedTab( int );
......
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