KLATEXFORMULA
Home
About
Downloads
Screen Shots
Wiki (Manuals)
News

Devel Manual:Add-On Distribution

From KLFWiki

Jump to: navigation, search

Add-ons (e.g. translations and plugins) are distributed as Qt Resource Archives (.rcc). These files can then be imported in KLatexFormula's settings dialog.

You may want to read also Qt's documentation on their Resource System, which can be found at http://doc.trolltech.com/4.4/resources.html.

RCC Add-On Structure

The RCC may theoretically contain any files, which will then become visible to KLatexFormula.

In the RCC file, translations should be placed in the

:/i18n/

directory. The files should be named <name>_<locale>.qm where <name> indicates vaguely what is translated (klatexformula, a part of it, or a specific plugin...) and <locale> is the language code (e.g. "el", "fr_CH", ...).

Plugins should all be packaged in a directory named

:/plugins/

and should have the correct extension (.so on linux, .dll on Windows and .dylib on mac). Files with extensions not corresponding to the current platform are ignored.

The RCC archive may then contain more data specific to the extension (could be some image files or data for a plugin...) which should be stored in a reasonable location, bearing in mind that the files are loaded in the global resource scope.

The RCC must also contain an XML file providing information about this extension. The XML file should be located at

:/rccinfo/info.xml

and should provide information for all the important fields (see below).

In order to avoid conflicts, add-ons should use specific characterized directories and file names. For example data corresponding to a skin would be stored in :/plugindata/skin/* and translation to french for a plugin named zapper would be named :/i18n/zapper_fr.qm .

RCC File Structure Example

The following extract provides an example of a RCC file for a (fictive) "Deep Thought" plugin: deepthoughtplugin.qrc:

<RCC>
  <qresource prefix="rccinfo">
    <file alias="info.xml">info.xml</file>
  </qresource>
 <qresource prefix="/plugins">
   <file>libdeepthoughtplugin.so</file>
   <file>libdeepthoughtplugin.dylib</file>
   <file>deepthoughtplugin.dll</file>
 </qresource>
 <qresource prefix="/plugindata/deepthoughtplugin">
   <file>pics/deepthought.png</file>
   <file>pics/towel.png</file>
   <file>banners/dont_panic.jpg</file>
   <file>help/quickhelp.html</file>
   <file>help/longhelp.html</file>
 </qresource>
</RCC>

We assume a directory structure similar to:

deepthoughtplugin/
  info.xml
  deepthoughtplugin.qrc
  ...
  libdeepthought.so
  libdeepthought.dylib
  deepthought.dll
  ...
  pics/
    ...
  help/
    ...

where the three libraries for linux, win and mac could have been compiled on separate machines and copied to this location.

The RCC file is then obtained with the command

rcc -binary -o deepthoughtplugin.rcc deepthoughtplugin.qrc

It is important to provide the -binary switch, otherwise rcc outputs C++ code for compiling into a project, which is not what we want!

The rccinfo XML File

The RCC information XML file located at :/rccinfo/info.xml and should look like this:

<?xml version='1.0' encoding='UTF-8'?>
<rccinfo>
  <title>Deep Thought Plugin</title>
  <author>Philippe Faist</author>
  <description>Finds the Answer to Life, the Universe and Everything (thanks to Mr. Adams)</description>
</rccinfo>

The file is (I hope) relatively self-explaining.