OSDN Git Service

poppler: bump minimum Poppler version to 0.28.0
authorIvailo Monev <xakepa10@gmail.com>
Wed, 13 Apr 2016 14:41:20 +0000 (14:41 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Wed, 13 Apr 2016 14:41:20 +0000 (14:41 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
okular/generators/CMakeLists.txt
okular/generators/poppler/CMakeLists.txt
okular/generators/poppler/annots.cpp
okular/generators/poppler/config-okular-poppler.h.cmake
okular/generators/poppler/formfields.cpp
okular/generators/poppler/generator_pdf.cpp

index d0d2c68..1975c8c 100644 (file)
@@ -3,7 +3,7 @@ include (MacroLogFeature)
 set(LIBSPECTRE_MINIMUM_VERSION "0.2")
 
 macro_optional_find_package(Poppler)
-macro_log_feature(POPPLER_FOUND "Poppler-Qt4" "A PDF rendering library" "http://poppler.freedesktop.org" FALSE "0.12.1" "Support for PDF files in okular.")
+macro_log_feature(POPPLER_FOUND "Poppler-Qt4" "A PDF rendering library" "http://poppler.freedesktop.org" FALSE "0.28.0" "Support for PDF files in okular.")
 
 macro_optional_find_package(LibSpectre)
 macro_log_feature(LIBSPECTRE_FOUND "libspectre" "A PostScript rendering library" "http://libspectre.freedesktop.org/wiki/" FALSE "${LIBSPECTRE_MINIMUM_VERSION}" "Support for PS files in okular.")
index 105a805..86ea45e 100644 (file)
@@ -34,7 +34,6 @@ set(okularGenerator_poppler_PART_SRCS
    annots.cpp
    synctex/synctex_parser.c
    synctex/synctex_parser_utils.c
-   pdfsettingswidget.ui
 )
 
 kde4_add_kcfg_files(okularGenerator_poppler_PART_SRCS conf/pdfsettings.kcfgc )
index 65ca4f3..3c7b6c6 100644 (file)
@@ -69,12 +69,10 @@ bool PopplerAnnotationProxy::supports( Capability cap ) const
 {
     switch ( cap )
     {
-#ifdef HAVE_POPPLER_0_20
         case Addition:
         case Modification:
         case Removal:
             return true;
-#endif
         default:
             return false;
     }
@@ -82,7 +80,6 @@ bool PopplerAnnotationProxy::supports( Capability cap ) const
 
 void PopplerAnnotationProxy::notifyAddition( Okular::Annotation *okl_ann, int page )
 {
-#ifdef HAVE_POPPLER_0_20
     // Export annotation to DOM
     QDomDocument doc;
     QDomElement dom_ann = doc.createElement( "root" );
@@ -127,12 +124,10 @@ void PopplerAnnotationProxy::notifyAddition( Okular::Annotation *okl_ann, int pa
     okl_ann->setDisposeDataFunction( disposeAnnotation );
 
     kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
 }
 
 void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_ann, int page, bool appearanceChanged )
 {
-#ifdef HAVE_POPPLER_0_20
     Q_UNUSED( page );
     Q_UNUSED( appearanceChanged );
 
@@ -241,12 +236,10 @@ void PopplerAnnotationProxy::notifyModification( const Okular::Annotation *okl_a
     }
 
     kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
 }
 
 void PopplerAnnotationProxy::notifyRemoval( Okular::Annotation *okl_ann, int page )
 {
-#ifdef HAVE_POPPLER_0_20
     Poppler::Annotation *ppl_ann = qvariant_cast<Poppler::Annotation*>( okl_ann->nativeId() );
 
     if ( !ppl_ann ) // Ignore non-native annotations
@@ -261,7 +254,6 @@ void PopplerAnnotationProxy::notifyRemoval( Okular::Annotation *okl_ann, int pag
     okl_ann->setNativeId( qVariantFromValue(0) ); // So that we don't double-free in disposeAnnotation
 
     kDebug(PDFGenerator::PDFDebug) << okl_ann->uniqueName();
-#endif
 }
 //END PopplerAnnotationProxy implementation
 
@@ -309,28 +301,17 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation *
 
             break;
         }
-#ifdef HAVE_POPPLER_0_22
         case Poppler::Annotation::AWidget:
         {
             annotation = new Okular::WidgetAnnotation();
             break;
         }
-#endif
-#ifdef HAVE_POPPLER_0_20
         case Poppler::Annotation::AScreen:
         {
-#ifdef HAVE_POPPLER_0_22
             Okular::ScreenAnnotation * m = new Okular::ScreenAnnotation();
             annotation = m;
             tieToOkularAnn = true;
             *doDelete = false;
-#else
-            Poppler::ScreenAnnotation * screenann = static_cast< Poppler::ScreenAnnotation * >( ann );
-            Okular::MovieAnnotation * m = new Okular::MovieAnnotation();
-            annotation = m;
-
-            m->setMovie( createMovieFromPopplerScreen( screenann->action() ) );
-#endif
             break;
         }
         case Poppler::Annotation::AText:
@@ -348,7 +329,6 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation *
             *doDelete = false;
             /* fallback */
         }
-#endif
         default:
         {
             // this is uber ugly but i don't know a better way to do it without introducing a poppler::annotation dependency on core
index 1e8ff9e..a5d478d 100644 (file)
@@ -1,17 +1,2 @@
-/* Defined if we have the 0.12.1 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_12_1 1
-
-/* Defined if we have the 0.16 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_16 1
-
-/* Defined if we have the 0.20 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_20 1
-
-/* Defined if we have the 0.22 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_22 1
-
-/* Defined if we have the 0.24 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_24 1
-
-/* Defined if we have the 0.28 version of the Poppler library */
-#cmakedefine HAVE_POPPLER_0_28 1
+/* Defined if we have the <VERSION> version of the Poppler library */
+/* #cmakedefine HAVE_POPPLER_<VERSION> 1 */
index 53e50ed..3dd742f 100644 (file)
@@ -279,18 +279,12 @@ void PopplerFormFieldChoice::setCurrentChoices( const QList<int>& choices )
 
 QString PopplerFormFieldChoice::editChoice() const
 {
-#ifdef HAVE_POPPLER_0_22
     return m_field->editChoice();
-#else
-    return QString();
-#endif
 }
 
 void PopplerFormFieldChoice::setEditChoice( const QString& text )
 {
-#ifdef HAVE_POPPLER_0_22
     m_field->setEditChoice( text );
-#endif
 }
 
 Qt::Alignment PopplerFormFieldChoice::textAlignment() const
index c2350ca..a2cf09b 100644 (file)
@@ -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,9 +56,7 @@
 
 Q_DECLARE_METATYPE(Poppler::Annotation*)
 Q_DECLARE_METATYPE(Poppler::FontInfo)
-#ifdef HAVE_POPPLER_0_20
 Q_DECLARE_METATYPE(const Poppler::LinkMovie*)
-#endif
 
 static const int defaultPageWidth = 595;
 static const int defaultPageHeight = 842;
@@ -82,9 +78,6 @@ class PDFOptionsPage : public QWidget
            layout->addWidget(m_forceRaster);
            layout->addStretch(1);
 
-#if defined(Q_WS_WIN) || !defined(HAVE_POPPLER_0_20)
-           m_printAnnots->setVisible( false );
-#endif
            setPrintAnnots( true ); // Default value
        }
 
@@ -180,10 +173,8 @@ 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;
 }
 
@@ -198,9 +189,7 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
     const Poppler::LinkBrowse *popplerLinkBrowse;
     const Poppler::LinkAction *popplerLinkAction;
     const Poppler::LinkSound *popplerLinkSound;
-#ifdef HAVE_POPPLER_0_20
     const Poppler::LinkMovie *popplerLinkMovie;
-#endif
     Okular::DocumentViewport viewport;
 
     bool deletePopplerLink = true;
@@ -251,7 +240,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
         }
         break;
 
