• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

Public Types | Public Member Functions | List of all members
ThumbCreator Class Referenceabstract

#include <thumbcreator.h>

Public Types

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

Public Member Functions

virtual bool create (const TQString &path, int width, int height, TQImage &img)=0
 
virtual Flags flags () const
 

Detailed Description

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

Using the class TDEIO::PreviewJob allows you to generate small images (thumbnails) for any kind of file, where a "ThumbCreator" is available. Have a look at tdebase/tdeioslave/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();
    }
    };

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

INCLUDES = $(all_includes)
kde_module_LTLIBRARIES = yourthumbcreator.la
yourthumbcreator_la_SOURCES = yourthumbcreator.cpp
yourthumbcreator_la_LIBADD = $(LIB_TDEIO)
yourthumbcreator_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
kde_services_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-TDE-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 (where you see [slash], put a /)

text[slash]* or image[slash]*.

If your plugin is rather inexpensive (e.g. like the text preview ThumbCreator), you can set CacheThumbnail=false to prevent your thumbnails from being cached on disk.

Baseclass for thumbnail-generating plugins.

Definition at line 84 of file thumbcreator.h.

Member Enumeration Documentation

enum ThumbCreator::Flags

The flags of this plugin.

See also
flags()

Definition at line 91 of file thumbcreator.h.

Member Function Documentation

virtual bool ThumbCreator::create ( const TQString &  path,
int  width,
int  height,
TQImage &  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
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
virtual Flags ThumbCreator::flags ( ) const
inlinevirtual

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 119 of file thumbcreator.h.


The documentation for this class was generated from the following file:
  • thumbcreator.h

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.8.8
This website is maintained by Timothy Pearson.