From 7f519abe783be1c2f2a476cc92567f4d70b45432 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 26 Jan 2012 23:48:27 +0100 Subject: [PATCH] Increase poppler required version to 0.12.1 Released Sun Oct 18, 2009, if you want to build this new Okular with that old poppler version you should really think updating it too, there's been lots of fixes since then --- cmake/modules/FindPoppler.cmake | 28 ------------------- generators/CMakeLists.txt | 6 ++-- generators/poppler/CMakeLists.txt | 18 ------------ generators/poppler/annots.cpp | 4 --- .../poppler/config-okular-poppler.h.cmake | 6 ---- generators/poppler/formfields.cpp | 6 ---- generators/poppler/generator_pdf.cpp | 22 --------------- 7 files changed, 3 insertions(+), 87 deletions(-) diff --git a/cmake/modules/FindPoppler.cmake b/cmake/modules/FindPoppler.cmake index d8e8a43e4..6b1ad660f 100644 --- a/cmake/modules/FindPoppler.cmake +++ b/cmake/modules/FindPoppler.cmake @@ -60,28 +60,6 @@ if (POPPLER_FOUND) # check whether we're using poppler 0.6 set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR} ${QT_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}) -check_cxx_source_compiles(" -#include - -int main() -{ - Poppler::SoundObject * so = 0; - (void)so; - - return 0; -} -" HAVE_POPPLER_0_6 ) - -check_cxx_source_compiles(" -#include -#include -int main() -{ - Poppler::FormFieldButton * button = 0; - button->buttonType(); - return 0; -} -" HAVE_POPPLER_0_8) check_cxx_source_compiles(" #include @@ -112,10 +90,6 @@ int main() set(popplerVersionMessage "0.16") elseif (HAVE_POPPLER_0_12_1) set(popplerVersionMessage "0.12.1") - elseif (HAVE_POPPLER_0_8) - set(popplerVersionMessage "0.8") - elseif (HAVE_POPPLER_0_6) - set(popplerVersionMessage "0.6") else (HAVE_POPPLER_0_16) set(popplerVersionMessage "0.5.4") endif (HAVE_POPPLER_0_16) @@ -132,8 +106,6 @@ endif (POPPLER_FOUND) # ensure that they are cached set(POPPLER_INCLUDE_DIR ${POPPLER_INCLUDE_DIR} CACHE INTERNAL "The Poppler-Qt4 include path") set(POPPLER_LIBRARY ${POPPLER_LIBRARY} CACHE INTERNAL "The Poppler-Qt4 library") -set(HAVE_POPPLER_0_6 ${HAVE_POPPLER_0_6} CACHE INTERNAL "Whether the version of Poppler-Qt4 is >= 0.6") -set(HAVE_POPPLER_0_8 ${HAVE_POPPLER_0_8} CACHE INTERNAL "Whether the version of Poppler-Qt4 is >= 0.8") set(HAVE_POPPLER_0_12_1 ${HAVE_POPPLER_0_12_1} CACHE INTERNAL "Whether the version of Poppler-Qt4 is >= 0.12.1") endif(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY) diff --git a/generators/CMakeLists.txt b/generators/CMakeLists.txt index 0f6fc5cf7..5a101bf4c 100644 --- a/generators/CMakeLists.txt +++ b/generators/CMakeLists.txt @@ -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.8" "Support for PDF files in okular.") +macro_log_feature(HAVE_POPPLER_0_12_1 "Poppler-Qt4" "A PDF rendering library" "http://poppler.freedesktop.org" FALSE "0.12.1" "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.") @@ -30,9 +30,9 @@ macro_log_feature(EPUB_FOUND "libepub" "A library for reading EPub documents" "h # let's enable the generators properly configured -if(POPPLER_FOUND AND HAVE_POPPLER_0_8) +if(POPPLER_FOUND AND HAVE_POPPLER_0_12_1) add_subdirectory(poppler) -endif(POPPLER_FOUND AND HAVE_POPPLER_0_8) +endif(POPPLER_FOUND AND HAVE_POPPLER_0_12_1) if(LIBSPECTRE_FOUND) add_subdirectory(spectre) diff --git a/generators/poppler/CMakeLists.txt b/generators/poppler/CMakeLists.txt index 599afc949..78885fc79 100644 --- a/generators/poppler/CMakeLists.txt +++ b/generators/poppler/CMakeLists.txt @@ -1,24 +1,6 @@ set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR} ${QT_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}) -check_cxx_source_compiles(" -#include -int main() -{ - Poppler::Document * doc = 0; - (void)doc->scripts(); - return 0; -} -" HAVE_POPPLER_0_9) -check_cxx_source_compiles(" -#include -int main() -{ - Poppler::LinkDestination * dest = 0; - const QString foo = dest->destinationName(); - return 0; -} -" HAVE_POPPLER_0_11) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/config-okular-poppler.h.cmake diff --git a/generators/poppler/annots.cpp b/generators/poppler/annots.cpp index b513f6c7e..2944b6495 100644 --- a/generators/poppler/annots.cpp +++ b/generators/poppler/annots.cpp @@ -20,9 +20,7 @@ Q_DECLARE_METATYPE( Poppler::Annotation* ) extern Okular::Sound* createSoundFromPopplerSound( const Poppler::SoundObject *popplerSound ); -#ifdef HAVE_POPPLER_0_9 extern Okular::Movie* createMovieFromPopplerMovie( const Poppler::MovieObject *popplerMovie ); -#endif static void disposeAnnotation( const Okular::Annotation *ann ) { @@ -37,7 +35,6 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation * bool tieToOkularAnn = false; switch ( ann->subType() ) { -#ifdef HAVE_POPPLER_0_9 case Poppler::Annotation::AFileAttachment: { Poppler::FileAttachmentAnnotation * attachann = static_cast< Poppler::FileAttachmentAnnotation * >( ann ); @@ -72,7 +69,6 @@ Okular::Annotation* createAnnotationFromPopplerAnnotation( Poppler::Annotation * break; } -#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 diff --git a/generators/poppler/config-okular-poppler.h.cmake b/generators/poppler/config-okular-poppler.h.cmake index 464a396ac..3f88d7faa 100644 --- a/generators/poppler/config-okular-poppler.h.cmake +++ b/generators/poppler/config-okular-poppler.h.cmake @@ -1,9 +1,3 @@ -/* Defined if we have the 0.9 version of the Poppler library */ -#cmakedefine HAVE_POPPLER_0_9 1 - -/* Defined if we have the 0.11 version of the Poppler library */ -#cmakedefine HAVE_POPPLER_0_11 1 - /* Defined if we have the 0.12.1 version of the Poppler library */ #cmakedefine HAVE_POPPLER_0_12_1 1 diff --git a/generators/poppler/formfields.cpp b/generators/poppler/formfields.cpp index c7152e320..ba955b88e 100644 --- a/generators/poppler/formfields.cpp +++ b/generators/poppler/formfields.cpp @@ -21,14 +21,12 @@ PopplerFormFieldButton::PopplerFormFieldButton( Poppler::FormFieldButton * field : Okular::FormFieldButton(), m_field( field ) { m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() ); -#ifdef HAVE_POPPLER_0_9 Poppler::Link *aAction = field->activationAction(); if ( aAction ) { setActivationAction( createLinkFromPopplerLink( aAction ) ); delete aAction; } -#endif } PopplerFormFieldButton::~PopplerFormFieldButton() @@ -105,14 +103,12 @@ PopplerFormFieldText::PopplerFormFieldText( Poppler::FormFieldText * field ) : Okular::FormFieldText(), m_field( field ) { m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() ); -#ifdef HAVE_POPPLER_0_9 Poppler::Link *aAction = field->activationAction(); if ( aAction ) { setActivationAction( createLinkFromPopplerLink( aAction ) ); delete aAction; } -#endif } PopplerFormFieldText::~PopplerFormFieldText() @@ -204,14 +200,12 @@ PopplerFormFieldChoice::PopplerFormFieldChoice( Poppler::FormFieldChoice * field : Okular::FormFieldChoice(), m_field( field ) { m_rect = Okular::NormalizedRect::fromQRectF( m_field->rect() ); -#ifdef HAVE_POPPLER_0_9 Poppler::Link *aAction = field->activationAction(); if ( aAction ) { setActivationAction( createLinkFromPopplerLink( aAction ) ); delete aAction; } -#endif } PopplerFormFieldChoice::~PopplerFormFieldChoice() diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index cba36aeb9..391d304a6 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -48,9 +48,7 @@ #include "formfields.h" #include "popplerembeddedfile.h" -#ifdef HAVE_POPPLER_0_9 Q_DECLARE_METATYPE(Poppler::FontInfo) -#endif static const int PDFDebug = 4710; static const int defaultPageWidth = 595; @@ -143,7 +141,6 @@ Okular::Sound* createSoundFromPopplerSound( const Poppler::SoundObject *popplerS return sound; } -#ifdef HAVE_POPPLER_0_9 Okular::Movie* createMovieFromPopplerMovie( const Poppler::MovieObject *popplerMovie ) { Okular::Movie *movie = new Okular::Movie( popplerMovie->url() ); @@ -153,7 +150,6 @@ Okular::Movie* createMovieFromPopplerMovie( const Poppler::MovieObject *popplerM movie->setPlayMode( (Okular::Movie::PlayMode)popplerMovie->playMode() ); return movie; } -#endif Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink) { @@ -163,9 +159,7 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink) const Poppler::LinkBrowse *popplerLinkBrowse; const Poppler::LinkAction *popplerLinkAction; const Poppler::LinkSound *popplerLinkSound; -#ifdef HAVE_POPPLER_0_9 const Poppler::LinkJavaScript *popplerLinkJS; -#endif Okular::DocumentViewport viewport; switch(popplerLink->linkType()) @@ -176,7 +170,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink) case Poppler::Link::Goto: { popplerLinkGoto = static_cast(popplerLink); -#ifdef HAVE_POPPLER_0_11 const Poppler::LinkDestination dest = popplerLinkGoto->destination(); const QString destName = dest.destinationName(); if (destName.isEmpty()) @@ -188,10 +181,6 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink) { link = new Okular::GotoAction(popplerLinkGoto->fileName(), destName); } -#else - fillViewportFromLinkDestination( viewport, popplerLinkGoto->destination() ); - link = new Okular::GotoAction(popplerLinkGoto->fileName(), viewport); -#endif } break; @@ -219,14 +208,12 @@ Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLink) } break; -#ifdef HAVE_POPPLER_0_9 case Poppler::Link::JavaScript: { popplerLinkJS = static_cast(popplerLink); link = new Okular::ScriptAction( Okular::JavaScript, popplerLinkJS->script() ); } break; -#endif case Poppler::Link::Movie: // not implemented @@ -700,13 +687,11 @@ Okular::FontInfo::List PDFGenerator::fontsForPage( int page ) of.setType( convertPopplerFontInfoTypeToOkularFontInfoType( font.type() ) ); of.setEmbedType( embedTypeForPopplerFontInfo( font) ); of.setFile( font.file() ); -#ifdef HAVE_POPPLER_0_9 of.setCanBeExtracted( of.embedType() != Okular::FontInfo::NotEmbedded ); QVariant nativeId; nativeId.setValue( font ); of.setNativeId( nativeId ); -#endif list.append( of ); } @@ -849,13 +834,8 @@ Okular::TextPage* PDFGenerator::textPage( Okular::Page *page ) void PDFGenerator::requestFontData(const Okular::FontInfo &font, QByteArray *data) { -#ifdef HAVE_POPPLER_0_9 Poppler::FontInfo fi = font.nativeId().value(); *data = pdfdoc->fontData(fi); -#else - Q_UNUSED( font ) - Q_UNUSED( data ) -#endif } #define DUMMY_QPRINTER_COPY @@ -1025,13 +1005,11 @@ QVariant PDFGenerator::metaData( const QString & key, const QVariant & option ) if ( pdfdoc->pageMode() == Poppler::Document::UseOutlines ) return true; } -#ifdef HAVE_POPPLER_0_9 else if ( key == "DocumentScripts" && option.toString() == "JavaScript" ) { QMutexLocker ml(userMutex()); return pdfdoc->scripts(); } -#endif return QVariant(); }