KIO::PreviewJob

Search for usage in LXR

#include <KIO/PreviewJob>

Inheritance diagram for KIO::PreviewJob:

Public Types

enum  ScaleType { Unscaled, Scaled, ScaledAndCached }
 
- Public Types inherited from KJob
typedef QFlags< CapabilityCapabilities
 
enum  Capability
 
enum  Unit
 

Signals

void failed (const KFileItem &item)
 
void gotPreview (const KFileItem &item, const QPixmap &preview)
 
- Signals inherited from KIO::Job
void canceled (KJob *job)
 
void connected (KIO::Job *job)
 
- Signals inherited from KJob
void description (KJob *job, const QString &title, const QPair< QString, QString > &field1=QPair< QString, QString >(), const QPair< QString, QString > &field2=QPair< QString, QString >())
 
void finished (KJob *job)
 
void infoMessage (KJob *job, const QString &plain, const QString &rich=QString())
 
void percent (KJob *job, unsigned long percent)
 
void percentChanged (KJob *job, unsigned long percent)
 
void processedAmount (KJob *job, KJob::Unit unit, qulonglong amount)
 
void processedAmountChanged (KJob *job, KJob::Unit unit, qulonglong amount)
 
void processedSize (KJob *job, qulonglong size)
 
void result (KJob *job)
 
void resumed (KJob *job)
 
void speed (KJob *job, unsigned long speed)
 
void suspended (KJob *job)
 
void totalAmount (KJob *job, KJob::Unit unit, qulonglong amount)
 
void totalAmountChanged (KJob *job, KJob::Unit unit, qulonglong amount)
 
void totalSize (KJob *job, qulonglong size)
 
void warning (KJob *job, const QString &plain, const QString &rich=QString())
 

Public Member Functions

 PreviewJob (const KFileItemList &items, int width, int height, int iconSize, int iconAlpha, bool scale, bool save, const QStringList *enabledPlugins)
 
 PreviewJob (const KFileItemList &items, const QSize &size, const QStringList *enabledPlugins=nullptr)
 
bool handlesSequences () const
 
int overlayIconAlpha () const
 
int overlayIconSize () const
 
void removeItem (const QUrl &url)
 
ScaleType scaleType () const
 
int sequenceIndex () const
 
float sequenceIndexWraparoundPoint () const
 
void setDevicePixelRatio (int dpr)
 
void setDevicePixelRatio (qreal dpr)
 
void setIgnoreMaximumSize (bool ignoreSize=true)
 
void setOverlayIconAlpha (int alpha)
 
void setOverlayIconSize (int size)
 
void setScaleType (ScaleType type)
 
void setSequenceIndex (int index)
 
- Public Member Functions inherited from KIO::Job
void addMetaData (const QString &key, const QString &value)
 
void addMetaData (const QMap< QString, QString > &values)
 
QStringList detailedErrorStrings (const QUrl *reqUrl=nullptr, int method=-1) const
 
QString errorString () const override
 
void mergeMetaData (const QMap< QString, QString > &values)
 
MetaData metaData () const
 
MetaData outgoingMetaData () const
 
JobparentJob () const
 
QString queryMetaData (const QString &key)
 
void setMetaData (const KIO::MetaData &metaData)
 
void setParentJob (Job *parentJob)
 
void setUiDelegateExtension (JobUiDelegateExtension *extension)
 
void start () override
 
KJobUiDelegateui () const
 
JobUiDelegateExtensionuiDelegateExtension () const
 
- Public Member Functions inherited from KCompositeJob
 KCompositeJob (QObject *parent=nullptr)
 
- Public Member Functions inherited from KJob
 KJob (QObject *parent=nullptr)
 
Capabilities capabilities () const
 
int error () const
 
QString errorText () const
 
bool exec ()
 
bool isAutoDelete () const
 
bool isSuspended () const
 
unsigned long percent () const
 
Q_SCRIPTABLE qulonglong processedAmount (Unit unit) const
 
void setAutoDelete (bool autodelete)
 
void setUiDelegate (KJobUiDelegate *delegate)
 
Q_SCRIPTABLE qulonglong totalAmount (Unit unit) const
 
KJobUiDelegateuiDelegate () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QStringList availablePlugins ()
 
static QStringList defaultPlugins ()
 
static KIO::filesize_t maximumFileSize ()
 
static QStringList supportedMimeTypes ()
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Slots

void slotResult (KJob *job) override
 
- Protected Slots inherited from KCompositeJob
virtual void slotInfoMessage (KJob *job, const QString &plain, const QString &rich)
 
virtual void slotResult (KJob *job)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Slots inherited from KJob
bool kill (KillVerbosity verbosity=Quietly)
 
