itom
Loading...
Searching...
No Matches
ito::PlugInModel Class Reference

class for visualizing the available (loaded) plugins More...

#include <pluginModel.h>

Inheritance diagram for ito::PlugInModel:

Public Types

enum  tItemType {
  itemUnknown = 0x0000 , itemCatDataIO = 0x0001 , itemCatActuator = 0x0002 , itemCatAlgo = 0x0004 ,
  itemSubCategoryDataIO_Grabber = 0x0008 , itemSubCategoryDataIO_ADDA = 0x0010 , itemSubCategoryDataIO_RawIO = 0x0020 , itemPlugin = 0x0040 ,
  itemInstance = 0x0080 , itemFilter = 0x0100 , itemWidget = 0x0200 , itemCatMainAll = itemCatDataIO | itemCatActuator | itemCatAlgo ,
  itemCatSubAll = itemSubCategoryDataIO_Grabber | itemSubCategoryDataIO_ADDA | itemSubCategoryDataIO_RawIO , itemCatAll = itemCatMainAll | itemCatSubAll
}
 

Public Member Functions

 PlugInModel (ito::AddInManager *addInManager, QObject *parent=NULL)
 
 ~PlugInModel ()
 
QVariant data (const QModelIndex &index, int role) const
 
Qt::ItemFlags flags (const QModelIndex &index) const
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 
QModelIndex parent (const QModelIndex &index) const
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 
int update (void)
 
bool insertInstance (ito::AddInInterfaceBase *addInInterface, bool beginOperation)
 
bool deleteInstance (ito::AddInBase *addInInstance, const bool beginOperation)
 
bool resetModel (bool beginOperation)
 
QModelIndex getIndexByAddIn (ito::AddInBase *ai) const
 
QModelIndex getIndexByAddInInterface (ito::AddInInterfaceBase *aib) const
 
bool getModelIndexInfo (const QModelIndex &index, tItemType &type, size_t &internalData) const
 
bool getIsAlgoPlugIn (tItemType &itemType, size_t &internalData) const
 
bool getIsGrabberInstance (tItemType &itemType, size_t &internalData) const
 
QModelIndex getTypeNode (const int type) const
 returns the background color for instances, that have been created by Python or which have at least one current reference by Python code
 
QColor backgroundColorInstancesWithPythonRef () const
 
void setBackgroundColorInstancesWithPythonRef (const QColor &bgColor)
 

Protected Member Functions

QVariant getFixedNodeInfo (const QModelIndex &index, const QVariant &name, const tItemType &itemType, const int &role, const QIcon icon) const
 
QVariant getPluginNodeInfo (const QModelIndex &index, const int &role) const
 
QVariant getInstanceNodeInfo (const QModelIndex &index, const int &role) const
 
QVariant getFilterOrWidgetNodeInfo (const QModelIndex &index, const int &role, bool filterNotWidget) const
 
QMimeData * mimeData (const QModelIndexList &indexes) const
 

Private Member Functions

QString getInitCommand (const QModelIndex &item) const
 
 Q_DECLARE_PRIVATE (PlugInModel)
 

Private Attributes

QScopedPointer< PlugInModelPrivated_ptr
 

Detailed Description

class for visualizing the available (loaded) plugins

The PlugInModel supplies a widget showing the available plugins (libraries) with their name, filename, version and so on. In addition below each plugin its running instances are shown and if a plugin offers a configuration dialog it can be opened using a right click on the instance and selecting "open configuration dialog" in the context menu. The tree view is automatically updated when a new instance is created or an existing one had been deleted.

Constructor & Destructor Documentation

◆ PlugInModel()

ito::PlugInModel::PlugInModel ( ito::AddInManager * addInManager,
QObject * parent = NULL )

constructor

constructor, creating column headers for the tree view

◆ ~PlugInModel()

ito::PlugInModel::~PlugInModel ( )

destructor - clean up, clear header and alignment list

Member Function Documentation

◆ columnCount()

int ito::PlugInModel::columnCount ( const QModelIndex & parent = QModelIndex()) const

return column count

Parameters
[in]parentparent of current item
Returns
2 for child elements (instances) and the header size for root elements (plugins)

◆ data()

QVariant ito::PlugInModel::data ( const QModelIndex & index,
int role ) const

return data elements for a given row

Parameters
[in]indexindex for which the data elements should be delivered
[in]rolethe current role of the model
Returns
data of the selected element, depending on the element's row and column (passed in index.row and index.column)

