Commit 87050538 authored by Enrico Ros's avatar Enrico Ros

fix: don't create a PageTransition object if there is no transition

specified or the transition is 'replace'.

svn path=/trunk/kdegraphics/kpdf/; revision=375057
parent 92ad74aa
......@@ -166,14 +166,6 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesGlitterTrans</cstring>
</property>
<property name="text">
<string>Use 'glittering' &amp;transition</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_SlidesShowProgress</cstring>
......
......@@ -234,76 +234,78 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, GList * items )
void PDFGenerator::addTransition( int pageNumber, KPDFPage * page )
{
KPDFPageTransition *transition = new KPDFPageTransition();
Page *pdfPage = pdfdoc->getCatalog()->getPage( pageNumber + 1 );
if ( pdfPage && pdfPage->getTransition() ) {
PageTransition *pdfTransition = pdfPage->getTransition();
switch ( pdfTransition->getType() ) {
case PageTransition::Replace:
transition->setType( KPDFPageTransition::Replace );
break;
case PageTransition::Split:
transition->setType( KPDFPageTransition::Split );
break;
case PageTransition::Blinds:
transition->setType( KPDFPageTransition::Blinds );
break;
case PageTransition::Box:
transition->setType( KPDFPageTransition::Box );
break;
case PageTransition::Wipe:
transition->setType( KPDFPageTransition::Wipe );
break;
case PageTransition::Dissolve:
transition->setType( KPDFPageTransition::Dissolve );
break;
case PageTransition::Glitter:
transition->setType( KPDFPageTransition::Glitter );
break;
case PageTransition::Fly:
transition->setType( KPDFPageTransition::Fly );
break;
case PageTransition::Push:
transition->setType( KPDFPageTransition::Push );
break;
case PageTransition::Cover:
transition->setType( KPDFPageTransition::Cover );
break;
case PageTransition::Uncover:
transition->setType( KPDFPageTransition::Uncover );
break;
case PageTransition::Fade:
transition->setType( KPDFPageTransition::Fade );
break;
}
if ( !pdfPage )
return;
transition->setDuration( pdfTransition->getDuration() );
PageTransition *pdfTransition = pdfPage->getTransition();
if ( !pdfTransition || pdfTransition->getType() == PageTransition::Replace )
return;
switch ( pdfTransition->getAlignment() ) {
case PageTransition::Horizontal:
transition->setAlignment( KPDFPageTransition::Horizontal );
break;
case PageTransition::Vertical:
transition->setAlignment( KPDFPageTransition::Vertical );
break;
}
KPDFPageTransition *transition = new KPDFPageTransition();
switch ( pdfTransition->getType() ) {
case PageTransition::Replace:
// won't get here, added to avoid warning
break;
case PageTransition::Split:
transition->setType( KPDFPageTransition::Split );
break;
case PageTransition::Blinds:
transition->setType( KPDFPageTransition::Blinds );
break;
case PageTransition::Box:
transition->setType( KPDFPageTransition::Box );
break;
case PageTransition::Wipe:
transition->setType( KPDFPageTransition::Wipe );
break;
case PageTransition::Dissolve:
transition->setType( KPDFPageTransition::Dissolve );
break;
case PageTransition::Glitter:
transition->setType( KPDFPageTransition::Glitter );
break;
case PageTransition::Fly:
transition->setType( KPDFPageTransition::Fly );
break;
case PageTransition::Push:
transition->setType( KPDFPageTransition::Push );
break;
case PageTransition::Cover:
transition->setType( KPDFPageTransition::Cover );
break;
case PageTransition::Uncover:
transition->setType( KPDFPageTransition::Uncover );
break;
case PageTransition::Fade:
transition->setType( KPDFPageTransition::Fade );
break;
}
switch ( pdfTransition->getDirection() ) {
case PageTransition::Inward:
transition->setDirection( KPDFPageTransition::Inward );
break;
case PageTransition::Outward:
transition->setDirection( KPDFPageTransition::Outward );
break;
}
transition->setDuration( pdfTransition->getDuration() );
transition->setAngle( pdfTransition->getAngle() );
transition->setScale( pdfTransition->getScale() );
transition->setIsRectangular( pdfTransition->isRectangular() == gTrue );
switch ( pdfTransition->getAlignment() ) {
case PageTransition::Horizontal:
transition->setAlignment( KPDFPageTransition::Horizontal );
break;
case PageTransition::Vertical:
transition->setAlignment( KPDFPageTransition::Vertical );
break;
}
switch ( pdfTransition->getDirection() ) {
case PageTransition::Inward:
transition->setDirection( KPDFPageTransition::Inward );
break;
case PageTransition::Outward:
transition->setDirection( KPDFPageTransition::Outward );
break;
}
transition->setAngle( pdfTransition->getAngle() );
transition->setScale( pdfTransition->getScale() );
transition->setIsRectangular( pdfTransition->isRectangular() == gTrue );
page->setTransition( transition );
}
......
......@@ -39,8 +39,6 @@
// transition effect to the next frame
struct PresentationFrame
{
PresentationFrame() : page( 0 ) {}
const KPDFPage * page;
QRect geometry;
};
......@@ -283,9 +281,13 @@ void PresentationWidget::generatePage()
generateOverlay();
#endif
// start transition or immediately update viewport
if ( m_frameIndex >= 0 && m_frames[ m_frameIndex ]->page )
initTransition( m_frames[ m_frameIndex ]->page->getTransition() );
// start transition on pages that have one
const KPDFPageTransition * transition = m_frameIndex != -1 ?
m_frames[ m_frameIndex ]->page->getTransition() : 0;
if ( transition )
initTransition( transition );
else
update();
}
void PresentationWidget::generateIntroPage( QPainter & p )
......
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