-#ifdef HAVE_POPPLER_0_20
         case Poppler::Link::Movie:
         {
             deletePopplerLink = false; // we'll delete it inside resolveMediaLinkReferences() after we have resolved all references
@@ -280,7 +268,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink)
             link = movieAction;
         }
         break;
-#endif
     }
 
     if ( deletePopplerLink )
@@ -342,13 +329,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 ),
@@ -369,11 +354,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()
@@ -862,7 +845,6 @@ void resolveMediaLinks( Okular::Action *action, enum Okular::Annotation::SubType
 
 void PDFGenerator::resolveMediaLinkReference( Okular::Action *action )
 {
-#ifdef HAVE_POPPLER_0_20
     if ( !action )
         return;
 
@@ -870,8 +852,6 @@ void PDFGenerator::resolveMediaLinkReference( Okular::Action *action )
         return;
 
     resolveMediaLinks<Poppler::LinkMovie, Okular::MovieAction, Poppler::MovieAnnotation, Okular::MovieAnnotation>( action, Okular::Annotation::AMovie, annotationsHash );
-
-#endif
 }
 
 void PDFGenerator::resolveMediaLinkReferences( Okular::Page *page )
@@ -1036,10 +1016,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())
@@ -1121,12 +1099,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();
 }
@@ -1156,12 +1130,10 @@ bool PDFGenerator::reparseConfig()
 
 void PDFGenerator::addPages( KConfigDialog *dlg )
 {
-#ifdef HAVE_POPPLER_0_24
     Ui_PDFSettingsWidget pdfsw;
     QWidget* w = new QWidget(dlg);
     pdfsw.setupUi(w);
     dlg->addPage(w, PDFSettings::self(), i18n("PDF"), "application-pdf", i18n("PDF Backend Configuration") );
-#endif
 }
 
 bool PDFGenerator::setDocumentRenderHints()
