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

okular

  • sources
  • kde-4.14
  • 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 class TilesManager;
34 
35 class GeneratorPrivate
36 {
37  public:
38  GeneratorPrivate();
39 
40  virtual ~GeneratorPrivate();
41 
42  Q_DECLARE_PUBLIC( Generator )
43  Generator *q_ptr;
44 
45  PixmapGenerationThread* pixmapGenerationThread();
46  TextPageGenerationThread* textPageGenerationThread();
47 
48  void pixmapGenerationFinished();
49  void textpageGenerationFinished();
50 
51  QMutex* threadsLock();
52 
53  virtual QVariant metaData( const QString &key, const QVariant &option ) const;
54  virtual QImage image( PixmapRequest * );
55 
56  DocumentPrivate *m_document;
57  // NOTE: the following should be a QSet< GeneratorFeature >,
58  // but it is not to avoid #include'ing generator.h
59  QSet< int > m_features;
60  PixmapGenerationThread *mPixmapGenerationThread;
61  TextPageGenerationThread *mTextPageGenerationThread;
62  mutable QMutex *m_mutex;
63  QMutex *m_threadsMutex;
64  bool mPixmapReady : 1;
65  bool mTextPageReady : 1;
66  bool m_closing : 1;
67  QEventLoop *m_closingLoop;
68  QSizeF m_dpi;
69 };
70 
71 
72 class PixmapRequestPrivate
73 {
74  public:
75  void swap();
76  TilesManager *tilesManager() const;
77 
78  DocumentObserver *mObserver;
79  int mPageNumber;
80  int mWidth;
81  int mHeight;
82  int mPriority;
83  int mFeatures;
84  bool mForce : 1;
85  bool mTile : 1;
86  Page *mPage;
87  NormalizedRect mNormalizedRect;
88 };
89 
90 
91 class PixmapGenerationThread : public QThread
92 {
93  Q_OBJECT
94 
95  public:
96  PixmapGenerationThread( Generator *generator );
97 
98  void startGeneration( PixmapRequest *request, bool calcBoundingRect );
99 
100  void endGeneration();
101 
102  PixmapRequest *request() const;
103 
104  QImage image() const;
105  bool calcBoundingBox() const;
106  NormalizedRect boundingBox() const;
107 
108  protected:
109  virtual void run();
110 
111  private:
112  Generator *mGenerator;
113  PixmapRequest *mRequest;
114  QImage mImage;
115  NormalizedRect mBoundingBox;
116  bool mCalcBoundingBox : 1;
117 };
118 
119 
120 class TextPageGenerationThread : public QThread
121 {
122  Q_OBJECT
123 
124  public:
125  TextPageGenerationThread( Generator *generator );
126 
127  void startGeneration( Page *page );
128 
129  void endGeneration();
130 
131  Page *page() const;
132 
133  TextPage* textPage() const;
134 
135  protected:
136  virtual void run();
137 
138  private:
139  Generator *mGenerator;
140  Page *mPage;
141  TextPage *mTextPage;
142 };
143 
144 class FontExtractionThread : public QThread
145 {
146  Q_OBJECT
147 
148  public:
149  FontExtractionThread( Generator *generator, int pages );
150 
151  void startExtraction( bool async );
152  void stopExtraction();
153 
154  Q_SIGNALS:
155  void gotFont( const Okular::FontInfo& );
156  void progress( int page );
157 
158  protected:
159  virtual void run();
160 
161  private:
162  Generator *mGenerator;
163  int mNumOfPages;
164  bool mGoOn;
165 };
166 
167 }
168 
169 #endif
Okular::GeneratorPrivate::mTextPageGenerationThread
TextPageGenerationThread * mTextPageGenerationThread
Definition: generator_p.h:61
Okular::PixmapRequestPrivate::mPageNumber
int mPageNumber
Definition: generator_p.h:79
Okular::PixmapRequestPrivate::mFeatures
int mFeatures
Definition: generator_p.h:83
QMutex
Okular::FontExtractionThread
Definition: generator_p.h:144
Okular::GeneratorPrivate::m_closingLoop
QEventLoop * m_closingLoop
Definition: generator_p.h:67
Okular::PixmapRequestPrivate::mNormalizedRect
NormalizedRect mNormalizedRect
Definition: generator_p.h:87
QEventLoop
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:60
Okular::GeneratorPrivate::mTextPageReady
bool mTextPageReady
Definition: generator_p.h:65
Okular::GeneratorPrivate::m_mutex
QMutex * m_mutex
Definition: generator_p.h:62
Okular::PixmapRequestPrivate::mObserver
DocumentObserver * mObserver
Definition: generator_p.h:78
Okular::TextPageGenerationThread
Definition: generator_p.h:120
Okular::GeneratorPrivate::m_threadsMutex
QMutex * m_threadsMutex
Definition: generator_p.h:63
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:114
Okular::PixmapGenerationThread
Definition: generator_p.h:91
Okular::GeneratorPrivate::m_features
QSet< int > m_features
Definition: generator_p.h:59
Okular::GeneratorPrivate::~GeneratorPrivate
virtual ~GeneratorPrivate()
Definition: generator.cpp:41
Okular::GeneratorPrivate::metaData
virtual QVariant metaData(const QString &key, const QVariant &option) const
Definition: generator.cpp:149
Okular::PixmapRequestPrivate::mPage
Page * mPage
Definition: generator_p.h:86
Okular::PixmapRequestPrivate::mHeight
int mHeight
Definition: generator_p.h:81
Okular::GeneratorPrivate::q_ptr
Generator * q_ptr
Definition: generator_p.h:43
Okular::GeneratorPrivate::threadsLock
QMutex * threadsLock()
Definition: generator.cpp:142
Okular::FontInfo
A small class that represents the information of a font.
Definition: fontinfo.h:27
Okular::GeneratorPrivate::GeneratorPrivate
GeneratorPrivate()
Definition: generator.cpp:32
Okular::TilesManager
Tiles management.
Definition: tilesmanager_p.h:98
Okular::GeneratorPrivate::pixmapGenerationThread
PixmapGenerationThread * pixmapGenerationThread()
Definition: generator.cpp:57
Okular::PixmapRequestPrivate
Definition: generator_p.h:72
Okular::PixmapRequestPrivate::mWidth
int mWidth
Definition: generator_p.h:80
Okular::Page
Collector for all the data belonging to a page.
Definition: page.h:49
QSet
QString
Okular::GeneratorPrivate::pixmapGenerationFinished
void pixmapGenerationFinished()
Definition: generator.cpp:85
Okular::GeneratorPrivate::m_document
DocumentPrivate * m_document
Definition: generator_p.h:56
Okular::DocumentPrivate
Definition: document_p.h:77
QImage
Okular::GeneratorPrivate::m_closing
bool m_closing
Definition: generator_p.h:66
QSizeF
Okular::GeneratorPrivate::mPixmapReady
bool mPixmapReady
Definition: generator_p.h:64
Okular::DocumentObserver
Base class for objects being notified when something changes.
Definition: observer.h:28
Okular::PixmapRequestPrivate::mPriority
int mPriority
Definition: generator_p.h:82
Okular::GeneratorPrivate::m_dpi
QSizeF m_dpi
Definition: generator_p.h:68
Okular::GeneratorPrivate::textPageGenerationThread
TextPageGenerationThread * textPageGenerationThread()
Definition: generator.cpp:71
QThread
Okular::GeneratorPrivate::image
virtual QImage image(PixmapRequest *)
Definition: generator.cpp:154
Okular::GeneratorPrivate
Definition: generator_p.h:35
Okular::PixmapRequest
Describes a pixmap type request.
Definition: generator.h:575
Okular::Generator
[Abstract Class] The information generator.
Definition: generator.h:186
QVariant
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:25 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