From 431e6841a3c621e629a8fb762ef192eac7312f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Thu, 24 Feb 2011 09:08:09 +0000 Subject: [PATCH] Document initialization in Base Interface git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10990 383ad7c9-94d9-4d36-a494-682f7c89f535 --- BasePlugin/BaseInterface.hh | 12 +++++++----- BasePlugin/ContextMenuInterface.hh | 4 ++-- BasePlugin/MenuInterface.hh | 4 ++-- BasePlugin/ToolboxInterface.hh | 4 ++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/BasePlugin/BaseInterface.hh b/BasePlugin/BaseInterface.hh index d4848692..80fa2e15 100644 --- a/BasePlugin/BaseInterface.hh +++ b/BasePlugin/BaseInterface.hh @@ -287,15 +287,17 @@ To use the BaseInterface:
  • And add the signals or slots you want to use to your plugin class (You don't need to implement all of them except BaseInterface::description() and BaseInterface::name() ) -\section Plugin initialization +\section Plugin Initialization BaseInterface provides two functions to initialize a plugin. The first function is BaseInterface::initializePlugin(). This function is called immediatly after the plugin has been connected with OpenFlipper. When a plugin is loaded, all signals and slots from the used interfaces are connected to the core. After this, the -BaseInterface::initializePlugin() slot is called. In this slot you can initialize your plugin and add -user interface parts to OpenFlipper. The order how plugins are loaded is not fixed. So you should -not rely or communicate with other plugins in this slot. \n +BaseInterface::initializePlugin() slot is called. In this slot you can initialize your plugin. +The order how plugins are loaded is not fixed. So you should not rely or communicate with other plugins +in this slot. \n After all plugins are loaded, the slot BaseInterface::pluginsInitialized() is called for each plugin. All -other plugins are now available and the user interface is setup correctly. +other plugins are now available and you can setup your userinterface components in this slot. +The following graphic shows the initialization of a plugin. +\image html startupProcess.jpg */ diff --git a/BasePlugin/ContextMenuInterface.hh b/BasePlugin/ContextMenuInterface.hh index 5ed72b22..f6315ced 100644 --- a/BasePlugin/ContextMenuInterface.hh +++ b/BasePlugin/ContextMenuInterface.hh @@ -165,7 +165,7 @@ To use the ContextMenuInterface: -Usually you should implement the BaseInterface::initializePlugin() function from BaseInterface. In this function you can setup +Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your menus.\n You have to create a QAction. The signals and slots of your actions have to be connected @@ -184,7 +184,7 @@ The following code shows a simple example to create a menu entry in the context \code // Setup the menus in initialize plugins -void ExamplePlugin::initializePlugin() +void ExamplePlugin::pluginsInitialized() { // create a global QMenu in the plugin that contains our menu // in the header is: diff --git a/BasePlugin/MenuInterface.hh b/BasePlugin/MenuInterface.hh index 5a98f1ba..e1a1946d 100644 --- a/BasePlugin/MenuInterface.hh +++ b/BasePlugin/MenuInterface.hh @@ -128,12 +128,12 @@ To use the MenuInterface:
  • And add the signals or slots you want to use to your plugin class (You don't need to implement all of them) -Usually you should implement the BaseInterface::initializePlugin() function from BaseInterface. In this function you can setup +Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your menus. The following code shows a simple example to create a menu entry in the file menu. \code -void PrintPlugin::initializePlugin() +void PrintPlugin::pluginsInitialized() { // Create a submenu called printing QMenu *printMenu = new QMenu(tr("&Printing")); diff --git a/BasePlugin/ToolboxInterface.hh b/BasePlugin/ToolboxInterface.hh index 01454c84..a87f01a1 100644 --- a/BasePlugin/ToolboxInterface.hh +++ b/BasePlugin/ToolboxInterface.hh @@ -114,13 +114,13 @@ To use the ToolboxInterface:
  • And add the signals or slots you want to use to your plugin class (You don't need to implement all of them) -Usually you should implement the BaseInterface::initializePlugin() function from BaseInterface. In this function you can setup +Usually you should implement the BaseInterface::pluginsInitialized() function from BaseInterface. In this function you can setup your toolbox ( some kind of QWidget, can also be any widget created with qt-designer). Optionally you can also add an icon to the toolbox. The following code shows a simple example to create an empty toolbox. \code -void SmootherPlugin::initializePlugin() +void SmootherPlugin::pluginsInitialized() { // Create the Toolbox Widget QWidget* toolBox = new QWidget(); -- GitLab