@@ -1179,11 +1151,8 @@ 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
     const int thinLineMode = PDFSettings::enhanceThinLines();
     const bool enableThinLineSolid = thinLineMode == PDFSettings::EnumEnhanceThinLines::Solid;
@@ -1198,7 +1167,6 @@ bool PDFGenerator::setDocumentRenderHints()
       pdfdoc->setRenderHint(Poppler::Document::ThinLineShape, enableShapeLineSolid);
       changed = true;
     }
-#endif
     return changed;
 }
 
@@ -1347,7 +1315,6 @@ void PDFGenerator::addSynopsisChildren( QDomNode * parent, QDomNode * parentDest
 
 void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * page )
 {
-#ifdef HAVE_POPPLER_0_28
     QSet<Poppler::Annotation::SubType> subtypes;
     subtypes << Poppler::Annotation::AFileAttachment
         << Poppler::Annotation::ASound
@@ -1363,9 +1330,6 @@ void PDFGenerator::addAnnotations( Poppler::Page * popplerPage, Okular::Page * p
         << Poppler::Annotation::ACaret;
 
     QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations( subtypes );
-#else
-    QList<Poppler::Annotation*> popplerAnnotations = popplerPage->annotations();
-#endif
 
     foreach(Poppler::Annotation *a, popplerAnnotations)
     {
@@ -1375,7 +1339,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 );
@@ -1410,7 +1373,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 );
@@ -1757,13 +1719,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
+            // Saving files with /Encrypt is supported after Poppler 0.22
             return true;
-#endif
         }
         default: ;
     }
@@ -1780,16 +1737,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 and /Encrypt
             break;
 
             case Poppler::BaseConverter::NoError:
@@ -1802,7 +1755,6 @@ bool PDFGenerator::save( const QString &fileName, SaveOptions options, QString *
             break;
         }
     }
-#endif
     delete pdfConv;
     return success;
 }