itom
|
abstract base class for configuration dialogs of plugins More...
#include <abstractAddInConfigDialog.h>
Public Types | |
enum | MessageLevel { msgLevelNo = 0 , msgLevelErrorOnly = 1 , msgLevelWarningOnly = 2 , msgLevelWarningAndError = msgLevelErrorOnly | msgLevelWarningOnly } |
Public Slots | |
virtual void | parametersChanged (QMap< QString, ito::Param > params)=0 |
slot invoked if any parameter of the plugin has been changed. | |
Public Member Functions | |
AbstractAddInConfigDialog (ito::AddInBase *plugin) | |
constructor. | |
virtual | ~AbstractAddInConfigDialog () |
destructor | |
virtual ito::RetVal | applyParameters ()=0 |
method to send changed parameters back to the plugin (needs to be overwritten) | |
Protected Member Functions | |
virtual ito::RetVal | setPluginParameter (QSharedPointer< ito::ParamBase > param, MessageLevel msgLevel=msgLevelWarningAndError) |
invokes AddInBase::setParam of plugin in order to set the given parameter | |
virtual ito::RetVal | setPluginParameters (const QVector< QSharedPointer< ito::ParamBase > > params, MessageLevel msgLevel=msgLevelWarningAndError) |
invokes AddInBase::setParamVector of plugin in order to set multiple given parameters | |
virtual ito::RetVal | observeInvocation (ItomSharedSemaphore *waitCond, MessageLevel msgLevel) const |
observes the status of the given semaphore and returns after the semaphore has been released or a timeout occurred | |
Protected Attributes | |
QMap< QString, ito::Param > | m_currentParameters |
Private Attributes | |
AbstractAddInConfigDialogPrivate * | d |
abstract base class for configuration dialogs of plugins
Inherit your plugin's configuration dialog from this class in order to benefit from many simplified and unified processes. Since the plugin runs in its own thread while the configuration dialog runs in the main thread, the communication between the plugin and its configuration dialog needs to be done via signal/slot connections or general invocations.
The methods of this class help in this process.
Communication plugin -> configuration dialog:
Communication configuration dialog -> plugin:
For implementing a configuration dialog, overload ito::AddInBase::hasConfigDialog and return 1. Additionally overload ito::AddInBase::showConfigDialog and create an instance of the configuration dialog that is directly passed to the api-function apiShowConfigurationDialog.
MessageLevel enumeration defines whether warnings and/or errors that might occur during some executions should be displayed with a message box.
|
pure virtual |
method to send changed parameters back to the plugin (needs to be overwritten)
This method is automatically called once the OK-button (accept-role) of the configuration dialog is clicked and should also be called if the apply-button is clicked (only this needs to be done by the plugin).
In this method, check all changed parameters and send them to the plugin using setPluginParameter or setPluginParameters. This method needs to be implemented in every single configuration dialog.
|
protectedvirtual |
observes the status of the given semaphore and returns after the semaphore has been released or a timeout occurred
This helper method is mainly called by setPluginParameter or setPluginParameters in order to wait until the parameters have been set within the plugin. The corresponding return value is obtained and returned or displayed in a message box (if desired).
Directly call this method after having invoked any other slot where an instance of ItomSharedSemaphore has been passed as wait condition. This method returns if the wait condition has been released by the receiver, if the invocation failed or if a timeout occurred. For any possible timeout the AddInBase::isAlive flag is continuously evaluated.
waitCond | is the wait condition passed to the invokeMethod command. |
msgLevel | defines if any warnings or errors should be displayed within an appropriate message box. |
|
pure virtualslot |
slot invoked if any parameter of the plugin has been changed.
private data pointer of this class.
overload this method in order reset the widgets depending on the current states of the parameter. The first invocation can also be used in order to configure the configuration dialog depending on the current set of available parameters. This slot is automatically invoked right after the construction of the configuration dialog
\params map of parameters (usually equal to m_params member of ito::AddInBase)
|
protectedvirtual |
invokes AddInBase::setParam of plugin in order to set the given parameter
Use this method to thread-safely set any desired parameter of the plugin. No direct call of setParam of the plugin is possible since the plugin usually runs in a secondary thread.
If the method was successful, the map m_currentParameters is updated with respect to param.
param | is the parameter to set. |
msgLevel | defines if any warnings or errors should be displayed within an appropriate message box. |
|
protectedvirtual |
invokes AddInBase::setParamVector of plugin in order to set multiple given parameters
Use this method to thread-safely set any desired parameters of the plugin. No direct call of setParam or setParamVector of the plugin is possible since the plugin usually runs in a secondary thread.
If the method was successful, the map m_currentParameters is updated with respect to params.
params | is a vector of parameters to set. |
msgLevel | defines if any warnings or errors should be displayed within an appropriate message box. |
|
private |
use this map to save the current values of all parameters. For instance it is convenient to copy the map given in parametersChanged to this map