Commit 5e0e973e authored by Piotr Szymanski's avatar Piotr Szymanski

- 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
parent 99c83440
...@@ -10,7 +10,8 @@ echo "or contact your package provider." ...@@ -10,7 +10,8 @@ echo "or contact your package provider."
echo "" echo ""
fi fi
if test "$HAVE_CHMLIB" != "yes"; then
if test "x$HAVE_CHMLIB" != "xyes"; then
echo "" echo ""
echo "The chm library was not found in your system." echo "The chm library was not found in your system."
echo "The chm backend will not be available." echo "The chm backend will not be available."
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
* (at your option) any later version. * * (at your option) any later version. *
***************************************************************************/ ***************************************************************************/
#include "interpreter_lib.h"
#include "kpdflibgsasyncgenerator.h" #include "kpdflibgsasyncgenerator.h"
#include "gsapi/iapi.h" #include <qgs.h>
#include "gsapi/gdevdsp.h"
#include <qpainter.h>
#include <qpixmap.h> #include <qpixmap.h>
#include <qimage.h> #include <qimage.h>
#include <kapplication.h> #include <kapplication.h>
...@@ -33,11 +33,14 @@ int anwser; ...@@ -33,11 +33,14 @@ int anwser;
PageInfo pData; PageInfo pData;
FILE * f; 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 <<endl; kdDebug() << "Handles: " << pix->handle() << " " << pData.handle <<endl;
QPainter p;
p.begin(pix);
p.drawImage(0,0,*img, 0,0,img->width(),img->height());
p.end();
XCopyArea XCopyArea
(qt_xdisplay(), (qt_xdisplay(),
pix->handle(), pix->handle(),
...@@ -60,15 +63,10 @@ void process() ...@@ -60,15 +63,10 @@ void process()
read ( mem, &pData, sizeof(pData) ); read ( mem, &pData, sizeof(pData) );
if ( !interpreter->running() ) if ( !interpreter->running() )
interpreter->startInterpreter(); interpreter->start(false);
kdDebug() << "Processing: " << pData.sync << endl;
if (pData.sync)
{
kdDebug() << "Request: " << pData.req.width << " " << pData.req.height << endl;
}
interpreter-> run ( f, &pData.pos, (pData.sync ? &pData.req : static_cast<PixmapRequest*>(0L) ), pData.sync ); // kdDebug() << "Processing: " << pData.sync << endl;
interpreter-> run ( f, pData.pos, pData.sync );
if (! pData.sync ) if (! pData.sync )
{ {
int x=3; int x=3;
...@@ -91,7 +89,8 @@ int main (int argc, char* argv[]) ...@@ -91,7 +89,8 @@ int main (int argc, char* argv[])
interpreter->setSize ( QString(argv[7]).toInt(), QString(argv[8]).toInt() ); interpreter->setSize ( QString(argv[7]).toInt(), QString(argv[8]).toInt() );
KApplication app(argc,argv,QCString("kpdflibgsasyncgenerator")); KApplication app(argc,argv,QCString("kpdflibgsasyncgenerator"));
PixHandler pxHandler; 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; int request;
anwser = open( argv[3] , O_RDWR ); anwser = open( argv[3] , O_RDWR );
......
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
#include <qpixmap.h> #include <qpixmap.h>
#include <interpreter.h> #include <interpreter.h>
#include <core/generator.h> #include <core/generator.h>
class QImage;
class PixHandler : public QObject class PixHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
public slots: public slots:
void slotPixmap(PixmapRequest *req); void slotPixmap(const QImage* img);
}; };
struct PageInfo struct PageInfo
......
...@@ -337,7 +337,7 @@ void Part::supportedMimetypes() ...@@ -337,7 +337,7 @@ void Part::supportedMimetypes()
for (; iterator != end; ++iterator) for (; iterator != end; ++iterator)
{ {
KService::Ptr service = *iterator; KService::Ptr service = *iterator;
mimeTypes = service->serviceTypes(); QStringList mimeTypes = service->serviceTypes();
for (mimeType=mimeTypes.begin();mimeType!=mimeTypes.end();++mimeType) for (mimeType=mimeTypes.begin();mimeType!=mimeTypes.end();++mimeType)
if (! (*mimeType).contains("oKular")) if (! (*mimeType).contains("oKular"))
m_supportedMimeTypes << *mimeType; m_supportedMimeTypes << *mimeType;
......
...@@ -89,6 +89,7 @@ protected: ...@@ -89,6 +89,7 @@ protected:
bool closeURL(); bool closeURL();
// filter that watches for splitter size changes // filter that watches for splitter size changes
bool eventFilter( QObject * watched, QEvent * e ); bool eventFilter( QObject * watched, QEvent * e );
void supportedMimetypes();
protected slots: protected slots:
// connected to actions // connected to actions
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment