Commit 77462e71 authored by Jan Möbius's avatar Jan Möbius

Documented PluginConnectionInterface

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11052 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 21319015
......@@ -46,16 +46,26 @@
#include <QString>
/**
/** \file PluginConnectionInterface.hh
*
* Interface for connecting signals and slots across plugins. \ref pluginConnectionInterfacePage
*/
/**
* \brief Allow to connect slots between plugins
*
* \ref pluginConnectionInterfacePage "Detailed description"
* \n
*
* Interface Class which allows to connect signals and slots across plugins
*
* WARNING! Never connect SIGNALS and SLOTS which are already defined in the Interfaces!! WARNING!
* 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 oiginal
* slot, OpenFlipper is not responsible for your endless loops! Be carefull!
* WARNING! Never connect SIGNALS and SLOTS which are already defined in the Interfaces!! WARNING!
* \n
* <b> WARNING! Never connect SIGNALS and SLOTS which are already defined in the 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!
*/
class PluginConnectionInterface {
......@@ -64,9 +74,9 @@ class PluginConnectionInterface {
*
* Connect a signal of one plugin to another plugin by its scripting name.
* _pluginName1 is the scripting name of the plugin containing the signal ( Use script editor to check that name)
* _signal is the signal name. Use it like with regular connect ( SIGNAL(...) ) macro
* _signal is the signal name. Use it like with regular connect ( <tt>SIGNAL(...)</tt> ) macro
* _pluginName2 is the scripting name of the plugin containing a slot
* _slot is the slot name. Use it like with regular connect ( SLOT(...) ) macro
* _slot is the slot name. Use it like with regular connect ( <tt>SLOT(...)</tt> ) macro
*
*/
virtual void crossPluginConnect( QString /*_pluginName1*/, const char* /*_signal*/, QString /*_pluginName2*/, const char* /*_slot*/) {};
......@@ -79,6 +89,44 @@ 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
To use the ScriptInterface:
<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")
#endif // PLUGINCONNECTIONINTERFACE_HH
......@@ -236,7 +236,7 @@ To use the ScriptInterface:
</ul>
An easier interface to call functions is available by the \ref RPCInterfacePage "RPC Interface". Additionally it is
possible to connect signals and slots across plugins via the \ref PluginConnectionInterfacePage "Plugin Connection Interface"
possible to connect signals and slots across plugins via the \ref pluginConnectionInterfacePage "Plugin Connection Interface"
*/
......
......@@ -62,7 +62,6 @@ LoadSaveInterface
MouseInterface
OptionsInterface
PickingInterface
PluginConnectionInterface
ProcessInterface
RPCInterface
SecurityInterface
......@@ -200,6 +199,10 @@ This page shows interfaces for other operations.
\image html ScriptInterface.png
For plugins which provide scriptable functions ( \ref scriptInterfacePage )
\subpage pluginConnectionInterfacePage
\image html PluginConnectionInterface.png
Enables the developer to connect signals and slots across plugins. ( \ref pluginConnectionInterfacePage )
*/
......
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