• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • core
generator_p.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007 Tobias Koenig <tokoe@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 #ifndef OKULAR_THREADEDGENERATOR_P_H
11 #define OKULAR_THREADEDGENERATOR_P_H
12 
13 #include "area.h"
14 
15 #include <QtCore/QSet>
16 #include <QtCore/QThread>
17 #include <QtGui/QImage>
18 
19 class QEventLoop;
20 class QMutex;
21 
22 namespace Okular {
23 
24 class DocumentObserver;
25 class DocumentPrivate;
26 class FontInfo;
27 class Generator;
28 class Page;
29 class PixmapGenerationThread;
30 class PixmapRequest;
31 class TextPage;
32 class TextPageGenerationThread;
33 
34 class GeneratorPrivate
35 {
36  public:
37  GeneratorPrivate();
38 
39  virtual ~GeneratorPrivate();
40 
41  Q_DECLARE_PUBLIC( Generator )
42  Generator *q_ptr;
43 
44  PixmapGenerationThread* pixmapGenerationThread();
45  TextPageGenerationThread* textPageGenerationThread();
46 
47  void pixmapGenerationFinished();
48  void textpageGenerationFinished();
49 
50  QMutex* threadsLock();
51 
52  virtual QVariant metaData( const QString &key, const QVariant &option ) const;
53  virtual QImage image( PixmapRequest * );
54 
55  DocumentPrivate *m_document;
56  // NOTE: the following should be a QSet< GeneratorFeature >,
57  // but it is not to avoid #include'ing generator.h
58  QSet< int > m_features;
59  PixmapGenerationThread *mPixmapGenerationThread;
60  TextPageGenerationThread *mTextPageGenerationThread;
61  mutable QMutex *m_mutex;
62  QMutex *m_threadsMutex;
63  bool mPixmapReady : 1;
64  bool mTextPageReady : 1;
65  bool m_closing : 1;
66  QEventLoop *m_closingLoop;
67 };
68 
69 
70 class PixmapRequestPrivate
71 {
72  public:
73  void swap();
74 
75  DocumentObserver *mObserver;
76  int mPageNumber;
77  int mWidth;
78  int mHeight;
79  int mPriority;
80  int mFeatures;
81  bool mForce : 1;
82  bool mTile : 1;
83  Page *mPage;
84  NormalizedRect mNormalizedRect;
85 };
86 
87 
88 class PixmapGenerationThread : public QThread
89 {
90  Q_OBJECT
91 
92  public:
93  PixmapGenerationThread( Generator *generator );
94 
95  void startGeneration( PixmapRequest *request, bool calcBoundingRect );
96 
97  void endGeneration();
98 
99  PixmapRequest *request() const;
100 
101  QImage image() const;
102  bool calcBoundingBox() const;
103  NormalizedRect boundingBox() const;
104 
105  protected:
106  virtual void run();
107 
108  private:
109  Generator *mGenerator;
110  PixmapRequest *mRequest;
111  QImage mImage;
112  NormalizedRect mBoundingBox;
113  bool mCalcBoundingBox : 1;
114 };
115 
116 
117 class TextPageGenerationThread : public QThread
118 {
119  Q_OBJECT
120 
121  public:
122  TextPageGenerationThread( Generator *generator );
123 
124  void startGeneration( Page *page );
125 
126  void endGeneration();
127 
128  Page *page() const;
129 
130  TextPage* textPage() const;
131 
132  protected:
133  virtual void run();
134 
135  private:
136  Generator *mGenerator;
137  Page *mPage;
138  TextPage *mTextPage;
139 };
140 
141 class FontExtractionThread : public QThread
142 {
143  Q_OBJECT
144 
145  public:
146  FontExtractionThread( Generator *generator, int pages );
147 
148  void startExtraction( bool async );
149  void stopExtraction();
150 
151  Q_SIGNALS:
152  void gotFont( const Okular::FontInfo& );
153  void progress( int page );
154 
155  protected:
156  virtual void run();
157 
158  private:
159  Generator *mGenerator;
160  int mNumOfPages;
161  bool mGoOn;
162 };
163 
164 }
165 
166 #endif
Okular::GeneratorPrivate::mTextPageGenerationThread
TextPageGenerationThread * mTextPageGenerationThread
Definition: generator_p.h:60
Okular::PixmapRequestPrivate::mPageNumber
int mPageNumber
Definition: generator_p.h:76
Okular::PixmapRequestPrivate::mFeatures
int mFeatures
Definition: generator_p.h:80
Okular::FontExtractionThread
Definition: generator_p.h:141
Okular::GeneratorPrivate::m_closingLoop
QEventLoop * m_closingLoop
Definition: generator_p.h:66
Okular::PixmapRequestPrivate::mNormalizedRect
NormalizedRect mNormalizedRect
Definition: generator_p.h:84
Okular::TextPage
The TextPage class represents the text of a page by providing.
Definition: textpage.h:90
Okular::GeneratorPrivate::mPixmapGenerationThread
PixmapGenerationThread * mPixmapGenerationThread
Definition: generator_p.h:59
Okular::GeneratorPrivate::mTextPageReady
bool mTextPageReady
Definition: generator_p.h:64
Okular::GeneratorPrivate::m_mutex
QMutex * m_mutex
Definition: generator_p.h:61
Okular::PixmapRequestPrivate::mObserver
DocumentObserver * mObserver
Definition: generator_p.h:75
Okular::TextPageGenerationThread
Definition: generator_p.h:117
Okular::GeneratorPrivate::m_threadsMutex
QMutex * m_threadsMutex
Definition: generator_p.h:62
Okular::NormalizedRect
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
area.h
Okular::GeneratorPrivate::textpageGenerationFinished
void textpageGenerationFinished()
Definition: generator.cpp:111
Okular::PixmapGenerationThread
Definition: generator_p.h:88
Okular::GeneratorPrivate::m_features
QSet< int > m_features
Definition: generator_p.h:58
Okular::GeneratorPrivate::~GeneratorPrivate
virtual ~GeneratorPrivate()
Definition: generator.cpp:38
Okular::GeneratorPrivate::metaData
virtual QVariant metaData(const QString &key, const QVariant &option) const
Definition: generator.cpp:146
Okular::PixmapRequestPrivate::mPage
Page * mPage
Definition: generator_p.h:83
Okular::PixmapRequestPrivate::mHeight
int mHeight
Definition: generator_p.h:78
Okular::GeneratorPrivate::q_ptr
Generator * q_ptr
Definition: generator_p.h:42
Okular::GeneratorPrivate::threadsLock
QMutex * threadsLock()
Definition: generator.cpp:139
Okular::FontInfo
A small class that represents the information of a font.
Definition: fontinfo.h:27
Okular::GeneratorPrivate::GeneratorPrivate
GeneratorPrivate()
Definition: generator.cpp:30
Okular::GeneratorPrivate::pixmapGenerationThread
PixmapGenerationThread * pixmapGenerationThread()
Definition: generator.cpp:54
Okular::PixmapRequestPrivate
Definition: generator_p.h:70
Okular::PixmapRequestPrivate::mWidth
int mWidth
Definition: generator_p.h:77
Okular::Page
Collector for all the data belonging to a page.
Definition: page.h:49
Okular::GeneratorPrivate::pixmapGenerationFinished
void pixmapGenerationFinished()
Definition: generator.cpp:82
Okular::GeneratorPrivate::m_document
DocumentPrivate * m_document
Definition: generator_p.h:55
Okular::DocumentPrivate
Definition: document_p.h:83
Okular::GeneratorPrivate::m_closing
bool m_closing
Definition: generator_p.h:65
Okular::GeneratorPrivate::mPixmapReady
bool mPixmapReady
Definition: generator_p.h:63
Okular::DocumentObserver
Base class for objects being notified when something changes.
Definition: observer.h:28
Okular::PixmapRequestPrivate::mPriority
int mPriority
Definition: generator_p.h:79
Okular::GeneratorPrivate::textPageGenerationThread
TextPageGenerationThread * textPageGenerationThread()
Definition: generator.cpp:68
Okular::GeneratorPrivate::image
virtual QImage image(PixmapRequest *)
Definition: generator.cpp:151
QThread
Okular::GeneratorPrivate
Definition: generator_p.h:34
Okular::PixmapRequest
Describes a pixmap type request.
Definition: generator.h:522
Okular::Generator
[Abstract Class] The information generator.
Definition: generator.h:185
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal