Okular
generator.cpp
76 mPixmapGenerationThread, &PixmapGenerationThread::finished, q, [this] { pixmapGenerationFinished(); }, Qt::QueuedConnection);
90 mTextPageGenerationThread, &TextPageGenerationThread::finished, q, [this] { textpageGenerationFinished(); }, Qt::QueuedConnection);
115 request->page()->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(img)), request->normalizedRect());
205Document::OpenResult Generator::loadDocumentWithPassword(const QString &fileName, QVector<Page *> &pagesVector, const QString &)
210Document::OpenResult Generator::loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector<Page *> &pagesVector, const QString &)
212 return loadDocumentFromData(fileData, pagesVector) ? Document::OpenSuccess : Document::OpenError;
215Generator::SwapBackingFileResult Generator::swapBackingFile(QString const & /*newFileName */, QVector<Okular::Page *> & /*newPagesVector*/)
288 if (hasFeature(TextExtraction) && !request->page()->hasTextPage() && canGenerateTextPage() && !d->m_closing) {
293 // since not all the times the pixmap generation thread starts we want the text generation thread to also start
300 // pixmap generation thread must be started *after* connect(), else we may miss the start signal and get lock-ups (see bug 396137)
307 request->page()->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(img)), request->normalizedRect());
459 pagePrivate->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(image)), request->normalizedRect(), true /* isPartialPixmap */);
484QVariant Generator::documentMetaData(const DocumentMetaDataKey key, const QVariant &option) const
564PixmapRequest::PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, qreal dpr, int priority, PixmapRequestFeatures features)
682 ExportFormatPrivate(const QString &description, const QMimeType &mimeType, const QIcon &icon = QIcon())
708ExportFormat::ExportFormat(const QIcon &icon, const QString &description, const QMimeType &mimeType)
758 return ExportFormat(QIcon::fromTheme(QStringLiteral("text-x-generic")), i18n("Plain &Text..."), db.mimeTypeForName(QStringLiteral("text/plain")));
761 return ExportFormat(QIcon::fromTheme(QStringLiteral("application-pdf")), i18n("PDF"), db.mimeTypeForName(QStringLiteral("application/pdf")));
765 QIcon::fromTheme(QStringLiteral("application-vnd.oasis.opendocument.text")), i18nc("This is the document format", "OpenDocument Text"), db.mimeTypeForName(QStringLiteral("application/vnd.oasis.opendocument.text")));
768 return ExportFormat(QIcon::fromTheme(QStringLiteral("text-html")), i18nc("This is the document format", "HTML"), db.mimeTypeForName(QStringLiteral("text/html")));
static const QString NetworkWallet()
A helper class to store information about x509 certificate.
Definition signatureutils.h:516
The DocumentInfo structure can be filled in by generators to display metadata about the currently ope...
Definition document.h:76
Base class for objects being notified when something changes.
Definition observer.h:29
virtual void notifyPageChanged(int page, int flags)
This method is called whenever the content on page described by the passed flags has been changed.
Definition observer.cpp:29
static ExportFormat standardFormat(StandardExportFormat type)
Builds a standard format for the specified type .
Definition generator.cpp:753
QIcon icon() const
Returns the icon for GUI representations of the format.
Definition generator.cpp:743
ExportFormat & operator=(const ExportFormat &other)
Definition generator.cpp:722
virtual void walletDataForFile(const QString &fileName, QString *walletName, QString *walletFolder, QString *walletKey) const
This method is called to know which wallet data should be used for the given file name.
Definition generator.cpp:417
virtual void freeOpaqueActionContents(const BackendOpaqueAction &action)
Frees the contents of the opaque action (if any);.
Definition generator.cpp:397
virtual void pageSizeChanged(const PageSize &pageSize, const PageSize &oldPageSize)
This method is called when the page size has been changed by the user.
Definition generator.cpp:384
virtual void generatePixmap(PixmapRequest *request)
This method can be called to trigger the generation of a new pixmap as described by request.
Definition generator.cpp:268
virtual void opaqueAction(const BackendOpaqueAction *action)
Calls the backend to execute an BackendOpaqueAction.
Definition generator.cpp:393
void generateTextPage(Page *page)
This method can be called to trigger the generation of a text page for the given page.
Definition generator.cpp:324
virtual const DocumentSynopsis * generateDocumentSynopsis()
Returns the 'table of content' object of the document or 0 if no table of content is available.
Definition generator.cpp:350
Generator(QObject *parent=nullptr, const QVariantList &args=QVariantList())
Creates a new generator.
Definition generator.cpp:173
virtual ExportFormat::List exportFormats() const
Returns the list of additional supported export formats.
Definition generator.cpp:407
virtual QAbstractItemModel * layersModel() const
Returns the 'layers model' object of the document or NULL if layers model is not available.
Definition generator.cpp:525
virtual bool loadDocument(const QString &fileName, QVector< Page * > &pagesVector)
Loads the document with the given fileName and fills the pagesVector with the parsed pages.
Definition generator.cpp:192
void signalPartialPixmapRequest(Okular::PixmapRequest *request, const QImage &image)
This method can be called to trigger a partial pixmap update for the given request Make sure you call...
Definition generator.cpp:452
virtual Document::OpenResult loadDocumentWithPassword(const QString &fileName, QVector< Page * > &pagesVector, const QString &password)
Loads the document with the given fileName and password and fills the pagesVector with the parsed pag...
Definition generator.cpp:205
virtual void rotationChanged(Rotation orientation, Rotation oldOrientation)
This method is called when the orientation has been changed by the user.
Definition generator.cpp:375
virtual QVariant metaData(const QString &key, const QVariant &option) const
This method returns the meta data of the given key with the given option of the document.
Definition generator.cpp:401
virtual const QList< EmbeddedFile * > * embeddedFiles() const
Returns the 'list of embedded files' object of the document or 0 if no list of embedded files is avai...
Definition generator.cpp:360
bool hasFeature(GeneratorFeature feature) const
Query for the specified feature.
Definition generator.cpp:426
void signalTextGenerationDone(Page *page, TextPage *textPage)
This method must be called when a text generation has been finished.
Definition generator.cpp:442
bool closeDocument()
This method is called when the document is closed and not used any longer.
Definition generator.cpp:220
virtual TextPage * textPage(TextRequest *request)
Returns the text page for the given request.
Definition generator.cpp:338
virtual bool isAllowed(Permission action) const
Returns whether the given action is allowed in the document.
Definition generator.cpp:370
virtual FontInfo::List fontsForPage(int page)
Returns the 'list of embedded fonts' object of the specified page of the document.
Definition generator.cpp:355
GeneratorFeature
Describe the possible optional features that a Generator can provide.
Definition generator.h:201
@ Threaded
Whether the Generator supports asynchronous generation of pictures or text pages.
Definition generator.h:202
@ TextExtraction
Whether the Generator can extract text from the document in the form of TextPage's.
Definition generator.h:203
virtual Document::OpenResult loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector< Page * > &pagesVector, const QString &password)
Loads the document from the raw data fileData and password and fills the pagesVector with the parsed ...
Definition generator.cpp:210
virtual SwapBackingFileResult swapBackingFile(const QString &newFileName, QVector< Okular::Page * > &newPagesVector)
Changes the path of the file we are reading from.
Definition generator.cpp:215
virtual DocumentInfo generateDocumentInfo(const QSet< DocumentInfo::Key > &keys) const
Returns the general information object of the document.
Definition generator.cpp:343
virtual PageSizeMetric pagesSizeMetric() const
This method returns the metric of the page size.
Definition generator.cpp:365
virtual bool exportTo(const QString &fileName, const ExportFormat &format)
This method is called to export the document in the given format and save it under the given fileName...
Definition generator.cpp:412
QVariant documentMetaData(const DocumentMetaDataKey key, const QVariant &option=QVariant()) const
Request a meta data of the Document, if available, like an internal setting.
Definition generator.cpp:484
virtual bool canGenerateTextPage() const
This method returns whether the generator is ready to handle a new text page request.
Definition generator.cpp:318
void setFeature(GeneratorFeature feature, bool on=true)
Toggle the feature .
Definition generator.cpp:474
void signalPixmapRequestDone(PixmapRequest *request)
This method must be called when the pixmap request triggered by generatePixmap() has been finished.
Definition generator.cpp:432
void updatePageBoundingBox(int page, const NormalizedRect &boundingBox)
Set the bounding box of a page after the page has already been handed to the Document.
Definition generator.cpp:500
virtual Document::PrintError print(QPrinter &printer)
This method is called to print the document to the given printer.
Definition generator.cpp:388
virtual PageSize::List pageSizes() const
Returns the list of supported page sizes.
Definition generator.cpp:379
virtual bool doCloseDocument()=0
This method is called when the document is closed and not used any longer.
virtual bool loadDocumentFromData(const QByteArray &fileData, QVector< Page * > &pagesVector)
Loads the document from the raw data fileData and fills the pagesVector with the parsed pages.
Definition generator.cpp:200
virtual QByteArray requestFontData(const Okular::FontInfo &font)
Gets the font data for the given font.
Definition generator.cpp:508
virtual bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition generator.cpp:247
virtual QImage image(PixmapRequest *request)
Returns the image of the page as specified in the passed pixmap request.
Definition generator.cpp:332
QMutex * userMutex() const
Return the pointer to a mutex the generator can use freely.
Definition generator.cpp:494
A NormalizedRect is a rectangle which can be defined by two NormalizedPoints.
Definition area.h:189
bool hasTextPage() const
Returns whether the page provides a text page (TextPage).
Definition page.cpp:256
void setPixmap(DocumentObserver *observer, QPixmap *pixmap, const NormalizedRect &rect=NormalizedRect())
Sets the region described by rect with pixmap for the given observer.
Definition page.cpp:547
bool isBoundingBoxKnown() const
Returns whether the bounding box of the page has been computed.
Definition page.cpp:200
bool preload() const
Returns whether the generation request is for a page that is not important i.e.
Definition generator.cpp:615
void setTile(bool tile)
Sets whether the generator should render only the given normalized rect or the entire page.
Definition generator.cpp:625
bool asynchronous() const
Returns whether the generation should be done synchronous or asynchronous.
Definition generator.cpp:610
bool shouldAbortRender() const
Should the request be aborted if possible?
Definition generator.cpp:659
PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, qreal dpr, int priority, PixmapRequestFeatures features)
Creates a new pixmap request.
Definition generator.cpp:564
void setPartialUpdatesWanted(bool partialUpdatesWanted)
Sets whether the request should report back updates if possible.
Definition generator.cpp:649
int priority() const
Returns the priority (less it better, 0 is maximum) of the request.
Definition generator.cpp:605
const NormalizedRect & normalizedRect() const
Returns the normalized region of the page to request.
Definition generator.cpp:644
bool partialUpdatesWanted() const
Should the request report back updates if possible?
Definition generator.cpp:654
void setNormalizedRect(const NormalizedRect &rect)
Sets the region of the page to request.
Definition generator.cpp:635
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition generator.cpp:620
bool isTile() const
Returns whether the generator should render just the region given by normalizedRect() or the entire p...
Definition generator.cpp:630
bool shouldAbortExtraction() const
Should the request be aborted if possible?
Definition generator.cpp:554
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition generator.cpp:549
static NormalizedRect imageBoundingBox(const QImage *image)
Compute the smallest rectangle that contains all non-white pixels in image), in normalized [0,...
Definition utils.cpp:69
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
KCALUTILS_EXPORT QString mimeType()
QDebug operator<<(QDebug dbg, const PerceptualColor::LchaDouble &value)
int exec(ProcessEventsFlags flags)
QIcon fromTheme(const QString &name)
QMimeType mimeTypeForName(const QString &nameOrAlias) const const
QObject(QObject *parent)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
QString section(QChar sep, qsizetype start, qsizetype end, SectionFlags flags) const const
QueuedConnection
void started()
singleShot
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:17:35 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.