mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-01 05:33:33 +00:00
Fix wrong interpretation of autoplay flag
BUGS: 436709
This commit is contained in:
parent
5bb79f2cfd
commit
a33e499b40
|
@ -30,6 +30,7 @@ public:
|
|||
, m_tmp(nullptr)
|
||||
, m_showControls(false)
|
||||
, m_autoPlay(false)
|
||||
, m_startPaused(false)
|
||||
, m_showPosterImage(false)
|
||||
{
|
||||
}
|
||||
|
@ -43,6 +44,7 @@ public:
|
|||
QImage m_posterImage;
|
||||
bool m_showControls : 1;
|
||||
bool m_autoPlay : 1;
|
||||
bool m_startPaused : 1;
|
||||
bool m_showPosterImage : 1;
|
||||
};
|
||||
|
||||
|
@ -145,6 +147,16 @@ bool Movie::autoPlay() const
|
|||
return d->m_autoPlay;
|
||||
}
|
||||
|
||||
void Movie::setStartPaused(bool startPaused)
|
||||
{
|
||||
d->m_startPaused = startPaused;
|
||||
}
|
||||
|
||||
bool Movie::startPaused() const
|
||||
{
|
||||
return d->m_startPaused;
|
||||
}
|
||||
|
||||
void Movie::setShowPosterImage(bool show)
|
||||
{
|
||||
d->m_showPosterImage = show;
|
||||
|
|
10
core/movie.h
10
core/movie.h
|
@ -117,6 +117,16 @@ public:
|
|||
*/
|
||||
bool autoPlay() const;
|
||||
|
||||
/**
|
||||
* Sets whether to start the movie in paused mode
|
||||
*/
|
||||
void setStartPaused(bool startPaused);
|
||||
|
||||
/**
|
||||
* Whether to start the movie in paused mode
|
||||
*/
|
||||
bool startPaused() const;
|
||||
|
||||
/**
|
||||
* Sets whether to show a poster image.
|
||||
*
|
||||
|
|
|
@ -218,6 +218,7 @@ Okular::Movie *createMovieFromPopplerMovie(const Poppler::MovieObject *popplerMo
|
|||
movie->setShowControls(popplerMovie->showControls());
|
||||
movie->setPlayMode((Okular::Movie::PlayMode)popplerMovie->playMode());
|
||||
movie->setAutoPlay(false); // will be triggered by external MovieAnnotation
|
||||
movie->setStartPaused(false);
|
||||
movie->setShowPosterImage(popplerMovie->showPosterImage());
|
||||
movie->setPosterImage(popplerMovie->posterImage());
|
||||
return movie;
|
||||
|
@ -240,7 +241,13 @@ Okular::Movie *createMovieFromPopplerScreen(const Poppler::LinkRendition *popple
|
|||
movie->setPlayMode(Okular::Movie::PlayLimited);
|
||||
movie->setPlayRepetitions(rendition->repeatCount());
|
||||
}
|
||||
movie->setAutoPlay(rendition->autoPlay());
|
||||
/**
|
||||
* Warning: Confusing flag name from PDF spec. Described as:
|
||||
* > If true, the media should automatically play when activated.
|
||||
* > If false, the media should be initially paused when activated
|
||||
* To set autoplay, page actions are used.
|
||||
*/
|
||||
movie->setStartPaused(!rendition->autoPlay());
|
||||
return movie;
|
||||
}
|
||||
|
||||
|
|
|
@ -325,6 +325,9 @@ void VideoWidget::pageEntered()
|
|||
if (d->movie->autoPlay()) {
|
||||
show();
|
||||
QMetaObject::invokeMethod(this, "play", Qt::QueuedConnection);
|
||||
if (d->movie->startPaused()) {
|
||||
QMetaObject::invokeMethod(this, "pause", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue