Remove poppler 0.74 ifdefs since we require 0.86 now

remotes/origin/work/aacid/shorcutslost_2008
Albert Astals Cid 6 years ago
parent 9264723002
commit 4d12c257b2
  1. 10
      generators/poppler/CMakeLists.txt
  2. 3
      generators/poppler/config-okular-poppler.h.cmake
  3. 50
      generators/poppler/generator_pdf.cpp
  4. 4
      generators/poppler/generator_pdf.h

@ -5,16 +5,6 @@ add_subdirectory( conf )
set(CMAKE_REQUIRED_LIBRARIES Poppler::Qt5 Qt5::Core Qt5::Gui)
check_cxx_source_compiles("
#include <poppler-qt5.h>
int main()
{
Poppler::Document *document = nullptr;
(void)document->outline();
return 0;
}
" HAVE_POPPLER_0_74)
check_cxx_source_compiles("
#include <poppler-form.h>
#include <poppler-qt5.h>

@ -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

@ -845,7 +845,6 @@ const Okular::DocumentSynopsis *PDFGenerator::generateDocumentSynopsis()
if (!pdfdoc)
return nullptr;
#ifdef HAVE_POPPLER_0_74
userMutex()->lock();
const QVector<Poppler::OutlineItem> 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<Poppler::TextBox *>
return ktp;
}
#ifdef HAVE_POPPLER_0_74
void PDFGenerator::addSynopsisChildren(const QVector<Poppler::OutlineItem> &outlineItems, QDomNode *parentDestination)
{
for (const Poppler::OutlineItem &outlineItem : outlineItems) {
@ -1638,43 +1625,6 @@ void PDFGenerator::addSynopsisChildren(const QVector<Poppler::OutlineItem> &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<Poppler::Annotation::SubType> subtypes;

@ -113,11 +113,7 @@ private:
Okular::Document::OpenResult init(QVector<Okular::Page *> &pagesVector, const QString &password);
// create the document synopsis hierarchy
#ifdef HAVE_POPPLER_0_74
void addSynopsisChildren(const QVector<Poppler::OutlineItem> &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

Loading…
Cancel
Save