Expose the thin line support of poppler 0.24

Based on a patch by Thomas Freitag - Thomas.Freitag@alfa.de
remotes/origin/epub-qtextdoc
Albert Astals Cid 13 years ago
parent 751f564aed
commit 69f683b9a4
  1. 13
      cmake/modules/FindPoppler.cmake
  2. 7
      generators/poppler/CMakeLists.txt
  3. 3
      generators/poppler/config-okular-poppler.h.cmake
  4. 28
      generators/poppler/generator_pdf.cpp
  5. 2
      generators/poppler/libokularGenerator_poppler.desktop

@ -116,9 +116,20 @@ int main()
}
" HAVE_POPPLER_0_22)
check_cxx_source_compiles("
#include <poppler-qt4.h>
int main()
{
Poppler::Document::RenderHint hint = Poppler::Document::ThinLineSolid;
return 0;
}
" HAVE_POPPLER_0_24)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_POPPLER_0_22)
if (HAVE_POPPLER_0_24)
set(popplerVersionMessage "0.24")
elseif (HAVE_POPPLER_0_22)
set(popplerVersionMessage "0.22")
elseif (HAVE_POPPLER_0_20)
set(popplerVersionMessage "0.20")

@ -1,3 +1,4 @@
add_subdirectory( conf )
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})
@ -35,6 +36,12 @@ set(okularGenerator_poppler_PART_SRCS
synctex/synctex_parser_utils.c
)
kde4_add_ui_files(okularGenerator_poppler_PART_SRCS
conf/pdfsettingswidget.ui
)
kde4_add_kcfg_files(okularGenerator_poppler_PART_SRCS conf/pdfsettings.kcfgc )
kde4_add_plugin(okularGenerator_poppler ${okularGenerator_poppler_PART_SRCS})
target_link_libraries(okularGenerator_poppler ${POPPLER_LIBRARY} okularcore ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} ${ZLIB_LIBRARIES})

@ -9,3 +9,6 @@
/* Defined if we have the 0.22 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_22 1
/* Defined if we have the 0.24 version of the Poppler library */
#cmakedefine HAVE_POPPLER_0_24 1

@ -25,6 +25,7 @@
#include <QtGui/QPainter>
#include <kaboutdata.h>
#include <kconfigdialog.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kpassworddialog.h>
@ -44,6 +45,9 @@
#include <core/fileprinter.h>
#include <core/utils.h>
#include "ui_pdfsettingswidget.h"
#include "pdfsettings.h"
#include <config-okular-poppler.h>
#include <algorithm>
@ -1280,8 +1284,14 @@ bool PDFGenerator::reparseConfig()
return somethingchanged;
}
void PDFGenerator::addPages( KConfigDialog * )
void PDFGenerator::addPages( KConfigDialog *dlg )
{
#ifdef HAVE_POPPLER_0_24
Ui_PDFSettingsWidget pdfsw;
QWidget* w = new QWidget(dlg);
pdfsw.setupUi(w);
dlg->addPage(w, PDFSettings::self(), i18n("PDF"), "application-pdf", i18n("PDF Backend Configuration") );
#endif
}
bool PDFGenerator::setDocumentRenderHints()
@ -1303,6 +1313,22 @@ bool PDFGenerator::setDocumentRenderHints()
SET_HINT("TextHinting", false, Poppler::Document::TextHinting)
#endif
#undef SET_HINT
#ifdef HAVE_POPPLER_0_24
// load thin line mode
const int thinLineMode = PDFSettings::enhanceThinLines();
const bool enableThinLineSolid = thinLineMode == PDFSettings::EnumEnhanceThinLines::Solid;
const bool enableShapeLineSolid = thinLineMode == PDFSettings::EnumEnhanceThinLines::Shape;
const bool thinLineSolidWasEnabled = (oldhints & Poppler::Document::ThinLineSolid) == Poppler::Document::ThinLineSolid;
const bool thinLineShapeWasEnabled = (oldhints & Poppler::Document::ThinLineShape) == Poppler::Document::ThinLineShape;
if (enableThinLineSolid != thinLineSolidWasEnabled) {
pdfdoc->setRenderHint(Poppler::Document::ThinLineSolid, enableThinLineSolid);
changed = true;
}
if (enableShapeLineSolid != thinLineShapeWasEnabled) {
pdfdoc->setRenderHint(Poppler::Document::ThinLineShape, enableShapeLineSolid);
changed = true;
}
#endif
return changed;
}

@ -124,4 +124,4 @@ MimeType=application/x-pdf;application/pdf;application/x-wwf;
X-KDE-Library=okularGenerator_poppler
X-KDE-Priority=1
X-KDE-okularAPIVersion=1
X-KDE-okularHasInternalSettings=false
X-KDE-okularHasInternalSettings=true

Loading…
Cancel
Save