ThumbCreator Class Reference
This is the baseclass for "thumbnail-plugins" in KDE. More...
#include <thumbcreator.h>
Public Types | |
enum | Flags { None = 0, DrawFrame = 1, BlendIcon = 2 } |
Public Member Functions | |
virtual bool | create (const QString &path, int width, int height, QImage &img)=0 |
Creates a thumbnail Note that the width and height parameters should not be used for scaling. | |
virtual Flags | flags () const |
The flags of this plugin:
|
Detailed Description
This is the baseclass for "thumbnail-plugins" in KDE.Using the class KIO::PreviewJob allows you to generate small images (thumbnails) for any kind of file, where a "ThumbCreator" is available. Have a look at kdebase/kioslave/thumbnail/ for existing ThumbCreators.
What you need to do to create and register a ThumbCreator:
- Inherit from this class and reimplement the create() method to generate a thumbnail for the given file-path.
- Provide a factory method in your implementation file to instantiate your plugin, e.g.: extern "C" { ThumbCreator *new_creator() { return new YourThumbCreator(); } };
INCLUDES = LDFLAGS = kde_module_LTLIBRARIES = yourthumbcreator.la yourthumbcreator_la_SOURCES = yourthumbcreator.cpp yourthumbcreator_la_LIBADD = yourthumbcreator_la_LDFLAGS = -module servicedir = service_DATA = yourthumbcreator.desktop
- Create a file yourthumbcreator.desktop with the following contents: [Desktop Entry] Encoding=UTF-8 Type=Service Name=Name of the type of files your ThumbCreator supports ServiceTypes=ThumbCreator MimeTypes=application/x-somemimetype CacheThumbnail=true X-KDE-Library=yourthumbcreator
Definition at line 84 of file thumbcreator.h.
Member Function Documentation
|
Creates a thumbnail Note that the width and height parameters should not be used for scaling. Only plugins that create an image "from scratch", like the TextCreator should directly use the specified size. If the resulting preview is larger than width x height, it will be scaled down.
|
|
The flags of this plugin:
Definition at line 113 of file thumbcreator.h. |
The documentation for this class was generated from the following file: