Okular
generator.cpp
77 mPixmapGenerationThread, &PixmapGenerationThread::finished, q, [this] { pixmapGenerationFinished(); }, Qt::QueuedConnection);
91 mTextPageGenerationThread, &TextPageGenerationThread::finished, q, [this] { textpageGenerationFinished(); }, Qt::QueuedConnection);
116 request->page()->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(img)), request->normalizedRect());
206Document::OpenResult Generator::loadDocumentWithPassword(const QString &fileName, QVector<Page *> &pagesVector, const QString &)
211Document::OpenResult Generator::loadDocumentFromDataWithPassword(const QByteArray &fileData, QVector<Page *> &pagesVector, const QString &)
213 return loadDocumentFromData(fileData, pagesVector) ? Document::OpenSuccess : Document::OpenError;
216Generator::SwapBackingFileResult Generator::swapBackingFile(QString const & /*newFileName */, QVector<Okular::Page *> & /*newPagesVector*/)
289 if (hasFeature(TextExtraction) && !request->page()->hasTextPage() && canGenerateTextPage() && !d->m_closing) {
294 // since not all the times the pixmap generation thread starts we want the text generation thread to also start
301 // pixmap generation thread must be started *after* connect(), else we may miss the start signal and get lock-ups (see bug 396137)
308 request->page()->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(img)), request->normalizedRect());
404BackendOpaqueAction::OpaqueActionResult Generator::opaqueAction(const BackendOpaqueAction * /*action*/)
471 pagePrivate->setPixmap(request->observer(), new QPixmap(QPixmap::fromImage(image)), request->normalizedRect(), true /* isPartialPixmap */);
501QVariant Generator::documentMetaData(const DocumentMetaDataKey key, const QVariant &option) const
581PixmapRequest::PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, qreal dpr, int priority, PixmapRequestFeatures features)
699 ExportFormatPrivate(const QString &description, const QMimeType &mimeType, const QIcon &icon = QIcon())
725ExportFormat::ExportFormat(const QIcon &icon, const QString &description, const QMimeType &mimeType)
775 return ExportFormat(QIcon::fromTheme(QStringLiteral("text-x-generic")), i18n("Plain &Text..."), db.mimeTypeForName(QStringLiteral("text/plain")));
778 return ExportFormat(QIcon::fromTheme(QStringLiteral("application-pdf")), i18n("PDF"), db.mimeTypeForName(QStringLiteral("application/pdf")));
782 QIcon::fromTheme(QStringLiteral("application-vnd.oasis.opendocument.text")), i18nc("This is the document format", "OpenDocument Text"), db.mimeTypeForName(QStringLiteral("application/vnd.oasis.opendocument.text")));
785 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:517
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
DocumentAdditionalActionType
Describes the additional actions available in the Document.
Definition document.h:775
static ExportFormat standardFormat(StandardExportFormat type)
Builds a standard format for the specified type .
Definition generator.cpp:770
QIcon icon() const
Returns the icon for GUI representations of the format.
Definition generator.cpp:760
ExportFormat & operator=(const ExportFormat &other)
Definition generator.cpp:739
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:429
virtual void freeOpaqueActionContents(const BackendOpaqueAction &action)
Frees the contents of the opaque action (if any);.
Definition generator.cpp:409
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:395
virtual BackendOpaqueAction::OpaqueActionResult opaqueAction(const BackendOpaqueAction *action)
Calls the backend to execute a BackendOpaqueAction action and returns BackendOpaqueAction result.
Definition generator.cpp:404
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:269
void generateTextPage(Page *page)
This method can be called to trigger the generation of a text page for the given page.
Definition generator.cpp:325
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:351
Generator(QObject *parent=nullptr, const QVariantList &args=QVariantList())
Creates a new generator.
Definition generator.cpp:174
virtual ExportFormat::List exportFormats() const
Returns the list of additional supported export formats.
Definition generator.cpp:419
virtual QAbstractItemModel * layersModel() const
Returns the 'layers model' object of the document or NULL if layers model is not available.
Definition generator.cpp:542
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:193
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:464
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:206
virtual void rotationChanged(Rotation orientation, Rotation oldOrientation)
This method is called when the orientation has been changed by the user.
Definition generator.cpp:386
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:413
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:361
bool hasFeature(GeneratorFeature feature) const
Query for the specified feature.
Definition generator.cpp:438
void signalTextGenerationDone(Page *page, TextPage *textPage)
This method must be called when a text generation has been finished.
Definition generator.cpp:454
bool closeDocument()
This method is called when the document is closed and not used any longer.
Definition generator.cpp:221
virtual TextPage * textPage(TextRequest *request)
Returns the text page for the given request.
Definition generator.cpp:339
virtual bool isAllowed(Permission action) const
Returns whether the given action is allowed in the document.
Definition generator.cpp:381
virtual FontInfo::List fontsForPage(int page)
Returns the 'list of embedded fonts' object of the specified page of the document.
Definition generator.cpp:356
GeneratorFeature
Describe the possible optional features that a Generator can provide.
Definition generator.h:202
@ Threaded
Whether the Generator supports asynchronous generation of pictures or text pages.
Definition generator.h:203
@ TextExtraction
Whether the Generator can extract text from the document in the form of TextPage's.
Definition generator.h:204
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:211
virtual SwapBackingFileResult swapBackingFile(const QString &newFileName, QVector< Okular::Page * > &newPagesVector)
Changes the path of the file we are reading from.
Definition generator.cpp:216
virtual DocumentInfo generateDocumentInfo(const QSet< DocumentInfo::Key > &keys) const
Returns the general information object of the document.
Definition generator.cpp:344
virtual PageSizeMetric pagesSizeMetric() const
This method returns the metric of the page size.
Definition generator.cpp:376
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:424
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:501
virtual bool canGenerateTextPage() const
This method returns whether the generator is ready to handle a new text page request.
Definition generator.cpp:319
void setFeature(GeneratorFeature feature, bool on=true)
Toggle the feature .
Definition generator.cpp:491
void signalPixmapRequestDone(PixmapRequest *request)
This method must be called when the pixmap request triggered by generatePixmap() has been finished.
Definition generator.cpp:444
virtual Okular::Action * additionalDocumentAction(Document::DocumentAdditionalActionType type)
Retrieves the additional document action for the specified type .
Definition generator.cpp:486
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:517
virtual Document::PrintError print(QPrinter &printer)
This method is called to print the document to the given printer.
Definition generator.cpp:399
virtual PageSize::List pageSizes() const
Returns the list of supported page sizes.
Definition generator.cpp:390
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:201
virtual QByteArray requestFontData(const Okular::FontInfo &font)
Gets the font data for the given font.
Definition generator.cpp:525
virtual PageLayout defaultPageLayout() const
This method returns the default page layout.
Definition generator.cpp:366
virtual bool canGeneratePixmap() const
This method returns whether the generator is ready to handle a new pixmap request.
Definition generator.cpp:248
virtual QImage image(PixmapRequest *request)
Returns the image of the page as specified in the passed pixmap request.
Definition generator.cpp:333
QMutex * userMutex() const
Return the pointer to a mutex the generator can use freely.
Definition generator.cpp:511
virtual bool defaultPageContinuous() const
This method returns if the default page layout is continuous.
Definition generator.cpp:371
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:632
void setTile(bool tile)
Sets whether the generator should render only the given normalized rect or the entire page.
Definition generator.cpp:642
bool asynchronous() const
Returns whether the generation should be done synchronous or asynchronous.
Definition generator.cpp:627
bool shouldAbortRender() const
Should the request be aborted if possible?
Definition generator.cpp:676
PixmapRequest(DocumentObserver *observer, int pageNumber, int width, int height, qreal dpr, int priority, PixmapRequestFeatures features)
Creates a new pixmap request.
Definition generator.cpp:581
void setPartialUpdatesWanted(bool partialUpdatesWanted)
Sets whether the request should report back updates if possible.
Definition generator.cpp:666
int priority() const
Returns the priority (less it better, 0 is maximum) of the request.
Definition generator.cpp:622
const NormalizedRect & normalizedRect() const
Returns the normalized region of the page to request.
Definition generator.cpp:661
bool partialUpdatesWanted() const
Should the request report back updates if possible?
Definition generator.cpp:671
void setNormalizedRect(const NormalizedRect &rect)
Sets the region of the page to request.
Definition generator.cpp:652
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition generator.cpp:637
bool isTile() const
Returns whether the generator should render just the region given by normalizedRect() or the entire p...
Definition generator.cpp:647
bool shouldAbortExtraction() const
Should the request be aborted if possible?
Definition generator.cpp:571
Page * page() const
Returns a pointer to the page where the pixmap shall be generated for.
Definition generator.cpp:566
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()
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
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 Fri Nov 22 2024 12:02:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.