Warning, /graphics/libkipi/src/Mainpage.dox is written in an unsupported language. File is not indexed.

0001 /**
0002    \mainpage libkipi reference page.
0003 
0004    This page will tell you both how to develop a new
0005    plugin for KIPI, and how to add KIPI support to a new
0006    application (referred to as host application).
0007 
0008    This documentation has been writen by Gilles Caulier and has been updated
0009    and improved by Victor Dodon.
0010 
0011    <h1>General information about libkipi 2.0.0</h1>
0012 
0013    Starting with 2.0.0 version of libkipi shared library, Plugin class
0014    inherits KXMLGUIClient class. This means that if your application uses
0015    KDE-XML GUI, you can add plugin actions to the toolbar(if you add plugins to
0016    the guiFactory of you KXmlGuiWindow). For more documentation about KDE-XML
0017    GUI you can look <a href="http://techbase.kde.org/Development/Architecture/KDE4/XMLGUI_Technology">here</a>.
0018 
0019    <h2>Developing a new KIPI plugin</h2>
0020 
0021    The easiest way to start a new plugin, is to copy the
0022    <a href="https://commits.kde.org/libkipi?path=tests/plugins/kxmlhelloworld">
0023    KXMLHelloWorld</a> plugin, which you may find in <a
0024    href="https://commits.kde.org/libkipi">
0025    libkipi</a> project from KDE git repository. Please also read <a
0026    href="http://www.ukuug.org/events/linux2004/programme/paper-JPedersen-2/index.html">
0027    this tutorial</a> which tells in general about developing a plugin
0028    structure for an application, but it also gives some background
0029    information on how plugins are loaded, and especially on the macros
0030    involved. The tutorial has been written by one of the KIPI authors, so
0031    it matches fairly good the model of KIPI.
0032 
0033 
0034 
0035 
0036 
0037    <h2>General things to do to implement a KIPI plugin</h2>
0038 
0039    Here is a list of things to do.
0040    <ul>
0041    <li> Create a class that inherits KIPI::Plugin. In the constructor you
0042    must create instances of QAction for your application. The topmost
0043    actions should be given to the Plugin super class using KIPI::Plugin::addAction().
0044    <li> As described in the tutorial <a href="http://www.ukuug.org/events/linux2004/programme/paper-JPedersen-2/index.html#understanding_loading">here</a>, you must call KDE macros
0045    <tt>K_PLUGIN_FACTORY</tt> and <tt>K_EXPORT_PLUGIN</tt>.
0046    <li> You also need to create a desktop file, as described <a href="http://www.ukuug.org/events/linux2004/programme/paper-JPedersen-2/index.html#makefile_am_client">here</a>
0047    <li> You must write a rc file describing the gui of your plugin. For an
0048    example look at the <a href="https://commits.kde.org/libkipi?path=tests/plugins/kxmlhelloworld/kipiplugin_kxmlhelloworldui.rc">rc
0049    file</a> of the KXMLHelloWorld plugin.
0050    </ul>
0051 
0052 
0053 
0054 
0055 
0056    <h2>Retrieving information from the KIPI host application</h2>
0057 
0058    The above was the required step to build the plugin. The following will
0059    tell you about the functions with which you communicate with the host
0060    application.
0061 
0062    The origin of all your communication with the host application is
0063    \ref KIPI::Interface. You obtain a pointer to this by casting the parent
0064    pointer given to your plugin during construction, or, beginning with libkipi
0065    2.0.0, by calling interface() method from KIPI::Plugin class.
0066 
0067    Selection of images can be obtained using
0068    KIPI::Interface::currentSelection(), KIPI::Interface::currentAlbum() and
0069    KIPI::Interface::allAlbums(). These methods uses KIPI::ImageCollection
0070    to wrap a selection of images.
0071 
0072    Finally to obtain information about individual images, call
0073    KIPI::Interface::info(), which returns a KIPI::ImageInfo, with the
0074    information. Note that Kipi-plugins provide a dedicated wrapper around KIPI::ImageInfo
0075    to simplify item attribute management with host application. See
0076    <a href="https://commits.kde.org/kipi-plugins?path=common/libkipiplugins/tools/kpimageinfo.h">
0077    here</a> for details.
0078 
0079    When developing plugins, you should pay special attention to the fact the different
0080    host applications may have different feature sets they
0081    support. Information about what the host application support can be
0082    obtained from KIPI::Interface::hasFeature(). See also extra settings that can be shared
0083    by KIPI host application. Kipi-plugins provide a dedicated wrapper around KIPI::Interface to
0084    simplify host settings management.
0085 
0086 
0087 
0088    <h2>Utilities for Plugins</h2>
0089 
0090    KIPI has a number of utilities useful when developing plugins:
0091    <ul>
0092    <li> use KIPI::ImageCollectionSelector to ask the user for a collection.
0093    <li> use KIPI::UploadWidget when the user should specify a directory to
0094    write images into.
0095    <li> KIPI::Interface::thumbnail() helps you load thumbnails of images from KIPI host thumbnail manager.
0096    <li> KIPI::Interface::progress*() helps you dispatch progress information to KIPI host progress manager.
0097    <li> <a href="https://commits.kde.org/libkipi?path=tests/kipicmd">
0098    kipicmd command line program</a> helps you to test your plugin without to have a KIPI host application available.
0099    It emulates a simplified KIPI interface and can run plugin as stand-alone application.
0100    Look kipicmd command line documentation for details.
0101    <li> Beginning with libkipi 2.0.0 you have a simple gui program,
0102    <a href="https://commits.kde.org/libkipi?path=tests/kxmlkipicmd">kxmlkipicmd</a>,
0103    which emulates a simplified KIPI interface with a menubar and a toolbar. This
0104    way you can test the gui of your plugin.
0105    </ul>
0106 
0107 
0108 
0109 
0110    <h1>Adding KIPI support to a new host application.</h1>
0111 
0112    To add KIPI support to your application you must inherit
0113    KIPI::Interface, and give an instance of this class to
0114    KIPI::PluginLoader. See \ref KIPI::PluginLoader "KIPI::PluginLoader" for details on loading plugins.
0115 
0116    To be able to create an instance of your subclass of KIPI::Interface,
0117    you must of course implement all the pure virtual method of the super
0118    class, among others this requires you to create and return instances of
0119    KIPI::ImageCollection and KIPI::ImageInfo. The only way you can do so
0120    are by giving the classes a pointer to a subclass of
0121    KIPI::ImageCollectionShared and KIPI::ImageInfoShared. These sub classes
0122    are also your responsibility to implement.
0123 
0124    The reason why things are that complicated, are to solve the problem of
0125    ownership of pointers to the classes in question. The
0126    KIPI::ImageCollectionShared pointer you give to KIPI::ImageCollection
0127    constructor will be the owned by the ImageCollection instance.
0128 */