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
remotes/origin/KDE/4.0
Pino Toscano 19 years ago
parent 37eb438999
commit fb3fec647e
  1. 22
      cmake/modules/FindPoppler.cmake
  2. 4
      config-okular.h.cmake
  3. 4
      generators/poppler/CMakeLists.txt
  4. 30
      generators/poppler/generator_pdf.cpp

@ -39,12 +39,10 @@ if (POPPLER_FOUND)
set(POPPLER_INCLUDE_DIR ${_PopplerIncDir}) set(POPPLER_INCLUDE_DIR ${_PopplerIncDir})
set(POPPLER_LIBRARY ${_PopplerLinkFlags}) 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_INCLUDES ${POPPLER_INCLUDE_DIR}/poppler ${QT_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY}) set(CMAKE_REQUIRED_LIBRARIES ${POPPLER_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
check_cxx_source_compiles(" check_cxx_source_compiles("
#define UNSTABLE_POPPLER_QT4
#include <poppler-qt4.h> #include <poppler-qt4.h>
int main() int main()
@ -54,24 +52,24 @@ int main()
return 0; return 0;
} }
" HAVE_POPPLER_HEAD ) " HAVE_POPPLER_0_6 )
set(CMAKE_REQUIRED_INCLUDES) set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES) set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_POPPLER_HEAD) if (HAVE_POPPLER_0_6)
set(popplerHeadMessage "yes") set(poppler06Message "yes")
else (HAVE_POPPLER_HEAD) else (HAVE_POPPLER_0_6)
set(popplerHeadMessage "no") set(poppler06Message "no")
endif (HAVE_POPPLER_HEAD) endif (HAVE_POPPLER_0_6)
if (NOT Poppler_FIND_QUIETLY) 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) endif (NOT Poppler_FIND_QUIETLY)
else (POPPLER_FOUND) else (POPPLER_FOUND)
if (Poppler_FIND_REQUIRED) 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_FIND_REQUIRED)
endif (POPPLER_FOUND) 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) endif(POPPLER_INCLUDE_DIR AND POPPLER_LIBRARY)

@ -1,5 +1,5 @@
/* Defines if force the use DRM in okular */ /* Defines if force the use DRM in okular */
#define OKULAR_FORCE_DRM ${_OKULAR_FORCE_DRM} #define OKULAR_FORCE_DRM ${_OKULAR_FORCE_DRM}
/* Defined if we have the HEAD version of the Poppler library */ /* Defined if we have the 0.6 version of the Poppler library */
#cmakedefine HAVE_POPPLER_HEAD 1 #cmakedefine HAVE_POPPLER_0_6 1

@ -11,12 +11,12 @@ set(okularGenerator_poppler_PART_SRCS
generator_pdf.cpp generator_pdf.cpp
) )
if (HAVE_POPPLER_HEAD) if (HAVE_POPPLER_0_6)
set(okularGenerator_poppler_PART_SRCS set(okularGenerator_poppler_PART_SRCS
${okularGenerator_poppler_PART_SRCS} ${okularGenerator_poppler_PART_SRCS}
formfields.cpp formfields.cpp
) )
endif (HAVE_POPPLER_HEAD) endif (HAVE_POPPLER_0_6)
kde4_automoc(${okularGenerator_poppler_PART_SRCS}) kde4_automoc(${okularGenerator_poppler_PART_SRCS})