This method is actually used to fill the tree view. It returns the data for the selected element, depending as well on the column of the selected element, passed in index.column. The method here is divided into two parts. The first one handles requests for root elements (plugins) the second one is used for child elements (instances of plugins).

◆ deleteInstance()

bool ito::PlugInModel::deleteInstance ( ito::AddInBase * addInInstance,
const bool beginOperation )
Parameters
addInInterface
addInInstance
beginOperation
Returns
bool

◆ flags()

Qt::ItemFlags ito::PlugInModel::flags ( const QModelIndex & index) const
Parameters

return

◆ getFilterOrWidgetNodeInfo()

QVariant ito::PlugInModel::getFilterOrWidgetNodeInfo ( const QModelIndex & index,
const int & role,
bool filterNotWidget ) const
protected
Parameters
index
role
filterNotWidget
Returns
QVariant

◆ getFixedNodeInfo()

QVariant ito::PlugInModel::getFixedNodeInfo ( const QModelIndex & index,
const QVariant & name,
const tItemType & itemType,
const int & role,
const QIcon icon ) const
protected
Parameters
index
name
itemType
role
icon
Returns
QVariant

◆ getIndexByAddIn()

QModelIndex ito::PlugInModel::getIndexByAddIn ( ito::AddInBase * ai) const
Parameters
ai
Returns
QModelIndex

◆ getIndexByAddInInterface()

QModelIndex ito::PlugInModel::getIndexByAddInInterface ( ito::AddInInterfaceBase * aib) const
Parameters
aib
Returns
QModelIndex

◆ getInitCommand()

QString ito::PlugInModel::getInitCommand ( const QModelIndex & item) const
private

‍self-managed pointer to the private class container (deletes itself if d_ptr is destroyed)

◆ getInstanceNodeInfo()

QVariant ito::PlugInModel::getInstanceNodeInfo ( const QModelIndex & index,
const int & role ) const
protected
Parameters
index
role
Returns
QVariant

◆ getIsAlgoPlugIn()

bool ito::PlugInModel::getIsAlgoPlugIn ( tItemType & itemType,
size_t & internalData ) const
Parameters
itemType
internalData
Returns
bool

◆ getIsGrabberInstance()

bool ito::PlugInModel::getIsGrabberInstance ( tItemType & itemType,
size_t & internalData ) const
Parameters
itemType
internalData
Returns
bool

◆ getModelIndexInfo()

bool ito::PlugInModel::getModelIndexInfo ( const QModelIndex & index,
tItemType & type,
size_t & internalData ) const
Parameters
index
type
internalData
Returns
bool

◆ getPluginNodeInfo()

QVariant ito::PlugInModel::getPluginNodeInfo ( const QModelIndex & index,
const int & role ) const
protected
Parameters
index
role
Returns
QVariant

◆ headerData()

QVariant ito::PlugInModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const

return the header / captions for the tree view model

◆ index()

QModelIndex ito::PlugInModel::index ( int row,
int column,
const QModelIndex & parent = QModelIndex() ) const

return current index element

Parameters
[in]rowrow of current element
[in]columncolumn of current element
[in]parentparent of current element
Returns
QModelIndex - element at current index

This method returns the QModelIndex for the current element. As the tree structure is not cached it has to be "calculated" on each call. An invalid parent means were in the top most "plane" of the tree, i.e. the plugin-plane. If the passed index is out of range we return an empty element. Otherwise a new element marked as root level element (i.e. internal pointer = ROOTPOINTER) is returned. If the parent element is valid the index for an instance is requested. In that case it is first checked if the index for a child child element is queried. In that case again an empty element is returned else the plugin for the selected instance is searched in the plugin lists and an according index is created.

◆ insertInstance()

bool ito::PlugInModel::insertInstance ( ito::AddInInterfaceBase * addInInterface,
bool beginOperation )
Parameters
addInInterface
beginOperation
Returns
bool

◆ parent()

QModelIndex ito::PlugInModel::parent ( const QModelIndex & index) const

return parent element

Parameters
[in]indexthe element's index for which the parent should be returned
Returns
the parent element.

◆ resetModel()

bool ito::PlugInModel::resetModel ( bool beginOperation)
Parameters
beginOperation
Returns
bool

◆ rowCount()

int ito::PlugInModel::rowCount ( const QModelIndex & parent = QModelIndex()) const

return number of rows

Parameters
[in]parentparent of current item
Returns
returns 0 for all child-child elements, the number of instances for child elements (a plugin) and the number of plugins for a root element

The documentation for this class was generated from the following files: