Commit 2ea502b0 authored by Christophe Courtaut's avatar Christophe Courtaut

Added play button on clip preview

parent fc822ead
......@@ -6,6 +6,8 @@
</qresource>
<qresource prefix="/images" >
<file>images/vlmc.png</file>
<file alias="play" >images/play.png</file>
<file alias="pause" >images/pause.png</file>
</qresource>
<qresource prefix="/text" >
<file>AUTHORS</file>
......
......@@ -91,11 +91,6 @@ QPixmap* InputMedia::takeSnapshot( unsigned int width, unsigned int height
// m_vlcMediaPlayer->setTime(currentTime);
}
bool InputMedia::isPlaying()
{
return m_vlcMediaPlayer->isPlaying();
}
bool InputMedia::isSeekable()
{
return m_vlcMediaPlayer->isSeekable();
......
......@@ -45,10 +45,6 @@ public:
QPixmap* takeSnapshot( unsigned int width, unsigned int heigth );
/**
* Ask libvlc if the media is currently playing
*/
bool isPlaying();
/**
* Ask libvlc if the media can be seeked
*/
......
......@@ -129,3 +129,8 @@ void Media::setTime( qint64 time )
{
m_vlcMediaPlayer->setTime( time );
}
bool Media::isPlaying()
{
return m_vlcMediaPlayer->isPlaying();
}
......@@ -59,6 +59,10 @@ public:
* Change the current time of the media
*/
void setTime( qint64 time );
/**
* Ask libvlc if the media is currently playing
*/
virtual bool isPlaying();
protected:
//Protected constructor so we can't use a Media without its sub-implementation
......
......@@ -29,6 +29,7 @@ PreviewWidget::PreviewWidget( QWidget *parent ) :
m_ui( new Ui::PreviewWidget ), m_currentMedia( NULL )
{
m_ui->setupUi( this );
m_ui->groupBoxButton->hide();
char const *vlc_argv[] =
{
......@@ -83,6 +84,7 @@ void PreviewWidget::dropEvent( QDropEvent* event )
m_currentMedia->setupMedia();
m_currentMedia->setDrawable( m_ui->clipRenderWidget->winId() );
m_currentMedia->play();
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) );
connect( m_currentMedia->mediaPlayer(),
SIGNAL( timeChanged() ),
this,
......@@ -105,3 +107,19 @@ void PreviewWidget::seekSliderMoved( int )
m_currentMedia->setTime( m_ui->seekSlider->value() * 100 );
}
}
void PreviewWidget::on_pushButtonPlay_clicked()
{
if ( m_currentMedia == NULL )
return;
if ( m_currentMedia->isPlaying() )
{
m_currentMedia->pause();
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/play" ) );
}
else
{
m_currentMedia->play();
m_ui->pushButtonPlay->setIcon( QIcon( ":/images/pause" ) );
}
}
......@@ -46,6 +46,7 @@ protected:
virtual void dropEvent( QDropEvent* event );
private slots:
void on_pushButtonPlay_clicked();
void videoTimeChanged();
void seekSliderMoved( int value );
......
......@@ -35,7 +35,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
......@@ -91,7 +91,43 @@
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QGroupBox" name="groupBox">
<widget class="QPushButton" name="pushButtonPlay">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../ressources.qrc">
<normaloff>:/images/play</normaloff>:/images/play</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBoxButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
......@@ -246,6 +282,8 @@
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../../../ressources.qrc"/>
</resources>
<connections/>
</ui>
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