From fb3fec647eb509789aca0e3f779b1845fa87c4af Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 25 May 2007 23:57:03 +0000 Subject: [PATCH] the Poppler library is going to start the release cycle of the 0.6 serie, so s/HEAD/0_6/ svn path=/trunk/KDE/kdegraphics/okular/; revision=668326 --- cmake/modules/FindPoppler.cmake | 22 ++++++++++---------- config-okular.h.cmake | 4 ++-- generators/poppler/CMakeLists.txt | 4 ++-- generators/poppler/generator_pdf.cpp | 30 ++++++++++++++-------------- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/cmake/modules/FindPoppler.cmake b/cmake/modules/FindPoppler.cmake index 6e87b0919..b2df1b554 100644 --- a/cmake/modules/FindPoppler.cmake +++ b/cmake/modules/FindPoppler.cmake @@ -39,12 +39,10 @@ if (POPPLER_FOUND) set(POPPLER_INCLUDE_DIR ${_PopplerIncDir}) set(POPPLER_LIBRARY ${_PopplerLinkFlags}) - # check whether we're using poppler HEAD + # check whether we're using poppler 0.6 set(CMAKE_REQUIRED_INCLUDES ${POPPLER_INCLUDE_DIR}/poppler ${QT_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}) check_cxx_source_compiles(" -#define UNSTABLE_POPPLER_QT4 - #include int main() @@ -54,24 +52,24 @@ int main() return 0; } -" HAVE_POPPLER_HEAD ) +" HAVE_POPPLER_0_6 ) set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_LIBRARIES) - if (HAVE_POPPLER_HEAD) - set(popplerHeadMessage "yes") - else (HAVE_POPPLER_HEAD) - set(popplerHeadMessage "no") - endif (HAVE_POPPLER_HEAD) + if (HAVE_POPPLER_0_6) + set(poppler06Message "yes") + else (HAVE_POPPLER_0_6) + set(poppler06Message "no") + endif (HAVE_POPPLER_0_6) if (NOT Poppler_FIND_QUIETLY) - message(STATUS "Found Poppler-Qt4: ${POPPLER_LIBRARY}, HEAD? ${popplerHeadMessage}") + message(STATUS "Found Poppler-Qt4: ${POPPLER_LIBRARY}, 0.6.x? ${poppler06Message}") endif (NOT Poppler_FIND_QUIETLY) else (POPPLER_FOUND) if (Poppler_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find Poppler-qt4") + message(FATAL_ERROR "Could NOT find Poppler-Qt4") endif (Poppler_FIND_REQUIRED) endif (POPPLER_FOUND) -MARK_AS_ADVANCED(POPPLER_INCLUDE_DIR POPPLER_LIBRARY) +MARK_AS_ADVANCED(POPPLER_INCLUDE_DIR POPPLER_LIBRARY HAVE_POPPLER_0_6) endif(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY) diff --git a/config-okular.h.cmake b/config-okular.h.cmake index 86a5ddad1..db91968c3 100644 --- a/config-okular.h.cmake +++ b/config-okular.h.cmake @@ -1,5 +1,5 @@ /* Defines if force the use DRM in okular */ #define OKULAR_FORCE_DRM ${_OKULAR_FORCE_DRM} -/* Defined if we have the HEAD version of the Poppler library */ -#cmakedefine HAVE_POPPLER_HEAD 1 +/* Defined if we have the 0.6 version of the Poppler library */ +#cmakedefine HAVE_POPPLER_0_6 1 diff --git a/generators/poppler/CMakeLists.txt b/generators/poppler/CMakeLists.txt index 0c7349f0e..59e4dbeb9 100644 --- a/generators/poppler/CMakeLists.txt +++ b/generators/poppler/CMakeLists.txt @@ -11,12 +11,12 @@ set(okularGenerator_poppler_PART_SRCS generator_pdf.cpp ) -if (HAVE_POPPLER_HEAD) +if (HAVE_POPPLER_0_6) set(okularGenerator_poppler_PART_SRCS ${okularGenerator_poppler_PART_SRCS} formfields.cpp ) -endif (HAVE_POPPLER_HEAD) +endif (HAVE_POPPLER_0_6) kde4_automoc(${okularGenerator_poppler_PART_SRCS}) diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index be18ddd10..66b0846ed 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -41,7 +41,7 @@ #include -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 #include "formfields.h" #endif @@ -131,7 +131,7 @@ static void fillViewportFromLinkDestination( Okular::DocumentViewport &viewport, left = destination.left(); top = destination.top(); -#ifndef HAVE_POPPLER_HEAD +#ifndef HAVE_POPPLER_0_6 Poppler::Page *page = pdfdoc->page( viewport.pageNumber ); QSize pageSize = page->pageSize(); delete page; @@ -162,7 +162,7 @@ static Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLin const Poppler::LinkExecute *popplerLinkExecute; const Poppler::LinkBrowse *popplerLinkBrowse; const Poppler::LinkAction *popplerLinkAction; -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 const Poppler::LinkSound *popplerLinkSound; #endif Okular::DocumentViewport viewport; @@ -193,7 +193,7 @@ static Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLin link = new Okular::DocumentAction( (Okular::DocumentAction::DocumentActionType)popplerLinkAction->actionType() ); break; -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 case Poppler::Link::Sound: { popplerLinkSound = static_cast(popplerLink); @@ -236,7 +236,7 @@ static QLinkedList generateLinks( const QListlinkArea(); -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 double nl = linkArea.left(), nt = linkArea.top(), nr = linkArea.right(), @@ -279,7 +279,7 @@ PDFGenerator::PDFGenerator() docFontsDirty( true ), docEmbeddedFilesDirty( true ) { setFeature( TextExtraction ); -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 setFeature( ReadRawData ); #endif // update the configuration @@ -321,7 +321,7 @@ bool PDFGenerator::loadDocument( const QString & filePath, QVector & pagesVector ) { -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 #ifndef NDEBUG if ( pdfdoc ) { @@ -417,7 +417,7 @@ bool PDFGenerator::init(QVector & pagesVector, const QString &wal loadPages(pagesVector, 0, false); -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 pdfdoc->setRenderHint(Poppler::Document::Antialiasing); pdfdoc->setRenderHint(Poppler::Document::TextAntialiasing); #endif @@ -471,7 +471,7 @@ void PDFGenerator::loadPages(QVector &pagesVector, int rotation, addTransition( p, page ); if ( true ) //TODO real check addAnnotations( p, page ); -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 Poppler::Link * tmplink = p->action( Poppler::Page::Opening ); if ( tmplink ) { @@ -720,7 +720,7 @@ void PDFGenerator::generatePixmap( Okular::PixmapRequest * request ) Poppler::Page *p = pdfdoc->page(page->number()); // 2. Take data from outputdev and attach it to the Page -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 page->setPixmap( request->id(), new QPixmap( QPixmap::fromImage( p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0 ) ) ) ); #else page->setPixmap( request->id(), p->splashRenderToPixmap(fakeDpiX, fakeDpiY, -1, -1, request->width(), request->height(), genObjectRects, Poppler::Page::Rotate0 ) ); @@ -823,7 +823,7 @@ bool PDFGenerator::print( KPrinter& printer ) docLock.lock(); // TODO rotation -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 double xScale = ((double)width - (double)marginLeft - (double)marginRight) / (double)width; double yScale = ((double)height - (double)marginBottom - (double)marginTop) / (double)height; bool strictMargins = false; @@ -1272,7 +1272,7 @@ void PDFGenerator::addTransition( Poppler::Page * pdfPage, Okular::Page * page ) void PDFGenerator::addFormFields( Poppler::Page * popplerPage, Okular::Page * page ) { -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 QList popplerFormFields = popplerPage->formFields(); QLinkedList okularFormFields; foreach( Poppler::FormField *f, popplerFormFields ) @@ -1312,7 +1312,7 @@ void PDFGenerator::initFontNames() // THESE VALUES HAVE TO BE IN SYNC with the poppler font type enyum int i = 0; -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 fontNames.resize(12); fontNames[i++] = i18n("unknown"); fontNames[i++] = i18n("Type 1"); @@ -1473,7 +1473,7 @@ void PDFGenerator::loadPdfSync( const QString & filePath, QVector KPrintDialogPage* PDFGenerator::printConfigurationWidget() const { -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 return new PDFOptionsPage(); #else return 0; @@ -1697,7 +1697,7 @@ void PDFPixmapGeneratorThread::run() if ( !d->m_textList.isEmpty() ) kDebug(PDFDebug) << "PDFPixmapGeneratorThread: previous text not taken" << endl; #endif -#ifdef HAVE_POPPLER_HEAD +#ifdef HAVE_POPPLER_0_6 d->m_image = new QImage( pp->renderToImage( fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0 ) ); #else d->m_image = new QImage( pp->splashRenderToImage( fakeDpiX, fakeDpiY, -1, -1, width, height, genObjectRects, Poppler::Page::Rotate0 ) );