cc_tools_qt
Common Environment for Protocol Analysis.
|
#include "cc_tools_qt/ToolsPlugin.h"
Interface class for plugin definition.
Inherits QObject.
Public Types | |
using | ListOfGuiActions = QList< QAction * > |
List of GUI action buttons. | |
enum | Type : unsigned { Type_Socket , Type_Filter , Type_Protocol , Type_NumOfValues } |
Type of the plugin. More... | |
Signals | |
void | sigInterPluginConfigReport (const QVariantMap &props) |
Signal reporting inter-plugin configuration request. | |
Public Member Functions | |
ToolsPlugin (Type type) | |
Constructor. | |
virtual | ~ToolsPlugin () noexcept |
Destructor. | |
void | applyInterPluginConfig (const QVariantMap &props) |
Apply inter-plugin configuration. | |
QWidget * | createConfigurationWidget () |
Create a widget to perform plugin configuration in GUI application. | |
ToolsFilterPtr | createFilter () |
Create filter. | |
ListOfGuiActions | createGuiActions () |
Create GUI actions relevant to the plugin. | |
ToolsProtocolPtr | createProtocol () |
Create protocol. | |
ToolsSocketPtr | createSocket () |
Create socket. | |
QVariantMap | getCurrentConfig () |
Get currentConfiguration. | |
void | getCurrentConfig (QVariantMap &config) |
Get current configuration. | |
void | reconfigure (const QVariantMap &config) |
Request to perform reconfigure. | |
void | setDebugOutputLevel (unsigned level=0U) |
Set debug output level. | |
Protected Slots | |
void | reportInterPluginConfig (const QVariantMap &props) |
Report inter-plugin configuration. | |
Protected Member Functions | |
virtual void | applyInterPluginConfigImpl (const QVariantMap &props) |
Polymorphic inter-plugin configuration application. | |
virtual QWidget * | createConfigurationWidgetImpl () |
Create configuration widget. | |
virtual ToolsFilterPtr | createFilterImpl () |
Create filter object. | |
virtual ListOfGuiActions | createGuiActionsImpl () |
Create GUI actions. | |
virtual ToolsProtocolPtr | createProtocolImpl () |
Create protocol object. | |
virtual ToolsSocketPtr | createSocketImpl () |
Create socket object. | |
virtual void | getCurrentConfigImpl (QVariantMap &config) |
Polymorphic call to retrieve current configuration. | |
virtual void | reconfigureImpl (const QVariantMap &config) |
Polymorphic call to perform plugin (re)configuration. | |
enum cc_tools_qt::ToolsPlugin::Type : unsigned |
void cc_tools_qt::ToolsPlugin::applyInterPluginConfig | ( | const QVariantMap & | props | ) |
Apply inter-plugin configuration.
Allows one plugin to influence the configuration of another. This function will be called for all currently chosen plugins to override current configuration. Invokes polymorphic applyInterPluginConfigImpl().
[in] | props | Properties map. |
|
protectedvirtual |
Polymorphic inter-plugin configuration application.
Invoked by the applyInterPluginConfig().
[in] | props | Properties map. |
QWidget * cc_tools_qt::ToolsPlugin::createConfigurationWidget | ( | ) |
Create a widget to perform plugin configuration in GUI application.
Sometimes there is a need to provide a way to configure the plugin. A GUI application will call this function to retrieve a widget which will control the configuration. The returned widged is expected to be dynamically allocated and will be owned by the GUI application, i.e. the plugin doesn't need to perform any delete operation on it.
The function will invoke createConfigurationWidgetImpl().
|
protectedvirtual |
Create configuration widget.
ToolsFilterPtr cc_tools_qt::ToolsPlugin::createFilter | ( | ) |
Create filter.
This function will be called if it is filter plugin. It will invoke createFilterImpl() if assigned type is Type_Filter.
|
protectedvirtual |
Create filter object.
Expected to be overriden by the derived class.
ToolsPlugin::ListOfGuiActions cc_tools_qt::ToolsPlugin::createGuiActions | ( | ) |
Create GUI actions relevant to the plugin.
This function will invoke the relevant callback function assigned by the derived class to pluginProperties(). The callback function is responsible to allocate and return a list of QAction objects, which will appear to the main toolbar of the GUI application. Note, that the main application will own the allocated QAction objects and will delete them later. The plugin doesn't need to do it explicityly.
The function will invoke createGuiActionsImpl().
|
protectedvirtual |
Create GUI actions.
ToolsProtocolPtr cc_tools_qt::ToolsPlugin::createProtocol | ( | ) |
Create protocol.
This function will be called if it is protocol plugin. It will invoke createProtocolImpl() if assigned type is Type_Protocol.
|
protectedvirtual |
Create protocol object.
Expected to be overriden by the derived class.
ToolsSocketPtr cc_tools_qt::ToolsPlugin::createSocket | ( | ) |
Create socket.
This function will be called if it is socket plugin. It will invoke createSocketImpl() if assigned type is Type_Socket.
|
protectedvirtual |
Create socket object.
Expected to be overriden by the derived class.
QVariantMap cc_tools_qt::ToolsPlugin::getCurrentConfig | ( | ) |
Get currentConfiguration.
Invokes getCurrentConfigImpl(), which can be overridden by the derived class. It is responsible to update the provided configuration with new entries relevant to the plugin.
void cc_tools_qt::ToolsPlugin::getCurrentConfig | ( | QVariantMap & | config | ) |
Get current configuration.
Invokes getCurrentConfigImpl(), which can be overridden by the derived class. It is responsible to update the provided configuration with new entries relevant to the plugin.
[in,out] | config | Configuration map |
|
protectedvirtual |
Polymorphic call to retrieve current configuration.
Default implementation does nothing. The derived class needs to override this function if the plugin requires or supports configuration and update the provided map with relevant values.
[in,out] | config | Configuration map |
void cc_tools_qt::ToolsPlugin::reconfigure | ( | const QVariantMap & | config | ) |
Request to perform reconfigure.
Invokes reconfigureImpl(), which can be overridden by the derived class. The latter must retrieve appropriate values from the configuration map and apply requested updates.
|
protectedvirtual |
Polymorphic call to perform plugin (re)configuration.
Default implementation does nothing. The derived class needs to override byt function if the plugin requires or supports (re)configuration.
[in] | config | Configuration map |
|
protectedslot |
Report inter-plugin configuration.
Sometimes configuration of one plugin may influence configuration of another. Use this function to report inter-plugin configuration properties. When invoked all other plugins are expected to get their respecitve applyInterPluginConfig() functions invoked.
Emits sigInterPluginConfigReport() signal.
[in] | props | Reported properties. |
void cc_tools_qt::ToolsPlugin::setDebugOutputLevel | ( | unsigned | level = 0U | ) |
Set debug output level.
[in] | level | Debug level. If 0, debug output is disabled |
|
signal |
Signal reporting inter-plugin configuration request.
[in] | props | Configuration properties. |