@ -41,7 +41,7 @@
#include <config-okular.h> #include <config-okular.h>
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
#include "formfields.h" #include "formfields.h"
#endif #endif
@ -131,7 +131,7 @@ static void fillViewportFromLinkDestination( Okular::DocumentViewport &viewport,
left = destination.left(); left = destination.left();
top = destination.top(); top = destination.top();
#ifndef HAVE_POPPLER_HEAD #ifndef HAVE_POPPLER_0_6
Poppler::Page *page = pdfdoc->page( viewport.pageNumber ); Poppler::Page *page = pdfdoc->page( viewport.pageNumber );
QSize pageSize = page->pageSize(); QSize pageSize = page->pageSize();
delete page; delete page;
@ -162,7 +162,7 @@ static Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLin
const Poppler::LinkExecute *popplerLinkExecute; const Poppler::LinkExecute *popplerLinkExecute;
const Poppler::LinkBrowse *popplerLinkBrowse; const Poppler::LinkBrowse *popplerLinkBrowse;
const Poppler::LinkAction *popplerLinkAction; const Poppler::LinkAction *popplerLinkAction;
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
const Poppler::LinkSound *popplerLinkSound; const Poppler::LinkSound *popplerLinkSound;
#endif #endif
Okular::DocumentViewport viewport; Okular::DocumentViewport viewport;
@ -193,7 +193,7 @@ static Okular::Action* createLinkFromPopplerLink(const Poppler::Link *popplerLin
link = new Okular::DocumentAction( (Okular::DocumentAction::DocumentActionType)popplerLinkAction->actionType() ); link = new Okular::DocumentAction( (Okular::DocumentAction::DocumentActionType)popplerLinkAction->actionType() );
break; break;
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
case Poppler::Link::Sound: case Poppler::Link::Sound:
{ {
popplerLinkSound = static_cast<const Poppler::LinkSound *>(popplerLink); popplerLinkSound = static_cast<const Poppler::LinkSound *>(popplerLink);
@ -236,7 +236,7 @@ static QLinkedList<Okular::ObjectRect*> generateLinks( const QList<Poppler::Link
foreach(const Poppler::Link *popplerLink, popplerLinks) foreach(const Poppler::Link *popplerLink, popplerLinks)
{ {
QRectF linkArea = popplerLink->linkArea(); QRectF linkArea = popplerLink->linkArea();
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
double nl = linkArea.left(), double nl = linkArea.left(),
nt = linkArea.top(), nt = linkArea.top(),
nr = linkArea.right(), nr = linkArea.right(),
@ -279,7 +279,7 @@ PDFGenerator::PDFGenerator()
docFontsDirty( true ), docEmbeddedFilesDirty( true ) docFontsDirty( true ), docEmbeddedFilesDirty( true )
{ {
setFeature( TextExtraction ); setFeature( TextExtraction );
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
setFeature( ReadRawData ); setFeature( ReadRawData );
#endif #endif
// update the configuration // update the configuration
@ -321,7 +321,7 @@ bool PDFGenerator::loadDocument( const QString & filePath, QVector<Okular::Page*
bool PDFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector<Okular::Page*> & pagesVector ) bool PDFGenerator::loadDocumentFromData( const QByteArray & fileData, QVector<Okular::Page*> & pagesVector )
{ {
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
#ifndef NDEBUG #ifndef NDEBUG
if ( pdfdoc ) if ( pdfdoc )
{ {
@ -417,7 +417,7 @@ bool PDFGenerator::init(QVector<Okular::Page*> & pagesVector, const QString &wal
loadPages(pagesVector, 0, false); loadPages(pagesVector, 0, false);
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
pdfdoc->setRenderHint(Poppler::Document::Antialiasing); pdfdoc->setRenderHint(Poppler::Document::Antialiasing);
pdfdoc->setRenderHint(Poppler::Document::TextAntialiasing); pdfdoc->setRenderHint(Poppler::Document::TextAntialiasing);
#endif #endif
@ -471,7 +471,7 @@ void PDFGenerator::loadPages(QVector<Okular::Page*> &pagesVector, int rotation,
addTransition( p, page ); addTransition( p, page );
if ( true ) //TODO real check if ( true ) //TODO real check
addAnnotations( p, page ); addAnnotations( p, page );
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
Poppler::Link * tmplink = p->action( Poppler::Page::Opening ); Poppler::Link * tmplink = p->action( Poppler::Page::Opening );
if ( tmplink ) if ( tmplink )
{ {
@ -720,7 +720,7 @@ void PDFGenerator::generatePixmap( Okular::PixmapRequest * request )
Poppler::Page *p = pdfdoc->page(page->number()); Poppler::Page *p = pdfdoc->page(page->number());
// 2. Take data from outputdev and attach it to the Page // 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 ) ) ) ); page->setPixmap( request->id(), new QPixmap( QPixmap::fromImage( p->renderToImage(fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0 ) ) ) );
#else #else
page->setPixmap( request->id(), p->splashRenderToPixmap(fakeDpiX, fakeDpiY, -1, -1, request->width(), request->height(), genObjectRects, Poppler::Page::Rotate0 ) ); 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(); docLock.lock();
// TODO rotation // TODO rotation
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
double xScale = ((double)width - (double)marginLeft - (double)marginRight) / (double)width; double xScale = ((double)width - (double)marginLeft - (double)marginRight) / (double)width;
double yScale = ((double)height - (double)marginBottom - (double)marginTop) / (double)height; double yScale = ((double)height - (double)marginBottom - (double)marginTop) / (double)height;
bool strictMargins = false; 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 ) void PDFGenerator::addFormFields( Poppler::Page * popplerPage, Okular::Page * page )
{ {
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
QList<Poppler::FormField*> popplerFormFields = popplerPage->formFields(); QList<Poppler::FormField*> popplerFormFields = popplerPage->formFields();
QLinkedList<Okular::FormField*> okularFormFields; QLinkedList<Okular::FormField*> okularFormFields;
foreach( Poppler::FormField *f, popplerFormFields ) 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 // THESE VALUES HAVE TO BE IN SYNC with the poppler font type enyum
int i = 0; int i = 0;
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
fontNames.resize(12); fontNames.resize(12);
fontNames[i++] = i18n("unknown"); fontNames[i++] = i18n("unknown");
fontNames[i++] = i18n("Type 1"); fontNames[i++] = i18n("Type 1");
@ -1473,7 +1473,7 @@ void PDFGenerator::loadPdfSync( const QString & filePath, QVector<Okular::Page*>
KPrintDialogPage* PDFGenerator::printConfigurationWidget() const KPrintDialogPage* PDFGenerator::printConfigurationWidget() const
{ {
#ifdef HAVE_POPPLER_HEAD #ifdef HAVE_POPPLER_0_6
return new PDFOptionsPage(); return new PDFOptionsPage();
#else #else
return 0; return 0;
@ -1697,7 +1697,7 @@ void PDFPixmapGeneratorThread::run()
if ( !d->m_textList.isEmpty() ) if ( !d->m_textList.isEmpty() )
kDebug(PDFDebug) << "PDFPixmapGeneratorThread: previous text not taken" << endl; kDebug(PDFDebug) << "PDFPixmapGeneratorThread: previous text not taken" << endl;
#endif #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 ) ); d->m_image = new QImage( pp->renderToImage( fakeDpiX, fakeDpiY, -1, -1, -1, -1, Poppler::Page::Rotate0 ) );
#else #else
d->m_image = new QImage( pp->splashRenderToImage( fakeDpiX, fakeDpiY, -1, -1, width, height, genObjectRects, Poppler::Page::Rotate0 ) ); d->m_image = new QImage( pp->splashRenderToImage( fakeDpiX, fakeDpiY, -1, -1, width, height, genObjectRects, Poppler::Page::Rotate0 ) );

Loading…
Cancel
Save