How can i write my own plug-in?

First you have to download source code of the project and make sure you are able to compile it.

1. Write an image format plug-in

You just need to implement the ImageModuleInterface class which have to provide a specialized implentation of Image class. You can find an example in src/modules/seformatbmp/ directory.

1.1 Implementation of ImageModuleInterface

Let's try to add a plugin for support of PNG. You first have to extend the module interface and then specify to Qt that you are about to write a plugin:

myformatpng.h #include <imagemoduleinterface.h>

using namespace SilentEyeFramework;

namespace MyFormatPNG {

class MyFormatPNG : public ImageModuleInterface
{
Q_OBJECT;
Q_INTERFACES(SilentEyeFramework::ImageModuleInterface);


public:
  MyFormatPNG();
  QWidget* encodeWidget();
  QWidget* decodeWidget();
  bool isEncodeWidgetReady() const;
  bool isDecodeWidgetReady() const;

  QPointer<Image> encodeImage(QPointer<Image>,bool=false);
  QPointer<Image> decodeImage(QPointer<Image>,bool=false);

  QString typeSupported() const;

  QString name() const;
  QString version() const;
  QString status();

Implementation must reference itself to the Qt plugin system.

myformatpng.cpp #include "myformatpng.h"

...

Q_EXPORT_PLUGIN2(myformatpng, MyFormatPNG::MyFormatPNG)

1.2 Implementation of Image

myimagepng.cpp #include <image.h>

using namespace SilentEyeFramework;

namespace MyFormatPNG {

class MyImagePNG : public Image
{
...

In this class, 3 methods are important and must be override:
  • quint32 capacity() const; : must return the max number of byte we can hide into the current image.
  • bool loadData(); : read current media in order to extract hidden information. Result must be setted into m_data
  • bool saveToDir(QString) : hide message into the current media and save current output into given destination folder
Information to encode is provide as an EncodedData object. This is an easy to use objet for a bit per bit read. See API documentation for more information.

1.3 Provide a configuration widget

You can provide a configuration widget for the SilentEye GUI. This QWidget will be retreive by "encodeWidget()" and "decodeWidget()" methods of your ModuleFormatInterface implementation.

2. Write a cryptography plug-in

Coming soon !

Ads