2007-01-24 15:06:45 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2007 Tobias Koenig <tokoe@kde.org> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef OKULAR_THREADEDGENERATOR_P_H
|
|
|
|
#define OKULAR_THREADEDGENERATOR_P_H
|
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
#include <QtCore/QSet>
|
2007-01-24 15:06:45 +00:00
|
|
|
#include <QtCore/QThread>
|
2007-04-19 18:30:20 +00:00
|
|
|
#include <QtGui/QImage>
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
class KAboutData;
|
|
|
|
class KComponentData;
|
|
|
|
|
2007-01-24 15:06:45 +00:00
|
|
|
namespace Okular {
|
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
class Document;
|
2007-07-07 20:35:01 +00:00
|
|
|
class FontInfo;
|
2007-04-20 17:17:44 +00:00
|
|
|
class Generator;
|
|
|
|
class Page;
|
|
|
|
class PixmapGenerationThread;
|
|
|
|
class PixmapRequest;
|
|
|
|
class TextPage;
|
|
|
|
class TextPageGenerationThread;
|
|
|
|
|
|
|
|
class GeneratorPrivate
|
2007-01-24 15:06:45 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-04-20 17:17:44 +00:00
|
|
|
GeneratorPrivate( Generator *parent );
|
|
|
|
|
|
|
|
~GeneratorPrivate();
|
|
|
|
|
2007-04-20 17:59:12 +00:00
|
|
|
PixmapGenerationThread* pixmapGenerationThread();
|
|
|
|
TextPageGenerationThread* textPageGenerationThread();
|
2007-04-20 17:17:44 +00:00
|
|
|
|
|
|
|
void pixmapGenerationFinished();
|
|
|
|
void textpageGenerationFinished();
|
|
|
|
|
|
|
|
Document *m_document;
|
|
|
|
// NOTE: the following should be a QSet< GeneratorFeature >,
|
|
|
|
// but it is not to avoid #include'ing generator.h
|
|
|
|
QSet< int > m_features;
|
|
|
|
KAboutData *m_about;
|
|
|
|
KComponentData *m_componentData;
|
|
|
|
Generator *m_generator;
|
|
|
|
PixmapGenerationThread *mPixmapGenerationThread;
|
|
|
|
TextPageGenerationThread *mTextPageGenerationThread;
|
|
|
|
bool mPixmapReady;
|
|
|
|
bool mTextPageReady;
|
|
|
|
};
|
2007-01-24 15:06:45 +00:00
|
|
|
|
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
class PixmapGenerationThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
public:
|
|
|
|
PixmapGenerationThread( Generator *generator );
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
void startGeneration( PixmapRequest *request );
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
void endGeneration();
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
PixmapRequest *request() const;
|
|
|
|
|
|
|
|
QImage image() const;
|
2007-01-24 15:06:45 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
protected:
|
|
|
|
virtual void run();
|
2007-01-24 15:06:45 +00:00
|
|
|
|
|
|
|
private:
|
2007-01-31 18:31:19 +00:00
|
|
|
Generator *mGenerator;
|
2007-01-24 15:06:45 +00:00
|
|
|
PixmapRequest *mRequest;
|
|
|
|
QImage mImage;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-01-24 18:27:54 +00:00
|
|
|
class TextPageGenerationThread : public QThread
|
|
|
|
{
|
2007-04-20 17:17:44 +00:00
|
|
|
Q_OBJECT
|
2007-01-24 18:27:54 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
public:
|
|
|
|
TextPageGenerationThread( Generator *generator );
|
2007-01-24 18:27:54 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
void startGeneration( Page *page );
|
2007-01-24 18:27:54 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
void endGeneration();
|
2007-01-24 18:27:54 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
Page *page() const;
|
2007-01-24 18:27:54 +00:00
|
|
|
|
2007-04-20 17:17:44 +00:00
|
|
|
TextPage* textPage() const;
|
2007-01-24 18:27:54 +00:00
|
|
|
|
|
|
|
protected:
|
2007-04-20 17:17:44 +00:00
|
|
|
virtual void run();
|
2007-01-24 18:27:54 +00:00
|
|
|
|
|
|
|
private:
|
2007-01-31 18:31:19 +00:00
|
|
|
Generator *mGenerator;
|
2007-01-24 18:27:54 +00:00
|
|
|
Page *mPage;
|
|
|
|
TextPage *mTextPage;
|
|
|
|
};
|
|
|
|
|
2007-07-07 20:35:01 +00:00
|
|
|
class FontExtractionThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
FontExtractionThread( Generator *generator, int pages );
|
|
|
|
|
|
|
|
void startExtraction( bool async );
|
2007-07-08 21:22:37 +00:00
|
|
|
void stopExtraction();
|
2007-07-07 20:35:01 +00:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void gotFont( const Okular::FontInfo& );
|
|
|
|
void progress( int page );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void run();
|
|
|
|
|
|
|
|
private:
|
|
|
|
Generator *mGenerator;
|
|
|
|
int mNumOfPages;
|
2007-07-08 21:22:37 +00:00
|
|
|
bool mGoOn;
|
2007-07-07 20:35:01 +00:00
|
|
|
};
|
|
|
|
|
2007-01-24 15:06:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|