itom 1.3.0
ito::PlugInModel Class Reference

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

#include <PlugInModel.h>

List of all members.

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, itemUnknown = 0x0000, itemCatDataIO = 0x0001,
  itemCatActuator = 0x0002, itemCatAlgo = 0x0004, itemCatDesignerWidget = 0x0008, itemSubCategoryDataIO_Grabber = 0x0008,
  itemSubCategoryDataIO_ADDA = 0x0010, itemSubCategoryDataIO_RawIO = 0x0020, itemSubCategoryDesignerWidget = 0x0080, itemPlugin = 0x0040,
  itemInstance = 0x0080, itemFilter = 0x0100, itemWidget = 0x0200, itemDesignerWidget = 0x1000,
  itemCatMainAll = itemCatDataIO | itemCatActuator | itemCatAlgo, itemCatSubAll = itemSubCategoryDataIO_Grabber | itemSubCategoryDataIO_ADDA | itemSubCategoryDataIO_RawIO, itemCatAll = itemCatMainAll | itemCatSubAll
}
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, itemUnknown = 0x0000, itemCatDataIO = 0x0001,
  itemCatActuator = 0x0002, itemCatAlgo = 0x0004, itemCatDesignerWidget = 0x0008, itemSubCategoryDataIO_Grabber = 0x0008,
  itemSubCategoryDataIO_ADDA = 0x0010, itemSubCategoryDataIO_RawIO = 0x0020, itemSubCategoryDesignerWidget = 0x0080, itemPlugin = 0x0040,
  itemInstance = 0x0080, itemFilter = 0x0100, itemWidget = 0x0200, itemDesignerWidget = 0x1000,
  itemCatMainAll = itemCatDataIO | itemCatActuator | itemCatAlgo, itemCatSubAll = itemSubCategoryDataIO_Grabber | itemSubCategoryDataIO_ADDA | itemSubCategoryDataIO_RawIO, itemCatAll = itemCatMainAll | itemCatSubAll
}

Public Member Functions

 PlugInModel ()
 ~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::AddInInterfaceBase *addInInterface, ito::AddInBase *addInInstance, 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
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::AddInInterfaceBase *addInInterface, ito::AddInBase *addInInstance, 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 (size_t &internalData) const
bool getIsGrabberInstance (size_t &internalData) const
QModelIndex getTypeNode (const int type) const
void setDesignerPlugins (QList< DesignerPlugin > &designerPlugins)

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
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

Private Attributes

QList< QString > m_headers
 string list of names of column headers
QList< QVariant > m_alignment
 list of alignments for the corresponding headers
int m_treeFixNodes [6]
QModelIndex m_treeFixIndizes [6]
QIcon m_iconActuator
QIcon m_iconGrabber
QIcon m_iconADDA
QIcon m_iconRawIO
QIcon m_iconFilter
QIcon m_iconDataIO
QIcon m_iconAlgo
QIcon m_iconWidget
QIcon m_iconPlots
int * m_treeFixNodes
QModelIndex * m_treeFixIndizes
QIcon m_iconDesignerWidget
QList< DesignerPluginm_designerPlugins
QMap< int, QString > m_designerWidgetPlotTypes

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::PlugInModel ( )

constructor

contructor, creating column headers for the tree view

PlugInModel::~PlugInModel ( )

destructor - clean up, clear header and alignment list


Member Function Documentation

int 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)
QVariant 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 divded into two parts. The first one handels requests for root elements (plugins) the second one is used for child elements (instances of plugins).

bool PlugInModel::deleteInstance ( ito::AddInInterfaceBase addInInterface,
ito::AddInBase addInInstance,
bool  beginOperation 
)
Parameters:
addInInterface
addInInstance
beginOperation
Returns:
bool
Qt::ItemFlags PlugInModel::flags ( const QModelIndex &  index) const
Parameters:
@return
QVariant PlugInModel::getFilterOrWidgetNodeInfo ( const QModelIndex &  index,
const int &  role,
bool  filterNotWidget 
) const [protected]
Parameters:
index
role
filterNotWidget
Returns:
QVariant
QVariant 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
QModelIndex PlugInModel::getIndexByAddIn ( ito::AddInBase ai) const
Parameters:
ai
Returns:
QModelIndex
QModelIndex PlugInModel::getIndexByAddInInterface ( ito::AddInInterfaceBase aib) const
Parameters:
aib
Returns:
QModelIndex
QVariant PlugInModel::getInstanceNodeInfo ( const QModelIndex &  index,
const int &  role 
) const [protected]
Parameters:
index
role
Returns:
QVariant
bool ito::PlugInModel::getIsAlgoPlugIn ( tItemType &  itemType,
size_t &  internalData 
) const
Parameters:
itemType
internalData
Returns:
bool
bool ito::PlugInModel::getIsGrabberInstance ( tItemType &  itemType,
size_t &  internalData 
) const
Parameters:
itemType
internalData
Returns:
bool
bool PlugInModel::getModelIndexInfo ( const QModelIndex &  index,
tItemType &  type,
size_t &  internalData 
) const
Parameters:
index
type
internalData
Returns:
bool
QVariant PlugInModel::getPluginNodeInfo ( const QModelIndex &  index,
const int &  role 
) const [protected]
Parameters:
index
role
Returns:
QVariant
QVariant PlugInModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const

return the header / captions for the tree view model

QModelIndex 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. interal 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.

bool PlugInModel::insertInstance ( ito::AddInInterfaceBase addInInterface,
bool  beginOperation 
)
Parameters:
addInInterface
beginOperation
Returns:
bool
QModelIndex 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.
bool PlugInModel::resetModel ( bool  beginOperation)
Parameters:
beginOperation
Returns:
bool
int 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:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends