From 5e0e973e128f176454b0726daac5cdbbc764a02a Mon Sep 17 00:00:00 2001 From: Piotr Szymanski Date: Wed, 7 Dec 2005 21:25:25 +0000 Subject: [PATCH] - add supported mimetype caching to the kpdf part properly - begin work on ghostscript backend port to libqgs - minor tweak in configure.in.bot svn path=/trunk/playground/graphics/oKular/kpdf/; revision=486447 --- generators/configure.in.bot | 3 +- .../ghostview/kpdflibgsasyncgenerator.cpp | 29 +++++++++---------- .../ghostview/kpdflibgsasyncgenerator.h | 4 +-- part.cpp | 2 +- part.h | 1 + 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/generators/configure.in.bot b/generators/configure.in.bot index 3cf85d415..d6f69bb04 100644 --- a/generators/configure.in.bot +++ b/generators/configure.in.bot @@ -10,7 +10,8 @@ echo "or contact your package provider." echo "" fi -if test "$HAVE_CHMLIB" != "yes"; then + +if test "x$HAVE_CHMLIB" != "xyes"; then echo "" echo "The chm library was not found in your system." echo "The chm backend will not be available." diff --git a/generators/ghostview/kpdflibgsasyncgenerator.cpp b/generators/ghostview/kpdflibgsasyncgenerator.cpp index 4f7ae883f..cfb9b1b51 100644 --- a/generators/ghostview/kpdflibgsasyncgenerator.cpp +++ b/generators/ghostview/kpdflibgsasyncgenerator.cpp @@ -7,12 +7,12 @@ * (at your option) any later version. * ***************************************************************************/ -#include "interpreter_lib.h" + #include "kpdflibgsasyncgenerator.h" -#include "gsapi/iapi.h" -#include "gsapi/gdevdsp.h" +#include +#include #include #include #include @@ -33,11 +33,14 @@ int anwser; PageInfo pData; FILE * f; -void PixHandler::slotPixmap(PixmapRequest *req) +void PixHandler::slotPixmap(const QImage* img) { - QPixmap *pix=interpreter->takePixmap(); - + QPixmap *pix=new QPixmap(img->size(), img->depth()); kdDebug() << "Handles: " << pix->handle() << " " << pData.handle <width(),img->height()); + p.end(); XCopyArea (qt_xdisplay(), pix->handle(), @@ -60,15 +63,10 @@ void process() read ( mem, &pData, sizeof(pData) ); if ( !interpreter->running() ) - interpreter->startInterpreter(); - - kdDebug() << "Processing: " << pData.sync << endl; - if (pData.sync) - { - kdDebug() << "Request: " << pData.req.width << " " << pData.req.height << endl; - } + interpreter->start(false); - interpreter-> run ( f, &pData.pos, (pData.sync ? &pData.req : static_cast(0L) ), pData.sync ); +// kdDebug() << "Processing: " << pData.sync << endl; + interpreter-> run ( f, pData.pos, pData.sync ); if (! pData.sync ) { int x=3; @@ -91,7 +89,8 @@ int main (int argc, char* argv[]) interpreter->setSize ( QString(argv[7]).toInt(), QString(argv[8]).toInt() ); KApplication app(argc,argv,QCString("kpdflibgsasyncgenerator")); PixHandler pxHandler; - QObject::connect(interpreter,SIGNAL(newPageImage(PixmapRequest*)),&pxHandler,SLOT(slotPixmap(PixmapRequest *))); + + QObject::connect(interpreter,SIGNAL(Finished(const QImage* img)),&pxHandler,SLOT(slotPixmap(const QImage* img))); int request; anwser = open( argv[3] , O_RDWR ); diff --git a/generators/ghostview/kpdflibgsasyncgenerator.h b/generators/ghostview/kpdflibgsasyncgenerator.h index 7c15cf000..167433590 100644 --- a/generators/ghostview/kpdflibgsasyncgenerator.h +++ b/generators/ghostview/kpdflibgsasyncgenerator.h @@ -13,12 +13,12 @@ #include #include #include - +class QImage; class PixHandler : public QObject { Q_OBJECT public slots: - void slotPixmap(PixmapRequest *req); + void slotPixmap(const QImage* img); }; struct PageInfo diff --git a/part.cpp b/part.cpp index 9cb66eaef..35c986a06 100644 --- a/part.cpp +++ b/part.cpp @@ -337,7 +337,7 @@ void Part::supportedMimetypes() for (; iterator != end; ++iterator) { KService::Ptr service = *iterator; - mimeTypes = service->serviceTypes(); + QStringList mimeTypes = service->serviceTypes(); for (mimeType=mimeTypes.begin();mimeType!=mimeTypes.end();++mimeType) if (! (*mimeType).contains("oKular")) m_supportedMimeTypes << *mimeType; diff --git a/part.h b/part.h index 404e442ea..64757214b 100644 --- a/part.h +++ b/part.h @@ -89,6 +89,7 @@ protected: bool closeURL(); // filter that watches for splitter size changes bool eventFilter( QObject * watched, QEvent * e ); + void supportedMimetypes(); protected slots: // connected to actions