Commit 7a26a497 authored by Martin Schultz's avatar Martin Schultz

moved detail documentation of PluginConnectionInterface to separate

.docu file
parent b6081243
/** \page pluginConnectionInterfacePage Plugin Connection Interface
\n
\image html PluginConnectionInterface.png
\n
The PluginConnectionInterface allows to connect signals and slots across different OpenFlipper plugins.
Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup
your connections. Don't try to setup your connections earlier as the plugins you try to connect may not exist yet.
\n
<b> WARNING! Never connect SIGNALS and SLOTS which are already defined in other Interfaces!! WARNING! </b>
\n
This might result in endless loops and breaks OpenFlippers control loops. You have to keep track
of your connections yourself. If you call slots which call updatedOject which in turn call your original
slot you get a loop and OpenFlipper is not responsible for your endless loops! Be careful!
The following code shows a simple example to connect signals and slots. For the signal and slot definition
you have to use the common QT macros SIGNAL and SLOT.
\code
void ExamplePlugin::pluginsInitialized()
{
// Use the QT macros to generate the signatures
emit crossPluginConnect(pluginA,SIGNAL(signalA(QString)),pluginB,SLOT(slotB(QString)));
}
\endcode
The next example shows how to use a queued connection between two plugins:
\n
ExamplePlugin.hh:
\code
class ExamplePlugin: public QObject, BaseInterface, PluginConnectionInterface, [...]
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(PluginConnectionInterface)
[...]
signals:
void crossPluginConnectQueued( QString, const char*, QString, const char*);
/// example signal which can be used to group objects in datacontrol
void void dataControlGroupObjects(IdList, QString);
[...]
void exampleFunction();
}
\endcode
ExamplePlugin.cc:
\code
[...]
void ExamplePlugin::pluginsInitialized()
{
[...]
emit crossPluginConnectQueued("exampleplugin",SIGNAL(dataControlGroupObjects(IdList, QString)),"datacontrol",SLOT(groupObjects(IdList, QString)));
}
void ExamplePlugin::exampleFunction()
{
//do whatever you want, especially use the signals you want, but don't create loops
// e.g. emit a bazillion addEmptObject signals
[...]
// finally group them by emitting the connected signal
emit dataControlGroupObjects(ids, "fancy group name");
}
\endcode
To use the PluginConnectionInterface:
<ul>
<li> include PluginConnectionInterface.hh in your plugins header file
<li> derive your plugin from the class PluginConnectionInterface
<li> add Q_INTERFACES(PluginConnectionInterface) to your plugin class
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
</ul>
*/
......@@ -107,84 +107,6 @@ class PluginConnectionInterface {
};
/** \page pluginConnectionInterfacePage Plugin Connection Interface
\n
\image html PluginConnectionInterface.png
\n
The PluginConnectionInterface allows to connect signals and slots across different OpenFlipper plugins.
Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup
your connections. Don't try to setup your connections earlier as the plugins you try to connect may not exist yet.
\n
<b> WARNING! Never connect SIGNALS and SLOTS which are already defined in other Interfaces!! WARNING! </b>
\n
This might result in endless loops and breaks OpenFlippers control loops. You have to keep track
of your connections yourself. If you call slots which call updatedOject which in turn call your original
slot you get a loop and OpenFlipper is not responsible for your endless loops! Be careful!
The following code shows a simple example to connect signals and slots. For the signal and slot definition
you have to use the common QT macros SIGNAL and SLOT.
\code
void ExamplePlugin::pluginsInitialized()
{
// Use the QT macros to generate the signatures
emit crossPluginConnect(pluginA,SIGNAL(signalA(QString)),pluginB,SLOT(slotB(QString)));
}
\endcode
The next example shows how to use a queued connection between two plugins:
\n
ExamplePlugin.hh:
\code
class ExamplePlugin: public QObject, BaseInterface, PluginConnectionInterface, [...]
{
Q_OBJECT
Q_INTERFACES(BaseInterface)
Q_INTERFACES(PluginConnectionInterface)
[...]
signals:
void crossPluginConnectQueued( QString, const char*, QString, const char*);
/// example signal which can be used to group objects in datacontrol
void void dataControlGroupObjects(IdList, QString);
[...]
void exampleFunction();
}
\endcode
ExamplePlugin.cc:
\code
[...]
void ExamplePlugin::pluginsInitialized()
{
[...]
emit crossPluginConnectQueued("exampleplugin",SIGNAL(dataControlGroupObjects(IdList, QString)),"datacontrol",SLOT(groupObjects(IdList, QString)));
}
void ExamplePlugin::exampleFunction()
{
//do whatever you want, especially use the signals you want, but don't create loops
// e.g. emit a bazillion addEmptObject signals
[...]
// finally group them by emitting the connected signal
emit dataControlGroupObjects(ids, "fancy group name");
}
\endcode
To use the PluginConnectionInterface:
<ul>
<li> include PluginConnectionInterface.hh in your plugins header file
<li> derive your plugin from the class PluginConnectionInterface
<li> add Q_INTERFACES(PluginConnectionInterface) to your plugin class
<li> And add the signals or slots you want to use to your plugin class (You don't need to implement all of them)
</ul>
*/
Q_DECLARE_INTERFACE(PluginConnectionInterface,"OpenFlipper.PluginConnectionInterface/1.0")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment