From 4d12c257b20dcb1d6543263dcf52cd40ab21ab89 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Sun, 13 Sep 2020 01:18:34 +0200 Subject: [PATCH] Remove poppler 0.74 ifdefs since we require 0.86 now --- generators/poppler/CMakeLists.txt | 10 ---- .../poppler/config-okular-poppler.h.cmake | 3 -- generators/poppler/generator_pdf.cpp | 50 ------------------- generators/poppler/generator_pdf.h | 4 -- 4 files changed, 67 deletions(-) diff --git a/generators/poppler/CMakeLists.txt b/generators/poppler/CMakeLists.txt index a26f5c22e..1d92d25f8 100644 --- a/generators/poppler/CMakeLists.txt +++ b/generators/poppler/CMakeLists.txt @@ -5,16 +5,6 @@ add_subdirectory( conf ) set(CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui) -check_cxx_source_compiles(" -#include -int main() -{ - Poppler::Document *document = nullptr; - (void)document->outline(); - return 0; -} -" HAVE_POPPLER_0_74) - check_cxx_source_compiles(" #include #include diff --git a/generators/poppler/config-okular-poppler.h.cmake b/generators/poppler/config-okular-poppler.h.cmake index 0a20718a2..24a3101d6 100644 --- a/generators/poppler/config-okular-poppler.h.cmake +++ b/generators/poppler/config-okular-poppler.h.cmake @@ -1,6 +1,3 @@ -/* Defined if we have the 0.74 version of the Poppler library */ -#cmakedefine HAVE_POPPLER_0_74 1 - /* Defined if we have the 0.79 version of the Poppler library */ #cmakedefine HAVE_POPPLER_0_79 1 diff --git a/generators/poppler/generator_pdf.cpp b/generators/poppler/generator_pdf.cpp index 8dfa15fe5..357c690a1 100644 --- a/generators/poppler/generator_pdf.cpp +++ b/generators/poppler/generator_pdf.cpp @@ -845,7 +845,6 @@ const Okular::DocumentSynopsis *PDFGenerator::generateDocumentSynopsis() if (!pdfdoc) return nullptr; -#ifdef HAVE_POPPLER_0_74 userMutex()->lock(); const QVector outline = pdfdoc->outline(); userMutex()->unlock(); @@ -854,16 +853,6 @@ const Okular::DocumentSynopsis *PDFGenerator::generateDocumentSynopsis() return nullptr; addSynopsisChildren(outline, &docSyn); -#else - userMutex()->lock(); - QDomDocument *toc = pdfdoc->toc(); - userMutex()->unlock(); - if (!toc) - return nullptr; - - addSynopsisChildren(toc, &docSyn); - delete toc; -#endif docSynopsisDirty = false; return &docSyn; @@ -1610,8 +1599,6 @@ Okular::TextPage *PDFGenerator::abstractTextPage(const QList return ktp; } -#ifdef HAVE_POPPLER_0_74 - void PDFGenerator::addSynopsisChildren(const QVector &outlineItems, QDomNode *parentDestination) { for (const Poppler::OutlineItem &outlineItem : outlineItems) { @@ -1638,43 +1625,6 @@ void PDFGenerator::addSynopsisChildren(const QVector &outl } } -#else - -void PDFGenerator::addSynopsisChildren(QDomNode *parent, QDomNode *parentDestination) -{ - // keep track of the current listViewItem - QDomNode n = parent->firstChild(); - while (!n.isNull()) { - // convert the node to an element (sure it is) - QDomElement e = n.toElement(); - - // The name is the same - QDomElement item = docSyn.createElement(e.tagName()); - parentDestination->appendChild(item); - - if (!e.attribute(QStringLiteral("ExternalFileName")).isNull()) - item.setAttribute(QStringLiteral("ExternalFileName"), e.attribute(QStringLiteral("ExternalFileName"))); - if (!e.attribute(QStringLiteral("DestinationName")).isNull()) - item.setAttribute(QStringLiteral("ViewportName"), e.attribute(QStringLiteral("DestinationName"))); - if (!e.attribute(QStringLiteral("Destination")).isNull()) { - Okular::DocumentViewport vp; - fillViewportFromLinkDestination(vp, Poppler::LinkDestination(e.attribute(QStringLiteral("Destination")))); - item.setAttribute(QStringLiteral("Viewport"), vp.toString()); - } - if (!e.attribute(QStringLiteral("Open")).isNull()) - item.setAttribute(QStringLiteral("Open"), e.attribute(QStringLiteral("Open"))); - if (!e.attribute(QStringLiteral("DestinationURI")).isNull()) - item.setAttribute(QStringLiteral("URL"), e.attribute(QStringLiteral("DestinationURI"))); - - // descend recursively and advance to the next node - if (e.hasChildNodes()) - addSynopsisChildren(&n, &item); - n = n.nextSibling(); - } -} - -#endif - void PDFGenerator::addAnnotations(Poppler::Page *popplerPage, Okular::Page *page) { QSet subtypes; diff --git a/generators/poppler/generator_pdf.h b/generators/poppler/generator_pdf.h index 593be3381..64f2c5b24 100644 --- a/generators/poppler/generator_pdf.h +++ b/generators/poppler/generator_pdf.h @@ -113,11 +113,7 @@ private: Okular::Document::OpenResult init(QVector &pagesVector, const QString &password); // create the document synopsis hierarchy -#ifdef HAVE_POPPLER_0_74 void addSynopsisChildren(const QVector &outlineItems, QDomNode *parentDestination); -#else - void addSynopsisChildren(QDomNode *parentSource, QDomNode *parentDestination); -#endif // fetch annotations from the pdf file and add they to the page void addAnnotations(Poppler::Page *popplerPage, Okular::Page *page); // fetch the transition information and add it to the page