kio Library API Documentation

ThumbCreator Class Reference

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

#include <thumbcreator.h>

List of all members.

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:
  • None nothing special
  • DrawFrame a frame should be painted around the preview
  • BlendIcon the mimetype icon should be blended over the preview.



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:

Compile your ThumbCreator as a module. The contents of Makefile.am need to look like this:
INCLUDES = LDFLAGS = kde_module_LTLIBRARIES = yourthumbcreator.la yourthumbcreator_la_SOURCES = yourthumbcreator.cpp yourthumbcreator_la_LIBADD = yourthumbcreator_la_LDFLAGS = -module servicedir = service_DATA = yourthumbcreator.desktop

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

Definition at line 84 of file thumbcreator.h.


Member Function Documentation

virtual bool ThumbCreator::create const QString path,
int  width,
int  height,
QImage img
[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:
path the (always local) file path to create a preview for
width maximum width for the preview
height maximum height for the preview
img this image will contain the preview on success
Returns:
true if preview generation succeeded

virtual Flags ThumbCreator::flags  )  const [inline, virtual]
 

The flags of this plugin:

  • None nothing special
  • DrawFrame a frame should be painted around the preview
  • BlendIcon the mimetype icon should be blended over the preview.

Returns:
flags for this plugin

Definition at line 113 of file thumbcreator.h.


The documentation for this class was generated from the following file:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:23:15 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001