class ThumbCreator

This is the baseclass for "thumbnail-plugins" in KDE. More...

Contains pure virtuals
Definition#include <thumbcreator.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods


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:


 extern "C"
 {
   ThumbCreator *new_creator()
   {
     return new YourThumbCreator();
   }
 };

Compile your ThumbCreator as a module. The contents of Makefile.am need to look like this:


 INCLUDES = $(all_includes)
 LDFLAGS = $(all_libraries) $(KDE_RPATH)
 kde_module_LTLIBRARIES = yourthumbcreator.la
 yourthumbcreator_la_SOURCES = yourthumbcreator.cpp
 yourthumbcreator_la_LIBADD = $(LIB_KIO)
 yourthumbcreator_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
 servicedir = $(kde_servicesdir)
 service_DATA = yourthumbcreator.desktop


 [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

You can supply a comma-separated list of mimetypes to the MimeTypes entry, naming all mimetypes your ThumbCreator supports. You can also use simple wildcards, like

enum Flags { None = 0, DrawFrame = 1, BlendIcon = 2 }

Flags

 ~ThumbCreator ()

~ThumbCreator

[virtual]

bool  create (const QString &path, int width, int height, QImage &img)

create

[pure virtual]

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.

Parameters:
paththe (always local) file path to create a preview for
widthmaximum width for the preview
heightmaximum height for the preview
imgthis image will contain the preview on success

Returns: true if preview generation succeeded

Flags  flags ()

flags

[const virtual]

The flags of this plugin:

Returns: flags for this plugin


Generated by: caleb on tcdevel on Tue Jan 28 12:54:15 2003, using kdoc $.