• English
  • Français (French)

Creating a new plugin for FreeMedForms

This page describes how to write a plugin for FreeMedForms. FMF basically is derived from QtCreator by Nokia, and you can write plugins like you would write one for QtCreator, the basic code is the same. Using QtCreator, you can easily create a plugin with the builtin template wizard, we've created a template that should keep you up and running.

In the FMF source tree, there is the qtcreator_wizards directory, which contains subdirectories, that can just be copied (or better linked, for update safety) to the QtCreator template wizards directory. You can gather some info from here (for QtCreator 2.4).

We recommend that you put a link in your personal home directory, so you don't have to bother with admin rights and update problems. The user directory QtCreator is looking at startup is ~/.config/Nokia/qtcreator/templates/wizards.

Installing instructions

Linux

Go to the qtcreator_wizards directory, and run the following commands (for e.g. the freemedformsplugin, repeat for other directories):

mkdir -p ~/.config/Nokia/qtcreator/templates/wizards
ln -s $PWD/freemedformsplugin ~/.config/Nokia/qtcreator/templates/wizards/freemedformsplugin

Mac

TODO

Windows

TODO

After a QtCreator restart there should be a new wizard available.

Using the wizard

Right-click on the freemedforms project, and select New subproject…:

Then unter FreeMedForms choose FreeMedForms Plugin:

Under Introduction and Project Location you must give the directory a lowercase name (e.g. “myplugin”), and you must choose /freemedforms/plugins as directory where to create the plugin:

Under Target Setup you can use your usual settings.

Fill out the Plugin Information form (Plugin name, Author, Vendor etc) - these items will be visible within the application when opening the plugin manager.

Under the last page, Project Management, it's very important that you choose plugins.pro as the project where to add this new subproject - otherwise it won't work. choose any VCS you are working with, we are using git at the main FMF repository.

Then click Finish.

Final steps

The wizard is not able to write a little speciality that is needed by FMF. All the common plugins live in /plugins, but there is also a %application%/plugins directory (where %application% means freepad, freediams etc.) with a plugins.pro file for only that application. This file is the main plugins project file for that application, but it has to reference the plugins relatively in ../../plugins.

Therefore you have to open the plugins.pro file in QtCreator, and change what the wizard just wrote manually: search for the last line of the SUBDIRS variable, you'll see the following line:

../../plugins/myspecialplugin

Delete this line and write just

myspecial

instead. Now scroll down to the lower part, create a new section and write

myspecial.subdir = ../../plugins/myplugin
myspecial.depends += core
myspecial.depends += %whatElseItDependsOn%

Then you should have no problem compiling and running the plugin.

en/code/howto_write_a_fmf_plugin.txt · Dernière modification: 2013/04/09 23:04 par Christian A. Reiter
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki FreeMedForms © Eric Maeker, MD