Commit 6bfd2a36 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Improving PreviewWidget.

When a media is selected, preview widget shows the snapshot so the user is aware of which clip is going to be previewed.
Black background is now always shown, even when previewing.
parent 1af5a299
......@@ -56,6 +56,8 @@ PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent
connect( m_ui->seekSlider, SIGNAL( sliderReleased() ), this, SLOT( seekSliderReleased() ) );
m_renderer->setRenderWidget( m_ui->renderWidget );
m_renderer->setPreviewLabel( m_ui->previewLabel );
connect( m_renderer, SIGNAL( stopped() ), this, SLOT( videoStopped() ) );
connect( m_renderer, SIGNAL( paused() ), this, SLOT( videoPaused() ) );
connect( m_renderer, SIGNAL( playing() ), this, SLOT( videoPlaying() ) );
......@@ -146,17 +148,11 @@ void PreviewWidget::videoStopped()
{
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
m_ui->seekSlider->setValue( 0 );
// Set the black background
m_ui->renderWidget->setPalette( m_videoPalette );
}
void PreviewWidget::videoPlaying()
{
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) );
// Remove the black background
m_ui->renderWidget->setPalette( QPalette() );
}
void PreviewWidget::endReached()
......
......@@ -165,6 +165,25 @@
<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>
</layout>
......
......@@ -56,7 +56,11 @@ void ClipRenderer::setMedia( Media* media )
if ( m_isRendering == true )
m_mediaChanged = true;
else
{
m_previewLabel->setPixmap( media->getSnapshot().scaled( m_previewLabel->size(),
Qt::KeepAspectRatio ) );
m_clipLoaded = false;
}
}
void ClipRenderer::setClip( Clip* clip )
......@@ -67,13 +71,19 @@ void ClipRenderer::setClip( Clip* clip )
if ( m_isRendering == true )
m_mediaChanged = true;
else
{
m_previewLabel->setPixmap( clip->getParent()->getSnapshot().scaled( m_previewLabel->size(),
Qt::KeepAspectRatio ) );
m_clipLoaded = false;
}
}
void ClipRenderer::startPreview()
{
if ( m_selectedMedia == NULL )
return ;
m_previewLabel->setVisible( false );
//If an old media is found, we delete it, and disconnect
if ( m_vlcMedia != NULL )
delete m_vlcMedia;
......
......@@ -25,6 +25,7 @@
#include <QObject>
#include <QWidget>
#include <QLabel>
#include "Clip.h"
#include "VLCMediaPlayer.h"
......@@ -50,6 +51,10 @@ public:
{
m_mediaPlayer->setDrawable( renderWidget->winId() );
}
virtual void setPreviewLabel( QLabel* previewLabel )
{
m_previewLabel = previewLabel;
}
virtual void togglePlayPause( bool forcePause = false ) = 0;
virtual void nextFrame() = 0;
virtual void previousFrame() = 0;
......@@ -79,6 +84,8 @@ protected:
*/
bool m_isRendering;
QLabel* m_previewLabel;
public slots:
virtual void __positionChanged() = 0;
......
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