NCL Composer project file specification

In its current version (0.1.x) a project file in NCL Composer is a unique file with extension .cpr. This file is a text file, compressed through a ZIP algorithm.

The file is composed of a set of sections. Each section delimiter is started with #SECTION_NAME.

The first section (the header of the file) is the #COMPOSER_PROJECT section.

The second section is the #COMPOSER_MODEL section, that will contain a serialized version of the internal model of the NCL Composer.

Following this, there will be N #COMPOSER_PLUGIN_DATA sections. Each #COMPOSER_PLUGIN_DATA will contain specific data of the plug-in.

#COMPOSER_PROJECT name="project-example" version="0.1"
#COMPOSER_MODEL
...
#END_COMPOSER_MODEL
#COMPOSER_PLUGIN_DATA "br.puc-rio.telemidia.textual"
..
#END_COMPOSER_PLUGIN_DATA
...

The IPlugin API defines a signal that can be called when a plug-in wants to save some data. This way, when creating a plugin, developers can call the core to save its specific data through a code similar to:

  QByteArray data;
  ...
  // Fill data variable
  ...
  emit setPluginData(data); // call core to save the specific plug-in data.

Moreover, when a project is closed, the core will call a specific slot from the plugin API:

  bool saveSubsession();

You need to re-implement this method if you want to save the specific plug-in data when the project associated to that plug-in is closed.

I typical implementation of this method is:

  bool MyPlugin::saveSubsession()
  {
    QByteArray data;
    ...
    // Fill specific plug-in data in the data variable
    ...
    emit setPluginData(data); // call core to save the specific plug-in data.
  }