summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2014-08-09 17:33:37 (GMT)
committerAlbert Astals Cid <aacid@kde.org>2014-08-09 17:33:37 (GMT)
commitd1fa3b869f7c399c73dd46de638db0297000570a (patch)
tree439d4d543a8f515b37612b521243d7bd90c0864e
parentbc155c6842249ee90ff470a6055e605bb34d72c6 (diff)
Clean up some have_poppler defines
-rw-r--r--generators/poppler/generator_pdf.cpp57
1 files changed, 3 insertions, 54 deletions
diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp
index e1496af..7930f83 100644
--- a/generators/poppler/generator_pdf.cpp
+++ b/generators/poppler/generator_pdf.cpp
@@ -48,9 +48,7 @@
#include <config-okular-poppler.h>
-#ifdef HAVE_POPPLER_0_20
-# include <poppler-media.h>
-#endif
+#include <poppler-media.h>
#include "annots.h"
#include "formfields.h"
@@ -58,12 +56,8 @@
Q_DECLARE_METATYPE(Poppler::Annotation*)
Q_DECLARE_METATYPE(Poppler::FontInfo)
-#ifdef HAVE_POPPLER_0_20
Q_DECLARE_METATYPE(const Poppler::LinkMovie*)
-#endif
-#ifdef HAVE_POPPLER_0_22
Q_DECLARE_METATYPE(const Poppler::LinkRendition*)
-#endif
static const int defaultPageWidth = 595;
static const int defaultPageHeight = 842;
@@ -85,7 +79,7 @@ class PDFOptionsPage : public QWidget
layout->addWidget(m_forceRaster);
layout->addStretch(1);
-#if defined(Q_WS_WIN) || !defined(HAVE_POPPLER_0_20)
+#if defined(Q_WS_WIN)
m_printAnnots->setVisible( false );
#endif
setPrintAnnots( true ); // Default value
@@ -183,14 +177,11 @@ Okular::Movie* createMovieFromPopplerMovie( const Poppler::MovieObject *popplerM
movie->setShowControls( popplerMovie->showControls() );
movie->setPlayMode( (Okular::Movie::PlayMode)popplerMovie->playMode() );
movie->setAutoPlay( false ); // will be triggered by external MovieAnnotation
-#ifdef HAVE_POPPLER_0_22
movie->setShowPosterImage( popplerMovie->showPosterImage() );
movie->setPosterImage( popplerMovie->posterImage() );
-#endif
return movie;
}
-#ifdef HAVE_POPPLER_0_20
Okular::Movie* createMovieFromPopplerScreen( const Poppler::LinkRendition *popplerScreen )
{
Poppler::MediaRendition *rendition = popplerScreen->rendition();
@@ -205,7 +196,6 @@ Okular::Movie* createMovieFromPopplerScreen( const Poppler::LinkRendition *poppl
movie->setAutoPlay( rendition->autoPlay() );
return movie;
}
-#endif
/**
* Note: the function will take ownership of the popplerLink object.
@@ -219,12 +209,8 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
const Poppler::LinkAction *popplerLinkAction;
const Poppler::LinkSound *popplerLinkSound;
const Poppler::LinkJavaScript *popplerLinkJS;
-#ifdef HAVE_POPPLER_0_20
const Poppler::LinkMovie *popplerLinkMovie;
-#endif
-#ifdef HAVE_POPPLER_0_22
const Poppler::LinkRendition *popplerLinkRendition;
-#endif
Okular::DocumentViewport viewport;
bool deletePopplerLink = true;
@@ -282,7 +268,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
}
break;
-#ifdef HAVE_POPPLER_0_22
case Poppler::Link::Rendition:
{
deletePopplerLink = false; // we'll delete it inside resolveMediaLinkReferences() after we have resolved all references
@@ -318,9 +303,7 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
link = renditionAction;
}
break;
-#endif
-#ifdef HAVE_POPPLER_0_20
case Poppler::Link::Movie:
{
deletePopplerLink = false; // we'll delete it inside resolveMediaLinkReferences() after we have resolved all references
@@ -349,7 +332,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
link = movieAction;
}
break;
-#endif
}
if ( deletePopplerLink )
@@ -411,13 +393,11 @@ static KAboutData createAboutData()
OKULAR_EXPORT_PLUGIN(PDFGenerator, createAboutData())
-#ifdef HAVE_POPPLER_0_16
static void PDFGeneratorPopplerDebugFunction(const QString &message, const QVariant &closure)
{
Q_UNUSED(closure);
kDebug() << "[Poppler]" << message;
}
-#endif
PDFGenerator::PDFGenerator( QObject *parent, const QVariantList &args )
: Generator( parent, args ), pdfdoc( 0 ),
@@ -438,11 +418,9 @@ PDFGenerator::PDFGenerator( QObject *parent, const QVariantList &args )
setFeature( ReadRawData );
setFeature( TiledRendering );
-#ifdef HAVE_POPPLER_0_16
// You only need to do it once not for each of the documents but it is cheap enough
// so doing it all the time won't hurt either
Poppler::setDebugErrorFunction(PDFGeneratorPopplerDebugFunction, QVariant());
-#endif
}
PDFGenerator::~PDFGenerator()
@@ -931,24 +909,14 @@ void resolveMediaLinks( Okular::Action *action, enum Okular::Annotation::SubType
void PDFGenerator::resolveMediaLinkReference( Okular::Action *action )
{
-#ifdef HAVE_POPPLER_0_20
if ( !action )
return;
-#ifdef HAVE_POPPLER_0_22
if ( (action->actionType() != Okular::Action::Movie) && (action->actionType() != Okular::Action::Rendition) )
return;
resolveMediaLinks<Poppler::LinkMovie, Okular::MovieAction, Poppler::MovieAnnotation, Okular::MovieAnnotation>( action, Okular::Annotation::AMovie, annotationsHash );
resolveMediaLinks<Poppler::LinkRendition, Okular::RenditionAction, Poppler::ScreenAnnotation, Okular::ScreenAnnotation>( action, Okular::Annotation::AScreen, annotationsHash );
-#else
- if ( action->actionType() != Okular::Action::Movie )
- return;
-
- resolveMediaLinks<Poppler::LinkMovie, Okular::MovieAction, Poppler::MovieAnnotation, Okular::MovieAnnotation>( action, Okular::Annotation::AMovie, annotationsHash );
-#endif
-
-#endif
}
void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )
@@ -1113,10 +1081,8 @@ bool PDFGenerator::print( QPrinter& printer )
psConverter->setForceRasterize(forceRasterize);
psConverter->setTitle(pstitle);
-#ifdef HAVE_POPPLER_0_20
if (!printAnnots)
psConverter->setPSOptions(psConverter->psOptions() | Poppler::PSConverter::HideAnnotations );
-#endif
userMutex()->lock();
if (psConverter->convert())
@@ -1203,12 +1169,8 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option )
}
else if ( key == "HasUnsupportedXfaForm" )
{
-#ifdef HAVE_POPPLER_0_22
QMutexLocker ml(userMutex());
return pdfdoc->formType() == Poppler::Document::XfaForm;
-#else
- return false;
-#endif
}
return QVariant();
}
@@ -1261,9 +1223,7 @@ bool PDFGenerator::setDocumentRenderHints()
}
SET_HINT("GraphicsAntialias", true, Poppler::Document::Antialiasing)
SET_HINT("TextAntialias", true, Poppler::Document::TextAntialiasing)
-#ifdef HAVE_POPPLER_0_12_1
SET_HINT("TextHinting", false, Poppler::Document::TextHinting)
-#endif
#undef SET_HINT
#ifdef HAVE_POPPLER_0_24
// load thin line mode
@@ -1457,7 +1417,6 @@ void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * p
{
page->addAnnotation(newann);
-#ifdef HAVE_POPPLER_0_22
if ( a->subType() == Poppler::Annotation::AScreen )
{
Poppler::ScreenAnnotation *annotScreen = static_cast<Poppler::ScreenAnnotation*>( a );
@@ -1492,7 +1451,6 @@ void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * p
if ( pageClosingLink )
widgetAnnotation->setAdditionalAction( Okular::Annotation::PageClosing, createLinkFromPopplerLink( pageClosingLink ) );
}
-#endif
if ( !doDelete )
annotationsHash.insert( newann, a );
@@ -1840,12 +1798,8 @@ bool PDFGenerator::supportsOption( SaveOption option ) const
case SaveChanges:
{
// Saving files with /Encrypt is not supported before Poppler 0.22
-#ifndef HAVE_POPPLER_0_22
QMutexLocker locker( userMutex() );
return pdfdoc->isEncrypted() ? false : true;
-#else
- return true;
-#endif
}
default: ;
}
@@ -1862,16 +1816,12 @@ bool PDFGenerator::save( const QString &fileName, SaveOptions options, QString *
QMutexLocker locker( userMutex() );
bool success = pdfConv->convert();
-#ifdef HAVE_POPPLER_0_12_1
if (!success)
{
switch (pdfConv->lastError())
{
case Poppler::BaseConverter::NotSupportedInputFileError:
-#ifndef HAVE_POPPLER_0_22
- // This can only happen with Poppler before 0.22
- *errorText = i18n("Saving files with /Encrypt is not supported.");
-#endif
+ // This can only happen with Poppler before 0.22 which did not have qt5 version
break;
case Poppler::BaseConverter::NoError:
@@ -1884,7 +1834,6 @@ bool PDFGenerator::save( const QString &fileName, SaveOptions options, QString *
break;
}
}
-#endif
delete pdfConv;
return success;
}