bool resume ()
 
bool suspend ()
 
- Public Attributes inherited from KJob
 Bytes
 
 Directories
 
 Files
 
 Items
 
 Killable
 
 NoCapabilities
 
 Suspendable
 
 UnitsCount
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from KIO::Job
 Job (JobPrivate &dd)
 
bool addSubjob (KJob *job) override
 
bool doKill () override
 
bool doResume () override
 
bool doSuspend () override
 
bool removeSubjob (KJob *job) override
 
- Protected Member Functions inherited from KCompositeJob
void clearSubjobs ()
 
bool hasSubjobs () const
 
const QList< KJob * > & subjobs () const
 
- Protected Member Functions inherited from KJob
void emitPercent (qulonglong processedAmount, qulonglong totalAmount)
 
void emitResult ()
 
void emitSpeed (unsigned long speed)
 
bool isFinished () const
 
void setCapabilities (Capabilities capabilities)
 
void setError (int errorCode)
 
void setErrorText (const QString &errorText)
 
void setPercent (unsigned long percentage)
 
void setProcessedAmount (Unit unit, qulonglong amount)
 
void setProgressUnit (Unit unit)
 
void setTotalAmount (Unit unit, qulonglong amount)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Attributes inherited from KIO::Job
JobPrivate *const d_ptr
 

Detailed Description

KIO Job to get a thumbnail picture.

This class catches a preview (thumbnail) for files.

Definition at line 29 of file previewjob.h.

Member Enumeration Documentation

Specifies the type of scaling that is applied to the generated preview.

For HiDPI, pixel density scaling,

See also
setDevicePixelRatio
Since
4.7
Enumerator
Unscaled 

The original size of the preview will be returned.

Most previews will return a size of 256 x 256 pixels.

Scaled 

The preview will be scaled to the size specified when constructing the PreviewJob.

The aspect ratio will be kept.

ScaledAndCached 

The preview will be scaled to the size specified when constructing the PreviewJob.

The result will be cached for later use. Per default ScaledAndCached is set.

Definition at line 39 of file previewjob.h.

Constructor & Destructor Documentation

PreviewJob::PreviewJob ( const KFileItemList items,
int  width,
int  height,
int  iconSize,
int  iconAlpha,
bool  scale,
bool  save,
const QStringList enabledPlugins 
)

Creates a new PreviewJob.

Parameters
itemsa list of files to create previews for
widththe desired width
heightthe desired height, 0 to use the width
iconSizethe size of the MIME type icon to overlay over the preview or zero to not overlay an icon. This has no effect if the preview plugin that will be used doesn't use icon overlays.
iconAlphatransparency to use for the icon overlay
scaleif the image is to be scaled to the requested size or returned in its original size
saveif the image should be cached for later use
enabledPluginsIf non-zero, this points to a list containing the names of the plugins that may be used. If enabledPlugins is zero all available plugins are used.
Deprecated:
Since 4.7, use PreviewJob(const KFileItemList&, const QSize&, const QStringList*) in combination with the setter-methods instead. Note that the semantics of enabledPlugins has been slightly changed.

Definition at line 186 of file previewjob.cpp.

PreviewJob::PreviewJob ( const KFileItemList items,
const QSize size,
const QStringList enabledPlugins = nullptr 
)
Parameters
itemsList of files to create previews for.
sizeDesired size of the preview.
enabledPluginsIf non-zero it defines the list of plugins that are considered for generating the preview. If enabledPlugins is zero the plugins specified in the KConfigGroup "PreviewSettings" are used.
Since
4.7

Definition at line 201 of file previewjob.cpp.

Member Function Documentation

QStringList PreviewJob::availablePlugins ( )
static

Returns a list of all available preview plugins.

The list contains the basenames of the plugins' .desktop files (no path, no .desktop).

Returns
the list of all available plugins

Definition at line 950 of file previewjob.cpp.

QStringList PreviewJob::defaultPlugins ( )
static

Returns a list of plugins that should be enabled by default, which is all plugins Minus the plugins specified in an internal blacklist.

Returns
the list of plugins that should be enabled by default
Since
5.40

Definition at line 963 of file previewjob.cpp.

void KIO::PreviewJob::failed ( const KFileItem item)
signal

Emitted when a thumbnail for item could not be created, either because a ThumbCreator for its MIME type does not exist, or because something went wrong.

Parameters
itemthe file that failed
void KIO::PreviewJob::gotPreview ( const KFileItem item,
const QPixmap preview 
)
signal

Emitted when a thumbnail picture for item has been successfully retrieved.

Parameters
itemthe file of the preview
previewthe preview image
bool KIO::PreviewJob::handlesSequences ( ) const

