Support for non-integer transition durations in PDF presentations

REVIEW: 125329
This commit is contained in:
Arseniy Lartsev 2015-10-15 00:16:55 +02:00 committed by Albert Astals Cid
parent 9f0ff21a22
commit 76c1e944a8
5 changed files with 24 additions and 6 deletions

View file

@ -135,9 +135,20 @@ int main()
}
" HAVE_POPPLER_0_28)
check_cxx_source_compiles("
#include <poppler-qt4.h>
int main()
{
Poppler::PageTransition *p = 0;
return p->durationReal();
}
" HAVE_POPPLER_0_37)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_POPPLER_0_28)
if (HAVE_POPPLER_0_37)
set(popplerVersionMessage "0.37")
elseif (HAVE_POPPLER_0_28)
set(popplerVersionMessage "0.28")
elseif (HAVE_POPPLER_0_24)
set(popplerVersionMessage "0.24")

View file

@ -29,7 +29,7 @@ class PageTransition::Private
}
Type m_type;
int m_duration;
double m_duration;
Alignment m_alignment;
Direction m_direction;
int m_angle;
@ -67,7 +67,7 @@ PageTransition::Type PageTransition::type() const
return d->m_type;
}
int PageTransition::duration() const
double PageTransition::duration() const
{
return d->m_duration;
}
@ -102,7 +102,7 @@ void PageTransition::setType( Type type )
d->m_type = type;
}
void PageTransition::setDuration( int duration )
void PageTransition::setDuration( double duration )
{
d->m_duration = duration;
}

View file

@ -86,7 +86,7 @@ class OKULAR_EXPORT PageTransition
/**
* Returns the duration of the transition in seconds.
*/
int duration() const;
double duration() const;
/**
* Returns the alignment of the transition.
@ -121,7 +121,7 @@ class OKULAR_EXPORT PageTransition
/**
* Sets the @p duration in seconds for the transition.
*/
void setDuration( int duration );
void setDuration( double duration );
/**
* Sets the @p alignment of the transition (@ref Alignment).

View file

@ -15,3 +15,6 @@
/* Defined if we have the 0.28 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_28 1
/* Defined if we have the 0.37 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_37 1

View file

@ -1515,7 +1515,11 @@ void PDFGenerator::addTransition( Poppler::Page * pdfPage, Okular::Page * page )
break;
}
#ifdef HAVE_POPPLER_0_37
transition->setDuration( pdfTransition->durationReal() );
#else
transition->setDuration( pdfTransition->duration() );
#endif
switch ( pdfTransition->alignment() ) {
case Poppler::PageTransition::Horizontal: