Commit 8683822a authored by Tobias Koenig's avatar Tobias Koenig
Browse files

Improve auto play behaviour of videos

Use the auto play property of movies that are not started via
the 'page open' action. That's the case for Rendition-based videos
from PDF documents for example.
parent 648c2a06
...@@ -819,6 +819,10 @@ void PresentationWidget::changePage( int newPage ) ...@@ -819,6 +819,10 @@ void PresentationWidget::changePage( int newPage )
if ( m_document->page( m_frameIndex)->pageAction( Okular::Page::Opening ) ) if ( m_document->page( m_frameIndex)->pageAction( Okular::Page::Opening ) )
m_document->processAction( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) ); m_document->processAction( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) );
Q_FOREACH ( VideoWidget *vw, m_frames[ m_frameIndex ]->videoWidgets )
{
vw->pageEntered();
}
} }
if ( oldIndex != m_frameIndex ) if ( oldIndex != m_frameIndex )
...@@ -836,6 +840,11 @@ void PresentationWidget::changePage( int newPage ) ...@@ -836,6 +840,11 @@ void PresentationWidget::changePage( int newPage )
// we have just opened the presentation view // we have just opened the presentation view
if ( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) ) if ( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) )
m_document->processAction( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) ); m_document->processAction( m_document->page( m_frameIndex )->pageAction( Okular::Page::Opening ) );
Q_FOREACH ( VideoWidget *vw, m_frames[ m_frameIndex ]->videoWidgets )
{
vw->pageEntered();
}
} }
} }
} }
......
...@@ -225,6 +225,14 @@ bool VideoWidget::isPlaying() const ...@@ -225,6 +225,14 @@ bool VideoWidget::isPlaying() const
return d->player->isPlaying(); return d->player->isPlaying();
} }
void VideoWidget::pageEntered()
{
if ( d->anno->movie()->autoPlay() ) {
show();
QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection);
}
}
void VideoWidget::play() void VideoWidget::play()
{ {
d->load(); d->load();
......
...@@ -30,6 +30,11 @@ class VideoWidget : public QWidget ...@@ -30,6 +30,11 @@ class VideoWidget : public QWidget
bool isPlaying() const; bool isPlaying() const;
/**
* This method is called when the page the video widget is located on has been entered.
*/
void pageEntered();
public slots: public slots:
void play(); void play();
void pause(); void pause();
......
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