Determines whether the ThumbCreator in use is a ThumbSequenceCreator.

Since
5.80

Definition at line 465 of file previewjob.cpp.

KIO::filesize_t PreviewJob::maximumFileSize ( )
static

Returns the default "maximum file size", in bytes, used by PreviewJob.

This is useful for applications providing a GUI for letting the user change the size.

Since
4.1
Deprecated:
Since 4.5, PreviewJob uses different maximum file sizes dependent on the URL. The returned file size is only valid for local URLs.

Definition at line 1013 of file previewjob.cpp.

int PreviewJob::overlayIconAlpha ( ) const
Returns
The alpha-value for the MIME-type icon which overlays the preview. Per default 70 is returned.
See also
PreviewJob::setOverlayIconAlpha()
Since
4.7

Definition at line 248 of file previewjob.cpp.

int PreviewJob::overlayIconSize ( ) const
Returns
The size of the MIME-type icon which overlays the preview.
See also
PreviewJob::setOverlayIconSize()
Since
4.7

Definition at line 236 of file previewjob.cpp.

void PreviewJob::removeItem ( const QUrl url)

Removes an item from preview processing.

Use this if you passed an item to filePreview and want to delete it now.

Parameters
urlthe url of the item that should be removed from the preview queue

Definition at line 431 of file previewjob.cpp.

PreviewJob::ScaleType PreviewJob::scaleType ( ) const
Returns
The scale type for the generated preview.
See also
PreviewJob::ScaleType
Since
4.7

Definition at line 275 of file previewjob.cpp.

int KIO::PreviewJob::sequenceIndex ( ) const

Returns the currently set sequence index.

Since
4.3

Definition at line 455 of file previewjob.cpp.

float KIO::PreviewJob::sequenceIndexWraparoundPoint ( ) const

Returns the index at which the thumbs of a ThumbSequenceCreator start wrapping around ("looping").

Fractional values may be returned if the ThumbSequenceCreator supports sub-integer precision, but frontends supporting only integer sequence indices may choose to round it down.

See also
ThumbSequenceCreator::sequenceIndexWraparoundPoint()
Since
5.80

Definition at line 460 of file previewjob.cpp.

void KIO::PreviewJob::setDevicePixelRatio ( int  dpr)

Request preview to use the device pixel ratio dpr.

The returned thumbnail may not respect the device pixel ratio requested. Use QPixmap::devicePixelRatio to check, or paint as necessary.

Since
5.80
Deprecated:
Since 5.86, use setDevicePixelRatio(qreal dpr) instead

Definition at line 471 of file previewjob.cpp.

void KIO::PreviewJob::setDevicePixelRatio ( qreal  dpr)

Request preview to use the device pixel ratio dpr.

The returned thumbnail may not respect the device pixel ratio requested. Use QPixmap::devicePixelRatio to check, or paint as necessary.

Since
5.84

Definition at line 477 of file previewjob.cpp.

void PreviewJob::setIgnoreMaximumSize ( bool  ignoreSize = true)

If ignoreSize is true, then the preview is always generated regardless of the settings.

Definition at line 482 of file previewjob.cpp.

void PreviewJob::setOverlayIconAlpha ( int  alpha)

Sets the alpha-value for the MIME-type icon which overlays the preview.

The alpha-value may range from 0 (= fully transparent) to 255 (= opaque). Per default the value is set to 70.

See also
PreviewJob::setOverlayIconSize()
Since
4.7

Definition at line 242 of file previewjob.cpp.

void PreviewJob::setOverlayIconSize ( int  size)

Sets the size of the MIME-type icon which overlays the preview.

If zero is passed no overlay will be shown at all. The setting has no effect if the preview plugin that will be used does not use icon overlays. Per default the size is set to 0.

Since
4.7

Definition at line 230 of file previewjob.cpp.

void PreviewJob::setScaleType ( ScaleType  type)

Sets the scale type for the generated preview.

Per default PreviewJob::ScaledAndCached is set.

See also
PreviewJob::ScaleType
Since
4.7

Definition at line 254 of file previewjob.cpp.

void KIO::PreviewJob::setSequenceIndex ( int  index)

Sets the sequence index given to the thumb creators.

Use the sequence index, it is possible to create alternative icons for the same item. For example it may allow iterating through the items of a directory, or the frames of a video.

Since
4.3

Definition at line 450 of file previewjob.cpp.

QStringList PreviewJob::supportedMimeTypes ( )
static

Returns a list of all supported MIME types.

The list can contain entries like text/ * (without the space).

Returns
the list of MIME types

Definition at line 975 of file previewjob.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 23:03:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.