Commit b2783596 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Corrected bug when stopping a video in the preview widget. The snapshot weren't showed again.

parent b4fbbdec
......@@ -57,6 +57,7 @@ PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent
m_renderer->setRenderWidget( m_ui->renderWidget );
m_renderer->setPreviewLabel( m_ui->previewLabel );
m_ui->previewLabel->hide();
connect( m_renderer, SIGNAL( stopped() ), this, SLOT( videoStopped() ) );
connect( m_renderer, SIGNAL( paused() ), this, SLOT( videoPaused() ) );
......
......@@ -29,7 +29,7 @@
<string>Preview</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButtonPreviousFrame">
......@@ -138,7 +138,7 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="Slider" name="seekSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -157,7 +157,7 @@
</property>
</widget>
</item>
<item row="0" column="0">
<item row="1" column="0">
<widget class="QWidget" name="renderWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
......@@ -165,25 +165,19 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<widget class="QLabel" name="previewLabel">
<property name="geometry">
<rect>
<x>4</x>
<y>3</y>
<width>311</width>
<height>251</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="previewLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
......
......@@ -62,6 +62,7 @@ void ClipRenderer::setMedia( Media* media )
m_mediaChanged = true;
else
{
setSnapshotVisibility( true );
m_previewLabel->setPixmap( media->getSnapshot().scaled( m_previewLabel->size(),
Qt::KeepAspectRatio ) );
m_clipLoaded = false;
......@@ -83,6 +84,7 @@ void ClipRenderer::setClip( Clip* clip )
m_mediaChanged = true;
else
{
setSnapshotVisibility( true );
m_previewLabel->setPixmap( clip->getParent()->getSnapshot().scaled( m_previewLabel->size(),
Qt::KeepAspectRatio ) );
m_clipLoaded = false;
......@@ -93,7 +95,7 @@ void ClipRenderer::startPreview()
{
if ( m_selectedMedia == NULL )
return ;
m_previewLabel->setVisible( false );
setSnapshotVisibility( false );
//If an old media is found, we delete it, and disconnect
if ( m_vlcMedia != NULL )
......@@ -193,6 +195,12 @@ void ClipRenderer::mediaUnloaded( const QUuid& uuid )
}
}
void ClipRenderer::setSnapshotVisibility( bool val )
{
m_previewLabel->setVisible( val );
m_renderWidget->setVisible( !val );
}
/////////////////////////////////////////////////////////////////////
/////SLOTS :
/////////////////////////////////////////////////////////////////////
......@@ -231,4 +239,3 @@ void ClipRenderer::__endReached()
m_clipLoaded = false;
emit endReached();
}
......@@ -47,6 +47,7 @@ public:
private:
void startPreview();
void setSnapshotVisibility( bool val );
private:
bool m_clipLoaded;
......
......@@ -50,6 +50,7 @@ public:
virtual void setRenderWidget( QWidget* renderWidget )
{
m_mediaPlayer->setDrawable( renderWidget->winId() );
m_renderWidget = renderWidget;
}
virtual void setPreviewLabel( QLabel* previewLabel )
{
......@@ -84,6 +85,7 @@ protected:
*/
bool m_isRendering;
QWidget* m_renderWidget;
QLabel* m_previewLabel;
......
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