From: Stefan Bund Date: Tue, 26 Oct 2010 10:34:16 +0000 (+0200) Subject: Make poppler optional X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=1793efe27443e9ccd8e7acac8361392ee790f972;p=pykit.git Make poppler optional --- diff --git a/.gitignore b/.gitignore index 2daed2e..85f641b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ moc_* .sconsign* *.moc /pykit -/Makefile +/Makefile.qmake diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2ed7bae --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +default: all ; + +Makefile.qmake: + qmake -o Makefile.qmake pykit.pro + +%: Makefile.qmake FORCE + @$(MAKE) -f Makefile.qmake $@ +FORCE: ; + +clean: + @$(MAKE) -f Makefile.qmake clean + rm -f pykit Makefile.qmake + +Makefile: ; + diff --git a/Viewer.cc b/Viewer.cc index abb1b2f..a67a092 100644 --- a/Viewer.cc +++ b/Viewer.cc @@ -19,6 +19,8 @@ #define prefix_ ///////////////////////////////cc.p//////////////////////////////////////// +#ifdef POPPLER + namespace { class PDFWebPluginFactory @@ -77,6 +79,8 @@ prefix_ QList PDFWebPluginFactory::plugins() return plugins; } +#endif + /////////////////////////////////////////////////////////////////////////// // pykit::Viewer @@ -86,7 +90,9 @@ prefix_ pykit::Viewer::Viewer(QUrl const & url, Publisher * publisher, QWidget * QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); page()->setNetworkAccessManager( new InternalNetworkAccessManager(page()->networkAccessManager(), this, publisher)); +#ifdef POPPLER page()->setPluginFactory(new PDFWebPluginFactory (page()->networkAccessManager(), this)); +#endif load(url); } diff --git a/pykit.pro b/pykit.pro index 63d9604..1cb9fb6 100644 --- a/pykit.pro +++ b/pykit.pro @@ -1,3 +1,4 @@ +# CONFIG += no_poppler TEMPLATE = app TARGET = pykit DEPENDPATH += . @@ -12,18 +13,21 @@ QMAKE_CXXFLAGS += $$system(python-config --cflags) QMAKE_CFFLAGS += $$system(python-config --cflags) LIBS += $$system(python-config --ldflags) -# poppler -LIBS += -lpoppler-qt4 -lpoppler - # Input HEADERS += MainWindow.hh \ Publisher.hh \ PythonPublisher.hh \ - Viewer.hh \ - PDFWidget.hh + Viewer.hh SOURCES += main.cc \ MainWindow.cc \ Publisher.cc \ PythonPublisher.cc \ - Viewer.cc \ - PDFWidget.cc + Viewer.cc + +# poppler +!no_poppler { + LIBS += -lpoppler-qt4 -lpoppler + HEADERS += PDFWidget.hh + SOURCES += PDFWidget.cc + DEFINES += POPPLER +}