Skip to content

Coding your own plugins

Gabriel Caudrelier edited this page May 2, 2016 · 1 revision

Why would you do want to do that?

If you want to implement your own hash for instance, or a special decoder type, or just a cool parser.

Prequisites

  • Having a working Qt development environment
  • Having a good basic knowledge on dynamic library development in C/C++
  • Using QtCreator makes it easier, but that's ultimately optional. I guess anyone mastering libraries development would only need notepad.

Using QtCreator

If you are using QtCreator make sure to create a new C++ library project , and not a Qt Plugin project

New File or Project->Libraries->C++ library

Base principles

The plugin itself is a factory for TransformAbstract objects.

The programme loading the plugin will use the root class (the one the one that implement the TransformFactoryPluginInterface interface) to retrieve instances of transformations objects.

To send error messages to the GUI just use the signals error(message,source) and warning(message,sources) or the Pip3lineCallback object (logError()/logWarning()/logStatus())

The individual panels will only display the last messages but all messages will appears in the logs panel.

Memory management

You should not delete any TransformAbstract objects yourself, this should done automatically.

The same applies to the GUI configuration objects, Qt guarantee that these will be cleaned automatically whenever the parent GUI object is deleted.

Example

The source code repository contains a ready-to-build example, located in defaultplugins/examplePlugin.

The source is documented, and should not be too difficult to understand.

Notes

The gui/command line tool should do most of the hard work for you, as long as you are doing yours well (i.e. cleaning memory, sanitizing any user input ..) there should not be any issue.