mirror of
https://invent.kde.org/graphics/okular
synced 2024-11-05 18:34:53 +00:00
Switch from poster image to video player after video has started playing
If we switch immediately after the play() trigger, a black frame is visible for a moment, which looks ugly.
This commit is contained in:
parent
02b04e7e9b
commit
811e3b2539
2 changed files with 12 additions and 1 deletions
|
@ -25,6 +25,7 @@
|
|||
#include <kicon.h>
|
||||
#include <klocale.h>
|
||||
|
||||
#include <phonon/mediaobject.h>
|
||||
#include <phonon/seekslider.h>
|
||||
#include <phonon/videoplayer.h>
|
||||
|
||||
|
@ -69,6 +70,7 @@ public:
|
|||
void setPosterImage( const QImage& );
|
||||
void takeSnapshot();
|
||||
void videoStopped();
|
||||
void stateChanged(Phonon::State, Phonon::State);
|
||||
|
||||
// slots
|
||||
void finished();
|
||||
|
@ -113,6 +115,9 @@ void VideoWidget::Private::load()
|
|||
else
|
||||
player->load( newurl );
|
||||
|
||||
connect( player->mediaObject(), SIGNAL( stateChanged( Phonon::State, Phonon::State ) ),
|
||||
q, SLOT( stateChanged( Phonon::State, Phonon::State ) ) );
|
||||
|
||||
seekSlider->setEnabled( true );
|
||||
}
|
||||
|
||||
|
@ -210,6 +215,12 @@ void VideoWidget::Private::setPosterImage( const QImage &image )
|
|||
q->show();
|
||||
}
|
||||
|
||||
void VideoWidget::Private::stateChanged( Phonon::State newState, Phonon::State )
|
||||
{
|
||||
if ( newState == Phonon::PlayingState )
|
||||
pageLayout->setCurrentIndex( 0 );
|
||||
}
|
||||
|
||||
VideoWidget::VideoWidget( Okular::MovieAnnotation *movieann, Okular::Document *document, QWidget *parent )
|
||||
: QWidget( parent ), d( new Private( movieann, document, this ) )
|
||||
{
|
||||
|
@ -336,7 +347,6 @@ void VideoWidget::pageLeft()
|
|||
|
||||
void VideoWidget::play()
|
||||
{
|
||||
d->pageLayout->setCurrentIndex( 0 );
|
||||
d->load();
|
||||
d->player->play();
|
||||
d->stopAction->setEnabled( true );
|
||||
|
|
|
@ -54,6 +54,7 @@ class VideoWidget : public QWidget
|
|||
Q_PRIVATE_SLOT( d, void finished() )
|
||||
Q_PRIVATE_SLOT( d, void playOrPause() )
|
||||
Q_PRIVATE_SLOT( d, void setPosterImage( const QImage& ) )
|
||||
Q_PRIVATE_SLOT( d, void stateChanged( Phonon::State, Phonon::State ) )
|
||||
|
||||
// private storage
|
||||
class Private;
|
||||
|
|
Loading…
Reference in a new issue